/* HitSix v2 — modern cricket-store inspired tokens + base */
:root {
  /* Cricket palette */
  --red: #E11D2C;          /* cricket ball red — primary CTA */
  --red-deep: #B11622;
  --red-soft: #FEE7E9;
  --navy: #0A1F3D;          /* deep test-cricket navy */
  --navy-2: #11294E;
  --navy-3: #1B3766;
  --cream: #FAF6EE;         /* parchment */
  --cream-2: #F2EBDD;
  --pitch: #2D7D4F;         /* cricket pitch green */
  --pitch-soft: #E1F2E8;
  --gold: #D4A24C;          /* willow tan */

  /* App tokens */
  --bg: #F6F4EE;
  --surface: #FFFFFF;
  --surface-2: #FBF8F2;
  --surface-3: #F0EBE0;
  --text: #0A0A0A;
  --text-2: #4A4744;
  --text-3: #847F77;
  --border: #E8E2D2;
  --border-strong: #D4CCB6;

  --accent: var(--red);
  --accent-soft: var(--red-soft);
  --accent-deep: var(--red-deep);

  --green: #15803D;
  --green-soft: #DCFCE7;
  --amber: #B45309;
  --amber-soft: #FEF3C7;
  --blue: #1D4ED8;
  --blue-soft: #DBEAFE;

  --shadow-sm: 0 1px 2px rgba(11, 31, 61, 0.05);
  --shadow: 0 2px 6px rgba(11, 31, 61, 0.06), 0 1px 2px rgba(11, 31, 61, 0.04);
  --shadow-md: 0 6px 16px rgba(11, 31, 61, 0.08), 0 2px 4px rgba(11, 31, 61, 0.04);
  --shadow-lg: 0 16px 40px rgba(11, 31, 61, 0.16), 0 4px 8px rgba(11, 31, 61, 0.06);

  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;

  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --display: "Anton", "Inter", system-ui, sans-serif;
  --serif: "Newsreader", Georgia, serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;

  --sidebar-w: 240px;
  --topbar-h: 64px;
  --promo-h: 36px;
}

[data-theme="dark"] {
  --bg: #08111F;
  --surface: #0E1B30;
  --surface-2: #122340;
  --surface-3: #1A2D50;
  --text: #F4F1E8;
  --text-2: #C9C2B0;
  --text-3: #8B8676;
  --border: #1F3358;
  --border-strong: #2A4170;
  --cream: #112440;
  --cream-2: #182F52;

  --red-soft: #2A0C10;
  --green: #22C55E;
  --green-soft: #0B2818;
  --amber-soft: #2A1C08;
  --blue-soft: #0E1F44;
  --pitch-soft: #0F2618;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.5);
  --shadow: 0 2px 6px rgba(0,0,0,0.5);
  --shadow-md: 0 6px 16px rgba(0,0,0,0.6);
  --shadow-lg: 0 20px 50px rgba(0,0,0,0.7);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; cursor: pointer; }

.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ========= SIDEBAR (modern dark navy) ========= */
.sidebar {
  background: var(--navy);
  color: #DFE7F4;
  display: flex;
  flex-direction: column;
  padding: 14px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 100;
  border-right: 1px solid rgba(255,255,255,0.05);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 8px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 16px;
}
.brand-mark {
  width: 38px; height: 38px;
  background: var(--red);
  border-radius: 9px;
  font-family: var(--display);
  font-size: 22px;
  font-weight: 400;
  color: white;
  display: grid;
  place-items: center;
  letter-spacing: -0.02em;
  box-shadow: 0 4px 10px rgba(225, 29, 44, 0.3);
  position: relative;
  overflow: hidden;
}
.brand-mark::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 20% 30%, transparent 30%, rgba(255,255,255,0.08) 35%, transparent 50%);
}
.brand-name {
  font-family: var(--display);
  font-size: 22px;
  letter-spacing: 0.02em;
  color: white;
  line-height: 1;
}
.brand-sub {
  font-size: 9.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.55);
  margin-top: 3px;
  font-weight: 500;
}

.nav-section {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.4);
  padding: 14px 12px 6px;
  font-weight: 600;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.75);
  background: transparent;
  border: none;
  font-size: 13.5px;
  font-weight: 500;
  width: 100%;
  text-align: left;
  margin-bottom: 1px;
  position: relative;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: white; }
.nav-item.active {
  background: rgba(225, 29, 44, 0.14);
  color: white;
}
.nav-item.active::before {
  content: "";
  position: absolute;
  left: 0; top: 8px; bottom: 8px;
  width: 3px;
  background: var(--red);
  border-radius: 0 3px 3px 0;
}
.nav-item svg { color: rgba(255,255,255,0.6); flex-shrink: 0; }
.nav-item.active svg { color: var(--red); }
.nav-badge {
  margin-left: auto;
  background: var(--red);
  color: white;
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  letter-spacing: 0.02em;
}

@media (max-width: 768px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    transform: translateX(-100%); transition: transform 0.2s;
    width: var(--sidebar-w);
  }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
}

/* ========= MAIN ========= */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.promo-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  background: var(--navy);
  color: white;
  height: var(--promo-h);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 0 20px;
  position: relative;
  overflow: hidden;
}
.promo-strip::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(225,29,44,0.18) 50%, transparent 100%);
  pointer-events: none;
}
.promo-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  position: relative;
}
.promo-item b { color: var(--red); font-weight: 700; letter-spacing: 0.06em; }
.promo-divider {
  width: 4px; height: 4px; border-radius: 50%;
  background: rgba(255,255,255,0.3);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 24px;
  height: var(--topbar-h);
  background: var(--navy);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  position: sticky;
  top: var(--promo-h);
  z-index: 50;
}

/* Logo / brand */
.topnav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-right: 28px;
  flex-shrink: 0;
}
.topnav-logo-img {
  height: 38px;
  width: 38px;
  object-fit: contain;
  border-radius: 8px;
}
.topnav-logo-mark {
  width: 38px; height: 38px;
  background: var(--red);
  border-radius: 9px;
  font-family: var(--display);
  font-size: 22px;
  color: white;
  display: grid;
  place-items: center;
  letter-spacing: -0.02em;
  box-shadow: 0 4px 10px rgba(225, 29, 44, 0.3);
  flex-shrink: 0;
}
.topnav-name {
  font-family: var(--display);
  font-size: 21px;
  color: white;
  letter-spacing: 0.02em;
  line-height: 1;
}
.topnav-sub {
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.5);
  margin-top: 2px;
  font-weight: 500;
}

/* Nav links */
.topnav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
}
.topnav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 13px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.65);
  font-size: 13px;
  font-weight: 500;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.12s;
  position: relative;
  white-space: nowrap;
}
.topnav-link:hover { color: white; background: rgba(255,255,255,0.07); }
.topnav-link.active { color: white; }
.topnav-link.active::after {
  content: "";
  position: absolute;
  bottom: -1px; left: 13px; right: 13px;
  height: 2px;
  background: var(--red);
  border-radius: 2px 2px 0 0;
}
.topnav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--red);
  color: white;
  font-size: 10px;
  font-weight: 700;
  min-width: 17px;
  height: 17px;
  border-radius: 999px;
  padding: 0 4px;
}

/* Action icons */
.topnav-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 16px;
}
.topbar .btn-icon {
  color: rgba(255,255,255,0.65);
}
.topbar .btn-icon:hover {
  background: rgba(255,255,255,0.08);
  color: white;
}

/* Mobile hamburger */
.menu-btn {
  display: none;
  background: transparent; border: none;
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.75);
  margin-right: 8px;
}
.menu-btn:hover { background: rgba(255,255,255,0.08); color: white; }

/* Mobile: collapse links behind hamburger */
@media (max-width: 768px) {
  .menu-btn { display: grid; place-items: center; }
  .topnav-links { display: none; }
  .topnav-name { font-size: 18px; }
  .topnav-sub { display: none; }
}
.topnav-mobile-menu {
  display: none;
  position: fixed;
  top: calc(var(--promo-h) + var(--topbar-h));
  left: 0; right: 0;
  background: var(--navy);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  padding: 8px 16px 14px;
  z-index: 49;
  flex-direction: column;
  gap: 2px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}
.topnav-mobile-menu.open { display: flex; }
.topnav-mobile-menu .topnav-link { width: 100%; }
.topnav-mobile-menu .topnav-link.active::after { display: none; }
.topnav-mobile-menu .topnav-link.active { background: rgba(225, 29, 44, 0.14); }

.topbar-spacer { flex: 1; }

.content {
  padding: 28px 32px 56px;
  max-width: 1500px;
  margin: 0 auto;
  width: 100%;
}
@media (max-width: 600px) { .content { padding: 18px 16px 40px; } }

/* ========= BUTTONS ========= */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  transition: all 0.12s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); border-color: var(--text-3); }
.btn-primary {
  background: var(--red);
  color: white;
  border-color: var(--red);
  box-shadow: 0 2px 6px rgba(225, 29, 44, 0.25);
}
.btn-primary:hover { background: var(--red-deep); border-color: var(--red-deep); box-shadow: 0 3px 10px rgba(225, 29, 44, 0.35); }
.btn-dark {
  background: var(--navy);
  color: white;
  border-color: var(--navy);
}
.btn-dark:hover { background: var(--navy-2); border-color: var(--navy-2); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  background: transparent;
  border: 1px solid transparent;
}
.btn-icon:hover { background: var(--surface-2); color: var(--text); }

/* ========= CARDS ========= */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow 0.15s;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  gap: 16px;
}
.card-title {
  font-family: var(--display);
  font-size: 17px;
  letter-spacing: 0.02em;
  color: var(--text);
}
.card-body { padding: 20px; }
.card-body.no-pad { padding: 0; }

/* ========= HERO SCOREBOARD ========= */
.scoreboard {
  background: var(--navy);
  background-image:
    radial-gradient(ellipse at top right, rgba(225,29,44,0.18), transparent 50%),
    radial-gradient(ellipse at bottom left, rgba(45,125,79,0.14), transparent 60%);
  color: white;
  border-radius: var(--radius-lg);
  padding: 32px 36px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(11, 31, 61, 0.18);
}
.scoreboard::before {
  content: "";
  position: absolute;
  top: -40px; right: -40px;
  width: 220px; height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--red) 0%, var(--red-deep) 60%, transparent 100%);
  opacity: 0.15;
}
.scoreboard::after {
  content: "";
  position: absolute;
  top: -40px; right: -40px;
  width: 220px; height: 220px;
  border-radius: 50%;
  border: 1.5px dashed rgba(255,255,255,0.08);
}
.sb-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
  position: relative;
  z-index: 2;
}
.sb-eyebrow {
  font-size: 10px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.55);
  font-weight: 600;
  margin-bottom: 6px;
}
.sb-title {
  font-family: var(--display);
  font-size: 36px;
  letter-spacing: 0.01em;
  line-height: 1;
  color: white;
}
.sb-subtitle {
  color: rgba(255,255,255,0.7);
  font-size: 14px;
  margin-top: 6px;
}
.sb-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.04em;
  backdrop-filter: blur(4px);
}
.sb-pill .dot {
  width: 8px; height: 8px;
  background: #4ADE80;
  border-radius: 50%;
  box-shadow: 0 0 8px #4ADE80;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }

.sb-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 0;
  position: relative;
  z-index: 2;
}
@media (max-width: 900px) { .sb-grid { grid-template-columns: 1fr 1fr; } }
.sb-cell {
  padding: 0 24px;
  border-left: 1px solid rgba(255,255,255,0.08);
}
.sb-cell:first-child { border-left: none; padding-left: 0; }
@media (max-width: 900px) {
  .sb-cell { padding: 12px 16px; border-left: none; border-top: 1px solid rgba(255,255,255,0.08); }
  .sb-cell:nth-child(-n+2) { border-top: none; padding-top: 0; }
}
.sb-cell-label {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.5);
  font-weight: 600;
  margin-bottom: 8px;
}
.sb-cell-value {
  font-family: var(--display);
  font-size: 38px;
  letter-spacing: 0.005em;
  line-height: 1;
  color: white;
}
.sb-cell-value.accent { color: var(--red); }
.sb-cell-value.green { color: #4ADE80; }
.sb-cell-sub {
  font-size: 11.5px;
  color: rgba(255,255,255,0.6);
  margin-top: 8px;
  font-variant-numeric: tabular-nums;
}

.sb-stitch {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 4px;
  background: repeating-linear-gradient(
    90deg,
    var(--red) 0, var(--red) 18px,
    transparent 18px, transparent 26px
  );
  opacity: 0.85;
}

/* ========= KPI grid (sub-stats below scoreboard) ========= */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}
@media (max-width: 900px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .kpi-grid { grid-template-columns: 1fr; } }

.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
}
.kpi-icon {
  position: absolute;
  top: 14px; right: 14px;
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  color: var(--text-2);
  display: grid;
  place-items: center;
}
.kpi-label {
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-3);
  font-weight: 600;
  margin-bottom: 8px;
}
.kpi-value {
  font-family: var(--display);
  font-size: 28px;
  letter-spacing: 0.01em;
  line-height: 1;
  color: var(--text);
  font-weight: 400;
}
.kpi-value.accent { color: var(--red); }
.kpi-value-sub {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
  letter-spacing: 0;
  margin-left: 4px;
}
.kpi-meta { font-size: 11.5px; color: var(--text-3); margin-top: 7px; }
.kpi-trend { color: var(--green); font-weight: 600; }

[data-density="compact"] .kpi { padding: 14px 16px; }
[data-density="compact"] .kpi-value { font-size: 24px; }
[data-density="comfy"] .kpi { padding: 22px 26px; }
[data-density="comfy"] .kpi-value { font-size: 32px; }

/* ========= TABLE ========= */
.table-wrap { overflow-x: auto; }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table th {
  text-align: left;
  font-weight: 700;
  color: var(--text-3);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  white-space: nowrap;
}
.table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--surface-2); }
.td-num { text-align: right; font-variant-numeric: tabular-nums; }
.td-strong { font-weight: 600; }
.td-mono { font-family: var(--mono); font-size: 12.5px; font-weight: 500; }
.td-muted { color: var(--text-3); }

[data-density="compact"] .table th, [data-density="compact"] .table td { padding: 8px 12px; font-size: 12.5px; }
[data-density="comfy"] .table th, [data-density="comfy"] .table td { padding: 16px 18px; font-size: 14px; }

/* ========= PILLS ========= */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
  text-transform: uppercase;
}
.pill-green { background: var(--green-soft); color: var(--green); }
.pill-amber { background: var(--amber-soft); color: var(--amber); }
.pill-red { background: var(--red-soft); color: var(--red); }
.pill-blue { background: var(--blue-soft); color: var(--blue); }
.pill-gray { background: var(--surface-3); color: var(--text-2); }
.pill-accent { background: var(--accent-soft); color: var(--accent); }
.pill-pitch { background: var(--pitch-soft); color: var(--pitch); }
.pill-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ========= SEARCH ========= */
.search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  height: 40px;
  transition: border-color 0.15s;
}
.search:focus-within { border-color: var(--text-3); background: var(--surface); }
.search input {
  border: none;
  background: transparent;
  outline: none;
  flex: 1;
  font-size: 13.5px;
  color: var(--text);
  height: 100%;
  font-family: inherit;
}
.search svg { color: var(--text-3); width: 16px; height: 16px; flex-shrink: 0; }

/* ========= FILTERS / CHIPS ========= */
.chips { display: flex; gap: 6px; flex-wrap: wrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
@media (max-width: 600px) { .chips { flex-wrap: nowrap; padding-bottom: 4px; } }
.chip {
  padding: 6px 13px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-2);
  white-space: nowrap;
}
.chip:hover { background: var(--surface-2); }
.chip.active, .chip-active {
  background: var(--navy);
  color: white;
  border-color: var(--navy);
}
.chip-count { opacity: 0.7; margin-left: 4px; font-weight: 500; }

.select-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.select-label {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
}
.select-wrap select {
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  font-family: inherit;
}

/* ========= PAGE HEADER ========= */
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.page-title {
  font-family: var(--display);
  font-size: 36px;
  font-weight: 400;
  letter-spacing: 0.005em;
  margin: 0 0 6px;
  line-height: 1;
  color: var(--text);
}
.page-sub {
  color: var(--text-3);
  font-size: 13.5px;
  margin: 0;
}
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
@media (max-width: 600px) {
  .page-header { flex-direction: column; align-items: flex-start; }
  .page-actions { width: 100%; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; -webkit-overflow-scrolling: touch; }
  .page-actions .btn { white-space: nowrap; flex-shrink: 0; }
}

/* ========= LAYOUT HELPERS ========= */
.two-col { display: grid; grid-template-columns: 1.7fr 1fr; gap: 20px; }
@media (max-width: 1100px) { .two-col { grid-template-columns: 1fr; } }
.three-col { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 900px) { .three-col { grid-template-columns: 1fr; } }
.row { display: flex; align-items: center; gap: 12px; }
.row-sb { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.col { display: flex; flex-direction: column; gap: 4px; }
.gap-sm { gap: 6px; }
.gap-md { gap: 12px; }
.gap-lg { gap: 20px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.flex-1 { flex: 1; min-width: 0; }
.muted { color: var(--text-3); }
.text-2 { color: var(--text-2); }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.serif { font-family: var(--serif); }
.display { font-family: var(--display); letter-spacing: 0.02em; }
.mono { font-variant-numeric: tabular-nums; }
.strong { font-weight: 600; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }

/* ========= INVENTORY GRID (cards) ========= */
.view-toggle {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 3px;
}
.view-toggle button {
  border: none;
  background: transparent;
  width: 36px; height: 32px;
  border-radius: 5px;
  display: grid;
  place-items: center;
  color: var(--text-3);
}
.view-toggle button.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.inv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.inv-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  cursor: pointer;
  transition: all 0.15s;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.inv-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--border-strong);
}
.inv-card-img {
  height: 120px;
  background: var(--surface-2);
  background-image:
    radial-gradient(circle at 25% 25%, rgba(0,0,0,0.04) 0%, transparent 50%),
    linear-gradient(135deg, var(--surface-2) 0%, var(--surface-3) 100%);
  position: relative;
  display: grid;
  place-items: center;
  border-bottom: 1px solid var(--border);
}
.inv-card-img.cat-bats { background: linear-gradient(135deg, #FAF6EE 0%, #F2E5C8 100%); }
.inv-card-img.cat-balls { background: linear-gradient(135deg, #FEE7E9 0%, #FBC4C9 100%); }
.inv-card-img.cat-gloves { background: linear-gradient(135deg, #DBEAFE 0%, #B6D5FB 100%); }
.inv-card-img.cat-pads { background: linear-gradient(135deg, #DCFCE7 0%, #B0F1C2 100%); }
.inv-card-img.cat-helmet { background: linear-gradient(135deg, #F3E8FF 0%, #DCC6FA 100%); }
.inv-card-img.cat-shoes { background: linear-gradient(135deg, #F0EBE0 0%, #DCD0B5 100%); }
.inv-card-img.cat-acc { background: linear-gradient(135deg, #FEF3C7 0%, #FCD981 100%); }
.inv-card-img.cat-stumps { background: linear-gradient(135deg, #FEE7E9 0%, #FBC4C9 100%); }
.inv-card-img.cat-thigh { background: linear-gradient(135deg, #DCFCE7 0%, #B0F1C2 100%); }
.inv-card-img.cat-wk { background: linear-gradient(135deg, #DBEAFE 0%, #B6D5FB 100%); }
.cat-icon { width: 56px; height: 56px; opacity: 0.85; }
.inv-card-stock {
  position: absolute;
  top: 10px; left: 10px;
}
.inv-card-src {
  position: absolute;
  top: 10px; right: 10px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  background: rgba(255,255,255,0.85);
  padding: 3px 8px;
  border-radius: 999px;
  backdrop-filter: blur(4px);
}
.inv-card-body { padding: 14px 16px; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.inv-card-cat {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-3);
}
.inv-card-name {
  font-weight: 600;
  font-size: 14px;
  line-height: 1.3;
  color: var(--text);
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.inv-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}
.inv-card-price {
  font-family: var(--display);
  font-size: 22px;
  letter-spacing: 0.01em;
  color: var(--text);
}
.inv-card-margin {
  font-size: 11px;
  font-weight: 600;
  color: var(--green);
}
.inv-card-margin.warn { color: var(--amber); }

/* ========= RESTOCK ROW ========= */
.restock-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.1s;
}
.restock-row:hover { background: var(--surface-2); }
.restock-row:last-child { border-bottom: none; }
.restock-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  display: grid;
  place-items: center;
  color: var(--text-2);
  flex-shrink: 0;
}

/* ========= SALES FEED ========= */
.feed-item {
  display: flex;
  gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.1s;
}
.feed-item:hover { background: var(--surface-2); }
.feed-item:last-child { border-bottom: none; }
.feed-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--navy);
  color: white;
  font-weight: 700;
  font-size: 13px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}
.feed-content { flex: 1; min-width: 0; }
.feed-line { font-size: 13.5px; color: var(--text); line-height: 1.4; }
.feed-line b { font-weight: 600; }
.feed-meta {
  display: flex;
  gap: 10px;
  font-size: 11.5px;
  color: var(--text-3);
  margin-top: 4px;
}
.feed-amount {
  font-family: var(--display);
  font-size: 18px;
  letter-spacing: 0.01em;
  color: var(--text);
  margin-left: auto;
  align-self: center;
}

/* ========= EMPTY ========= */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-3);
}
.empty-sm {
  padding: 28px;
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

/* ========= TOAST ========= */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--navy);
  color: white;
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 2000;
  animation: slideUp 0.2s;
}
@keyframes slideUp { from { transform: translate(-50%, 12px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

/* INR ref */
.inr-ref { color: var(--text-3); font-size: 11px; margin-left: 4px; font-weight: 500; }

/* Inputs */
.input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.1s;
  font-family: inherit;
}
.input:focus { border-color: var(--navy); }
.input-sm { padding: 6px 10px; font-size: 12.5px; }
textarea.input { resize: vertical; min-height: 60px; }

/* Section title (in drawers) */
.section-title {
  font-family: var(--display);
  font-size: 15px;
  letter-spacing: 0.04em;
  margin: 22px 0 10px;
  color: var(--text);
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
}

.notes-block {
  padding: 14px 16px;
  background: var(--surface-2);
  border-left: 3px solid var(--red);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.55;
  margin: 12px 0;
}

/* Avatar circle (customers) */
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--navy);
  color: white;
  font-size: 11.5px;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

/* ========= INFO GRID (item detail) ========= */
.info-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 18px 0;
  background: var(--surface);
}
@media (max-width: 720px) { .info-grid { grid-template-columns: repeat(2, 1fr); } }
.info-cell {
  padding: 14px 16px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.info-cell:nth-child(4n) { border-right: none; }
@media (max-width: 720px) { .info-cell { border-right: 1px solid var(--border) !important; } .info-cell:nth-child(2n) { border-right: none !important; } }
.info-label {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 5px;
}
.info-value {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
}
.info-value.strong { font-weight: 700; }
.info-value.accent { color: var(--red); font-weight: 700; }
.info-unit { font-size: 11px; color: var(--text-3); font-weight: 400; }

.table-compact th, .table-compact td { padding: 8px 12px; font-size: 12.5px; }

/* ========= DRAWER ========= */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 31, 61, 0.55);
  backdrop-filter: blur(2px);
  z-index: 500;
  display: flex;
  justify-content: flex-end;
  animation: fadeIn 0.15s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.drawer {
  background: var(--bg);
  width: min(720px, 96vw);
  height: 100vh;
  max-height: 100dvh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: slideRight 0.22s cubic-bezier(0.2,0.8,0.2,1);
  overflow: hidden;
}
.drawer-wide { width: min(960px, 98vw); }
@keyframes slideRight { from { transform: translateX(40px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.drawer-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.drawer-title {
  font-family: var(--display);
  font-size: 24px;
  letter-spacing: 0.02em;
  margin: 0;
}
.drawer-sub { color: var(--text-3); font-size: 13px; margin: 2px 0 0; }
.drawer-body { padding: 22px 24px; overflow-y: auto; flex: 1; }
@media (max-width: 480px) {
  .drawer { width: 100vw !important; }
  .drawer-body { padding: 16px; }
  .drawer-header { padding: 14px 16px; }
  .drawer-footer { padding: 12px 16px; }
}
.drawer-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ========= PRICE COMPARE ========= */
.price-compare-box {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 4px;
}
.price-compare-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--surface-2, var(--bg-2));
  border-bottom: 1px solid var(--border);
  gap: 10px;
  flex-wrap: wrap;
}
.price-compare-logo {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
}
.price-compare-search-input {
  font-size: 12px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  width: 180px;
}
.price-compare-searching,
.price-compare-empty {
  padding: 14px;
  font-size: 13px;
  color: var(--text-2);
  text-align: center;
}
.price-compare-results {
  display: flex;
  flex-direction: column;
}
.price-compare-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.price-compare-row:last-child { border-bottom: none; }
.price-compare-name {
  font-size: 12.5px;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.price-compare-name a {
  color: var(--text);
  text-decoration: none;
}
.price-compare-name a:hover { text-decoration: underline; color: var(--red); }
.price-compare-prices {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.price-compare-bcs {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.price-compare-diff {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 20px;
}
.price-compare-diff.cheaper {
  background: rgb(34 197 94 / .12);
  color: var(--green);
}
.price-compare-diff.pricier {
  background: rgb(239 68 68 / .12);
  color: var(--red);
}
.price-compare-diff.same {
  background: var(--bg-2);
  color: var(--text-2);
}
.price-compare-footer {
  display: flex;
  align-items: center;
  padding: 9px 14px;
  font-size: 12px;
  color: var(--text-2);
  background: var(--surface-2, var(--bg-2));
  border-top: 1px solid var(--border);
  gap: 8px;
}
.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
  height: auto;
  min-height: 0;
}

/* ========= INVOICE BUILDER ========= */
.builder-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 16px;
}
@media (max-width: 800px) { .builder-grid { grid-template-columns: 1fr; } }
.builder-summary {
  background: var(--navy);
  color: white;
  border-radius: var(--radius);
  padding: 18px 20px;
  align-self: start;
}
.builder-summary .section-title {
  color: white;
  border-color: rgba(255,255,255,0.15);
  margin-top: 0;
}
.builder-summary .sum-row { color: rgba(255,255,255,0.85); }
.sum-row {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  font-size: 13px;
}
.sum-grand {
  border-top: 1px solid rgba(255,255,255,0.15);
  margin-top: 6px;
  padding-top: 10px;
  font-family: var(--display);
  font-size: 18px;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: white;
}
.sum-meta { font-size: 11.5px; color: rgba(255,255,255,0.6); }

.bundle-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--accent-soft);
  border: 1px solid var(--red);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}

.line-list {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}
.line-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.line-row:last-child { border-bottom: none; }
.line-info { flex: 1; min-width: 0; }
.line-name { font-weight: 600; font-size: 13.5px; }
.line-meta { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.line-amount { font-family: var(--mono); width: 84px; text-align: right; font-weight: 700; }

/* ========= INVOICE VIEWER STYLES ========= */
.invoice-preview-wrap {
  flex: 1;
  overflow-y: auto;
  background: var(--surface-3);
  padding: 28px;
}
.invoice-style-tabs {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.invoice-doc {
  background: white;
  color: #1a1a1a;
  width: 8.5in;
  max-width: 100%;
  margin: 0 auto;
  padding: 0.6in;
  box-shadow: 0 8px 32px rgba(0,0,0,0.10);
  font-family: var(--sans);
  font-size: 11pt;
  border-radius: 6px;
}

/* Minimal */
.invoice-minimal .min-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 36px;
  padding-bottom: 16px;
  border-bottom: 2px solid #1a1a1a;
}
.min-brand { font-family: var(--display); font-size: 30pt; letter-spacing: 0.02em; }
.min-sub { font-size: 10pt; color: #666; margin-top: 2px; }
.min-meta { text-align: right; }
.min-meta-label { font-size: 9pt; letter-spacing: 0.18em; text-transform: uppercase; color: #666; font-weight: 600; }
.min-meta-id { font-family: var(--mono); font-size: 14pt; font-weight: 700; margin-top: 4px; }
.min-meta-date { font-size: 10pt; color: #666; margin-top: 2px; }
.min-bill { margin-bottom: 28px; }
.min-label { font-size: 9pt; letter-spacing: 0.18em; text-transform: uppercase; color: #666; margin-bottom: 6px; font-weight: 600; }
.min-customer { font-family: var(--display); font-size: 20pt; letter-spacing: 0.02em; }
.min-line { font-size: 10pt; color: #555; }
.min-table { width: 100%; border-collapse: collapse; margin: 24px 0; }
.min-table th { text-align: left; font-size: 9pt; letter-spacing: 0.12em; text-transform: uppercase; color: #666; padding: 10px 0; border-bottom: 1px solid #1a1a1a; font-weight: 700; }
.min-table td { padding: 12px 0; border-bottom: 1px solid #e5e5e5; font-size: 11pt; }
.min-totals { margin-left: auto; width: 280px; margin-top: 16px; }
.min-tot-row { display: flex; justify-content: space-between; padding: 5px 0; font-size: 11pt; }
.min-tot-grand { border-top: 1px solid #1a1a1a; margin-top: 8px; padding-top: 12px; font-family: var(--display); font-size: 18pt; letter-spacing: 0.02em; }
.min-notes { margin-top: 32px; padding: 14px 16px; background: #f7f5ef; border-left: 3px solid #1a1a1a; font-size: 10pt; color: #555; }
.min-footer { margin-top: 48px; padding-top: 16px; border-top: 1px solid #e5e5e5; text-align: center; font-size: 9pt; color: #888; letter-spacing: 0.05em; }

/* Modern */
.invoice-modern .mod-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 32px 36px;
  margin: -0.6in -0.6in 36px;
  background: #E11D2C;
  color: white;
  position: relative;
  overflow: hidden;
}
.invoice-modern .mod-header::after {
  content: "";
  position: absolute;
  top: -40px; right: -40px;
  width: 200px; height: 200px;
  border-radius: 50%;
  border: 1.5px dashed rgba(255,255,255,0.18);
}
.mod-brand { font-family: var(--display); font-size: 32pt; letter-spacing: 0.02em; line-height: 1; }
.mod-tagline { font-size: 10pt; opacity: 0.9; margin-top: 4px; letter-spacing: 0.08em; text-transform: uppercase; }
.mod-contact { font-size: 9pt; opacity: 0.8; margin-top: 10px; }
.mod-stamp { text-align: right; position: relative; z-index: 2; }
.mod-stamp-label { font-size: 9pt; letter-spacing: 0.18em; text-transform: uppercase; opacity: 0.9; font-weight: 600; }
.mod-stamp-id { font-family: var(--mono); font-size: 18pt; font-weight: 700; margin-top: 4px; }
.mod-stamp-date { font-size: 10pt; opacity: 0.9; margin-top: 2px; }
.mod-bill { display: flex; justify-content: space-between; gap: 24px; margin-bottom: 32px; align-items: flex-start; }
.mod-bill-col { flex: 1; }
.mod-bill-label { font-size: 9pt; letter-spacing: 0.18em; text-transform: uppercase; color: #888; margin-bottom: 6px; font-weight: 700; }
.mod-bill-name { font-family: var(--display); font-size: 18pt; letter-spacing: 0.02em; }
.mod-bill-line { font-size: 10pt; color: #555; }
.mod-amount { font-family: var(--display); font-size: 36pt; color: #E11D2C; letter-spacing: 0.02em; line-height: 1; }
.mod-table { width: 100%; border-collapse: collapse; }
.mod-table th { text-align: left; font-size: 9pt; letter-spacing: 0.12em; text-transform: uppercase; color: #888; padding: 12px 14px; background: #f7f5ef; font-weight: 700; }
.mod-table th:first-child { border-radius: 6px 0 0 6px; }
.mod-table th:last-child { border-radius: 0 6px 6px 0; }
.mod-table td { padding: 14px; border-bottom: 1px solid #eee; font-size: 11pt; }
.mod-line-name { font-weight: 600; }
.mod-line-cat { font-size: 9pt; color: #888; margin-top: 2px; letter-spacing: 0.04em; }
.mod-totals { margin-left: auto; width: 320px; margin-top: 20px; padding: 18px 22px; background: #f7f5ef; border-radius: 10px; }
.mod-tot-row { display: flex; justify-content: space-between; padding: 5px 0; font-size: 11pt; color: #555; }
.mod-tot-grand { border-top: 1px solid #d6d2c4; margin-top: 8px; padding-top: 10px; font-family: var(--display); font-size: 18pt; letter-spacing: 0.02em; color: #1a1a1a; }
.mod-notes { margin-top: 28px; }
.mod-notes b { display: block; font-size: 9pt; letter-spacing: 0.12em; text-transform: uppercase; color: #888; margin-bottom: 4px; font-weight: 700; }
.mod-notes p { font-size: 10pt; color: #555; line-height: 1.55; margin: 0; }
.mod-footer { margin-top: 36px; padding-top: 16px; border-top: 1px solid #eee; text-align: center; font-size: 9pt; color: #888; letter-spacing: 0.05em; }

/* Scoreboard invoice */
.invoice-scoreboard { background: #FAF6EE; }
.invoice-scoreboard .sb-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 26px 32px;
  margin: -0.6in -0.6in 28px;
  background: #0A1F3D;
  color: #F4F1E8;
  border-bottom: 4px solid #E11D2C;
  position: relative;
}
.sb-brand { display: flex; align-items: center; gap: 14px; }
.sb-logo {
  width: 56px; height: 56px;
  background: #E11D2C;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-size: 24pt;
  color: white;
  letter-spacing: 0.02em;
}
.sb-name { font-family: var(--display); font-size: 26pt; letter-spacing: 0.02em; line-height: 1; }
.sb-tag { font-size: 9pt; letter-spacing: 0.2em; text-transform: uppercase; opacity: 0.7; }
.sb-meta { text-align: right; font-family: var(--mono); }
.sb-meta-row { display: flex; justify-content: space-between; gap: 24px; font-size: 10pt; padding: 2px 0; }
.sb-meta-row span { opacity: 0.6; letter-spacing: 0.1em; font-weight: 500; }
.sb-meta-row b { font-weight: 700; }
.sb-bill-row {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 20px;
  margin-bottom: 26px;
}
.sb-label { font-size: 9pt; letter-spacing: 0.2em; text-transform: uppercase; color: #888; margin-bottom: 6px; font-weight: 700; }
.sb-customer { font-family: var(--display); font-size: 22pt; letter-spacing: 0.02em; color: #1a1a1a; }
.sb-customer-sub { font-size: 10pt; color: #666; margin-top: 2px; }
.sb-summary-card {
  background: #E11D2C;
  color: white;
  padding: 18px 22px;
  border-radius: 10px;
  min-width: 220px;
  text-align: right;
}
.sb-summary-label { font-size: 9pt; letter-spacing: 0.2em; text-transform: uppercase; opacity: 0.9; font-weight: 600; }
.sb-summary-value { font-family: var(--display); font-size: 32pt; line-height: 1; margin-top: 4px; letter-spacing: 0.02em; }
.sb-summary-sub { font-size: 9pt; opacity: 0.9; margin-top: 4px; }
.sb-table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.sb-table th { font-size: 9pt; letter-spacing: 0.16em; text-transform: uppercase; color: #888; padding: 12px; text-align: left; border-bottom: 2px solid #1a1a1a; font-weight: 700; }
.sb-table td { padding: 14px 12px; border-bottom: 1px solid #e5e5e5; font-size: 11pt; vertical-align: top; }
.sb-num { font-family: var(--mono); color: #888; font-size: 10pt; font-weight: 600; }
.sb-line-name { font-weight: 600; }
.sb-line-cat { font-size: 9pt; color: #888; margin-top: 2px; letter-spacing: 0.06em; text-transform: uppercase; }
.sb-totals { display: flex; justify-content: flex-end; margin-top: 18px; }
.sb-totals-inner { width: 320px; padding: 16px 20px; background: white; border: 1px solid #d6d2c4; border-radius: 10px; }
.sb-tot-row { display: flex; justify-content: space-between; padding: 5px 0; font-size: 11pt; color: #555; }
.sb-tot-grand { border-top: 2px solid #0A1F3D; margin-top: 8px; padding-top: 10px; font-family: var(--display); font-size: 18pt; letter-spacing: 0.02em; color: #0A1F3D; }
.sb-notes { margin-top: 24px; padding: 14px 18px; background: white; border-left: 3px solid #E11D2C; }
.sb-footer { margin-top: 32px; }
.sb-footer-divider {
  text-align: center;
  font-family: var(--display);
  font-size: 13pt;
  color: #E11D2C;
  letter-spacing: 0.3em;
  position: relative;
  margin: 16px 0 12px;
}
.sb-footer-divider::before, .sb-footer-divider::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 30%;
  height: 1px;
  background: #d6d2c4;
}
.sb-footer-divider::before { left: 0; }
.sb-footer-divider::after { right: 0; }
.sb-footer-divider span { background: #FAF6EE; padding: 0 18px; position: relative; }
.sb-footer-meta { text-align: center; font-size: 9pt; color: #888; letter-spacing: 0.05em; }

/* ========= BATCH CARDS ========= */
.batch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.batch-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
  overflow: hidden;
}
.batch-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.batch-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--src-color, var(--text-3));
}
.batch-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.batch-source-pill {
  color: white;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: 999px;
}
.batch-date { font-size: 11px; color: var(--text-3); font-weight: 500; letter-spacing: 0.04em; }
.batch-name {
  font-family: var(--display);
  font-size: 19px;
  letter-spacing: 0.02em;
  margin-bottom: 4px;
}
.batch-meta { font-size: 12px; color: var(--text-3); margin-bottom: 14px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.batch-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.batch-stat-label { font-size: 9.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-3); font-weight: 600; }
.batch-stat-val { font-family: var(--display); font-size: 17px; letter-spacing: 0.02em; margin-top: 2px; }
.batch-progress { height: 5px; background: var(--surface-3); border-radius: 3px; overflow: hidden; }
.batch-progress-bar { height: 100%; background: var(--red); transition: width 0.3s; }
.batch-note {
  margin-top: 12px;
  font-size: 11.5px;
  color: var(--text-3);
  line-height: 1.5;
  font-style: italic;
}

/* ========= SETTINGS UI ========= */
.toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  gap: 16px;
}
.toggle-row:last-child { border-bottom: none; }
.switch {
  width: 40px; height: 22px;
  border-radius: 999px;
  background: var(--border-strong);
  position: relative;
  transition: background 0.15s;
  flex-shrink: 0;
  border: none;
  padding: 0;
}
.switch.on { background: var(--red); }
.switch-knob {
  position: absolute;
  top: 2px; left: 2px;
  width: 18px; height: 18px;
  background: white;
  border-radius: 50%;
  transition: transform 0.15s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.switch.on .switch-knob { transform: translateX(18px); }

.radio-row { padding: 14px 0; border-bottom: 1px solid var(--border); }
.radio-row:last-child { border-bottom: none; }
.seg {
  display: inline-flex;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 2px;
  margin-top: 8px;
}
.seg-opt {
  padding: 7px 14px;
  border-radius: 5px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  background: transparent;
  border: none;
}
.seg-opt.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* nav backdrop */
.nav-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 90; }
@media (min-width: 769px) { .nav-backdrop { display: none; } }

/* App fade */
.app { opacity: 0; animation: appFadeIn 0.15s 0.05s forwards; }
@keyframes appFadeIn { to { opacity: 1; } }

/* ── BCS Image Picker ───────────────────────────────────────────────────────── */
.bcs-picker-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 15, 30, 0.55);
  z-index: 10;
  display: flex;
  align-items: flex-end;
  border-radius: inherit;
}
.bcs-picker {
  width: 100%;
  background: var(--surface);
  border-radius: 16px 16px 0 0;
  display: flex;
  flex-direction: column;
  max-height: 80%;
  overflow: hidden;
}
.bcs-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.bcs-picker-title { font-weight: 700; font-size: 15px; }
.bcs-picker-close {
  background: none; border: none; cursor: pointer;
  font-size: 18px; color: var(--text-3); padding: 2px 6px;
  border-radius: 6px; line-height: 1;
}
.bcs-picker-close:hover { background: var(--surface-3); color: var(--text); }
.bcs-picker-tabs {
  display: flex;
  gap: 4px;
  padding: 10px 18px 0;
  flex-shrink: 0;
}
.bcs-tab {
  flex: 1; padding: 7px 10px; font-size: 13px; font-weight: 600;
  border-radius: 8px 8px 0 0; border: 1px solid var(--border); border-bottom: none;
  background: var(--surface-3); color: var(--text-3); cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.bcs-tab.active { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.bcs-tab:not(.active):hover { background: var(--surface-2); color: var(--text-2); }
.bcs-picker-search {
  display: flex; gap: 8px; align-items: center;
  padding: 10px 18px 0; flex-shrink: 0;
}
.bcs-picker-search .input { flex: 1; font-size: 13px; padding: 6px 10px; }
.bcs-picker-search .btn { flex-shrink: 0; font-size: 13px; padding: 6px 14px; }
.bcs-picker-body {
  flex: 1; overflow-y: auto; padding: 12px 18px 18px;
  min-height: 120px;
}
.bcs-picker-loading, .bcs-picker-empty {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; padding: 32px 0; color: var(--text-3); font-size: 14px;
}
.bcs-spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid var(--border-strong);
  border-top-color: var(--red);
  animation: bcsSpinAnim 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes bcsSpinAnim { to { transform: rotate(360deg); } }
.bcs-thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
}
.bcs-thumb-card {
  background: var(--surface-2); border: 1.5px solid var(--border);
  border-radius: 10px; padding: 0; cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, opacity 0.15s;
  display: flex; flex-direction: column; overflow: hidden; text-align: left;
}
.bcs-thumb-card:hover:not(:disabled) {
  border-color: var(--red); box-shadow: 0 0 0 2px var(--red-soft);
}
.bcs-thumb-card:disabled { opacity: 0.6; cursor: default; }
.bcs-thumb-card.applying { border-color: var(--red); }
.bcs-thumb-card.no-image { opacity: 0.45; cursor: not-allowed; }
.bcs-thumb-img {
  position: relative; width: 100%; aspect-ratio: 1 / 1;
  background: var(--surface-3); overflow: hidden;
}
.bcs-thumb-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bcs-thumb-placeholder {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: var(--text-3);
}
.bcs-thumb-applying {
  position: absolute; inset: 0; background: rgba(255,255,255,0.7);
  display: flex; align-items: center; justify-content: center;
}
.bcs-thumb-info { padding: 6px 8px; }
.bcs-thumb-name {
  font-size: 11px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  line-height: 1.3;
}
.bcs-thumb-price { font-size: 11px; color: var(--pitch); margin-top: 2px; font-weight: 600; }

/* Print */
@media print {
  body, .invoice-preview-wrap { background: white !important; padding: 0 !important; }
  .drawer-overlay, .drawer-header, .drawer-footer, .invoice-style-tabs, .sidebar, .topbar, .promo-strip { display: none !important; }
  .drawer { width: 100% !important; height: auto !important; }
  .drawer-body, .invoice-preview-wrap { overflow: visible !important; }
  .invoice-doc { box-shadow: none !important; padding: 0.5in !important; border-radius: 0 !important; }
}

/* ── Batch Image Review ─────────────────────────────────────────────────── */
.batch-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 300; display: flex; align-items: center; justify-content: center; padding: 20px; }
.batch-panel { background: var(--surface); border-radius: var(--radius); width: 100%; max-width: 860px; max-height: 90vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 24px 80px rgba(0,0,0,0.35); }
.batch-header { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px 16px; border-bottom: 1px solid var(--border); }
.batch-title { font-weight: 700; font-size: 17px; }
.batch-sub { color: var(--text-2); font-size: 14px; }
.batch-prog-bar { height: 3px; background: var(--border); }
.batch-prog-fill { height: 3px; background: var(--accent); transition: width 0.3s; }
.batch-item-section { flex: 1; overflow-y: auto; padding: 20px 24px; }
.batch-item-meta { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.batch-item-name { font-size: 18px; font-weight: 600; }
.batch-loading { display: flex; align-items: center; gap: 10px; color: var(--text-2); padding: 40px 0; justify-content: center; }
.batch-empty { text-align: center; color: var(--text-2); padding: 40px 0; font-size: 14px; }
.batch-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.bcs-thumb-card.batch-selected { outline: 3px solid var(--accent); outline-offset: -2px; background: var(--surface-2); }
.bcs-thumb-source { font-size: 10px; font-weight: 600; color: var(--accent); text-transform: uppercase; letter-spacing: 0.04em; margin-top: 2px; }
.batch-footer { display: flex; justify-content: space-between; align-items: center; padding: 16px 24px; border-top: 1px solid var(--border); }
.batch-stats-mini { font-size: 13px; color: var(--text-2); }
.batch-done { align-items: center; justify-content: center; gap: 16px; padding: 60px 40px; }
.batch-done-icon { font-size: 48px; color: var(--green, #22c55e); }
.batch-done-title { font-size: 28px; font-weight: 700; }
.batch-done-stats { color: var(--text-2); font-size: 15px; }


/* ── Custom Invoice page ──────────────────────────────────────────────────── */
.ci-page { padding: 0; }
.ci-layout {
  display: grid;
  grid-template-columns: 1fr 480px;
  gap: 24px;
  align-items: start;
  padding-bottom: 40px;
}
@media (max-width: 1100px) {
  .ci-layout { grid-template-columns: 1fr; }
}
.ci-form { display: flex; flex-direction: column; }
.ci-preview {
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
}
.ci-line-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}
