/* Al Essa Optician ERP — design system v2 (enterprise data-grid look) */
:root {
  --navy-950: #071526;
  --navy-900: #0b1f35;
  --navy-800: #12304f;
  --navy-700: #1b3f66;
  --brand: #0e6ba8;
  --brand-600: #0b5a8e;
  --brand-50: #e8f2fb;
  --teal: #0fb5ae;
  --accent: #14a3b8;
  --grad-brand: linear-gradient(135deg, #0fb5ae 0%, #0e7fc0 55%, #1d5fbf 100%);
  --grad-dark: linear-gradient(180deg, #0b1f35 0%, #0a1a2d 100%);
  --bg: #edf1f7;
  --surface: #ffffff;
  --surface-2: #f6f8fb;
  --grid-head: linear-gradient(180deg, #f4f7fb 0%, #e9eef5 100%);
  --border: #e1e7ef;
  --border-strong: #c9d3e0;
  --grid-line: #e8edf4;
  --text: #15233a;
  --text-2: #475569;
  --muted: #7a8699;
  --ok: #0f9960;   --ok-bg: #e1f6ec;
  --warn: #b7700a; --warn-bg: #fff2d9;
  --danger: #d13b3b; --danger-bg: #fdeaea;
  --info: #1f6fd1; --info-bg: #e6effc;
  --purple: #7048d6; --purple-bg: #efe9fd;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 6px 16px -6px rgba(15, 23, 42, .10);
  --shadow-lg: 0 24px 48px -12px rgba(15, 23, 42, .35);
  --sidebar-w: 248px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Arial, "Noto Sans Arabic", sans-serif;
  --mono: "JetBrains Mono", "Cascadia Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 13.5px/1.45 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; font-feature-settings: "cv11", "ss01"; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.015em; }
h1 { font-size: 22px; font-weight: 750; }
h2 { font-size: 14.5px; font-weight: 650; }
h3 { font-size: 13px; font-weight: 650; }
::selection { background: #bfe3f7; }
.mono { font-family: var(--mono); font-size: 12px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.num, td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.hidden { display: none !important; }
.pos-text { color: var(--ok); font-weight: 600; }
.neg-text { color: var(--danger); font-weight: 600; }
.ar { font-family: "Noto Sans Arabic", "Segoe UI", Tahoma, sans-serif; }
svg.i { flex-shrink: 0; }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: #b9c4d3 transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #c3cdd9; border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }

/* ================================================================ boot / login */
.boot { height: 100vh; display: grid; place-content: center; text-align: center; color: #fff; background: var(--grad-dark); }
.boot-logo { font-size: 24px; font-weight: 750; }
.boot-sub { color: #8fb0cc; margin-top: 6px; }
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.15fr 1fr; background: var(--surface); }
.login-hero { position: relative; overflow: hidden; background: var(--grad-dark); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; }
.login-hero::before { content: ""; position: absolute; width: 620px; height: 620px; right: -220px; top: -180px; border-radius: 50%; background: radial-gradient(circle, rgba(15,181,174,.45), transparent 65%); }
.login-hero::after { content: ""; position: absolute; width: 520px; height: 520px; left: -200px; bottom: -220px; border-radius: 50%; background: radial-gradient(circle, rgba(29,95,191,.55), transparent 65%); }
.login-hero > * { position: relative; z-index: 1; }
.login-hero h1 { font-size: 38px; line-height: 1.12; margin-top: 18px; font-weight: 800; }
.login-hero p { color: rgba(255,255,255,.75); max-width: 460px; font-size: 15px; }
.login-hero ul { padding: 0; list-style: none; display: grid; gap: 10px; }
.login-hero li { display: flex; gap: 10px; align-items: center; color: rgba(255,255,255,.9); background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1); padding: 10px 14px; border-radius: 10px; max-width: 420px; backdrop-filter: blur(6px); }
.login-hero li::before { content: "✓"; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--grad-brand); font-size: 12px; font-weight: 700; }
.login-panel { display: grid; place-items: center; padding: 32px; background: radial-gradient(circle at 80% 10%, #eaf4fb, #fff 55%); }
.login-card { width: 100%; max-width: 380px; background: #fff; padding: 34px; border-radius: 16px; border: 1px solid var(--border); box-shadow: var(--shadow); }
.login-card h2 { font-size: 24px; font-weight: 750; margin-bottom: 4px; }
.brand-mark { display: inline-flex; align-items: center; gap: 12px; font-weight: 750; font-size: 16px; }
.brand-mark svg { width: 38px; height: 38px; border-radius: 10px; box-shadow: 0 6px 16px -4px rgba(15,181,174,.6); }
@media (max-width: 860px) { .login-wrap { grid-template-columns: 1fr; } .login-hero { display: none; } }

/* ================================================================ shell */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar { background: var(--grad-dark); color: #b4c5d6; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; border-right: 1px solid #06111e; }
.sidebar .brand { padding: 18px 18px 16px; color: #fff; border-bottom: 1px solid rgba(255,255,255,.06); background: linear-gradient(180deg, rgba(15,181,174,.10), transparent); }
.sidebar .brand .brand-mark { font-size: 14.5px; line-height: 1.2; }
.sidebar .brand small { display: block; color: #6f8ba6; font-weight: 500; font-size: 11px; margin-top: 3px; letter-spacing: .02em; }
.nav { padding: 6px 12px 28px; }
.nav-group { margin-top: 16px; }
.nav-group > .nav-title { font-size: 10px; text-transform: uppercase; letter-spacing: .12em; color: #587391; padding: 0 10px 6px; font-weight: 700; }
.nav a { position: relative; display: flex; align-items: center; gap: 11px; padding: 8px 10px; margin: 1px 0; border-radius: 8px; color: #b4c5d6; font-size: 13.2px; font-weight: 500; transition: background .15s, color .15s; }
.nav a:hover { background: rgba(255,255,255,.06); text-decoration: none; color: #fff; }
.nav a .ico { width: 20px; display: grid; place-items: center; color: #6fa3c7; }
.nav a.active { background: linear-gradient(90deg, rgba(15,181,174,.28), rgba(14,127,192,.14)); color: #fff; box-shadow: inset 0 0 0 1px rgba(15,181,174,.25); }
.nav a.active .ico { color: #5eead4; }
.nav a.active::before { content: ""; position: absolute; left: -12px; top: 7px; bottom: 7px; width: 4px; border-radius: 0 4px 4px 0; background: var(--grad-brand); }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 60px; background: rgba(255,255,255,.92); backdrop-filter: saturate(160%) blur(10px); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 14px; padding: 0 24px; position: sticky; top: 0; z-index: 20; box-shadow: 0 1px 0 rgba(15,23,42,.02), 0 4px 14px -10px rgba(15,23,42,.2); }
.topbar::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--grad-brand); }
.topbar .menu-btn { display: none; }
.topbar .spacer { flex: 1; }
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); font-weight: 500; white-space: nowrap; min-width: 0; overflow: hidden; }
@media (max-width: 1280px) { .crumbs > span:first-child, .crumbs > span:first-child + .sep { display: none; } }
@media (max-width: 1100px) { .crumbs { display: none; } .loc-switch .muted { display: none; } }
.crumbs b { color: var(--text); font-weight: 650; }
.crumbs .sep { color: #c0c9d6; }
.loc-switch { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px 4px 3px 10px; }
.loc-switch .muted { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.loc-switch select { min-width: 210px; font-weight: 650; border: 0; background: transparent; box-shadow: none; }
.user-chip { display: flex; align-items: center; gap: 8px; padding-left: 12px; border-left: 1px solid var(--border); }
.user-chip .who b { font-size: 13px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--grad-brand); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; box-shadow: 0 4px 10px -3px rgba(14,127,192,.55); }
.content { padding: 22px 28px 48px; max-width: 1680px; width: 100%; }
.page-head { display: flex; align-items: flex-end; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 3px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 50; width: 270px; transform: translateX(-100%); transition: transform .2s; }
  .shell.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .topbar .menu-btn { display: inline-flex; }
  .crumbs { display: none; }
  .content { padding: 14px; }
  .loc-switch select { min-width: 130px; }
  .user-chip .who { display: none; }
}

/* ================================================================ surfaces */
/* no overflow:hidden on cards - search dropdowns must be able to float outside them */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); background: linear-gradient(180deg, #fbfcfe, #f5f8fb); min-height: 50px; border-radius: var(--radius) var(--radius) 0 0; }
.card > .table-wrap:first-child, .card > div:first-child > .table-wrap:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.card > .table-wrap:last-child, .card > div:last-child > .table-wrap:last-child, .card > div:only-child > .table-wrap { border-radius: 0 0 var(--radius) var(--radius); }
.card > .table-wrap:only-child, .card > div:only-child > .table-wrap:only-child { border-radius: var(--radius); }
.card > .pager:last-child, .card > div:last-child > .pager:last-child { border-radius: 0 0 var(--radius) var(--radius); }
.card:has(.ta-list:not(.hidden)) { position: relative; z-index: 30; }
.card-head h2 { display: flex; align-items: center; gap: 9px; }
.card-head h2::before { content: ""; width: 4px; height: 16px; border-radius: 3px; background: var(--grad-brand); }
.card-head .actions { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.card-body { padding: 16px; }
.card-body.tight { padding: 0; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-side { grid-template-columns: minmax(0, 1fr) 380px; }
@media (max-width: 1200px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-side { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.stack { display: grid; gap: 10px; }
.gap-lg { gap: 16px; }
.mt { margin-top: 16px; }
.mt-sm { margin-top: 8px; }
.mb { margin-bottom: 16px; }

/* ================================================================ KPI tiles */
.kpi { position: relative; padding: 16px 18px 14px; overflow: hidden; }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--kpi-color, var(--brand)); }
.kpi::after { content: ""; position: absolute; right: -40px; top: -40px; width: 120px; height: 120px; border-radius: 50%; background: var(--kpi-color, var(--brand)); opacity: .06; }
.kpi .label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; font-weight: 650; }
.kpi .value { font-size: 26px; font-weight: 780; margin-top: 6px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.kpi .value small { font-size: 13px; color: var(--muted); font-weight: 600; margin-right: 4px; }
.kpi .foot { color: var(--text-2); font-size: 12.5px; margin-top: 4px; display: inline-block; }
.kpi .kpi-ico { position: absolute; right: 16px; top: 16px; width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; color: #fff; background: var(--kpi-color, var(--brand)); box-shadow: 0 8px 18px -8px var(--kpi-color, var(--brand)); z-index: 1; }
.kpi.c1 { --kpi-color: #0e7fc0; } .kpi.c2 { --kpi-color: #0f9960; } .kpi.c3 { --kpi-color: #7048d6; } .kpi.c4 { --kpi-color: #e08a0b; }

/* ================================================================ buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 35px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: linear-gradient(180deg, #fff, #f5f7fa); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none !important; box-shadow: var(--shadow-sm); transition: transform .08s, box-shadow .15s, background .15s, border-color .15s; }
.btn:hover { border-color: #aebbcc; box-shadow: 0 3px 8px -3px rgba(15,23,42,.18); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--grad-brand); border-color: transparent; color: #fff; box-shadow: 0 6px 14px -6px rgba(14,127,192,.7); }
.btn.primary:hover { filter: brightness(1.06); box-shadow: 0 8px 18px -6px rgba(14,127,192,.8); }
.btn.accent { background: linear-gradient(135deg, #14b8a6, #0ea5a0); border-color: transparent; color: #fff; box-shadow: 0 6px 14px -6px rgba(15,181,174,.7); }
.btn.ok { background: linear-gradient(135deg, #16a34a, #0f9960); border-color: transparent; color: #fff; }
.btn.danger { background: linear-gradient(135deg, #ef4444, #d13b3b); border-color: transparent; color: #fff; box-shadow: 0 6px 14px -6px rgba(209,59,59,.6); }
.btn.ghost { border-color: transparent; background: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--brand-50); }
.btn.sm { height: 29px; padding: 0 10px; font-size: 12.5px; }
.btn.lg { height: 46px; padding: 0 22px; font-size: 15px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn.icon { width: 35px; padding: 0; }
.btn .spin { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.link-btn { background: none; border: 0; color: var(--brand); cursor: pointer; font: inherit; padding: 0; font-weight: 600; }
.link-btn:hover { text-decoration: underline; }

/* ================================================================ forms */
label.f { display: grid; gap: 5px; font-size: 11.5px; color: var(--text-2); font-weight: 650; min-width: 0; text-transform: uppercase; letter-spacing: .04em; }
label.f .req { color: var(--danger); }
label.f .hint { font-weight: 500; color: var(--muted); text-transform: none; letter-spacing: 0; }
.input, select.input, textarea.input { height: 36px; width: 100%; padding: 0 11px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: #fff; font: inherit; font-size: 13.5px; color: var(--text); min-width: 0; text-transform: none; letter-spacing: 0; font-weight: 500; box-shadow: inset 0 1px 2px rgba(15,23,42,.04); transition: border-color .15s, box-shadow .15s; }
textarea.input { height: auto; min-height: 70px; padding: 9px 11px; resize: vertical; }
.input:hover { border-color: #aebbcc; }
.input:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 4px rgba(15,181,174,.16); }
.input.lg { height: 48px; font-size: 16px; }
.input.num { text-align: right; font-variant-numeric: tabular-nums; }
.input[readonly], .input:disabled { background: var(--surface-2); color: var(--muted); }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; user-select: none; text-transform: none; letter-spacing: 0; font-weight: 550; color: var(--text); }
.check input { width: 17px; height: 17px; accent-color: var(--brand); }
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.form-grid .span2 { grid-column: span 2; }
.form-grid .span-all { grid-column: 1 / -1; }
@media (max-width: 600px) { .form-grid .span2 { grid-column: auto; } }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 14px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.filters .input { width: auto; min-width: 150px; }
.filters .grow { flex: 1; min-width: 240px; }
.filters .grow .input { width: 100%; padding-left: 34px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%237a8699' stroke-width='2'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='M11 11l3.5 3.5'/%3E%3C/svg%3E") no-repeat 11px center; }
.section-title { display: flex; align-items: center; gap: 10px; font-size: 11px; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); margin: 20px 0 10px; font-weight: 700; }
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.input-group { display: flex; }
.input-group .input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-group .btn { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: -1px; height: 36px; }

/* ================================================================ data grid tables */
.table-wrap { overflow: auto; max-height: calc(100vh - 230px); }
.modal .table-wrap { max-height: none; }
table.t { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
table.t th { position: sticky; top: 0; z-index: 2; background: var(--grid-head); color: #3b4a60; font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; text-align: left; padding: 10px 12px; border-bottom: 2px solid var(--border-strong); border-right: 1px solid #dde4ed; white-space: nowrap; }
table.t th:last-child { border-right: 0; }
table.t td { padding: 9px 12px; border-bottom: 1px solid var(--grid-line); border-right: 1px solid #f0f3f7; vertical-align: middle; }
table.t td:last-child { border-right: 0; }
table.t tbody tr:nth-child(even) td { background: #f9fbfd; }
table.t tbody tr { transition: background .1s; }
table.t tbody tr:hover td { background: #eaf5fc; }
table.t tbody tr:hover td:first-child { box-shadow: inset 3px 0 0 var(--teal); }
table.t tr.click { cursor: pointer; }
table.t td b { font-weight: 650; }
table.t tbody td:first-child b { color: var(--navy-800); }
table.t tfoot td { position: sticky; bottom: 0; font-weight: 700; background: var(--navy-900); color: #fff; border-right-color: rgba(255,255,255,.08); border-bottom: 0; padding: 10px 12px; }
table.t tfoot td .input { color: var(--text); }
table.t td .input { height: 31px; }
table.t.compact td, table.t.compact th { padding: 6px 9px; }
table.t tr.group-row td { background: linear-gradient(90deg, #e3eefa, #f1f6fc) !important; font-weight: 700; color: var(--navy-800); border-top: 1px solid #d3e1f1; }
table.t tr.total-row td { font-weight: 750; background: #eef3f9 !important; border-top: 2px solid var(--border-strong); }
.empty { padding: 44px 20px; text-align: center; color: var(--muted); background: repeating-linear-gradient(-45deg, transparent 0 10px, rgba(15,23,42,.015) 10px 20px); }
.pager { display: flex; align-items: center; gap: 8px; justify-content: flex-end; padding: 10px 14px; color: var(--muted); font-size: 12.5px; border-top: 1px solid var(--border); background: var(--surface-2); }

/* ================================================================ badges */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px 0 8px; border-radius: 11px; font-size: 11.5px; font-weight: 650; background: #eef1f5; color: var(--text-2); white-space: nowrap; border: 1px solid rgba(15,23,42,.06); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.ok, .b-paid, .b-received, .b-delivered, .b-fit, .b-submitted, .b-posted, .b-closed { background: var(--ok-bg); color: var(--ok); }
.badge.warn, .b-open, .b-requested, .b-pending, .b-partial, .b-lens_ordered, .b-qc, .b-fit_with_correction { background: var(--warn-bg); color: var(--warn); }
.badge.danger, .b-unfit, .b-rejected, .b-cancelled, .b-overdue { background: var(--danger-bg); color: var(--danger); }
.badge.info, .b-in_transit, .b-approved, .b-in_lab, .b-ordered, .b-referred, .b-credit, .b-new, .b-sale { background: var(--info-bg); color: var(--info); }
.badge.purple, .b-ready, .b-return { background: var(--purple-bg); color: var(--purple); }

/* ================================================================ tabs (segmented) */
.tabs { display: inline-flex; gap: 3px; padding: 4px; margin-bottom: 16px; background: #e2e8f0; border-radius: 11px; overflow-x: auto; max-width: 100%; box-shadow: inset 0 1px 2px rgba(15,23,42,.08); }
.tabs a, .tabs button { padding: 7px 15px; color: var(--text-2); border: 0; background: none; font: inherit; font-weight: 600; font-size: 13px; cursor: pointer; border-radius: 8px; white-space: nowrap; transition: background .15s, color .15s; }
.tabs a:hover, .tabs button:hover { color: var(--navy-800); background: rgba(255,255,255,.5); text-decoration: none; }
.tabs .active { color: var(--navy-900); background: #fff; box-shadow: 0 1px 3px rgba(15,23,42,.15); }

/* ================================================================ modal & toast */
.modal-back { position: fixed; inset: 0; background: rgba(7, 21, 38, .55); backdrop-filter: blur(3px); display: grid; place-items: start center; padding: 5vh 16px; z-index: 100; overflow-y: auto; animation: fade .15s; }
.modal { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); width: 100%; max-width: 580px; animation: pop .18s; }
.modal-head { border-radius: 16px 16px 0 0; }
.modal-foot { border-radius: 0 0 16px 16px; }
.modal.lg { max-width: 900px; }
.modal.xl { max-width: 1160px; }
.modal.sm { max-width: 440px; }
.modal-head { display: flex; align-items: center; padding: 15px 20px; background: var(--grad-dark); color: #fff; position: relative; }
.modal-head::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--grad-brand); }
.modal-head h2 { font-size: 15.5px; }
.modal-head .x { margin-left: auto; color: #b4c5d6; }
.modal-head .x:hover { background: rgba(255,255,255,.1); color: #fff; }
.modal-body { padding: 20px; max-height: 72vh; overflow-y: auto; }
.modal-body:has(.ta-list:not(.hidden)) { overflow: visible; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 13px 20px; border-top: 1px solid var(--border); background: var(--surface-2); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: translateY(10px) scale(.985); opacity: 0; } }
#toast-root { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 10px; z-index: 200; }
.toast { background: var(--navy-900); color: #fff; padding: 12px 16px 12px 18px; border-radius: 11px; box-shadow: var(--shadow-lg); max-width: 440px; white-space: pre-line; border-left: 4px solid var(--teal); animation: pop .18s; font-weight: 500; }
.toast.error { border-left-color: #ff6b5e; }
.toast.ok { border-left-color: #34d399; }
.alert { padding: 11px 14px; border-radius: 10px; background: var(--info-bg); color: #1c4f94; font-size: 13px; white-space: pre-line; border: 1px solid rgba(31,111,209,.18); }
.alert.warn { background: var(--warn-bg); color: #8a5406; border-color: rgba(183,112,10,.22); }
.alert.danger { background: var(--danger-bg); color: #a42c2c; border-color: rgba(209,59,59,.22); }
.alert.ok { background: var(--ok-bg); color: #0b7a4c; border-color: rgba(15,153,96,.22); }
.loading { padding: 48px; text-align: center; color: var(--muted); }
.loading::before { content: ""; display: block; width: 28px; height: 28px; margin: 0 auto 12px; border: 3px solid #d7e0ea; border-top-color: var(--teal); border-radius: 50%; animation: spin .8s linear infinite; }

/* ================================================================ typeahead */
.ta { position: relative; }
.ta-list { position: absolute; left: 0; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--border-strong); border-radius: 12px; box-shadow: var(--shadow-lg); z-index: 60; max-height: 380px; overflow-y: auto; }
.ta-item { padding: 9px 14px; cursor: pointer; display: flex; gap: 10px; align-items: center; border-bottom: 1px solid var(--grid-line); }
.ta-item:last-child { border-bottom: 0; }
.ta-item.active, .ta-item:hover { background: linear-gradient(90deg, #e3f4fb, #f4fafd); }
.ta-item .meta { color: var(--muted); font-size: 12px; }
.ta-item .end { margin-left: auto; text-align: right; }

/* ================================================================ POS */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 16px; align-items: start; }
@media (max-width: 1100px) { .pos { grid-template-columns: 1fr; } }
.pos-scan .input { height: 50px; font-size: 16px; padding-left: 46px; border-width: 2px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='none' stroke='%230e7fc0' stroke-width='2'%3E%3Cpath d='M3 5v12M6 5v12M9 5v12M12 5v12M15 5v12M18 5v12'/%3E%3C/svg%3E") no-repeat 14px center; }
.step-no { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--grad-brand); color: #fff; font-size: 12px; font-weight: 750; margin-right: 2px; }
.card-head h2:has(.step-no)::before { display: none; }
.step-card { border: 1px solid #b9dcef; box-shadow: 0 0 0 4px rgba(15,181,174,.08), var(--shadow); }
.mobile-step { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.mobile-step .input.lg { font-size: 20px; letter-spacing: .08em; font-weight: 650; }
#pos-body.locked { position: relative; }
#pos-body.locked > * { opacity: .38; pointer-events: none; filter: grayscale(.4); user-select: none; }
#pos-body.locked::after { content: "↑  Enter the customer's mobile number first"; position: absolute; left: 50%; top: 70px; transform: translateX(-50%); background: var(--navy-900); color: #fff; padding: 12px 22px; border-radius: 30px; font-weight: 650; box-shadow: var(--shadow-lg); white-space: nowrap; z-index: 5; }
.pos-cust { display: flex; gap: 12px; align-items: center; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; }
.pos-cust .who { flex: 1; min-width: 0; }
.pos-cust .who b { display: block; font-size: 15px; }
.member-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.chip { border: 1px solid var(--border-strong); background: #fff; border-radius: 18px; padding: 5px 13px; font-size: 12.5px; cursor: pointer; font: inherit; font-weight: 600; transition: all .15s; }
.chip:hover { border-color: var(--teal); }
.chip.active { background: var(--grad-brand); color: #fff; border-color: transparent; box-shadow: 0 4px 10px -4px rgba(14,127,192,.7); }
.chip small { opacity: .75; margin-left: 4px; font-weight: 500; }
.totals { display: grid; gap: 0; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.totals .line { display: flex; justify-content: space-between; font-variant-numeric: tabular-nums; padding: 8px 12px; border-bottom: 1px solid var(--grid-line); }
.totals .line:nth-child(even) { background: #f9fbfd; }
.totals .grand { font-size: 21px; font-weight: 800; color: #fff; background: var(--grad-dark) !important; border-bottom: 0; padding: 12px; }
.totals > .row { padding: 10px 12px; border-bottom: 1px solid var(--grid-line); }
.totals > label.f { padding: 10px 12px; }
.pay-methods { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.pay-methods .btn { height: 42px; }
.rx-mini { font-family: var(--mono); font-size: 12px; background: #0b1f35; color: #a7f3d0; border-radius: 8px; padding: 9px 12px; }

/* ================================================================ Rx grid */
table.rx { border-collapse: separate; border-spacing: 0; width: 100%; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
table.rx th { font-size: 11px; color: #3b4a60; font-weight: 700; padding: 8px 6px; text-align: center; background: var(--grid-head); border-bottom: 1px solid var(--border-strong); text-transform: uppercase; letter-spacing: .05em; }
table.rx td { padding: 5px; border-bottom: 1px solid var(--grid-line); border-right: 1px solid #f0f3f7; }
table.rx tbody tr:last-child td { border-bottom: 0; }
table.rx td.eye { font-weight: 750; color: #fff; width: 76px; text-align: center; background: var(--navy-800); }
table.rx tfoot td { background: var(--surface-2); }
table.rx .input { height: 34px; text-align: center; padding: 0 4px; font-family: var(--mono); }

/* ================================================================ job board */
.board { display: grid; grid-template-columns: repeat(5, minmax(220px, 1fr)); gap: 14px; overflow-x: auto; align-items: start; }
.board-col { background: #e3e9f1; border-radius: 12px; padding: 10px; min-height: 140px; border: 1px solid #d6dee9; }
.board-col h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #3b4a60; padding: 2px 4px 10px; display: flex; align-items: center; }
.board-col h3 span { margin-left: auto; background: var(--navy-800); color: #fff; border-radius: 10px; padding: 1px 8px; font-size: 11px; }
.job-card { background: #fff; border-radius: 10px; padding: 11px 12px; box-shadow: var(--shadow); margin-bottom: 9px; cursor: pointer; border-left: 4px solid var(--teal); transition: transform .12s, box-shadow .12s; }
.job-card:hover { transform: translateY(-2px); box-shadow: 0 10px 20px -10px rgba(15,23,42,.35); }
.job-card.overdue { border-left-color: var(--danger); }
.job-card .top { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.job-card b { display: block; margin: 4px 0; }

/* ================================================================ charts */
.bars { display: flex; align-items: flex-end; gap: 8px; height: 180px; padding: 12px 4px 0; background: repeating-linear-gradient(0deg, transparent 0 35px, #eef2f7 35px 36px); }
.bars .bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; min-width: 0; }
.bars .bar i { display: block; width: 100%; max-width: 38px; background: var(--grad-brand); border-radius: 6px 6px 2px 2px; min-height: 3px; box-shadow: 0 4px 10px -6px rgba(14,127,192,.8); }
.bars .bar span { font-size: 10.5px; color: var(--muted); white-space: nowrap; font-weight: 600; }
.hbar { display: grid; grid-template-columns: 140px 1fr 96px; gap: 12px; align-items: center; padding: 7px 0; font-size: 13px; border-bottom: 1px dashed var(--grid-line); }
.hbar span:first-child { overflow: hidden; text-overflow: ellipsis; }
.hbar .track { background: #edf1f6; border-radius: 6px; height: 10px; overflow: hidden; }
.hbar .track i { display: block; height: 100%; background: var(--grad-brand); border-radius: 6px; }

/* ================================================================ key/value as table */
.kv { display: grid; grid-template-columns: 150px 1fr; font-size: 13px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.kv dt, .kv dd { margin: 0; padding: 8px 12px; border-bottom: 1px solid var(--grid-line); }
.kv dt { color: var(--text-2); background: var(--surface-2); font-weight: 600; font-size: 12px; border-right: 1px solid var(--grid-line); }
.kv dt:nth-last-of-type(1), .kv dd:last-of-type { border-bottom: 0; }
.kv > span { padding: 8px 12px; border-bottom: 1px solid var(--grid-line); }
.steps { display: flex; margin: 6px 0 18px; padding: 14px 6px 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; }
.steps .s { flex: 1; text-align: center; font-size: 11.5px; color: var(--muted); position: relative; padding-top: 22px; font-weight: 600; }
.steps .s::before { content: ""; position: absolute; top: 4px; left: 50%; width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 2px solid #c9d3e0; transform: translateX(-50%); z-index: 1; }
.steps .s::after { content: ""; position: absolute; top: 10px; left: -50%; width: 100%; height: 3px; background: #d6dee9; }
.steps .s:first-child::after { display: none; }
.steps .s.done { color: var(--ok); }
.steps .s.done::before { background: var(--ok); border-color: var(--ok); }
.steps .s.done::after { background: var(--ok); }
.steps .s.current { color: var(--navy-800); }
.steps .s.current::before { background: var(--brand); border-color: var(--brand); box-shadow: 0 0 0 5px rgba(14,107,168,.18); }
.scan-flash td { animation: flash .7s; }
@keyframes flash { from { background: #c8f5dd; } }
.drop { border: 2px dashed var(--border-strong); border-radius: 12px; padding: 28px; text-align: center; color: var(--muted); background: var(--surface-2); }
.drop:hover { border-color: var(--teal); }
.label-sheet { display: flex; flex-wrap: wrap; gap: 8px; }
