/* ------------------------------------------------------------------ tokens */
:root {
  color-scheme: light only;

  --bg:            #f4f5fb;
  --bg-accent:     #eceefa;
  --surface:       #ffffff;
  --surface-2:     #f7f8fd;
  --surface-3:     #eef0fa;
  --border:        #e5e7f4;
  --border-strong: #ccd0e8;

  --text:          #141733;
  --text-muted:    #5d6486;
  --text-faint:    #9098b8;

  /* জনতা ইলেকট্রিক এন্ড ইলেকট্রনিক্স — navy #14304F, amber #F5A524 */
  --brand:         #14304f;
  --brand-dark:    #0e2239;
  --brand-light:   #2f5680;
  --brand-soft:    #e8edf3;
  --brand-ring:    rgba(20, 48, 79, .22);
  --accent:        #f5a524;
  --accent-dark:   #d98c0d;

  --violet:        #8b5cf6;
  --cyan:          #06b6d4;
  --pink:          #ec4899;

  /* Soft tinted surfaces for the dashboard's headline tiles — a pastel wash
     behind each figure rather than a plain white card, so the row of KPIs
     reads as a set of distinct signals instead of four identical boxes. */
  --tint-1-bg: #eeecfc; --tint-1-fg: #5b4bde;
  --tint-2-bg: #e3f1fc; --tint-2-fg: #1c7fc4;
  --tint-3-bg: #fbe8f2; --tint-3-fg: #c23a83;
  --tint-4-bg: #e4f6ee; --tint-4-fg: #0d9463;

  --ok:            #0d9463;
  --ok-soft:       #e3f7ee;
  --warn:          #c07807;
  --warn-soft:     #fdf3e0;
  --danger:        #dc3a4b;
  --danger-soft:   #fdebed;

  --sidebar-top:   #1a1b3d;
  --sidebar-bot:   #0f102a;
  --sidebar-hover: rgba(255, 255, 255, .07);
  --sidebar-text:  #a2a6cc;
  --sidebar-faint: #5d6394;
  --sidebar-line:  rgba(255, 255, 255, .08);

  --radius-sm: 9px;
  --radius:    14px;
  --radius-lg: 18px;

  --shadow-xs: 0 1px 2px rgba(20, 23, 51, .05);
  --shadow:    0 1px 2px rgba(20, 23, 51, .05), 0 4px 14px -3px rgba(20, 23, 51, .08);
  --shadow-md: 0 4px 8px -2px rgba(20, 23, 51, .07), 0 16px 32px -10px rgba(20, 23, 51, .16);
  --shadow-lg: 0 12px 24px -6px rgba(20, 23, 51, .14), 0 32px 64px -16px rgba(20, 23, 51, .30);
  --shadow-brand: 0 2px 6px -1px rgba(91, 75, 222, .35), 0 10px 24px -6px rgba(91, 75, 222, .42);
  --glow-brand: 0 0 0 1px rgba(91, 75, 222, .18), 0 8px 28px -6px rgba(91, 75, 222, .40);

  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text",
          "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --ease:      cubic-bezier(.32, .72, 0, 1);
  --ease-back: cubic-bezier(.34, 1.56, .64, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.021em; line-height: 1.25; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }
[hidden] { display: none !important; }

/* One consistent keyboard-focus treatment, never shown for mouse clicks. */
:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 4px;
}

::selection { background: var(--brand-ring); }

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

/* ------------------------------------------------------------------ login */
.login-screen {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(880px 520px at 12% -8%, rgba(91, 75, 222, .55) 0%, transparent 62%),
    radial-gradient(760px 520px at 90% 4%, rgba(6, 182, 212, .30) 0%, transparent 58%),
    radial-gradient(720px 620px at 55% 112%, rgba(236, 72, 153, .28) 0%, transparent 62%),
    linear-gradient(165deg, #191a3f 0%, #12132c 55%, #0b0c1c 100%);
}

/* A soft grid, barely visible, to keep the backdrop from reading as flat. */
.login-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, .022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .022) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(circle at 50% 45%, #000 0%, transparent 72%);
  pointer-events: none;
}

.login-card {
  position: relative;
  width: 100%;
  max-width: 396px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 38px 34px 30px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  animation: rise .5s var(--ease) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.985); } }

.login-logo {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, var(--brand-light), var(--brand));
  box-shadow: var(--shadow-brand);
}
.login-logo svg { width: 27px; height: 27px; }
.login-card h1 { font-size: 23px; margin: 0 0 5px; }
.login-sub { margin: 0 0 26px; color: var(--text-muted); font-size: 14px; }
.login-card .field { text-align: left; }
.login-card .btn-block { margin-top: 6px; padding: 11px 15px; font-size: 14.5px; }
.login-hint { margin: 18px 0 0; font-size: 12.5px; color: var(--text-faint); }
.login-hint code {
  font-family: var(--mono);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 5px;
}

/* ------------------------------------------------------------------ layout */
.app { display: flex; min-height: 100%; }

.sidebar {
  width: 246px;
  flex: 0 0 246px;
  background: linear-gradient(170deg, var(--sidebar-top) 0%, var(--sidebar-bot) 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
  border-right: 1px solid rgba(0, 0, 0, .3);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 19px 18px;
  font-weight: 660;
  font-size: 15.5px;
  letter-spacing: -.015em;
  border-bottom: 1px solid var(--sidebar-line);
}
.brand-mark {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, var(--brand-light), var(--brand));
  box-shadow: 0 4px 14px -3px rgba(139, 124, 240, .7);
}
.brand-mark svg { width: 17px; height: 17px; }
.brand-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav { flex: 1; padding: 12px 12px 18px; overflow-y: auto; }
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  margin-bottom: 2px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-size: 14.2px;
  font-weight: 500;
  transition: background .16s var(--ease), color .16s var(--ease);
}
.nav-item svg {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  opacity: .78;
  transition: opacity .16s var(--ease);
}
.nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item:hover svg { opacity: 1; }
.nav-item.active {
  background: linear-gradient(100deg, var(--brand) 0%, var(--brand-light) 100%);
  color: #fff;
  font-weight: 570;
  box-shadow: 0 4px 16px -4px rgba(91, 75, 222, .85);
}
.nav-item.active svg { opacity: 1; }

/* Small marker on the rail, so the active row reads even at a glance. */
.nav-item.active::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  border-radius: 0 3px 3px 0;
  background: #fff;
}

.nav-sep {
  padding: 17px 12px 7px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--sidebar-faint);
  font-weight: 700;
}

.sidebar-foot { padding: 14px; border-top: 1px solid var(--sidebar-line); }
.who { display: flex; align-items: center; gap: 10px; margin-bottom: 11px; }
.avatar {
  width: 35px; height: 35px;
  flex: 0 0 35px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--brand-light), var(--brand));
  box-shadow: 0 4px 12px -3px rgba(139, 124, 240, .6);
  display: grid;
  place-items: center;
  font-weight: 680;
  font-size: 14px;
  color: #fff;
  box-shadow: 0 2px 8px -2px rgba(64, 84, 232, .6);
}
.who-text { min-width: 0; line-height: 1.32; }
.who-text strong { display: block; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-text span { font-size: 11.5px; color: var(--sidebar-text); text-transform: capitalize; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 32px;
  height: 68px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 30;
}
.topbar h1 { font-size: 19px; flex: 1; }
.topbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.menu-btn { display: none; }

.content {
  padding: 30px 32px 72px;
  flex: 1;
  background:
    radial-gradient(1000px 400px at 100% 0%, var(--bg-accent) 0%, transparent 70%);
}
.content > * { animation: fade-up .32s var(--ease) both; }
@keyframes fade-up { from { opacity: 0; transform: translateY(6px); } }

.sidebar-scrim { display: none; }

/* ------------------------------------------------------------------ buttons */
.btn {
  appearance: none;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 8px 15px;
  font: inherit;
  font-size: 14px;
  font-weight: 550;
  cursor: pointer;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-xs);
  transition: background .15s var(--ease), border-color .15s var(--ease),
              box-shadow .15s var(--ease), transform .1s var(--ease);
  white-space: nowrap;
  line-height: 1.4;
}
.btn:hover  { background: var(--surface-2); border-color: var(--border-strong); box-shadow: var(--shadow); }
.btn:active { transform: translateY(1px); box-shadow: var(--shadow-xs); }
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; transform: none; }

.btn-primary {
  background: linear-gradient(135deg, var(--brand-light) 0%, var(--brand) 55%, var(--brand-dark) 100%);
  background-size: 160% 160%;
  background-position: 0% 50%;
  border-color: transparent;
  color: #fff;
  box-shadow: var(--shadow-brand);
  transition: background-position .5s var(--ease), box-shadow .25s var(--ease),
              transform .18s var(--ease-back);
}
.btn-primary:hover {
  background-position: 100% 50%;
  box-shadow: var(--glow-brand);
  transform: translateY(-1.5px);
}
.btn-primary:active { transform: translateY(0); }
.btn-danger {
  background: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 80%, #000);
  color: #fff;
}
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 88%, #000); }
.btn-ghost {
  background: rgba(255, 255, 255, .05);
  border-color: rgba(255, 255, 255, .16);
  color: #cfdaea;
  box-shadow: none;
}
.btn-ghost:hover { background: rgba(255, 255, 255, .11); color: #fff; }
.btn-sm  { padding: 5px 11px; font-size: 13px; border-radius: 7px; }
.btn-block { width: 100%; display: block; }

.icon-btn {
  appearance: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 35px; height: 35px;
  font-size: 16px;
  cursor: pointer;
  color: var(--text-muted);
  transition: background .15s var(--ease), color .15s var(--ease);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

/* ------------------------------------------------------------------ forms */
.field { display: block; margin-bottom: 15px; }
.field > span {
  display: block;
  font-size: 12.5px;
  font-weight: 620;
  color: var(--text-muted);
  margin-bottom: 6px;
  letter-spacing: -.005em;
}
.field .hint { font-weight: 400; color: var(--text-faint); }

input, select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--text-faint); }
input:hover, select:hover, textarea:hover { border-color: var(--text-faint); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3.5px var(--brand-ring);
}
textarea { resize: vertical; min-height: 66px; }
select { cursor: pointer; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-bottom: 15px; }
.check input { width: auto; accent-color: var(--brand); }

/* ------------------------------------------------------------------ cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: box-shadow .22s var(--ease), border-color .22s var(--ease);
}
.card:hover { border-color: var(--border-strong); }
.card + .card { margin-top: 20px; }

.card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
}
.card-head h2 { font-size: 15.5px; flex: 1; }
.card-head .sub { font-size: 12.5px; color: var(--text-muted); font-weight: 400; }
.card-body { padding: 20px 22px; }
.card-body.tight { padding: 0; }

.grid { display: grid; gap: 20px; }
.grid-kpi { grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); }
.grid-2   { grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); }

/* KPI tiles carry a thin colour bar so the four read as a set, not a row
   of identical boxes. */
.kpi {
  position: relative;
  padding: 20px 22px;
  overflow: hidden;
  transition: border-color .22s var(--ease);
}
.kpi::after {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--brand-light), var(--brand));
}
.kpi:hover { border-color: var(--border-strong); }
.kpi-label {
  font-size: 10.5px;
  color: var(--text-faint);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  display: flex;
  align-items: center;
  gap: 7px;
}
.kpi-value {
  font-size: 29px;
  font-weight: 660;
  margin-top: 9px;
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.kpi-sub { font-size: 12.5px; color: var(--text-muted); margin-top: 4px; }
.kpi.accent-ok     .kpi-value { color: var(--ok); }
.kpi.accent-ok::after     { background: linear-gradient(180deg, #34d399, var(--ok)); }
.kpi.accent-warn   .kpi-value { color: var(--warn); }
.kpi.accent-warn::after   { background: linear-gradient(180deg, #fbbf47, var(--warn)); }
.kpi.accent-danger .kpi-value { color: var(--danger); }
.kpi.accent-danger::after { background: linear-gradient(180deg, #fb7185, var(--danger)); }

/* ---- soft pastel variant: a tinted card with an icon chip, in place of the
   plain white tile + left accent bar. Cycle four tints across the row. ---- */
.kpi-soft {
  border: none;
  border-radius: var(--radius-lg);
  background: var(--tint-bg);
}
.kpi-soft::after { display: none; }
.kpi.kpi-soft:hover { border-color: transparent; }
.kpi-soft .kpi-label { color: var(--tint-fg); opacity: .82; }
.kpi-soft .kpi-value { color: var(--tint-fg); }
.kpi-soft .kpi-sub { color: var(--tint-fg); opacity: .72; }

.kpi-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.kpi-icon {
  flex: 0 0 auto;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 11px;
  background: rgba(255, 255, 255, .6);
  color: var(--tint-fg);
}
.kpi-icon svg { width: 17px; height: 17px; }

.kpi-tint-1 { --tint-bg: var(--tint-1-bg); --tint-fg: var(--tint-1-fg); }
.kpi-tint-2 { --tint-bg: var(--tint-2-bg); --tint-fg: var(--tint-2-fg); }
.kpi-tint-3 { --tint-bg: var(--tint-3-bg); --tint-fg: var(--tint-3-fg); }
.kpi-tint-4 { --tint-bg: var(--tint-4-bg); --tint-fg: var(--tint-4-fg); }
/* Severity-linked tints for the restocking tile, reusing the same soft
   badge tokens as everywhere else red/amber/green already means something —
   a pastel card should not cost the tile its actual danger signal. */
.kpi-tint-danger { --tint-bg: var(--danger-soft); --tint-fg: var(--danger); }
.kpi-tint-warn    { --tint-bg: var(--warn-soft);   --tint-fg: var(--warn); }
.kpi-tint-ok      { --tint-bg: var(--ok-soft);     --tint-fg: var(--ok); }


/* ------------------------------------------------------------------ tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
  text-align: left;
  padding: 12px 16px;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--text-faint);
  background: transparent;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
thead th.sortable { cursor: pointer; user-select: none; transition: color .14s var(--ease); }
thead th.sortable:hover { color: var(--brand); }
tbody td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background .13s var(--ease); }
tbody tr:hover { background: var(--surface-2); }
tbody tr.clickable { cursor: pointer; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mono { font-family: var(--mono); font-size: 12.5px; }
tfoot td {
  padding: 12px 14px;
  border-top: 2px solid var(--border-strong);
  font-weight: 650;
  background: var(--surface-2);
}
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.cell-main { font-weight: 560; }
.cell-sub  { font-size: 12px; color: var(--text-faint); margin-top: 1px; }

/* ------------------------------------------------------------------ badges */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 100px;
  font-size: 11.5px;
  font-weight: 650;
  white-space: nowrap;
  border: 1px solid transparent;
  letter-spacing: -.005em;
}
.badge-ok     { background: var(--ok-soft);     color: var(--ok);         border-color: color-mix(in srgb, var(--ok) 22%, transparent); }
.badge-warn   { background: var(--warn-soft);   color: var(--warn);       border-color: color-mix(in srgb, var(--warn) 22%, transparent); }
.badge-danger { background: var(--danger-soft); color: var(--danger);     border-color: color-mix(in srgb, var(--danger) 22%, transparent); }
.badge-info   { background: var(--brand-soft);  color: var(--brand-dark); border-color: color-mix(in srgb, var(--brand) 22%, transparent); }
.badge-muted  { background: var(--surface-2);   color: var(--text-muted); border-color: var(--border); }

/* ------------------------------------------------------------------ misc */
.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 18px;
}
.toolbar input, .toolbar select { width: auto; min-width: 140px; }
.toolbar .search { flex: 1; min-width: 220px; max-width: 380px; }
.spacer { flex: 1; }

.alert {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  margin-bottom: 14px;
  border: 1px solid transparent;
}
.alert-error { background: var(--danger-soft); color: color-mix(in srgb, var(--danger) 78%, #000); border-color: color-mix(in srgb, var(--danger) 24%, transparent); }
.alert-info  { background: var(--brand-soft);  color: var(--brand-dark); border-color: color-mix(in srgb, var(--brand) 24%, transparent); }
.alert-warn  { background: var(--warn-soft);   color: color-mix(in srgb, var(--warn) 82%, #000); border-color: color-mix(in srgb, var(--warn) 26%, transparent); }
.empty { padding: 48px 20px; text-align: center; color: var(--text-muted); }
.empty-icon { font-size: 32px; opacity: .45; }
.empty p { margin: 10px 0 0; font-size: 14px; }

.loading { padding: 48px; text-align: center; color: var(--text-faint); font-size: 14px; }

.muted { color: var(--text-muted); }
.small { font-size: 12.5px; }
.text-ok     { color: var(--ok); }
.text-danger { color: var(--danger); }
.text-warn   { color: var(--warn); }
.nowrap { white-space: nowrap; }

.pager {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
  background: var(--surface-2);
}

/* ------------------------------------------------------------------ chart */
.chart { width: 100%; height: 180px; display: block; }
/* Every bar but today's sits in a light, low-opacity fill; today's is solid
   and full-strength, so the current figure reads at a glance against the
   trailing days rather than blending into a uniform row of bars. */
.chart .bar { fill: var(--tint-1-fg); opacity: .28; transition: opacity .14s var(--ease); rx: .8; }
.chart .bar.bar-current { opacity: .95; }
.chart .bar:hover { opacity: 1; }
.chart .axis { stroke: var(--border); stroke-width: 1; }
.chart .label { font-size: 9.5px; fill: var(--text-faint); }

.bar-row { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; margin-bottom: 13px; }
.bar-row:last-child { margin-bottom: 0; }
.bar-track { height: 7px; background: var(--surface-3); border-radius: 100px; overflow: hidden; margin-top: 6px; }
.bar-fill  {
  height: 100%;
  background: linear-gradient(90deg, var(--brand) 0%, var(--brand-light) 60%, var(--violet) 100%);
  border-radius: 100px;
}
.bar-name  { font-size: 13.5px; font-weight: 520; }
.bar-avatar {
  width: 34px; height: 34px;
  flex: 0 0 34px;
  border-radius: 11px;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 700;
  color: var(--tint-fg);
  background: var(--tint-bg);
}

/* ------------------------------------------------------------------ modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 13, 24, .55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 100;
  animation: fade .16s var(--ease);
}
@keyframes fade { from { opacity: 0; } }
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: pop .2s var(--ease);
}
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.modal.modal-lg { max-width: 780px; }
.modal-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 17px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-head h2 { font-size: 17px; flex: 1; }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-foot {
  display: flex;
  gap: 9px;
  justify-content: flex-end;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ------------------------------------------------------------------ toasts */
.toast-root {
  position: fixed;
  bottom: 22px;
  right: 22px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  z-index: 200;
  pointer-events: none;
}
.toast {
  background: #131c33;
  color: #fff;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13.8px;
  box-shadow: var(--shadow-lg);
  max-width: 380px;
  animation: slide .22s var(--ease);
  border-left: 3px solid var(--brand-light);
}
.toast.ok    { border-left-color: #34d399; }
.toast.error { border-left-color: #f87171; }
@keyframes slide { from { opacity: 0; transform: translateX(18px); } }

/* ------------------------------------------------------------------ POS */
.pos { display: grid; grid-template-columns: 1fr 400px; gap: 18px; align-items: start; }
.pos-results { max-height: 460px; overflow-y: auto; }
.pos-pick {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .13s var(--ease);
}
.pos-pick:hover { background: var(--brand-soft); }
.pos-pick:last-child { border-bottom: none; }
.pos-pick.disabled { opacity: .5; cursor: not-allowed; }
.pos-pick.disabled:hover { background: transparent; }
.pos-pick-main { flex: 1; min-width: 0; }
.pos-cart-line {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}
.pos-cart-line:last-of-type { border-bottom: none; }
.qty-box { display: flex; align-items: center; gap: 5px; margin-top: 6px; }
.qty-box input { width: 58px; text-align: center; padding: 4px; font-size: 13px; }
.qty-btn {
  width: 27px; height: 27px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  border-radius: 7px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  color: var(--text-muted);
  transition: background .13s var(--ease), color .13s var(--ease);
}
.qty-btn:hover { background: var(--surface-2); color: var(--text); }
.totals { border-top: 1px solid var(--border); margin-top: 14px; padding-top: 14px; }
.total-row {
  display: flex;
  justify-content: space-between;
  font-size: 13.8px;
  margin-bottom: 7px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.total-row.grand {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.02em;
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-top: 12px;
}

/* ------------------------------------------------------------------ receipt */
.receipt { font-family: var(--mono); font-size: 12.5px; }
.receipt-head { text-align: center; margin-bottom: 14px; }
.receipt-head h3 { font-family: var(--font); font-size: 17px; }

/* Shop identity on the printed invoice. The logo is inline SVG with its own
   fills rather than currentColor, because browsers drop background colours
   when printing but keep SVG fills. */
.receipt-brand {
  display: flex; align-items: center; justify-content: center;
  gap: 9px; margin-bottom: 6px;
}
.receipt-logo { width: 34px; height: 34px; flex: none; }
.receipt-owner {
  font-family: var(--font); font-weight: 600;
  font-size: 12.5px; margin-top: 2px;
}
.receipt-contact { font-family: var(--font); font-size: 11.5px; color: #444; }
/* A border, not a background: browsers drop background colours when printing
   unless the page asks otherwise, and this rule is the one piece of the shop's
   colour that has to survive onto paper. */
.receipt-rule {
  width: 54px; height: 0;
  border-top: 3px solid #F5A524;
  margin: 9px auto;
}
.receipt table { font-size: 12.5px; }
.receipt td, .receipt th { padding: 5px 6px; }

@media print {
  body * { visibility: hidden; }
  .modal-backdrop, .modal-backdrop * { visibility: visible; }
  .modal-backdrop { position: absolute; inset: 0; background: #fff; padding: 0; display: block; backdrop-filter: none; }
  .modal { box-shadow: none; max-width: 100%; max-height: none; border: none; }
  .modal-head, .modal-foot { display: none; }
  /* Margin is for the owner's screen, never the customer's copy. */
  .no-print, .no-print * { display: none !important; visibility: hidden !important; }
  /* Keep the shop's mark in colour on the customer's copy. */
  .receipt-logo, .receipt-rule { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1080px) {
  .pos { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .sidebar {
    position: fixed;
    left: 0; top: 0;
    transform: translateX(-100%);
    transition: transform .26s var(--ease);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: none; }
  .sidebar-scrim {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(8, 13, 24, .5);
    z-index: 35;
    opacity: 0;
    pointer-events: none;
    transition: opacity .26s var(--ease);
  }
  .sidebar-scrim.show { opacity: 1; pointer-events: auto; }
  .menu-btn { display: block; }
  .topbar { padding: 0 16px; }
  .content { padding: 16px 16px 48px; }
  .form-grid { grid-template-columns: 1fr; }
  .toolbar .search { max-width: none; }
  .kpi-value { font-size: 24px; }
}

/* ==================================================================
   Interaction layer
   Motion is used to explain state, not to decorate: things that can be
   clicked respond, things that just arrived settle into place, and
   anything still loading says so. All of it is disabled wholesale by the
   prefers-reduced-motion rule near the top of this file.
   ================================================================== */

/* ---- cards and tiles: lift toward the pointer ---- */
.card {
  transition: transform .28s var(--ease), box-shadow .28s var(--ease),
              border-color .28s var(--ease);
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

.kpi { transition: transform .3s var(--ease-back), box-shadow .3s var(--ease); }
.kpi:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
/* The accent bar widens as the tile lifts, so the colour reads as the
   tile's own rather than a stripe stuck to its edge. */
.kpi::after { transition: width .3s var(--ease-back); }
.kpi:hover::after { width: 6px; }

/* ---- staggered entrance, so a screen assembles instead of snapping in ---- */
.content > * { animation: fade-up .42s var(--ease) both; }
.grid > *          { animation: fade-up .42s var(--ease) both; }
.grid > *:nth-child(1) { animation-delay: .02s; }
.grid > *:nth-child(2) { animation-delay: .07s; }
.grid > *:nth-child(3) { animation-delay: .12s; }
.grid > *:nth-child(4) { animation-delay: .17s; }
.grid > *:nth-child(5) { animation-delay: .22s; }
.grid > *:nth-child(6) { animation-delay: .27s; }

/* ---- table rows: an accent slides in from the left on hover ---- */
tbody tr { position: relative; }
tbody tr td:first-child { position: relative; }
tbody tr td:first-child::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--brand);
  transform: scaleY(0);
  transform-origin: center;
  transition: transform .22s var(--ease);
}
tbody tr:hover td:first-child::before { transform: scaleY(1); }
tbody tr:hover { background: var(--brand-soft); }
tbody tr.clickable:active { background: var(--surface-3); }

/* ---- sidebar rows: nudge toward the content on hover ---- */
.nav-item { transition: background .18s var(--ease), color .18s var(--ease), transform .18s var(--ease); }
.nav-item:hover { transform: translateX(3px); }
.nav-item svg { transition: transform .22s var(--ease-back), opacity .18s var(--ease); }
.nav-item:hover svg { transform: scale(1.12); }
.nav-item.active:hover { transform: none; }

/* ---- buttons: press feedback plus a sheen that sweeps across on hover ---- */
.btn { position: relative; overflow: hidden; }
.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, .38) 50%, transparent 65%);
  transform: translateX(-120%);
  transition: transform .6s var(--ease);
  pointer-events: none;
}
.btn:hover::after { transform: translateX(120%); }
.btn:not(.btn-primary):hover { transform: translateY(-1px); }
.icon-btn { transition: background .16s var(--ease), color .16s var(--ease), transform .18s var(--ease-back); }
.icon-btn:hover { transform: scale(1.08); }

/* ---- badges ---- */
.badge { transition: transform .18s var(--ease-back); }
tbody tr:hover .badge { transform: scale(1.06); }

/* ---- chart: bars grow from the baseline on first paint ---- */
.chart .bar {
  transform-origin: center bottom;
  animation: bar-grow .6s var(--ease) both;
}
.chart .bar:nth-child(odd)  { animation-delay: .04s; }
.chart .bar:nth-child(even) { animation-delay: .09s; }
@keyframes bar-grow { from { transform: scaleY(0); } }
.chart .bar { transition: fill .18s var(--ease), opacity .18s var(--ease); }
.chart .bar:hover { fill: var(--violet); opacity: 1; }

/* ---- top-seller bars fill left-to-right ---- */
.bar-fill {
  transform-origin: left center;
  animation: bar-fill-in .8s var(--ease) both;
  animation-delay: .15s;
}
@keyframes bar-fill-in { from { transform: scaleX(0); } }

/* ---- loading: a shimmer beats the word "Loading" ---- */
.loading {
  position: relative;
  color: transparent;
  min-height: 120px;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-2);
}
.loading::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, .85) 50%, transparent 80%);
  transform: translateX(-100%);
  animation: shimmer 1.25s infinite var(--ease);
}
@keyframes shimmer { to { transform: translateX(100%); } }

/* ---- inputs: lift subtly when focused ---- */
input:focus, select:focus, textarea:focus { transform: translateY(-1px); }
input, select, textarea { transition: border-color .16s var(--ease), box-shadow .16s var(--ease), transform .16s var(--ease); }

/* ---- modal and toast get a little more life ---- */
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.96); } }
.modal { animation: pop .3s var(--ease-back); }
.toast { animation: slide .3s var(--ease-back); }

/* ---- counters animating up read as "live", so hint at it ---- */
.kpi-value.counting { font-variant-numeric: tabular-nums; }

/* ---- the alert banner pulses once to catch the eye, then rests ---- */
.alert-warn { animation: alert-in .5s var(--ease) both; }
@keyframes alert-in { from { opacity: 0; transform: translateY(-6px); } }


/* ------------------------------------------------------- owner-only figures */
.profit-panel {
  margin-top: 18px;
  padding: 14px 16px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-family: var(--font);
}
.profit-head {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .09em;
  font-weight: 650;
  color: var(--text-faint);
  margin-bottom: 10px;
}
.profit-figures { display: flex; gap: 28px; }
.profit-figures > div { display: flex; flex-direction: column; gap: 2px; }
.profit-label { font-size: 12px; color: var(--text-muted); }
.profit-figures strong {
  font-size: 20px;
  font-weight: 660;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}

/* Running margin on the sale being rung up — owner only, and visually set
   apart from the customer-facing totals above it. */
.pos-profit {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--border-strong);
}
.pos-profit .profit-head { margin-bottom: 8px; }
.pos-profit .total-row { margin-bottom: 5px; }
.pos-profit .profit-line { font-weight: 640; color: var(--text); font-size: 15px; }
.pos-profit .profit-line span:last-child { font-variant-numeric: tabular-nums; }
