:root {
  --blue: #2563eb;
  --blue2: #3b82f6;
  --indigo: #6366f1;
  --violet: #8b5cf6;
  --purple: #a855f7;
  --pink: #ec4899;
  --red: #ef4444;
  --orange: #f97316;
  --amber: #f59e0b;
  --green: #22c55e;
  --teal: #14b8a6;
  --cyan: #06b6d4;
  --navy: #1e3a8a;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --light: #eff6ff;
  --shadow: 0 6px 20px rgba(30, 58, 138, 0.10);
  --radius: 14px;
  --acc: var(--blue);
  --acc2: var(--blue2);
  --accbg: #eff6ff;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

svg { width: 16px; height: 16px; vertical-align: -3px; }

html, body { height: 100%; }

body {
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 85% -10%, rgba(99, 102, 241, 0.10), transparent 60%),
    radial-gradient(900px 400px at 0% 0%, rgba(20, 184, 166, 0.08), transparent 55%),
    repeating-linear-gradient(0deg, rgba(37, 99, 235, 0.035) 0 1px, transparent 1px 34px),
    linear-gradient(180deg, #f8fbff 0%, #eef3ff 100%);
  background-attachment: fixed;
  font-size: 15px;
}

.hidden { display: none !important; }

::selection { background: var(--blue); color: #fff; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: linear-gradient(180deg, var(--blue2), var(--violet)); border-radius: 999px; border: 2px solid #f0f4ff; }
::-webkit-scrollbar-thumb:hover { background: var(--indigo); }

/* ---------- Header ---------- */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  background: linear-gradient(120deg, #1e3a8a 0%, #4338ca 40%, #7c3aed 75%, #db2777 120%);
  background-size: 200% 200%;
  animation: gradShift 14s ease infinite;
  color: #fff;
  box-shadow: 0 8px 24px rgba(30, 58, 138, 0.35);
  position: sticky;
  top: 0;
  z-index: 60;
}
@keyframes gradShift { 0%,100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
.header-right { display: flex; align-items: center; }
.logo { display: flex; align-items: center; gap: 12px; }
.logo svg { filter: drop-shadow(0 3px 6px rgba(0,0,0,.25)); animation: floatY 4s ease-in-out infinite; }
@keyframes floatY { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
.logo-text h1 { font-size: 26px; line-height: 1; letter-spacing: 1px; }
.logo-text span { font-size: 12.5px; opacity: .85; display: block; margin-top: 4px; }
.header-info { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.chip {
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.28);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13.5px;
  display: flex; align-items: center; gap: 7px;
  backdrop-filter: blur(6px);
}
.chip b { font-size: 15px; }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: #7CFF9B; box-shadow: 0 0 10px #7CFF9B; animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: .5; transform: scale(.8); } }

/* ---------- Tabs ---------- */
.tabs {
  display: flex;
  gap: 5px;
  padding: 14px 18px 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  border: 1px solid rgba(30,58,138,.12);
  border-bottom: none;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  font-size: 14px;
  color: var(--navy);
  background: linear-gradient(180deg, #d8e7fd, #e9f2ff);
  padding: 11px 17px;
  border-radius: 14px 14px 0 0;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  transition: .15s;
  box-shadow: 0 -2px 6px rgba(30,58,138,.05);
}
.tab:hover { background: #fff; transform: translateY(-2px); }
.tab svg { width: 17px; height: 17px; }
.tab:nth-child(1).active { background: linear-gradient(180deg, #2563eb, #3b82f6); color: #fff; box-shadow: 0 4px 14px rgba(37,99,235,.35); }
.tab:nth-child(2).active { background: linear-gradient(180deg, #22c55e, #16a34a); color: #fff; box-shadow: 0 4px 14px rgba(34,197,94,.35); }
.tab:nth-child(3).active { background: linear-gradient(180deg, #f97316, #f59e0b); color: #fff; box-shadow: 0 4px 14px rgba(249,115,22,.35); }
.tab:nth-child(4).active { background: linear-gradient(180deg, #ef4444, #f43f5e); color: #fff; box-shadow: 0 4px 14px rgba(239,68,68,.35); }
.tab:nth-child(5).active { background: linear-gradient(180deg, #a855f7, #9333ea); color: #fff; box-shadow: 0 4px 14px rgba(168,85,247,.35); }
.tab:nth-child(6).active { background: linear-gradient(180deg, #14b8a6, #0d9488); color: #fff; box-shadow: 0 4px 14px rgba(20,184,166,.35); }
.tab:nth-child(7).active { background: linear-gradient(180deg, #6366f1, #4f46e5); color: #fff; box-shadow: 0 4px 14px rgba(99,102,241,.35); }
.tab:nth-child(8).active { background: linear-gradient(180deg, #8b5cf6, #7c3aed); color: #fff; box-shadow: 0 4px 14px rgba(139,92,246,.35); }
.tab:nth-child(9).active { background: linear-gradient(180deg, #06b6d4, #0891b2); color: #fff; box-shadow: 0 4px 14px rgba(6,182,212,.35); }
.tab:nth-child(10).active { background: linear-gradient(180deg, #d946ef, #c026d3); color: #fff; box-shadow: 0 4px 14px rgba(217,70,239,.35); }
.tab:nth-child(11).active { background: linear-gradient(180deg, #0ea5e9, #0284c7); color: #fff; box-shadow: 0 4px 14px rgba(14,165,233,.35); }
.tab:nth-child(12).active { background: linear-gradient(180deg, #64748b, #475569); color: #fff; box-shadow: 0 4px 14px rgba(100,116,139,.35); }

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 18px 60px;
}
main > * { animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Cards ---------- */
.card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(30,58,138,.07);
  padding: 18px;
  margin-bottom: 16px;
  transition: .2s;
  position: relative;
}
.card:hover { box-shadow: 0 10px 28px rgba(30,58,138,.14); }
.card h3 {
  font-size: 17px;
  color: var(--navy);
  margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px;
}
.card h3 svg { width: 19px; height: 19px; color: var(--acc, var(--blue)); }

.grid-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
}
.stat {
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  color: #fff;
  background: linear-gradient(135deg, var(--acc, var(--blue)), var(--acc2, var(--blue2)));
}
.stat::after {
  content: "";
  position: absolute;
  left: -24px; top: -24px;
  width: 90px; height: 90px;
  border-radius: 50%;
  background: rgba(255,255,255,.16);
}
.stat::before {
  content: "";
  position: absolute;
  right: -30px; bottom: -40px;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: rgba(255,255,255,.10);
}
.stat .lbl { color: rgba(255,255,255,.9); font-size: 13px; font-weight: 600; position: relative; }
.stat .val { font-size: 23px; font-weight: 800; margin-top: 6px; position: relative; text-shadow: 0 1px 2px rgba(0,0,0,.12); }
.stat .sub { font-size: 12px; color: rgba(255,255,255,.85); margin-top: 3px; position: relative; }
.stat.green { --acc: #22c55e; --acc2: #16a34a; }
.stat.red { --acc: #ef4444; --acc2: #f43f5e; }
.stat.amber { --acc: #f59e0b; --acc2: #f97316; }
.stat.blue { --acc: #2563eb; --acc2: #3b82f6; }
.stat.teal { --acc: #14b8a6; --acc2: #0d9488; }
.stat.violet { --acc: #8b5cf6; --acc2: #6d28d9; }
.stat.pink { --acc: #ec4899; --acc2: #db2777; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 9px 16px;
  border-radius: 10px;
  font: inherit;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: .18s;
  white-space: nowrap;
}
.btn:hover { border-color: var(--acc, var(--blue)); color: var(--acc, var(--blue)); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(30,58,138,.10); }
.btn:active { transform: translateY(0); }
.btn svg { width: 16px; height: 16px; }
.btn-primary {
  background: linear-gradient(135deg, var(--blue), var(--violet));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 5px 14px rgba(99,102,241,.35);
}
.btn-primary:hover { background: linear-gradient(135deg, #1d4ed8, #7c3aed); color: #fff; box-shadow: 0 7px 18px rgba(99,102,241,.45); }
.btn-danger { background: linear-gradient(135deg, #ef4444, #f97316); border-color: transparent; color: #fff; box-shadow: 0 5px 14px rgba(239,68,68,.3); }
.btn-danger:hover { background: linear-gradient(135deg, #dc2626, #ea580c); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--blue); box-shadow: none; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.icon-btn {
  border: none; background: transparent; cursor: pointer;
  padding: 6px; border-radius: 8px; color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center;
  transition: .15s;
}
.icon-btn:hover { background: var(--light); color: var(--acc, var(--blue)); transform: scale(1.08); }
.icon-btn.danger:hover { background: #fee2e2; color: var(--red); }
.icon-btn svg { width: 17px; height: 17px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

/* ---------- Forms ---------- */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; color: var(--muted); font-weight: 700; margin-bottom: 5px; }
input, select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  font: inherit;
  font-size: 14px;
  background: #fbfdff;
  color: var(--ink);
  transition: .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--acc, var(--blue));
  background: #fff;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--acc, var(--blue)) 15%, transparent);
}
textarea { resize: vertical; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.row4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 10px; }
.prows { display: flex; flex-direction: column; gap: 6px; }
.prow { display: grid; grid-template-columns: 1fr 120px 52px 80px 80px 32px; gap: 6px; align-items: center; }
.prow input, .prow select { width: 100%; min-width: 0; }
@media (max-width: 600px) { .prow { grid-template-columns: 1fr 100px 46px 70px 70px 30px; gap: 4px; } }
.field-box { border: 1.5px dashed var(--line); border-radius: 12px; padding: 10px 12px; background: #fbfdff; }
.field-box label { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.field-c-blue { border-color: #bfdbfe; background: #eff6ff; }
.field-c-violet { border-color: #ddd6fe; background: #f5f3ff; }
.field-c-amber { border-color: #fde68a; background: #fffbeb; }
.field-c-green { border-color: #a7f3d0; background: #ecfdf5; }
.field-c-pink { border-color: #fbcfe8; background: #fdf2f8; }
.field-c-teal { border-color: #99f6e4; background: #f0fdfa; }
.field-c-blue label { color: #1d4ed8; }
.field-c-violet label { color: #6d28d9; }
.field-c-amber label { color: #b45309; }
.field-c-green label { color: #047857; }
.field-c-pink label { color: #be185d; }
.field-c-teal label { color: #0f766e; }
.field-c-red { border-color: #fecaca; background: #fef2f2; }
.field-c-red label { color: #b91c1c; }

/* ---------- Tables ---------- */
.tbl-wrap { overflow-x: auto; border-radius: 10px; border: 1px solid var(--line); background: #fff; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: right;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 700;
  padding: 10px 12px;
  border-bottom: 2px solid var(--line);
  background: linear-gradient(180deg, #f7faff, #eef4ff);
  white-space: nowrap;
}
td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr { transition: .12s; }
tbody tr:hover { background: var(--light); }
tr.low-row td { background: #fff8f8; }
tr.low-row:hover td { background: #fff1f1; }
.actions { display: flex; gap: 2px; white-space: nowrap; }
td .actions { justify-content: flex-end; }
.tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  background: var(--light);
  color: var(--blue);
}
.tag-red { background: #fee2e2; color: var(--red); }
.tag-green { background: #dcfce7; color: var(--green); }
.tag-amber { background: #fef3c7; color: var(--amber); }
.tag-gray { background: #eef1f5; color: var(--muted); }
.tag.c-blue { background: #dbeafe; color: #1d4ed8; }
.tag.c-violet { background: #ede9fe; color: #7c3aed; }
.tag.c-teal { background: #ccfbf1; color: #0f766e; }
.tag.c-amber { background: #fef3c7; color: #b45309; }
.tag.c-pink { background: #fce7f3; color: #be185d; }
.tag.c-green { background: #dcfce7; color: #15803d; }
.tag.c-indigo { background: #e0e7ff; color: #4338ca; }
.tag.c-cyan { background: #cffafe; color: #0e7490; }
.tag.c-purple { background: #f3e8ff; color: #a21caf; }
.qty-badge { display: inline-block; background: var(--red); color: #fff; font-size: 11.5px; font-weight: 700; padding: 1px 7px; border-radius: 999px; margin-right: 6px; }
.qty-inline { color: var(--red); font-size: 12.5px; font-weight: 700; }
.tag.c-orange { background: #ffedd5; color: #c2410c; }
.tag.c-red { background: #fee2e2; color: #b91c1c; }
.tag.c-lime { background: #ecfccb; color: #4d7c0f; }

.empty {
  text-align: center;
  color: var(--muted);
  padding: 40px 10px;
  font-size: 15px;
}

/* ---------- Section colors ---------- */
.c-blue { --acc: #2563eb; --acc2: #3b82f6; --accbg: #dbeafe; }
.c-violet { --acc: #8b5cf6; --acc2: #7c3aed; --accbg: #ede9fe; }
.c-teal { --acc: #14b8a6; --acc2: #0d9488; --accbg: #ccfbf1; }
.c-amber { --acc: #f59e0b; --acc2: #f97316; --accbg: #fef3c7; }
.c-pink { --acc: #ec4899; --acc2: #db2777; --accbg: #fce7f3; }
.c-green { --acc: #22c55e; --acc2: #16a34a; --accbg: #dcfce7; }
.c-indigo { --acc: #6366f1; --acc2: #4f46e5; --accbg: #e0e7ff; }
.c-cyan { --acc: #06b6d4; --acc2: #0891b2; --accbg: #cffafe; }
.c-purple { --acc: #a855f7; --acc2: #9333ea; --accbg: #f3e8ff; }
.c-orange { --acc: #f97316; --acc2: #ea580c; --accbg: #ffedd5; }
.c-red { --acc: #ef4444; --acc2: #dc2626; --accbg: #fee2e2; }
.c-lime { --acc: #84cc16; --acc2: #65a30d; --accbg: #ecfccb; }

/* ---------- Section chips ---------- */
.sec-chips { display: flex; gap: 7px; flex-wrap: wrap; margin: 10px 0 14px; }
.sec-chip {
  border: 1.5px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 6px 14px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  transition: .18s;
}
.sec-chip:hover { border-color: var(--acc, var(--blue)); color: var(--acc, var(--blue)); transform: translateY(-1px); }
.sec-chip.active {
  background: linear-gradient(135deg, var(--acc, var(--blue)), var(--acc2, var(--blue2)));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 12px color-mix(in srgb, var(--acc, var(--blue)) 40%, transparent);
}
.sec-chip.active:hover { color: #fff; }

/* ---------- Search ---------- */
.search-wrap { position: relative; }
.search-wrap input { padding-right: 38px; }
.search-wrap .s-ic { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-wrap .s-ic svg { width: 17px; height: 17px; }

/* ---------- POS ---------- */
.pos-wrap { display: grid; grid-template-columns: 400px 1fr; gap: 16px; align-items: start; }
.prod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.prod {
  background: #fff;
  border: 1.5px solid var(--line);
  border-top: 4px solid var(--acc, var(--blue));
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
  text-align: center;
  transition: .18s;
}
.prod:hover {
  border-color: var(--acc, var(--blue));
  box-shadow: 0 10px 22px color-mix(in srgb, var(--acc, var(--blue)) 28%, transparent);
  transform: translateY(-3px);
}
.prod .p-name { font-weight: 700; font-size: 14px; color: var(--ink); }
.prod .p-sec { font-size: 11px; color: var(--muted); margin-top: 2px; }
.prod .p-price { color: var(--acc, var(--blue)); font-weight: 800; font-size: 17px; margin-top: 6px; }
.prod .p-qty { font-size: 11px; color: var(--muted); margin-top: 2px; }
.prod.low { border-color: #fca5a5; background: #fffafa; }
.prod.out { opacity: .45; pointer-events: none; filter: grayscale(.4); }

.cart { position: sticky; top: 76px; }
.cart h3 { display: flex; justify-content: space-between; align-items: center; }
.cart h3 .next-num { font-size: 13px; color: var(--muted); font-weight: 600; }
#custResults { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.cust-result {
  display: grid; grid-template-columns: 1fr auto auto; gap: 6px; align-items: center;
  width: 100%; text-align: right; padding: 8px 10px;
  background: #fff; border: 1px solid var(--line); border-radius: 10px; cursor: pointer;
  font-size: 13px; transition: .15s;
}
.cust-result:hover { border-color: var(--violet); box-shadow: 0 2px 8px rgba(99,102,241,.15); }
.cust-sel {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  background: linear-gradient(135deg, #eef4ff, #f0eeff);
  border: 1px solid var(--violet); border-radius: 10px; padding: 8px 10px; font-size: 13.5px; margin-top: 10px;
}
.cart-rows { max-height: 40vh; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.cart-row {
  display: grid;
  grid-template-columns: 1fr 62px 96px 62px 30px;
  gap: 6px;
  align-items: center;
  padding: 8px;
  background: #f7faff;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 13px;
}
.cr-name { font-weight: 700; }
.cr-price, .cr-sub { color: var(--blue); font-weight: 700; text-align: left; }
.cr-qty { display: flex; align-items: center; gap: 3px; }
.cr-qty input { text-align: center; padding: 4px; font-size: 13px; }
.cart-totals { margin-top: 12px; border-top: 2px dashed var(--line); padding-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.cart .field { margin-bottom: 10px; }
.cart .field label { font-size: 14px; color: var(--ink); }
.cart .field input, .cart .field select { font-size: 15px; padding: 10px 12px; border-radius: 10px; }
.cart .row2 { gap: 8px; }
.t-row { display: flex; justify-content: space-between; font-size: 14px; }
.t-row b { color: var(--navy); }
.t-grand { font-size: 19px; font-weight: 800; color: var(--blue); }
.manual-line { display: flex; gap: 6px; margin-top: 10px; }
.manual-line input { flex: 1; }

/* ---------- Custom fields ---------- */
.cf-presets { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; background: linear-gradient(135deg, #eef2ff, #f5f3ff); border: 1px solid #e0e7ff; border-radius: 12px; padding: 10px; }
.cf-presets > span { font-size: 12.5px; font-weight: 700; color: var(--muted); }
.cf-presets .btn { background: #fff; }
.cf-head {
  display: flex; align-items: center; gap: 7px;
  color: var(--violet); font-size: 14.5px; margin: 14px 0 10px;
  border-bottom: 2px solid #ede9fe; padding-bottom: 7px;
}
.cf-head svg { width: 17px; height: 17px; }
.cf-empty {
  display: flex; gap: 10px; align-items: center;
  background: #faf9ff; border: 1.5px dashed #d8d4f8;
  border-radius: 12px; padding: 12px; margin-top: 12px;
}
.cf-empty > span { color: var(--violet); }
.cf-empty svg { width: 20px; height: 20px; }
.cf-empty b { color: var(--ink); font-size: 13.5px; }
.cf-empty p { color: var(--muted); font-size: 12px; margin-top: 3px; line-height: 1.7; }

/* ---------- Modal ---------- */
.modal-back {
  position: fixed; inset: 0;
  background: rgba(17, 24, 39, .55);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; padding: 16px;
  backdrop-filter: blur(3px);
  animation: fadeIn .15s ease;
}
.modal {
  background: #fff;
  border-radius: 16px;
  width: min(600px, 100%);
  max-height: 90vh;
  overflow: auto;
  box-shadow: 0 24px 60px rgba(0,0,0,.3);
  border-top: 5px solid transparent;
  border-image: linear-gradient(90deg, var(--blue), var(--violet), var(--pink)) 1;
  animation: popIn .18s ease;
}
@keyframes popIn { from { opacity: 0; transform: scale(.96) translateY(8px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #f7faff, #eef4ff);
  border-radius: 16px 16px 0 0;
}
.modal-head h3 { color: var(--navy); font-size: 17px; }
.modal-body { padding: 18px; }
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }

/* ---------- Toast ---------- */
#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: linear-gradient(135deg, #1e3a8a, #4338ca);
  color: #fff;
  padding: 12px 24px; border-radius: 999px;
  font-weight: 700; font-size: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,.3);
  z-index: 300;
  animation: slideUp .25s ease;
}
#toast.err { background: linear-gradient(135deg, #dc2626, #f97316); }
@keyframes slideUp { from { opacity: 0; transform: translate(-50%, 16px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------- PIN screen ---------- */
.pin-screen {
  position: fixed; inset: 0; z-index: 500;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(800px 500px at 80% 20%, rgba(139,92,246,.25), transparent 60%),
    radial-gradient(700px 400px at 10% 90%, rgba(20,184,166,.18), transparent 55%),
    linear-gradient(135deg, #1e3a8a, #4338ca 60%, #7c3aed);
}
.pin-box {
  background: #fff; border-radius: 18px; padding: 28px;
  width: min(340px, 92%);
  text-align: center;
  box-shadow: 0 20px 50px rgba(0,0,0,.4);
  animation: popIn .25s ease;
}
.pin-box svg { width: 46px; height: 46px; color: var(--violet); }
.pin-box h2 { color: var(--navy); margin: 10px 0 4px; }
.pin-box p { color: var(--muted); font-size: 13px; margin-bottom: 16px; }
.pin-dots { display: flex; gap: 10px; justify-content: center; margin: 14px 0; }
.pin-dots span { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line); background: #fff; }
.pin-dots span.fill { background: linear-gradient(135deg, var(--blue), var(--violet)); border-color: var(--blue); }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pin-pad button {
  font: inherit; font-size: 20px; font-weight: 800;
  padding: 14px; border-radius: 12px;
  border: 1.5px solid var(--line); background: #fbfdff; color: var(--navy);
  cursor: pointer;
  transition: .12s;
}
.pin-pad button:hover { background: var(--light); border-color: var(--blue); transform: scale(1.04); }
.pin-err { color: var(--red); font-size: 13px; font-weight: 700; min-height: 18px; }

/* ---------- Print / Invoice ---------- */
#printArea { display: none; }
@media print {
  #app, #modalRoot, #toast, #pinScreen { display: none !important; }
  body { background: #fff; }
  #printArea { display: block; }
}
.invoice {
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  color: #111;
  width: 100%;
  padding: 12px;
  direction: rtl;
}
.invoice .inv-head { text-align: center; border-bottom: 2px solid #2563eb; padding-bottom: 10px; margin-bottom: 10px; }
.invoice .inv-head h2 { font-size: 22px; color: #1e3a8a; margin-bottom: 2px; }
.invoice .inv-head p { font-size: 12.5px; color: #444; margin: 1px 0; }
.invoice .inv-meta { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 8px; color: #333; }
.invoice table { width: 100%; border-collapse: collapse; font-size: 13px; }
.invoice th { background: #eaf2ff; color: #1e3a8a; border: 1px solid #cfe0fb; padding: 7px; }
.invoice td { border: 1px solid #dbe5f3; padding: 7px; }
.invoice .inv-totals { margin-top: 10px; font-size: 14px; display: flex; flex-direction: column; gap: 3px; align-items: flex-end; }
.invoice .inv-grand { font-size: 17px; font-weight: 800; color: #1e3a8a; border-top: 1px dashed #999; padding-top: 5px; margin-top: 3px; }
.invoice .inv-welcome { font-weight: 700; color: #2563eb; font-size: 13px !important; }
.invoice .inv-warn { margin-top: 10px; font-size: 12px; color: #b91c1c; border: 1px dashed #fca5a5; background: #fef2f2; border-radius: 8px; padding: 8px 10px; }
.invoice .inv-warn div { margin-top: 2px; }
.invoice .inv-foot { text-align: center; margin-top: 14px; font-size: 12px; color: #666; border-top: 1px dashed #bbb; padding-top: 8px; }

/* ---------- AI chat ---------- */
.ai-wrap { display: grid; grid-template-columns: 1fr 300px; gap: 16px; align-items: start; }
.chat-box {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  height: 62vh; display: flex; flex-direction: column;
  border: 1px solid rgba(30,58,138,.07);
  overflow: hidden;
}
.chat-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 85%; padding: 10px 14px; border-radius: 14px; font-size: 14px; line-height: 1.7; white-space: pre-wrap; word-break: break-word; }
.msg.user { align-self: flex-start; background: linear-gradient(135deg, var(--blue), var(--violet)); color: #fff; border-bottom-right-radius: 4px; box-shadow: 0 4px 12px rgba(99,102,241,.3); }
.msg.bot { align-self: flex-end; background: linear-gradient(180deg, #f1f6ff, #f5f3ff); border: 1px solid var(--line); color: var(--ink); border-bottom-left-radius: 4px; }
.msg.bot.err { background: #fee2e2; border-color: #fecaca; color: #7f1d1d; }
.chat-input { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); background: #fafcff; }
.chat-input input { flex: 1; }
.suggest { display: flex; flex-direction: column; gap: 8px; }
.suggest button { text-align: right; }
.suggest button:hover { border-color: var(--violet); color: var(--violet); }

/* ---------- AI Analytics ---------- */
.ai-analytics { border: 1.5px solid var(--violet); }
.ai-report { background: linear-gradient(180deg, #f1f6ff, #f5f3ff); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; font-size: 14px; line-height: 1.9; white-space: pre-wrap; word-break: break-word; margin-bottom: 12px; }
.ai-report h1, .ai-report h2, .ai-report h3 { margin: 10px 0 6px; color: var(--blue); font-size: 15px; }
.ai-box { background: #fff; border: 1px solid rgba(30,58,138,.07); border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow); }
.ai-box h4 { margin: 8px 0 6px; font-size: 13.5px; color: var(--blue); display: flex; align-items: center; gap: 6px; }
.ai-box h4:first-child { margin-top: 0; }
.ai-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 2px; border-bottom: 1px dashed var(--line); font-size: 13.5px; }
.ai-row:last-child { border-bottom: 0; }
.ai-row .danger { color: var(--red); }

/* ---------- Charts ---------- */
.bar-chart { display: flex; align-items: flex-end; gap: 8px; height: 130px; padding-top: 6px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.bar {
  width: 70%; max-width: 46px;
  background: linear-gradient(180deg, var(--teal), var(--blue));
  border-radius: 6px 6px 0 0; min-height: 3px; transition: .3s;
}
.bar-col:hover .bar { filter: brightness(1.15); }
.bar-val { font-size: 10.5px; color: var(--muted); }
.bar-day { font-size: 11px; color: var(--muted); font-weight: 700; }
.profit-sections { display: flex; flex-direction: column; gap: 8px; }
.ps-row { display: grid; grid-template-columns: 130px 1fr 90px; align-items: center; gap: 8px; font-size: 13px; }
.ps-bar { height: 12px; background: var(--light); border-radius: 999px; overflow: hidden; }
.ps-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--acc, var(--blue)), var(--acc2, var(--violet))); border-radius: 999px; }
.ps-val { font-weight: 800; color: var(--navy); text-align: left; }

/* ---------- Settings ---------- */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.settings-grid .card { margin-bottom: 0; }
.list-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px; background: #f7faff;
  border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px;
  transition: .15s;
}
.list-row:hover { border-color: var(--violet); box-shadow: 0 3px 10px rgba(139,92,246,.12); }
.list-row input { flex: 1; }

/* ---------- Utility ---------- */
.link-box { text-align: center; }
.link-url {
  display: inline-block; background: var(--light); color: var(--blue);
  border: 1.5px dashed var(--line); border-radius: 10px;
  padding: 10px 16px; font-weight: 700; font-size: 17px;
}
@media (max-width: 480px) { .link-url { font-size: 14px; } }
.flex { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.mt { margin-top: 12px; }
.mb { margin-bottom: 12px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.hint { font-size: 12.5px; color: var(--muted); line-height: 1.8; }
.kbd {
  display: inline-block; background: var(--light); color: var(--blue);
  padding: 1px 7px; border-radius: 6px; font-size: 12px; font-weight: 700;
}

@media (max-width: 960px) {
  .pos-wrap { grid-template-columns: 1fr; }
  .ai-wrap { grid-template-columns: 1fr; }
  .cart { position: static; }
  .row4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .header { flex-direction: column; align-items: flex-start; }
  .grid-stats { grid-template-columns: 1fr 1fr; }
  .row3, .row2 { grid-template-columns: 1fr; }
  .ps-row { grid-template-columns: 90px 1fr 70px; }
}
