/* Sri Rathna customer portal — light design system (Balaje-style) */
:root {
  --bg: #f4f6fb; --card: #fff; --line: #e6e9f2; --text: #1f2937; --muted: #6b7280;
  --indigo: #4f46e5; --indigo-d: #3730a3; --sky: #0ea5e9; --green: #16a34a; --amber: #f59e0b;
  --red: #ef4444; --purple: #9333ea; --pink: #db2777; --dark: #1f2937;
  --radius: 14px; --shadow: 0 1px 2px rgba(16,24,40,.04), 0 4px 16px rgba(16,24,40,.06);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-head: var(--font);
  /* theme-overridable tokens (see themes.css, generated by build_themes.py) —
     these defaults reproduce the original untheme'd look exactly, so this
     refactor changes nothing visually until a [data-theme] attribute is set.
     Themes override --indigo/--indigo-d/--pink/--bg/--card/--line/--text/
     --muted/--dark directly (every existing rule already uses those), plus
     the tile/sidebar/nav-active tokens below which are new. */
  --primary-tint: #e0e7ff; --accent: var(--pink);
  --brand-bg: var(--dark);
  --nav-active-bg: #e7f5ee; --nav-active-text: #14532d;
  --sidebar-bg: var(--card); --sidebar-text: #374151;
  --tile1: #4338ca; --tile2: #0ea5e9; --tile3: #16a34a; --tile4: #f5b301; --tile5: #ef4444; --tile6: #9333ea;
  --card-border-w: 1px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; max-width: 100%; overflow-x: hidden; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 700; }
.muted { color: var(--muted); } .muted-l { color: #cbd5e1; } .small { font-size: 12px; }
.r { text-align: right; } .c { text-align: center; } .mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; }
.link { color: var(--indigo); font-weight: 600; } .strong { font-weight: 700; }
.lbl { display: block; font-size: 11px; font-weight: 700; letter-spacing: .08em; color: var(--muted); margin: 0 0 6px; }

/* ───────── shell */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 262px; background: var(--sidebar-bg); border-right: 1px solid var(--line); padding: 18px 16px; display: flex; flex-direction: column; gap: 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; flex-shrink: 0; transition: width .18s, background .18s; }
.brand { display: flex; gap: 12px; align-items: center; padding: 4px 6px 12px; }
.brand-mark { width: 40px; height: 40px; border-radius: 50%; background: var(--brand-bg); color: #fff; display: grid; place-items: center; font-size: 20px; flex-shrink: 0; }
.brand-mark.big { width: 54px; height: 54px; font-size: 26px; }
.brand-name { display: block; font-weight: 800; font-size: 15px; letter-spacing: .02em; line-height: 1.15; }
.brand-sub { display: block; font-size: 11px; color: var(--muted); }
.nav { display: flex; flex-direction: column; gap: 4px; border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; font-weight: 500; color: var(--sidebar-text); }
.nav a i { font-style: normal; width: 20px; text-align: center; opacity: .8; }
.nav a:hover { background: rgba(127,127,127,.12); }
.brand-name, .brand-sub, .cust-login, .cust-role { color: var(--sidebar-text); }
.brand-sub, .cust-role { opacity: .65; }
.nav a.active { background: var(--nav-active-bg); color: var(--nav-active-text); font-weight: 600; position: relative; }
[data-theme] .nav a.active { border-left: 3px solid transparent; margin-left: -3px; padding-left: 15px; }
[data-theme$="-navy-gold"] .nav a.active,
[data-theme$="-burgundy"] .nav a.active,
[data-theme="sr-dispatch-dark"] .nav a.active { border-left-color: var(--accent); background: var(--nav-active-bg); }
[data-theme="sr-mint-charcoal-minimal"] .nav a.active { border-left-color: transparent; border-bottom: 2px solid var(--primary); border-radius: 10px 10px 0 0; }
.pill { margin-left: auto; background: var(--indigo); color: #fff; font-size: 11px; padding: 1px 7px; border-radius: 999px; }
.pill.light { background: #e0e7ff; color: var(--indigo-d); }
.cust-card { background: #f8f9fc; border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.cust-head { display: flex; gap: 10px; align-items: center; }
.avatar { width: 34px; height: 34px; border-radius: 10px; background: var(--indigo); color: #fff; display: grid; place-items: center; font-weight: 700; }
.cust-login { font-weight: 700; font-size: 13px; } .cust-role { font-size: 10px; letter-spacing: .1em; color: var(--muted); }
.cust-code { margin: 10px 0; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 12px; font-weight: 600; }
.cust-meta { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 11px; }
.cust-meta .lbl { margin: 6px 0 2px; font-size: 9.5px; } .cust-meta .val { color: #475569; } .cust-meta .val.strong { color: var(--text); }
.signout { margin-top: auto; } .signout button { width: 100%; display: flex; align-items: center; gap: 10px; background: none; border: 0; text-align: left; padding: 10px 12px; color: var(--muted); cursor: pointer; border-radius: 10px; font-size: 14px; }
.signout button:hover { background: #fef2f2; color: var(--red); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { background: var(--card); border-bottom: 1px solid var(--line); padding: 12px 24px; display: flex; align-items: center; gap: 16px; position: sticky; top: 0; z-index: 20; }
.icon-btn { background: none; border: 0; font-size: 18px; cursor: pointer; padding: 6px 8px; border-radius: 8px; position: relative; color: #475569; }
.icon-btn:hover { background: #f1f3f9; }
.icon-btn .dot { position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--red); }
.gsearch { flex: 0 1 300px; display: flex; align-items: center; gap: 8px; background: #f4f6fb; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
.gsearch input { border: 0; background: none; outline: 0; flex: 1; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.user-chip-wrap { position: relative; }
.user-chip { display: flex; align-items: center; gap: 10px; background: none; border: 1px solid transparent; border-radius: 12px; padding: 6px 10px 6px 6px; cursor: pointer; transition: background .12s, border-color .12s; }
.user-chip:hover, body.user-menu-open .user-chip { background: #f4f6fb; border-color: var(--line); }
.chip-caret { color: var(--muted); font-size: 12px; margin-left: 2px; transition: transform .15s; }
body.user-menu-open .chip-caret { transform: rotate(180deg); }
.user-menu { position: absolute; top: calc(100% + 8px); right: 0; min-width: 232px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(15,23,42,.12); padding: 8px; z-index: 40; }
.user-menu .menu-head { padding: 8px 12px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.user-menu .menu-head .u-name { font-weight: 700; font-size: 14px; }
.user-menu .menu-head .u-role { font-size: 10.5px; letter-spacing: .1em; color: var(--muted); }
.user-menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
.user-menu form { margin: 0; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; background: none; border: 0; border-radius: 8px; font-size: 13px; text-align: left; cursor: pointer; color: #374151; }
.menu-item i { font-style: normal; width: 18px; text-align: center; opacity: .8; }
.menu-item:hover { background: #f1f3f9; color: var(--indigo-d); }
.menu-item.menu-danger { color: var(--red); }
.menu-item.menu-danger:hover { background: #fef2f2; color: var(--red); }
.u-name { font-weight: 700; font-size: 13px; } .u-role { font-size: 10px; letter-spacing: .1em; color: var(--muted); }
.content { padding: 22px 24px 40px; display: flex; flex-direction: column; gap: 18px; }

/* ───────── cards, tables, badges, buttons */
.card { background: var(--card); border: var(--card-border-w) solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; }
[data-theme] h1, [data-theme] h2, [data-theme] h3, [data-theme] .brand-name, [data-theme] .tile b { font-family: var(--font-head); }
[data-theme] .content { font-size: var(--base-font-size, 14px); }
[data-theme] .card { padding: var(--card-pad, 18px 20px); }
.card.dark { background: var(--dark); color: #fff; border-color: var(--dark); }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.card-head h3 { font-size: 15px; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { font-size: 11px; letter-spacing: .06em; color: var(--muted); text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl.plain td { padding: 12px 8px; }
.rowlink { cursor: pointer; } .rowlink:hover td { background: #f8f9fc; }
.badge { display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: .05em; padding: 3px 8px; border-radius: 999px; }
.b-green { background: #dcfce7; color: #166534; } .b-red { background: #fee2e2; color: #991b1b; } .b-sky { background: #e0f2fe; color: #075985; }
.b-amber { background: #fef3c7; color: #92400e; } .b-pink { background: #fce7f3; color: var(--pink); } .b-grey { background: #f1f5f9; color: #64748b; }
.b-indigo { background: #e0e7ff; color: var(--indigo-d); }
.st-placed { background: #e0e7ff; color: var(--indigo-d); } .st-confirmed { background: #e0f2fe; color: #075985; }
.st-dispatched { background: #fef3c7; color: #92400e; } .st-invoiced { background: #dcfce7; color: #166534; } .st-cancelled { background: #fee2e2; color: #991b1b; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid transparent; border-radius: 10px; padding: 10px 18px; font-weight: 600; cursor: pointer; background: #f1f3f9; transition: .12s; white-space: nowrap; }
.btn:hover { filter: brightness(.96); } .btn:disabled { opacity: .6; cursor: default; }
.btn-primary, .btn-indigo { background: var(--indigo); color: #fff; } .btn-green { background: var(--green); color: #fff; }
.btn-danger { background: #fee2e2; color: #991b1b; } .btn-ghost { background: #fff; border-color: var(--line); }
.btn-light { background: #fff; color: var(--dark); } .btn-block { width: 100%; } .btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: 8px; }
.btn-add { background: var(--green); color: #fff; font-size: 18px; padding: 0 22px; border-radius: 12px; }
.flash { padding: 10px 14px; border-radius: 10px; font-weight: 500; }
.flash.ok { background: #dcfce7; color: #166534; } .flash.error { background: #fee2e2; color: #991b1b; }
.stk-ok { color: var(--green); } .stk-mid { color: #0d9488; } .stk-low { color: var(--red); } .stk-out { color: #9ca3af; }
.exp-ok { color: #475569; } .exp-soon { color: var(--amber); font-weight: 600; } .exp-past { color: var(--red); font-weight: 600; }
.scheme { color: var(--pink); font-weight: 700; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.kpi small { display: block; font-size: 11px; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.kpi b { display: block; font-size: 22px; margin-top: 4px; overflow-wrap: anywhere; }
.kpi.red b { color: var(--red); } .kpi.green b { color: var(--green); } .kpi.amber b { color: var(--amber); } .kpi.indigo b { color: var(--indigo); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters select, .filters input { border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; background: #fff; }
.seg a { padding: 6px 12px; border-radius: 8px; border: 1px solid var(--line); background: #fff; font-size: 12.5px; font-weight: 600; margin-right: 4px; }
.seg a.on { background: var(--indigo); color: #fff; border-color: var(--indigo); }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-head h2 { font-size: 20px; }
.dl-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.bill-jump { appearance: none; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%236b7280'%3E%3Cpath d='M5.25 7.5L10 12.25l4.75-4.75' stroke='%236b7280' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 10px center; background-size: 14px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 34px 10px 14px; font-weight: 600; font-size: 13px; color: var(--text); cursor: pointer; max-width: 260px; }
.bill-jump:hover { border-color: #c7d2fe; }
.bill-jump:focus { outline: 0; border-color: var(--indigo); box-shadow: 0 0 0 3px var(--primary-tint); }

/* ───────── dashboard */
.hello { display: flex; align-items: center; justify-content: space-between; }
.hello-l { display: flex; align-items: center; gap: 12px; } .hello h1 { font-size: 20px; }
.hello-ic { width: 38px; height: 38px; border-radius: 50%; background: #eef2ff; color: var(--indigo); display: grid; place-items: center; }
.hello-r { color: var(--muted); font-weight: 500; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.tile { display: flex; align-items: center; gap: 12px; padding: 18px 20px; border-radius: var(--radius); color: #fff; box-shadow: var(--shadow); transition: transform .12s; }
.tile:hover { transform: translateY(-2px); }
.tile .t-ic { width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,.2); display: grid; place-items: center; font-size: 16px; }
.tile b { display: block; font-size: 15px; } .tile small { display: block; opacity: .9; font-size: 12px; }
.tile i { margin-left: auto; font-style: normal; font-size: 18px; opacity: .9; }
.t-indigo { background: var(--tile1); } .t-sky { background: var(--tile2); } .t-green { background: var(--tile3); } .t-amber { background: var(--tile4); } .t-red { background: var(--tile5); } .t-purple { background: var(--tile6); }
.dash-grid { display: grid; grid-template-columns: 1.7fr 1fr; gap: 18px; }
.restock h3 { font-size: 18px; margin-bottom: 4px; }
.restock-list { list-style: none; padding: 0; margin: 14px 0 16px; display: flex; flex-direction: column; gap: 8px; }
.restock-list li { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; border-bottom: 1px solid rgba(255,255,255,.08); padding-bottom: 6px; }
.rs-meta { color: #94a3b8; white-space: nowrap; }

/* ───────── login */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-left { background: linear-gradient(160deg, #1e1b4b, #4338ca 70%, #6d28d9); color: #fff; padding: 56px 64px; display: flex; flex-direction: column; justify-content: center; gap: 22px; }
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; } .login-brand .brand-sub { color: #c7d2fe; }
.login-left h1 { font-size: 44px; line-height: 1.05; font-weight: 800; } .login-left p { color: #c7d2fe; font-size: 16px; max-width: 460px; }
.login-feats { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; color: #e0e7ff; }
.login-right { display: grid; place-items: center; padding: 40px 24px; }
.login-card { width: 100%; max-width: 420px; background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 32px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px; }
.login-card h2 { font-size: 24px; } .login-card label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 13px; }
.login-card input { border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; font-size: 15px; outline: 0; }
.login-card input:focus { border-color: var(--indigo); box-shadow: 0 0 0 3px #e0e7ff; }
.demo-box { border-top: 1px dashed var(--line); padding-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.demo-title { font-size: 12px; font-weight: 700; letter-spacing: .05em; margin-bottom: 4px; }
.demo-acc { text-align: left; background: #f8f9fc; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 12px; cursor: pointer; }
.demo-acc:hover { border-color: var(--indigo); background: #eef2ff; }

/* ───────── terminal */
.terminal { padding: 0; overflow: hidden; }
.term-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; gap: 12px; }
.term-title { display: flex; align-items: center; gap: 12px; } .term-title h2 { font-size: 19px; }
.term-ic { width: 40px; height: 40px; border-radius: 12px; background: var(--indigo); color: #fff; display: grid; place-items: center; font-size: 18px; }
.tabs { display: flex; background: #f1f3f9; border-radius: 10px; padding: 4px; }
.tab { border: 0; background: none; padding: 8px 14px; border-radius: 8px; font-weight: 600; color: var(--muted); cursor: pointer; display: flex; align-items: center; gap: 8px; }
.tab.active { background: #fff; color: var(--indigo); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.tab .pill { margin-left: 0; }
.term-body { display: grid; grid-template-columns: 330px 1fr; min-height: 560px; }
.term-body.saved { display: block; padding: 10px 20px 20px; }
.term-left { padding: 18px; border-right: 1px solid var(--line); background: #fbfbfd; display: flex; flex-direction: column; gap: 12px; }
.kbd-hint { font-weight: 500; letter-spacing: 0; text-transform: none; color: #9ca3af; margin-left: 6px; }
.search-box { position: relative; display: flex; align-items: center; background: #fff; border: 2px solid var(--line); border-radius: 12px; padding: 0 10px; }
.search-box:focus-within { border-color: var(--green); box-shadow: 0 0 0 3px #dcfce7; }
.search-box input { flex: 1; border: 0; outline: 0; padding: 12px 8px; font-size: 14px; background: none; }
.s-ic { opacity: .6; } .s-clear { border: 0; background: none; color: #9ca3af; cursor: pointer; }
.dropdown { position: absolute; left: -2px; top: calc(100% + 6px); width: 1000px; max-width: calc(100vw - 340px); max-height: 420px; overflow: auto; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 48px rgba(16,24,40,.18); z-index: 30; }
.dd-table { min-width: 680px; border-collapse: collapse; }
.dd-table th { position: sticky; top: 0; background: #fff; font-size: 10.5px; letter-spacing: .06em; color: var(--muted); text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.dd-table td { padding: 10px 12px; border-bottom: 1px solid #f1f3f9; white-space: nowrap; }
.dd-table td:first-child { white-space: normal; min-width: 240px; }
.dd-row { cursor: pointer; } .dd-row:hover { background: #f8f9fc; }
.dd-row.hi { background: #4c0519; color: #fff; }
.dd-row.hi .muted, .dd-row.hi .scheme, .dd-row.hi .stk-ok, .dd-row.hi .stk-mid, .dd-row.hi .stk-low, .dd-row.hi .exp-ok, .dd-row.hi .exp-soon, .dd-row.hi .exp-past { color: #fff; }
.dd-empty { padding: 18px; color: var(--muted); text-align: center; }
.qty-row { display: flex; gap: 10px; align-items: stretch; }
.stepper { flex: 1; display: flex; border: 2px solid var(--line); border-radius: 12px; background: #fff; overflow: hidden; }
.stepper:focus-within { border-color: var(--green); box-shadow: 0 0 0 3px #dcfce7; }
.stepper button { width: 42px; border: 0; background: #f8f9fc; font-size: 20px; cursor: pointer; color: #475569; }
.stepper button:hover { background: #e7f5ee; color: var(--green); }
.stepper input { flex: 1; border: 0; outline: 0; text-align: center; font-size: 20px; font-weight: 700; width: 60px; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }
.quick-qty { display: flex; gap: 6px; }
.quick-qty button { flex: 1; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 6px 0; font-size: 12px; font-weight: 600; cursor: pointer; color: #475569; }
.quick-qty button:hover { border-color: var(--green); color: var(--green); }
.focus-card { border: 1px solid var(--line); border-radius: 12px; background: #fff; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.focus-card.empty { border: 2px dashed var(--line); background: #f8f9fc; min-height: 170px; display: grid; place-items: center; }
.focus-empty { text-align: center; color: #9ca3af; display: flex; flex-direction: column; gap: 4px; } .focus-empty span { font-size: 26px; opacity: .5; }
.fc-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; } .fc-name { font-weight: 700; font-size: 14px; }
.fc-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.fc-grid div { background: #f8f9fc; border-radius: 8px; padding: 6px 8px; } .fc-grid small { display: block; font-size: 9.5px; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.fc-grid b { font-size: 13px; }
.fc-math { background: #eef2ff; border-radius: 8px; padding: 8px 10px; font-size: 13px; }
.fc-batches, .fc-hist { font-size: 11.5px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.fc-batches small, .fc-hist small { width: 100%; font-size: 9.5px; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.fc-batches span, .fc-hist span { background: #f8f9fc; border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; }
.fc-batches i { font-style: normal; }
.fc-incart { font-size: 12px; color: var(--green); font-weight: 600; }
.restock-strip { margin-top: auto; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; max-height: 150px; overflow: auto; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 5px 8px; text-align: left; cursor: pointer; max-width: 100%; }
.chip:hover { border-color: var(--indigo); background: #eef2ff; }
.chip b { display: block; font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 270px; } .chip small { color: var(--muted); font-size: 10.5px; }
.term-right { display: flex; flex-direction: column; min-width: 0; }
.cart-scroll { flex: 1; overflow: auto; max-height: 520px; }
.cart thead th { background: #2f3646; color: #fff; position: sticky; top: 0; font-size: 10.5px; padding: 12px 12px; border: 0; }
.cart td { padding: 10px 12px; }
.c-name { font-weight: 600; }
.qty-chip { display: inline-block; min-width: 40px; background: #eef2ff; color: var(--indigo-d); border: 1px solid #c7d2fe; border-radius: 6px; padding: 4px 8px; font-weight: 700; cursor: pointer; }
.qty-inline { width: 70px; text-align: center; border: 2px solid var(--indigo); border-radius: 6px; padding: 4px; font-weight: 700; }
.free-tag { font-size: 10.5px; color: var(--green); font-weight: 600; }
.ic-btn { width: 30px; height: 30px; border: 1px solid var(--line); background: #fff; border-radius: 8px; cursor: pointer; }
.ic-btn:hover { background: #eef2ff; } .ic-btn.danger:hover { background: #fee2e2; }
.cart-empty td { padding: 60px 20px !important; text-align: center; color: #9ca3af; border: 0 !important; }
.cart-foot { border-top: 1px solid var(--line); padding: 16px 20px; display: flex; align-items: center; gap: 28px; flex-wrap: wrap; background: #fff; }
.tot .tot-val { font-size: 26px; font-weight: 800; color: var(--indigo); } .tot.small .tot-val { font-size: 18px; color: var(--green); }
.foot-actions { margin-left: auto; display: flex; gap: 10px; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--dark); color: #fff; padding: 10px 18px; border-radius: 10px; z-index: 50; font-weight: 500; box-shadow: var(--shadow); }
.toast.ok { background: var(--green); } .toast.warn { background: var(--red); }
.modal { position: fixed; inset: 0; background: rgba(15,23,42,.45); display: grid; place-items: center; z-index: 40; }
.modal-box { background: #fff; border-radius: 16px; padding: 24px; width: 420px; max-width: calc(100vw - 32px); display: flex; flex-direction: column; gap: 12px; }
.modal-sum { display: flex; justify-content: space-between; font-weight: 700; font-size: 18px; background: #f8f9fc; border-radius: 10px; padding: 10px 14px; }
.modal-box textarea { border: 1px solid var(--line); border-radius: 10px; padding: 10px; resize: vertical; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.modal-close { position: absolute; top: 14px; right: 14px; width: 32px; height: 32px; border: 0; background: #f1f3f9; color: #64748b; border-radius: 50%; cursor: pointer; font-size: 13px; display: grid; place-items: center; }
.modal-close:hover { background: #e2e8f0; color: var(--dark); }

/* ─── security-settings modal (change password) ─── */
.passwd-box { padding: 28px 26px 22px; position: relative; max-width: 440px; }
.passwd-head { display: flex; align-items: center; gap: 12px; }
.passwd-ic { width: 44px; height: 44px; border-radius: 12px; background: #dcfce7; color: #16a34a; display: grid; place-items: center; font-size: 20px; }
.passwd-head h3 { font-size: 18px; }
.passwd-box .muted { margin: 6px 0 8px; line-height: 1.5; }
.passwd-box .lbl { margin-top: 12px; letter-spacing: .04em; text-transform: none; font-size: 12.5px; color: var(--text); font-weight: 600; }
.pw-field { position: relative; }
.pw-field input { width: 100%; border: 1px solid var(--line); background: #f8f9fc; border-radius: 10px; padding: 12px 42px 12px 14px; font-size: 14px; outline: 0; transition: border-color .12s, background .12s; }
.pw-field input:focus { border-color: var(--indigo); background: #fff; box-shadow: 0 0 0 3px #e0e7ff; }
.pw-eye { position: absolute; top: 50%; right: 8px; transform: translateY(-50%); border: 0; background: none; color: #94a3b8; cursor: pointer; padding: 6px 8px; font-size: 15px; border-radius: 6px; }
.pw-eye:hover { background: #f1f3f9; }
.passwd-msg { margin-top: 12px; padding: 8px 12px; border-radius: 8px; font-size: 13px; font-weight: 500; }
.passwd-msg.err { background: #fee2e2; color: #991b1b; }
.passwd-msg.ok { background: #dcfce7; color: #166534; }
.btn-passwd { margin-top: 16px; width: 100%; background: var(--dark); color: #fff; border: 0; padding: 13px; border-radius: 12px; font-weight: 700; font-size: 14px; cursor: pointer; letter-spacing: .01em; }
.btn-passwd:hover { filter: brightness(1.1); }
.btn-passwd:disabled { opacity: .6; cursor: default; }

/* ─── profile page ─── */
.profile-head { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.avatar-lg { width: 56px; height: 56px; border-radius: 14px; font-size: 22px; }
.profile-head h3 { font-size: 20px; margin-bottom: 2px; }
.tbl.plain th { text-align: left; font-weight: 500; color: var(--muted); text-transform: none; letter-spacing: 0; font-size: 12.5px; width: 42%; padding-left: 0; }
.tbl.plain td { padding-left: 0; padding-right: 0; font-size: 13px; }
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.nav-backdrop { display: none; }

/* ───────── salesman: shop cards */
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin-top: 14px; }
.shop-card { display: flex; flex-direction: column; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; box-shadow: var(--shadow); transition: transform .12s, border-color .12s; }
.shop-card:hover { transform: translateY(-2px); border-color: #c7d2fe; }
.shop-card-top { display: flex; gap: 10px; align-items: center; }
.shop-card-top b { display: block; font-size: 14px; }
.shop-card-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }

/* ───────── theme picker */
.theme-page-head h2 { font-size: 22px; margin-bottom: 6px; }
.theme-page-head p { max-width: 720px; line-height: 1.6; }
.theme-current-bar { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; margin: 14px 0 20px; flex-wrap: wrap; }
.theme-family-head { font-size: 13px; letter-spacing: .06em; color: var(--muted); text-transform: uppercase; margin: 22px 0 10px; }
.theme-family-head:first-of-type { margin-top: 6px; }
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.theme-card { text-align: left; background: var(--card); border: 2px solid var(--line); border-radius: 14px; padding: 0; cursor: pointer; overflow: hidden; display: flex; flex-direction: column; transition: border-color .12s, transform .12s; }
.theme-card:hover { transform: translateY(-2px); border-color: #c7d2fe; }
.theme-card.picked { border-color: var(--indigo); box-shadow: 0 0 0 3px var(--primary-tint); }
.theme-swatch { display: block; height: 64px; }
.theme-card-body { padding: 12px 14px 6px; display: flex; flex-direction: column; gap: 4px; }
.theme-card-body b { font-size: 14px; }
.theme-card-body small { line-height: 1.4; font-size: 11.5px; }
.theme-dots { display: flex; gap: 5px; padding: 8px 14px 14px; }
.theme-dots i { width: 12px; height: 12px; border-radius: 50%; display: block; }

/* ───────── documents (bill / order detail) */
.doc-head { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.doc-box { background: #f8f9fc; border-radius: 10px; padding: 12px 14px; font-size: 13px; }
.doc-box small { display: block; font-size: 10px; letter-spacing: .08em; color: var(--muted); font-weight: 700; margin-bottom: 4px; }
.doc-total { margin-left: auto; width: 320px; max-width: 100%; }
.doc-total div { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.doc-total div:last-child { border: 0; font-size: 18px; font-weight: 800; color: var(--indigo); }
.ack-lines label { display: flex; align-items: center; gap: 8px; }
.placed-banner { background: #dcfce7; color: #166534; border-radius: 12px; padding: 16px 20px; display: flex; align-items: center; gap: 14px; font-size: 15px; }
.placed-banner b { font-size: 18px; }
.steps { display: flex; gap: 6px; align-items: center; font-size: 12px; font-weight: 600; color: var(--muted); flex-wrap: wrap; }
.steps span { padding: 4px 10px; border-radius: 999px; background: #f1f3f9; } .steps span.on { background: var(--indigo); color: #fff; }
.bar { height: 8px; background: #f1f3f9; border-radius: 999px; overflow: hidden; } .bar i { display: block; height: 100%; background: var(--indigo); }
.staff-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; background: var(--dark); color: #fff; padding: 12px 24px; }
.staff-crumbs { font-size: 14px; }
body.staff .sidebar { background: var(--sidebar-bg, var(--dark)); }
body.staff:not([data-theme]) .sidebar,
body.staff[data-theme] .sidebar { background: var(--sidebar-bg); }
body.staff .nav a, body.staff .brand-name, body.staff .brand-sub, body.staff .cust-login, body.staff .cust-role, body.staff .cust-meta .lbl, body.staff .cust-meta .val { color: var(--sidebar-text); }
body.staff:not([data-theme]) { --sidebar-bg: #1f2937; --sidebar-text: #cbd5e1; }
body.staff:not([data-theme]) .cust-card, body.staff:not([data-theme]) .cust-meta, body.staff:not([data-theme]) .cust-code { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.12); }
body.staff:not([data-theme]) .nav a:hover { background: rgba(255,255,255,.08); }
body.staff:not([data-theme]) .nav a.active { background: rgba(255,255,255,.14); color: #fff; }
body.staff:not([data-theme]) .signout button { color: #94a3b8; }
.triage-black td:first-child { border-left: 4px solid #111; } .triage-red td:first-child { border-left: 4px solid var(--red); } .triage-blue td:first-child { border-left: 4px solid #2563eb; }
@media print { .sidebar, .topbar, .btn, .no-print { display: none !important; } .content { padding: 0; } .card { box-shadow: none; border: 0; } }

/* ───────── desktop sidebar collapse (icon rail) — independent of the
   mobile off-canvas drawer above; toggled by the same #navToggle button */
@media (min-width: 901px) {
  body.sidebar-collapsed .sidebar { width: 76px; background: var(--dark); padding-left: 0; padding-right: 0; align-items: center; }
  body.sidebar-collapsed .brand { justify-content: center; padding: 4px 0 12px; width: 100%; }
  body.sidebar-collapsed .brand-text, body.sidebar-collapsed .nav-label,
  body.sidebar-collapsed .cust-card, body.sidebar-collapsed .pill { display: none; }
  body.sidebar-collapsed .nav { width: 100%; border-bottom-color: rgba(255,255,255,.1); }
  body.sidebar-collapsed .nav a { justify-content: center; padding: 12px 0; color: #cbd5e1; }
  body.sidebar-collapsed .nav a i { width: auto; font-size: 18px; opacity: 1; }
  body.sidebar-collapsed .nav a:hover { background: rgba(255,255,255,.08); }
  body.sidebar-collapsed .nav a.active { background: rgba(255,255,255,.14); color: #fff; }
  body.sidebar-collapsed .nav a.has-badge { position: relative; }
  body.sidebar-collapsed .nav a.has-badge::after { content: ""; position: absolute; top: 8px; right: 24px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); border: 2px solid var(--dark); }
  body.sidebar-collapsed .signout { width: 100%; }
  body.sidebar-collapsed .signout button { justify-content: center; padding: 12px 0; color: #94a3b8; }
  body.sidebar-collapsed .signout button:hover { background: rgba(255,255,255,.08); color: #fff; }
}

/* ───────── responsive */
@media (max-width: 1100px) { .dash-grid { grid-template-columns: 1fr; } .term-body { grid-template-columns: 300px 1fr; } .dropdown { max-width: calc(100vw - 40px); } }

@media (max-width: 900px) {
  .sidebar { position: fixed; top: 0; bottom: 0; left: -280px; z-index: 31; transition: left .2s; box-shadow: 0 0 0 rgba(0,0,0,0); }
  body.nav-open .sidebar { left: 0; box-shadow: 8px 0 24px rgba(0,0,0,.18); }
  .nav-backdrop { display: block; position: fixed; inset: 0; background: rgba(15,23,42,.4); z-index: 30; opacity: 0; pointer-events: none; transition: opacity .2s; }
  body.nav-open .nav-backdrop { opacity: 1; pointer-events: auto; }
  body.nav-open { overflow: hidden; }
  #navToggle { display: block; }
  .term-body { grid-template-columns: 1fr; } .term-left { border-right: 0; border-bottom: 1px solid var(--line); }
  .dropdown { left: 0; right: 0; width: auto; max-width: none; }
  .login-wrap { grid-template-columns: 1fr; } .login-left { padding: 32px 24px; } .login-left h1 { font-size: 30px; }
  .doc-head { grid-template-columns: 1fr; } .content { padding: 14px; } .fc-grid { grid-template-columns: repeat(2, 1fr); }
  .cart { min-width: 640px; } #savedTable { min-width: 560px; }
  .term-body.saved { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tbl-wrap table.tbl { min-width: 620px; }
  .kpis { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
}

@media (max-width: 640px) {
  .gsearch { flex: 1 1 auto; min-width: 0; }
  .gsearch span { display: none; }
  .topbar { padding: 10px 14px; gap: 10px; }
  .cart-foot { gap: 14px; }
  .foot-actions { margin-left: 0; width: 100%; flex-wrap: wrap; }
  .foot-actions .btn { flex: 0 1 auto; }
  .foot-actions #exportBtn, .foot-actions #saveBtn { flex: 1 1 auto; }
  .foot-actions #placeBtn { flex: 1 1 100%; order: 5; }
  .quick-qty { flex-wrap: wrap; }
  .quick-qty button { flex: 1 1 30%; }
  .term-left, .term-head { padding: 14px; }
  .fc-grid { grid-template-columns: repeat(2, 1fr); }
  .tab { padding: 8px 9px; font-size: 12.5px; gap: 5px; white-space: nowrap; }
}

@media (max-width: 480px) {
  .user-chip-text { display: none; }
  .top-right { gap: 8px; }
  .hello { flex-direction: column; align-items: flex-start; gap: 8px; }
  .tiles { grid-template-columns: 1fr; }
  .term-head { flex-direction: column; align-items: stretch; }
  .tabs { justify-content: center; }
  .modal-box { padding: 18px; }
  .doc-head { gap: 10px; }
  .kpi { padding: 12px; } .kpi b { font-size: 18px; }
  .tot-val { font-size: 22px !important; }
}

/* iOS Safari zooms the page on focusing any input under 16px — keep the
   fields people actually type into at 16px on phones. */
@media (max-width: 600px) {
  .search-box input, .login-card input, .qty-inline, .stepper input,
  input[type="text"], input[type="password"], input[type="number"], input[type="search"],
  textarea, select { font-size: 16px; }
}
