/* Touch Electronics design system — tokens, primitives, components. No build step.
   Direction: quiet surfaces, hairline separators, one accent, typography carries hierarchy. */

:root {
  --font-sans: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Noto Sans Bengali", sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Cascadia Mono", monospace;

  /* Type scale (15px base) */
  --text-xs: .75rem;     /* 11.25 */
  --text-sm: .8125rem;   /* 12.2 */
  --text-base: .9375rem; /* 14 */
  --text-md: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.375rem;
  --text-2xl: 1.75rem;
  --text-3xl: 2.25rem;
  --tracking-tight: -0.022em;
  --tracking-snug: -0.012em;

  /* Spacing scale */
  --s-1: .25rem; --s-2: .5rem; --s-3: .75rem; --s-4: 1rem; --s-5: 1.25rem; --s-6: 1.5rem; --s-8: 2rem; --s-10: 2.5rem; --s-12: 3rem;

  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  /* Elevation: surfaces separate by hairlines; shadows only for floating layers */
  --shadow-xs: none;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .04);
  --shadow-md: 0 8px 24px -8px rgba(0, 0, 0, .14), 0 2px 6px -2px rgba(0, 0, 0, .06);
  --shadow-lg: 0 24px 56px -16px rgba(0, 0, 0, .22), 0 4px 12px -4px rgba(0, 0, 0, .08);

  --bg: #f5f5f7;
  --bg-elevated: #ffffff;
  --bg-subtle: #f2f2f4;
  --bg-hover: #ededf0;
  --border: rgba(0, 0, 0, .08);
  --border-strong: rgba(0, 0, 0, .16);
  --text: #1d1d1f;
  --text-muted: #6e6e73;
  --text-faint: #98989d;
  --text-inverse: #ffffff;

  --primary: #1d4ed8;
  --primary-hover: #1a44bf;
  --primary-active: #163aa4;
  --primary-soft: #e9efff;
  --primary-text: #1b3fa6;

  --success: #1f7a3d;
  --success-soft: #e6f4ea;
  --warning: #9a5b00;
  --warning-soft: #fcf1df;
  --danger: #c0262d;
  --danger-soft: #fdeaea;
  --info: #0c6b8a;
  --info-soft: #e3f3f8;

  --focus-ring: 0 0 0 3px rgba(29, 78, 216, .25);
  --sidebar-w: 256px;
  --topbar-h: 56px;

  --ease: cubic-bezier(.2, .7, .2, 1);
  --dur-fast: 120ms;
  --dur: 180ms;
  --dur-slow: 260ms;
}

:root[data-theme="dark"] {
  --bg: #0b0b0d;
  --bg-elevated: #161618;
  --bg-subtle: #1e1e21;
  --bg-hover: #26262a;
  --border: rgba(255, 255, 255, .09);
  --border-strong: rgba(255, 255, 255, .18);
  --text: #f5f5f7;
  --text-muted: #a1a1a6;
  --text-faint: #6e6e73;
  --text-inverse: #0b0b0d;

  --primary: #4d8cf8;
  --primary-hover: #6a9df9;
  --primary-active: #3b7bea;
  --primary-soft: rgba(77, 140, 248, .16);
  --primary-text: #9dbffb;

  --success: #3ccb6a;
  --success-soft: rgba(60, 203, 106, .14);
  --warning: #f2a93b;
  --warning-soft: rgba(242, 169, 59, .14);
  --danger: #f26d6d;
  --danger-soft: rgba(242, 109, 109, .14);
  --info: #46c3df;
  --info-soft: rgba(70, 195, 223, .14);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .5);
  --shadow-md: 0 10px 28px -8px rgba(0, 0, 0, .7), 0 2px 6px -2px rgba(0, 0, 0, .5);
  --shadow-lg: 0 28px 64px -16px rgba(0, 0, 0, .8), 0 4px 12px -4px rgba(0, 0, 0, .6);
  --focus-ring: 0 0 0 3px rgba(77, 140, 248, .38);
}

/* ---- Base --------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 15px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--font-sans); color: var(--text); background: var(--bg);
  line-height: 1.5; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; min-height: 100vh;
  font-size: var(--text-base); text-rendering: optimizeLegibility;
}
a { color: var(--primary); text-decoration: none; transition: color var(--dur-fast) var(--ease); }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3, h4 { margin: 0 0 .4rem; line-height: 1.2; font-weight: 600; letter-spacing: var(--tracking-snug); text-wrap: balance; }
h1 { font-size: var(--text-2xl); letter-spacing: var(--tracking-tight); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-md); }
h4 { font-size: var(--text-base); }
p { margin: 0 0 .75rem; }
small, .small { font-size: var(--text-sm); }
code, .mono { font-family: var(--font-mono); font-size: .92em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.25rem 0; }
img { max-width: 100%; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--radius-xs); }
::selection { background: var(--primary-soft); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ---- App shell ---------------------------------------------------------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar {
  background: var(--bg); border-right: 1px solid var(--border); position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; overflow-y: auto; scrollbar-width: thin;
}
.sidebar-brand { display: flex; align-items: center; gap: .7rem; padding: 0 1.1rem; min-height: var(--topbar-h); }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .8rem; letter-spacing: .02em; flex: none; }
.brand-name { font-weight: 600; font-size: var(--text-base); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: var(--tracking-snug); }
.brand-sub { display: block; font-size: var(--text-xs); color: var(--text-faint); font-weight: 500; margin-top: 1px; }
.nav { padding: .4rem .75rem; display: flex; flex-direction: column; gap: 2px; }
.nav-section { font-size: var(--text-xs); color: var(--text-faint); padding: 1rem .6rem .35rem; font-weight: 500; letter-spacing: .01em; }
.nav a {
  display: flex; align-items: center; gap: .7rem; padding: .48rem .65rem; border-radius: var(--radius-sm); color: var(--text-muted);
  font-size: var(--text-base); font-weight: 500; transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.nav a:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.nav a.is-active { background: var(--bg-elevated); color: var(--text); box-shadow: inset 0 0 0 1px var(--border); }
.nav a.is-active svg { color: var(--primary); opacity: 1; }
.nav a svg { width: 18px; height: 18px; flex: none; opacity: .7; }
.nav-footer { margin-top: auto; padding: .75rem; border-top: 1px solid var(--border); }
.user-chip { display: flex; align-items: center; gap: .65rem; padding: .45rem .5rem; border-radius: var(--radius-sm); transition: background var(--dur-fast) var(--ease); }
a.user-chip:hover { background: var(--bg-hover); text-decoration: none; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-text); display: grid; place-items: center; font-weight: 600; font-size: .76rem; flex: none; }
.user-chip .name { font-size: var(--text-sm); font-weight: 600; line-height: 1.2; }
.user-chip .role { font-size: var(--text-xs); color: var(--text-faint); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h); display: flex; align-items: center; gap: .75rem; padding: 0 1.5rem;
  background: color-mix(in srgb, var(--bg) 82%, transparent); -webkit-backdrop-filter: saturate(180%) blur(16px); backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20;
}
.topbar > strong { font-weight: 600; font-size: var(--text-base); letter-spacing: var(--tracking-snug); }
.topbar .spacer { flex: 1; }
.page { padding: 1.75rem 2rem 4rem; width: 100%; }
@media (min-width: 1600px) { .page { padding: 2rem 2.5rem 4rem; } html { font-size: 16px; } }
@keyframes page-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem 1.5rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.page-header h1 { margin-bottom: .15rem; }
.page-header .subtitle { color: var(--text-muted); margin: .25rem 0 0; font-size: var(--text-base); max-width: 68ch; }
.page-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.breadcrumb { font-size: var(--text-sm); color: var(--text-faint); margin-bottom: .5rem; }
.breadcrumb a { color: var(--text-muted); }

.menu-toggle { display: none; }
@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; width: var(--sidebar-w); background: var(--bg-elevated); transform: translateX(-100%); transition: transform var(--dur-slow) var(--ease); z-index: 40; box-shadow: var(--shadow-lg); }
  .sidebar.is-open { transform: none; }
  .menu-toggle { display: inline-flex; }
  .topbar { padding: 0 1rem; }
  .page { padding: 1.25rem 1rem 3rem; }
  .page-header { margin-bottom: 1.1rem; }
  .backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 30; animation: fade-in var(--dur) var(--ease); }
  h1 { font-size: var(--text-xl); }
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ---- Auth --------------------------------------------------------------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; background: var(--bg); }
.auth-card { width: 100%; max-width: 420px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 2.25rem 2rem; }
.auth-card.wide { max-width: 640px; }
.auth-card h1 { font-size: var(--text-xl); margin-top: .25rem; }
.auth-brand { display: flex; align-items: center; gap: .6rem; margin-bottom: 1.75rem; }
.auth-brand .brand-mark { width: 36px; height: 36px; font-size: .9rem; border-radius: 10px; }
.auth-foot { text-align: center; margin-top: 1.25rem; font-size: var(--text-sm); color: var(--text-muted); }
.auth-card .required::after { display: none; }
.auth-card .stack-sm { gap: 1rem; }
@media (max-width: 480px) { .auth { padding: 1rem; align-items: start; padding-top: 2rem; } .auth-card { padding: 1.5rem 1.25rem; } }

/* ---- Surfaces & layout -------------------------------------------------- */
.card { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius); }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .9rem 1.1rem; border-bottom: 1px solid var(--border); }
.card-header h2, .card-header h3 { margin: 0; }
.card-header .small { color: var(--text-muted); }
.card-body { padding: 1.1rem; }
.card-footer { padding: .8rem 1.1rem; border-top: 1px solid var(--border); border-radius: 0 0 var(--radius) var(--radius); }
.card + .card { margin-top: 1rem; }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); align-items: start; }
.grid-side { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 900px) { .grid-main, .grid-side { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; } }
.stack { display: flex; flex-direction: column; gap: 1rem; }
.stack-sm { display: flex; flex-direction: column; gap: .8rem; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; } .mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; }
.text-muted { color: var(--text-muted); } .text-faint { color: var(--text-faint); } .text-danger { color: var(--danger); } .text-success { color: var(--success); } .text-warning { color: var(--warning); }
.text-right { text-align: right; } .text-center { text-align: center; } .nowrap { white-space: nowrap; } .fw-600 { font-weight: 600; } .num { font-variant-numeric: tabular-nums; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flex-1 { flex: 1; min-width: 0; }

/* ---- Dashboard chart ---------------------------------------------------- */
.chart-wrap { padding: .5rem 1.1rem .75rem; }
.chart-wrap svg { width: 100%; height: auto; display: block; font-family: inherit; }
.chart-wrap .bar { transition: opacity var(--dur-fast) var(--ease); }
.chart-wrap .bar:hover { opacity: .8; }
.chart-wrap .bar.sales { fill: var(--primary); }
.chart-wrap .bar.profit { fill: var(--success); }
.chart-wrap .bar.neg { fill: var(--danger); }
.chart-wrap .grid { stroke: var(--border); stroke-width: 1; }
.chart-wrap .axis { fill: var(--text-muted); font-size: 12px; }
.chart-wrap .zero { stroke: var(--border-strong); stroke-width: 1; }
.chart-legend { display: flex; gap: 1.5rem; font-size: var(--text-sm); color: var(--text-muted); padding: .9rem 1.1rem 0; }
.chart-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 2px; margin-right: .45rem; vertical-align: -1px; }
.chart-legend .sw-sales { background: var(--primary); }
.chart-legend .sw-profit { background: var(--success); }

/* ---- Stat tiles --------------------------------------------------------- */
.stat { padding: 1.1rem 1.25rem 1.15rem; position: relative; display: flex; flex-direction: column; justify-content: flex-start; min-height: 128px; height: 100%; }
.stat .stat-icon { position: absolute; top: 1rem; right: 1rem; width: 38px; height: 38px; border-radius: 10px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; }
.stat .stat-icon svg { width: 20px; height: 20px; }
.stat:nth-child(2) .stat-icon { background: var(--success-soft); color: var(--success); }
.stat:nth-child(3) .stat-icon { background: var(--warning-soft); color: var(--warning); }
.stat:nth-child(4) .stat-icon { background: var(--info-soft); color: var(--info); }
.stat .label { padding-right: 3rem; }
.stat .delta { margin-top: auto; padding-top: .4rem; }
.grid-4 { align-items: stretch; }
.stat .label { font-size: var(--text-sm); color: var(--text-muted); font-weight: 500; }
.stat .value { font-size: var(--text-2xl); font-weight: 600; letter-spacing: var(--tracking-tight); margin-top: .35rem; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat .delta { font-size: var(--text-sm); color: var(--text-faint); margin-top: .4rem; }
@media (max-width: 640px) { .stat { padding: .9rem 1rem; } .stat .value { font-size: var(--text-xl); } .stat .delta { font-size: var(--text-xs); } }

/* ---- Buttons ------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem; padding: .5rem .95rem; font-size: var(--text-base); font-weight: 500;
  border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--bg-elevated); color: var(--text); cursor: pointer; min-height: 38px;
  line-height: 1.25; font-family: inherit; white-space: nowrap; text-decoration: none; letter-spacing: var(--tracking-snug);
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.btn:hover { background: var(--bg-hover); text-decoration: none; }
.btn:active { transform: translateY(.5px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-primary:active { background: var(--primary-active); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.94); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }
.btn-soft { background: var(--primary-soft); border-color: transparent; color: var(--primary-text); }
.btn-soft:hover { background: color-mix(in srgb, var(--primary-soft) 80%, var(--primary) 20%); }
.btn-sm { padding: .3rem .7rem; font-size: var(--text-sm); min-height: 32px; }
.btn-lg { padding: .7rem 1.25rem; font-size: var(--text-md); min-height: 46px; }
.btn-block { width: 100%; }
.btn-icon { padding: .45rem; min-height: 0; width: 36px; height: 36px; }
.btn .kbd { margin-left: .2rem; }
.btn-primary .kbd { background: rgba(255,255,255,.18); border-color: rgba(255,255,255,.25); color: #fff; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

/* ---- Forms -------------------------------------------------------------- */
.form-grid { display: grid; gap: 1rem 1.1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .span-2 { grid-column: span 2; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } .form-grid .span-2 { grid-column: span 1; } }
.field { display: flex; flex-direction: column; gap: .35rem; }
.field label, .label { font-size: var(--text-sm); font-weight: 500; color: var(--text-muted); }
.field .hint { font-size: var(--text-xs); color: var(--text-faint); line-height: 1.4; }
.field .error { font-size: var(--text-xs); color: var(--danger); }
.required::after { content: " *"; color: var(--danger); }
.input, .select, .textarea, input:not([type]), input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="search"], input[type="date"], input[type="time"], input[type="datetime-local"], input[type="month"], input[type="tel"], input[type="url"], input[type="file"], select, textarea {
  width: 100%; font: inherit; font-size: var(--text-base); color: var(--text); background: var(--bg-elevated); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: .5rem .75rem; line-height: 1.3; min-height: 38px; transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
select { appearance: none; -webkit-appearance: none; padding-right: 2rem; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236e6e73' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .7rem center; }
textarea { min-height: 84px; resize: vertical; }
input[type="file"] { padding: .35rem .5rem; cursor: pointer; }
input[type="file"]::file-selector-button { font: inherit; font-size: var(--text-sm); margin-right: .6rem; padding: .25rem .65rem; border: 1px solid var(--border-strong); border-radius: var(--radius-xs); background: var(--bg-subtle); color: var(--text); cursor: pointer; }
input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }
input[type="date"], input[type="time"], input[type="datetime-local"], input[type="month"] { color-scheme: light; }
:root[data-theme="dark"] input[type="date"], :root[data-theme="dark"] input[type="time"], :root[data-theme="dark"] input[type="datetime-local"], :root[data-theme="dark"] input[type="month"] { color-scheme: dark; }
input[readonly]:not([type="checkbox"]):not([type="radio"]) { background: var(--bg-subtle); color: var(--text-muted); }
input::placeholder, textarea::placeholder { color: var(--text-faint); }
input:hover:not(:focus):not(:disabled):not([readonly]), select:hover:not(:focus):not(:disabled), textarea:hover:not(:focus):not(:disabled) { border-color: color-mix(in srgb, var(--border-strong) 60%, var(--text-faint)); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus-ring); }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--danger); }
input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 25%, transparent); }
input:disabled, select:disabled, textarea:disabled { background: var(--bg-subtle); color: var(--text-faint); cursor: not-allowed; }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; accent-color: var(--primary); margin: 0; vertical-align: middle; flex: none; }
.check { display: inline-flex; align-items: center; gap: .55rem; font-size: var(--text-base); cursor: pointer; color: var(--text); }
.input-group { display: flex; }
.input-group > * { border-radius: 0; }
.input-group > :first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group > :last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.input-group .addon { display: inline-flex; align-items: center; padding: 0 .7rem; background: var(--bg-subtle); border: 1px solid var(--border-strong); border-left: 0; color: var(--text-muted); font-size: var(--text-sm); }
.form-actions { display: flex; gap: .6rem; justify-content: flex-end; align-items: center; margin-top: 1.25rem; }
.form-actions.start { justify-content: flex-start; }
.input-sm { min-height: 32px; padding: .3rem .6rem; font-size: var(--text-sm); }
select.input-sm { padding-right: 1.8rem; background-position: right .5rem center; }
.filters { display: flex; gap: .6rem .75rem; flex-wrap: wrap; align-items: end; margin-bottom: 1rem; }
.filters .field { min-width: 160px; }
.filters .field.grow { flex: 1; min-width: 220px; }
.filters-bar { margin: 0; border-bottom: 1px solid var(--border); padding: .9rem 1.1rem; }

/* Serial entry (document line editor) */
.serial-entry { display: flex; flex-direction: column; gap: .35rem; min-width: 220px; }
.serial-entry .chips { display: flex; flex-wrap: wrap; gap: .3rem; }
.serial-entry .chips:empty { display: none; }
.chip { display: inline-flex; align-items: center; gap: .25rem; padding: .1rem .3rem .1rem .55rem; font-size: var(--text-xs); border: 1px solid var(--border); border-radius: var(--radius-pill); background: var(--bg-subtle); color: var(--text); }
.chip button { border: 0; background: transparent; color: var(--text-muted); cursor: pointer; font-size: .95rem; line-height: 1; padding: 0 .15rem; border-radius: 50%; }
.chip button:hover { color: var(--danger); }

/* ---- Tables ------------------------------------------------------------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap > .table:not(.table-compact) { min-width: 640px; }
.table { width: 100%; border-collapse: collapse; font-size: var(--text-base); }
.table th, .table td { padding: .7rem 1.1rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { font-size: var(--text-sm); color: var(--text-muted); font-weight: 500; white-space: nowrap; }
.table tbody tr { transition: background var(--dur-fast) var(--ease); }
.table tbody tr:hover { background: var(--bg-subtle); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { text-align: right; white-space: nowrap; }
.table-compact th, .table-compact td { padding: .5rem .8rem; }
.table a.row-link { color: var(--text); font-weight: 500; }
.table a.row-link:hover { color: var(--primary); text-decoration: none; }
.cell-sub { display: block; font-size: var(--text-xs); color: var(--text-faint); margin-top: .1rem; }
.table .mono { white-space: nowrap; }
.table tfoot td { font-weight: 600; border-top: 1px solid var(--border-strong); }
.card > .table-wrap:first-child .table th { padding-top: .8rem; }

/* ---- Badges ------------------------------------------------------------- */
.badge { display: inline-flex; align-items: center; gap: .35rem; padding: .1rem .55rem; border-radius: var(--radius-pill); font-size: var(--text-xs); font-weight: 500; line-height: 1.6; background: var(--bg-subtle); color: var(--text-muted); white-space: nowrap; vertical-align: middle; }
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-primary { background: var(--primary-soft); color: var(--primary-text); }
h1 .badge { font-size: var(--text-sm); margin-left: .35rem; position: relative; top: -2px; }

/* ---- Alerts, banners, toasts -------------------------------------------- */
.alert { display: flex; gap: .7rem; align-items: flex-start; padding: .75rem 1rem; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--bg-elevated); font-size: var(--text-base); margin-bottom: 1.1rem; animation: page-in var(--dur) var(--ease); }
.alert strong { font-weight: 600; }
.alert ul { margin: .3rem 0 0 1rem; padding: 0; }
.alert-success { background: var(--success-soft); border-color: transparent; color: var(--success); }
.alert-error, .alert-danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.alert-warning { background: var(--warning-soft); border-color: transparent; color: var(--warning); }
.alert-info { background: var(--info-soft); border-color: transparent; color: var(--info); }
.alert .close { margin-left: auto; background: none; border: 0; color: inherit; cursor: pointer; font-size: 1.1rem; line-height: 1; padding: 0 .2rem; opacity: .7; }
.alert .close:hover { opacity: 1; }
.banner { padding: .55rem 1.5rem; font-size: var(--text-sm); display: flex; gap: .75rem; align-items: center; justify-content: center; flex-wrap: wrap; border-bottom: 1px solid var(--border); }
.banner-warning { background: var(--warning-soft); color: var(--warning); }
.banner-danger { background: var(--danger-soft); color: var(--danger); }
.banner-info { background: var(--info-soft); color: var(--info); }
.banner form { display: inline; }
.toasts { position: fixed; right: 1rem; bottom: 1rem; display: flex; flex-direction: column; gap: .5rem; z-index: 100; max-width: 380px; }
.toast { background: var(--text); color: var(--bg-elevated); padding: .7rem 1rem; border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); font-size: var(--text-base); animation: toast-in var(--dur) var(--ease); }
:root[data-theme="dark"] .toast { background: #2a2a2e; color: var(--text); border: 1px solid var(--border-strong); }
.toast-error { background: var(--danger) !important; color: #fff !important; }
.toast-success { background: var(--success) !important; color: #fff !important; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---- Empty state -------------------------------------------------------- */
.empty { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.empty .icon { width: 44px; height: 44px; margin: 0 auto .9rem; border-radius: 12px; background: var(--bg-subtle); display: grid; place-items: center; color: var(--text-faint); }
.empty h3 { color: var(--text); margin-bottom: .25rem; }
.empty p { margin-bottom: 1.1rem; font-size: var(--text-base); max-width: 44ch; margin-left: auto; margin-right: auto; }

/* ---- Pagination --------------------------------------------------------- */
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .75rem 1.1rem; border-top: 1px solid var(--border); font-size: var(--text-sm); color: var(--text-muted); flex-wrap: wrap; }
.pagination .pages { display: flex; gap: .2rem; }
.pagination a, .pagination span.cur { min-width: 30px; height: 30px; display: inline-grid; place-items: center; padding: 0 .5rem; border-radius: var(--radius-xs); color: var(--text); font-size: var(--text-sm); }
.pagination span.cur { background: var(--text); color: var(--bg-elevated); font-weight: 600; }
.pagination a:hover { background: var(--bg-hover); text-decoration: none; }

/* ---- Dropdown ----------------------------------------------------------- */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 190px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-md); padding: .35rem; z-index: 30; display: none; animation: pop-in var(--dur-fast) var(--ease); }
.dropdown.is-open .dropdown-menu { display: block; }
.dropdown-menu a, .dropdown-menu button { display: flex; width: 100%; text-align: left; padding: .5rem .65rem; border-radius: var(--radius-xs); color: var(--text); font-size: var(--text-base); background: none; border: 0; cursor: pointer; font-family: inherit; }
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--bg-hover); text-decoration: none; }
.dropdown-menu .danger { color: var(--danger); }
.dropdown-menu hr { margin: .3rem 0; }
.dropdown-menu.inline { position: static; display: none; margin-top: .4rem; max-height: 260px; overflow: auto; box-shadow: none; }
@keyframes pop-in { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }

/* ---- Modal -------------------------------------------------------------- */
dialog.modal { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 0; background: var(--bg-elevated); color: var(--text); box-shadow: var(--shadow-lg); width: min(520px, calc(100vw - 2rem)); }
dialog.modal[open] { animation: modal-in var(--dur) var(--ease); }
dialog.modal::backdrop { background: rgba(0, 0, 0, .4); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
dialog.modal.modal-lg { width: min(820px, calc(100vw - 2rem)); }
.modal-header { padding: 1.1rem 1.4rem .5rem; display: flex; justify-content: space-between; align-items: center; }
.modal-header h2, .modal-header h3 { margin: 0; font-size: var(--text-lg); }
.modal-body { padding: .5rem 1.4rem 1rem; }
.modal-footer { padding: .75rem 1.4rem 1.2rem; display: flex; justify-content: flex-end; gap: .5rem; }
@keyframes modal-in { from { opacity: 0; transform: translateY(6px) scale(.985); } to { opacity: 1; transform: none; } }

/* ---- Tabs --------------------------------------------------------------- */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1.25rem; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a, .tabs button { padding: .6rem .8rem; font-size: var(--text-base); color: var(--text-muted); border-bottom: 2px solid transparent; margin-bottom: -1px; background: none; border-top: 0; border-left: 0; border-right: 0; cursor: pointer; font-family: inherit; white-space: nowrap; transition: color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease); }
.tabs a.is-active, .tabs button.is-active { color: var(--text); border-bottom-color: var(--text); font-weight: 600; }
.tabs a:hover { text-decoration: none; color: var(--text); }

/* ---- Lists & summaries -------------------------------------------------- */
.dl { display: grid; grid-template-columns: max-content 1fr; gap: .5rem 1.5rem; font-size: var(--text-base); }
.dl dt { color: var(--text-muted); } .dl dd { margin: 0; }
.kv { display: flex; justify-content: space-between; gap: 1rem; padding: .4rem 0; font-size: var(--text-base); border-bottom: 1px solid var(--border); }
.kv:last-child { border-bottom: 0; }
.kv .k { color: var(--text-muted); } .kv .v { font-weight: 500; font-variant-numeric: tabular-nums; }
.kv.total { font-size: var(--text-md); font-weight: 600; border-top: 1px solid var(--border-strong); padding-top: .65rem; margin-top: .2rem; }

/* ---- Misc --------------------------------------------------------------- */
.kbd { font-family: var(--font-mono); font-size: .68rem; padding: .05rem .35rem; border: 1px solid var(--border-strong); border-radius: 5px; background: var(--bg-subtle); color: var(--text-muted); line-height: 1.5; }
.copy-box { display: flex; gap: .5rem; align-items: center; background: var(--bg-subtle); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .55rem .75rem; font-family: var(--font-mono); font-size: var(--text-sm); word-break: break-all; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: .5rem 0 .5rem 1.2rem; border-left: 1px solid var(--border-strong); position: relative; font-size: var(--text-sm); }
.timeline li::before { content: ""; position: absolute; left: -4.5px; top: 1rem; width: 8px; height: 8px; border-radius: 50%; background: var(--bg-elevated); border: 1.5px solid var(--text-faint); }
.timeline .when { color: var(--text-faint); font-size: var(--text-xs); }
.progress { height: 6px; background: var(--bg-subtle); border-radius: var(--radius-pill); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--primary); border-radius: var(--radius-pill); transition: width var(--dur-slow) var(--ease); }
.steps { display: flex; gap: .75rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.steps .step { display: flex; align-items: center; gap: .5rem; font-size: var(--text-sm); color: var(--text-faint); }
.steps .step .n { width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--border-strong); display: grid; place-items: center; font-size: var(--text-xs); font-weight: 600; }
.steps .step.is-active { color: var(--text); } .steps .step.is-active .n { background: var(--text); border-color: var(--text); color: var(--bg-elevated); }
.steps .step.is-done .n { background: var(--success-soft); color: var(--success); border-color: transparent; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .75rem; }
.perm-group { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .9rem; }
.perm-group h4 { margin-bottom: .5rem; }
.perm-group .check { display: flex; padding: .2rem 0; font-size: var(--text-sm); }
.pre-box { text-align: left; font-size: var(--text-xs); overflow: auto; max-height: 50vh; background: var(--bg-subtle); padding: 1rem; border-radius: var(--radius-sm); }

@media print {
  .sidebar, .topbar, .page-actions, .no-print, .toasts, .banner { display: none !important; }
  .shell { display: block; } .page { padding: 0; max-width: none; }
  body { background: #fff; color: #000; }
  .card { border: 0; }
}

/* ---- POS screen --------------------------------------------------------- */
.pos-body { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
.pos-top { height: 50px; display: flex; align-items: center; gap: .6rem; padding: 0 .9rem; background: var(--bg); border-bottom: 1px solid var(--border); flex: none; }
.pos-top .spacer { flex: 1; }
.pos-top form { display: inline; }
.pos-top .brand-mark { width: 26px; height: 26px; font-size: .68rem; border-radius: 7px; }
.pos-shortcuts { display: none; gap: .6rem; }
.pos-shortcuts .kbd { margin-right: .15rem; }
@media (min-width: 1100px) { .pos-shortcuts { display: inline-flex; } }
.pos { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 440px; min-height: 0; }
.pos-left { display: flex; flex-direction: column; min-width: 0; padding: .9rem; gap: .7rem; overflow: hidden; }
.pos-search { display: flex; gap: .5rem; }
.pos-search input { font-size: var(--text-md); min-height: 48px; padding-left: 1rem; border-radius: var(--radius); }
.pos-search select { width: auto; }
.pos-results { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-md); max-height: 50vh; overflow: auto; animation: pop-in var(--dur-fast) var(--ease); }
.pos-result { display: flex; justify-content: space-between; gap: 1rem; width: 100%; text-align: left; padding: .65rem .9rem; border: 0; border-bottom: 1px solid var(--border); background: none; color: var(--text); cursor: pointer; font: inherit; }
.pos-result:last-child { border-bottom: 0; }
.pos-result:hover, .pos-result.is-active { background: var(--bg-subtle); }
.pos-result .name { font-weight: 500; }
.pos-result .meta { font-size: var(--text-xs); color: var(--text-muted); }
.pos-result .right { text-align: right; white-space: nowrap; }
.pos-result .price { font-weight: 600; font-variant-numeric: tabular-nums; }
.pos-tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); }
.pos-tabs button { padding: .5rem .8rem; background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; color: var(--text-muted); font: inherit; font-size: var(--text-sm); font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: .4rem; }
.pos-tabs button.is-active { color: var(--text); border-bottom-color: var(--text); font-weight: 600; }
.pos-tab { overflow: auto; min-height: 0; flex: 1; }
.pos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(156px, 1fr)); gap: .6rem; padding-top: .4rem; }
.pos-tile { text-align: left; padding: .75rem .85rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-elevated); color: var(--text); cursor: pointer; font: inherit; min-height: 76px; display: flex; flex-direction: column; justify-content: space-between; transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease); }
.pos-tile:hover { border-color: var(--border-strong); background: var(--bg-subtle); }
.pos-tile:active { transform: scale(.99); }
.pos-tile .name { font-weight: 500; font-size: var(--text-base); line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pos-tile .meta { font-size: var(--text-xs); color: var(--text-muted); margin-top: .35rem; font-variant-numeric: tabular-nums; }
.pos-held-item { display: flex; justify-content: space-between; align-items: center; padding: .65rem .85rem; }
.pos-held-item .meta { font-size: var(--text-xs); color: var(--text-muted); }
.pos-right { display: flex; flex-direction: column; background: var(--bg-elevated); border-left: 1px solid var(--border); min-height: 0; }
.pos-customer { padding: .75rem .85rem; border-bottom: 1px solid var(--border); }
.pos-customer .btn { justify-content: space-between; font-weight: 500; }
.pos-customer .btn.has-customer { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-text); }
.pos-cart { flex: 1; overflow: auto; min-height: 0; }
.pos-cart-empty { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text-faint); font-size: var(--text-base); padding: 2rem; text-align: center; }
.pos-cart .table td { padding: .55rem .7rem; }
.pos-cart .name { font-weight: 500; font-size: var(--text-base); }
.pos-cart .meta { font-size: var(--text-xs); color: var(--text-muted); }
.pos-cart tr.flash { background: var(--primary-soft); transition: background .4s; }
.pos-cart tr.needs-serials td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.pos-cart input.num { width: 86px; text-align: right; }
.qty-ctl { display: inline-flex; align-items: center; border: 1px solid var(--border-strong); border-radius: var(--radius-xs); overflow: hidden; }
.qty-ctl button { width: 28px; height: 30px; border: 0; background: var(--bg-subtle); cursor: pointer; font-size: 1rem; color: var(--text); }
.qty-ctl button:hover { background: var(--bg-hover); }
.qty-ctl input { border: 0; width: 46px !important; min-height: 30px; text-align: center !important; padding: 0; border-radius: 0; }
.qty-ctl input:focus { box-shadow: none; }
.pos-summary { padding: .7rem 1rem; border-top: 1px solid var(--border); }
.pos-summary .kv { padding: .28rem 0; border-bottom: 0; }
.pos-summary .kv.total { border-top: 1px solid var(--border); padding-top: .6rem; margin-top: .3rem; }
.pos-summary .kv.total .v { font-size: var(--text-2xl); letter-spacing: var(--tracking-tight); }
.pos-actions { display: grid; grid-template-columns: 1fr 1fr 2fr; gap: .5rem; padding: .75rem .85rem 1rem; border-top: 1px solid var(--border); }
.pos-actions .btn { min-height: 46px; }
.pos-serial { padding: .4rem .55rem; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.pay-line { display: grid; grid-template-columns: 110px 1fr 120px 1fr 32px; gap: .35rem; align-items: center; }
.pay-line [data-emi] { grid-column: 1 / -1; order: 9; }
/* Single-column POS: search row, full-width bill, summary bar */
.pos-single { display: flex; flex-direction: column; grid-template-columns: none; }
.pos-single .pos-left { flex: 1; padding: 1rem 1.25rem .5rem; gap: .75rem; }
.pos-single .pos-search { flex-wrap: wrap; }
.pos-single .pos-search input[type="search"] { flex: 1 1 320px; }
.pos-single .pos-search .btn { min-height: 48px; }
.pos-single .pos-customer-btn { gap: .6rem; max-width: 320px; font-weight: 500; }
.pos-single .pos-customer-btn.has-customer { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-text); }
.pos-single .pos-customer-btn #customer-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pos-single .pos-cart { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius); }
.pos-single .pos-cart .table th { padding-top: .8rem; }
.pos-single .pos-cart .table td { padding: .7rem 1.1rem; }
.pos-single .pos-cart .name { font-size: var(--text-md); }
.pos-single .pos-cart-empty { min-height: 240px; }
.pos-bottom { flex: none; display: flex; align-items: center; justify-content: flex-end; gap: 2rem; padding: .8rem 1.25rem 1rem; background: var(--bg-elevated); border-top: 1px solid var(--border); }
.pos-bottom .pos-summary { display: flex; align-items: center; gap: 1.5rem; padding: 0; border: 0; margin-right: auto; flex-wrap: wrap; }
.pos-bottom .pos-summary .kv { display: flex; flex-direction: column; gap: .1rem; padding: 0; border: 0; }
.pos-bottom .pos-summary .kv .k { font-size: var(--text-xs); color: var(--text-faint); display: flex; align-items: center; gap: .4rem; }
.pos-bottom .pos-summary .kv .v { font-size: var(--text-lg); }
.pos-bottom .pos-summary .kv.total { border: 0; margin: 0; padding-left: 1.5rem; border-left: 1px solid var(--border); }
.pos-bottom .pos-summary .kv.total .v { font-size: var(--text-2xl); }
.pos-bottom .pos-summary #invoice-discount { width: 90px; }
.pos-bottom .pos-actions { display: flex; gap: .5rem; padding: 0; border: 0; }
.pos-bottom .pos-actions .btn-lg { min-width: 180px; }
.pos-edit-banner { margin: 0; justify-content: space-between; align-items: center; }
.price-disc { display: inline-flex; gap: .35rem; align-items: center; justify-content: flex-end; }
.price-disc input { width: 96px; }
.price-disc input[data-f="discount_amount"] { width: 76px; }
.price-disc .lbl { font-size: var(--text-xs); color: var(--text-faint); }
.cost-peek { position: relative; display: inline-block; }
.cost-peek .btn-info { width: 22px; height: 22px; min-height: 0; padding: 0; border-radius: 50%; font-size: .72rem; font-weight: 600; font-family: var(--font-mono); color: var(--text-muted); border-color: var(--border-strong); background: var(--bg-elevated); vertical-align: middle; margin-left: .3rem; }
.cost-peek .btn-info:hover { color: var(--text); }
.cost-pop { position: absolute; left: 0; top: calc(100% + 6px); z-index: 30; min-width: 220px; padding: .55rem .75rem; background: var(--text); color: var(--bg-elevated); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); font-size: var(--text-sm); white-space: nowrap; animation: pop-in var(--dur-fast) var(--ease); }
:root[data-theme="dark"] .cost-pop { background: #2a2a2e; color: var(--text); border: 1px solid var(--border-strong); }
.cost-pop .row-k { display: flex; justify-content: space-between; gap: 1rem; padding: .1rem 0; }
.cost-pop .row-k span:first-child { opacity: .7; }
.cost-pop.fade { opacity: 0; transition: opacity var(--dur-slow) var(--ease); }
.brand-mark img, .avatar img { width: 100%; height: 100%; object-fit: contain; border-radius: inherit; }
.brand-mark.has-logo { background: var(--bg-elevated); border: 1px solid var(--border); }
.logo-preview { width: 120px; height: 120px; border: 1px solid var(--border); border-radius: var(--radius); display: grid; place-items: center; background: var(--bg-elevated); overflow: hidden; }
.logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
@media (max-width: 760px) {
  .pos-single .pos-left { padding: .7rem .75rem .5rem; }
  .pos-bottom { flex-direction: column; align-items: stretch; gap: .75rem; padding: .7rem .75rem .9rem; }
  .pos-bottom .pos-summary { margin-right: 0; justify-content: space-between; gap: .75rem 1rem; }
  .pos-bottom .pos-summary .kv.total { padding-left: 0; border-left: 0; margin-left: auto; }
  .pos-bottom .pos-actions { display: grid; grid-template-columns: 1fr 1fr 1fr 2fr; }
  .pos-bottom .pos-actions .btn-lg { min-width: 0; }
  .pos-single .pos-customer-btn { max-width: none; flex: 1 1 100%; }
}
@media (max-width: 960px) {
  .pos { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .pos-right { border-left: 0; border-top: 1px solid var(--border); max-height: 55vh; }
  .pay-line { grid-template-columns: 1fr 1fr; }
  .pos-left { padding: .7rem; }
}

/* Branch picker (top bar) and sale channel switch (POS) */
.branch-switch select { width: auto; min-width: 150px; }
.branch-chip { font-size: var(--text-sm); color: var(--text-muted); border: 1px solid var(--border); border-radius: 999px; padding: .2rem .7rem; white-space: nowrap; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: none; padding: 0 .9rem; min-height: 48px; font: inherit; font-size: var(--text-sm); font-weight: 600; color: var(--text-muted); cursor: pointer; white-space: nowrap; }
.seg button + button { border-left: 1px solid var(--border); }
.seg button.is-active { background: var(--text); color: var(--bg); }
.pos-channel-note { font-size: var(--text-sm); color: var(--text-muted); padding: .35rem .2rem 0; }
