/* Crystal Books — Neon Dark theme
   Glowing fluorescent accents over a deep animated background. */

:root {
  --bg: #07070e;
  --surface: rgba(18, 18, 31, 0.72);
  --card: rgba(26, 26, 46, 0.66);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --muted: #5f5f82;
  --text: #eceafe;
  --text-soft: #a5a3c5;
  --accent: #818cf8;
  --accent-2: #a855f7;
  --cyan: #22d3ee;
  --pink: #ec4899;
  --success: #34d399;
  --warning: #fbbf24;
  --error: #fb7185;
  --radius: 10px;
  --glow-accent: 0 0 14px rgba(129, 140, 248, 0.45);
  --glow-strong: 0 0 22px rgba(168, 85, 247, 0.5);
  --font: "Rajdhani", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: "Orbitron", "Rajdhani", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
[hidden] { display: none !important; }

body {
  font-family: var(--font);
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
  background: var(--bg);
  padding-left: 232px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(168, 85, 247, 0.4); }

/* ---------- Animated glowing background ---------- */
.bg-glow {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 20% -10%, rgba(99, 102, 241, 0.16), transparent 55%),
    radial-gradient(ellipse at 110% 110%, rgba(236, 72, 153, 0.10), transparent 55%),
    var(--bg);
}
.bg-glow span {
  position: absolute;
  width: 480px;
  height: 480px;
  border-radius: 50%;
  filter: blur(110px);
  opacity: 0.32;
  animation: drift 26s ease-in-out infinite alternate;
}
.bg-glow span:nth-child(1) { background: #4f46e5; top: -10%; left: -5%; }
.bg-glow span:nth-child(2) { background: #9333ea; bottom: -15%; right: 0%; animation-delay: -9s; }
.bg-glow span:nth-child(3) { background: #0e7490; top: 40%; left: 45%; width: 380px; height: 380px; animation-delay: -17s; }

@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(80px, 60px) scale(1.15); }
}

/* ---------- Sidebar navigation ---------- */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: 232px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  background: rgba(12, 12, 22, 0.82);
  backdrop-filter: blur(16px);
  border-right: 1px solid var(--border);
}

.brand {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 4px 10px 18px;
  white-space: nowrap;
}
.brand-text {
  background: linear-gradient(95deg, #818cf8, #c084fc, #22d3ee);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 12px rgba(168, 85, 247, 0.5));
}
.brand-text em {
  font-style: normal;
  font-weight: 600;
  color: #fff;
  -webkit-text-fill-color: #fff;
  text-shadow: 0 0 14px rgba(255, 255, 255, 0.5);
}

.tabs { display: flex; flex-direction: column; gap: 3px; flex: 1; }

.nav-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 16px 12px 6px;
}

.tab {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  border: 1px solid transparent;
  background: none;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-soft);
  padding: 9px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  transition: background 150ms, color 150ms, border-color 150ms, box-shadow 200ms;
}
.tab-ico { font-size: 16px; width: 22px; text-align: center; filter: saturate(0.4) brightness(0.9); transition: filter 150ms; }
.tab:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.tab:hover .tab-ico { filter: none; }
.tab.active {
  color: #fff;
  background: linear-gradient(120deg, rgba(99, 102, 241, 0.32), rgba(168, 85, 247, 0.22));
  border-color: rgba(139, 124, 246, 0.45);
  box-shadow: var(--glow-accent), inset 0 0 18px rgba(99, 102, 241, 0.12);
  text-shadow: 0 0 10px rgba(165, 180, 252, 0.8);
}
.tab.active .tab-ico { filter: none; }
.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.sidebar-foot {
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 12px;
  border-top: 1px solid var(--border);
  text-transform: uppercase;
  line-height: 1.7;
}

main { max-width: 1180px; margin: 0 auto; padding: 28px 28px 80px; }

.view { animation: view-in 280ms cubic-bezier(0.22, 1, 0.36, 1); }
@keyframes view-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 12px 32px -16px rgba(0, 0, 0, 0.6);
  padding: 24px;
  margin-bottom: 20px;
  transition: border-color 200ms;
}
.card:hover { border-color: rgba(139, 124, 246, 0.22); }

.card-toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.card-toolbar input[type="search"] { flex: 1; max-width: 420px; min-width: 200px; }

/* ---------- Forms ---------- */
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-soft); }

input, select {
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 9px 12px;
  outline: none;
  transition: border-color 150ms, box-shadow 200ms, background 150ms;
  color-scheme: dark;
}
input::placeholder { color: var(--muted); font-weight: 500; }
input:focus, select:focus {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.08);
  box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.18), var(--glow-accent);
}
input[type="number"] { text-align: right; }
select option { background: #14142a; color: var(--text); }

.form-grid {
  display: grid;
  grid-template-columns: 160px 1fr 200px 180px;
  gap: 16px;
  margin-bottom: 24px;
}

.hint { font-weight: 500; font-size: 12px; color: var(--muted); text-transform: none; letter-spacing: 0; }

.edit-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: linear-gradient(120deg, rgba(99, 102, 241, 0.16), rgba(168, 85, 247, 0.10));
  border: 1px solid rgba(139, 124, 246, 0.4);
  box-shadow: inset 0 0 24px rgba(99, 102, 241, 0.08);
  border-radius: var(--radius);
  padding: 10px 16px;
  margin-bottom: 20px;
  font-size: 15px;
  font-weight: 600;
  color: #c7d2fe;
}
.edit-banner .btn { padding: 6px 14px; font-size: 13px; }

.scan-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.scan-bar .btn { min-width: 170px; }

/* ---------- Buttons ---------- */
.btn {
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.03em;
  border-radius: var(--radius);
  padding: 10px 20px;
  cursor: pointer;
  border: none;
  transition: transform 120ms, box-shadow 250ms, background 150ms, border-color 150ms;
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn.primary {
  background: linear-gradient(120deg, #6366f1, #9333ea);
  color: #fff;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.4);
  box-shadow: 0 0 16px rgba(124, 92, 246, 0.35);
}
.btn.primary:hover { box-shadow: var(--glow-strong), 0 0 30px rgba(99, 102, 241, 0.35); }
.btn.primary:disabled { opacity: 0.55; cursor: wait; box-shadow: none; }
.btn.primary kbd {
  font-family: inherit; font-size: 11px; background: rgba(255, 255, 255, 0.2);
  border-radius: 4px; padding: 1px 5px; margin-left: 6px;
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-strong);
  color: var(--text-soft);
}
.btn.ghost:hover { border-color: var(--accent); color: #c7d2fe; box-shadow: var(--glow-accent); }

a.btn { text-decoration: none; display: inline-flex; align-items: center; }

.icon-btn {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; background: transparent; border-radius: 8px;
  color: var(--muted); cursor: pointer; font-size: 15px;
  transition: background 120ms, color 120ms, box-shadow 200ms;
}
.icon-btn:hover { background: rgba(129, 140, 248, 0.15); color: var(--text); box-shadow: var(--glow-accent); }
.icon-btn.danger:hover { background: rgba(251, 113, 133, 0.15); color: var(--error); box-shadow: 0 0 14px rgba(251, 113, 133, 0.35); }

.link-btn {
  border: none; background: none; color: var(--accent);
  font-size: 13px; font-weight: 700; cursor: pointer; padding: 2px 4px;
  font-family: inherit;
}
.link-btn:hover { text-shadow: 0 0 10px rgba(129, 140, 248, 0.9); }

.cell-link {
  border: none; background: none; padding: 0;
  font: inherit; color: inherit; cursor: pointer;
  border-bottom: 1px dashed rgba(129, 140, 248, 0.45);
  transition: color 120ms, text-shadow 150ms;
  text-align: left;
}
.cell-link:hover { color: #a5b4fc; text-shadow: 0 0 12px rgba(129, 140, 248, 0.8); }

/* ---------- Purchase lines table ---------- */
.lines-table { width: 100%; border-collapse: collapse; }
.lines-table th {
  text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--muted); font-weight: 700; padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
.lines-table td { padding: 6px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.lines-table .col-num { width: 36px; }
.lines-table .col-qty { width: 110px; }
.lines-table .col-rate { width: 140px; }
.lines-table .col-amt { width: 130px; text-align: right; }
.lines-table .col-x { width: 44px; }
.lines-table td.col-amt { font-weight: 700; padding-top: 14px; white-space: nowrap; color: #c7d2fe; }
.lines-table td.col-num { color: var(--muted); padding-top: 14px; }
.lines-table input { width: 100%; }

#add-row { margin-top: 12px; }

/* ---------- Item picker / typeahead ---------- */
.item-picker { position: relative; }
.item-picker input { width: 100%; }

.dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 40;
  background: rgba(18, 18, 34, 0.97);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(139, 124, 246, 0.35);
  border-radius: var(--radius);
  box-shadow: 0 18px 42px -8px rgba(0, 0, 0, 0.7), var(--glow-accent);
  max-height: 320px;
  overflow-y: auto;
  animation: pop-in 140ms ease-out;
}
@keyframes pop-in {
  from { opacity: 0; transform: translateY(-6px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.dropdown .opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  cursor: pointer;
  font-size: 15px;
}
.dropdown .opt:hover, .dropdown .opt.active {
  background: linear-gradient(120deg, rgba(99, 102, 241, 0.25), rgba(168, 85, 247, 0.15));
  box-shadow: inset 2px 0 0 var(--accent);
}
.dropdown .opt .opt-name mark { background: rgba(250, 204, 21, 0.22); color: #fde047; border-radius: 2px; padding: 0 1px; }
.dropdown .opt .opt-meta { font-size: 12px; color: var(--text-soft); white-space: nowrap; }
.dropdown .opt.add-new { color: #a5b4fc; font-weight: 700; border-top: 1px solid var(--border); }
.dropdown .opt-empty { padding: 10px 12px; font-size: 13px; color: var(--muted); }

.opt-main { display: flex; align-items: center; gap: 10px; min-width: 0; }
.opt-main .opt-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

mark { background: rgba(250, 204, 21, 0.22); color: #fde047; border-radius: 2px; padding: 0 1px; }

.item-selected {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px 2px;
  min-height: 38px;
}
.item-selected .item-name { font-weight: 700; }

/* ---------- Badges ---------- */
.badge {
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-soft);
  border: 1px solid var(--border-strong);
  border-radius: 99px; padding: 2px 9px;
  text-transform: uppercase;
}
.badge.new {
  background: rgba(52, 211, 153, 0.12); color: var(--success);
  border-color: rgba(52, 211, 153, 0.5);
  box-shadow: 0 0 10px rgba(52, 211, 153, 0.35);
}
.badge.due {
  background: rgba(251, 113, 133, 0.12); color: var(--error);
  border-color: rgba(251, 113, 133, 0.5);
  box-shadow: 0 0 10px rgba(251, 113, 133, 0.3);
  margin-left: 6px;
}
.badge.platform {
  background: rgba(34, 211, 238, 0.10); color: var(--cyan);
  border-color: rgba(34, 211, 238, 0.45);
  box-shadow: 0 0 10px rgba(34, 211, 238, 0.25);
}

.stock-pill {
  display: inline-block;
  min-width: 44px;
  text-align: center;
  font-weight: 700;
  border-radius: 99px;
  padding: 3px 10px;
  font-size: 14px;
}
.stock-pill.ok { color: var(--success); background: rgba(52, 211, 153, 0.10); border: 1px solid rgba(52, 211, 153, 0.45); box-shadow: 0 0 12px rgba(52, 211, 153, 0.25); }
.stock-pill.low { color: var(--warning); background: rgba(251, 191, 36, 0.10); border: 1px solid rgba(251, 191, 36, 0.45); box-shadow: 0 0 12px rgba(251, 191, 36, 0.25); }
.stock-pill.out { color: var(--error); background: rgba(251, 113, 133, 0.10); border: 1px solid rgba(251, 113, 133, 0.5); box-shadow: 0 0 12px rgba(251, 113, 133, 0.3); }

.new-fields { display: flex; gap: 8px; width: 100%; margin-top: 4px; }
.new-fields input { font-size: 12px; padding: 5px 8px; width: 110px; }

/* ---------- Entry footer / totals ---------- */
.entry-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 32px;
  margin-top: 24px;
}
.notes-field { flex: 1; max-width: 420px; }

.totals { width: 330px; display: flex; flex-direction: column; gap: 10px; }
.t-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 15px;
  color: var(--text-soft);
}
.t-row input { width: 130px; padding: 6px 10px; }
.t-row.grand {
  font-family: var(--font-display);
  font-size: 19px; font-weight: 800; color: #fff;
  border-top: 1px solid rgba(139, 124, 246, 0.4); padding-top: 12px; margin-top: 4px;
  text-shadow: 0 0 16px rgba(165, 180, 252, 0.7);
}
.totals .btn { margin-top: 8px; }

/* ---------- Stats ---------- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--card);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px 20px;
  transition: border-color 200ms, box-shadow 250ms, transform 150ms;
}
.stat-card.clickable { cursor: pointer; }
.stat-card.clickable:hover, .stat-card:hover {
  border-color: rgba(139, 124, 246, 0.45);
  box-shadow: var(--glow-accent);
  transform: translateY(-2px);
}
.stat-card .stat-label { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.14em; }
.stat-card .stat-value {
  font-family: var(--font-display);
  font-size: 23px; font-weight: 800; margin-top: 6px;
  color: #e0e7ff;
  text-shadow: 0 0 18px rgba(129, 140, 248, 0.65);
  white-space: nowrap;
}
.stat-card .stat-sub { font-size: 12px; color: var(--text-soft); margin-top: 3px; }

/* ---------- Data tables ---------- */
.data-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.data-table th {
  text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--muted); font-weight: 700; padding: 10px;
  border-bottom: 1px solid var(--border-strong);
}
.data-table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tbody tr { transition: background 120ms; }
.data-table tbody tr:hover > td { background: rgba(99, 102, 241, 0.07); }
.data-table th.num, .data-table td.num { text-align: right; }
.data-table td.num { font-weight: 700; white-space: nowrap; }
.data-table .items-summary {
  max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--text-soft); font-size: 13px;
}
.data-table .row-actions { white-space: nowrap; text-align: right; }
tr.return-row > td { background: rgba(251, 113, 133, 0.04); }

.detail-row td { background: rgba(10, 10, 20, 0.5) !important; padding: 14px 24px; }
.detail-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.detail-table th { text-align: left; color: var(--muted); font-weight: 700; padding: 4px 8px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; }
.detail-table td { padding: 4px 8px; border-bottom: none; }
.detail-table .num { text-align: right; }
.detail-notes { font-size: 13px; color: var(--text-soft); margin-top: 8px; }

.ledger-summary {
  margin-top: 10px; padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 14px; color: var(--text-soft);
}

/* ---------- Sale entry ---------- */
.sale-form {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-end;
}
.sale-form > label { flex: 0 0 auto; }
.sale-form > label:nth-of-type(1) { width: 110px; }  /* type */
.sale-form > label:nth-of-type(2) { width: 160px; }  /* date */
.sale-form > label:nth-of-type(3) { width: 180px; }  /* platform */
.sale-form > label:nth-of-type(4) { width: 190px; }  /* order no */
.sale-form > .sale-item-field { flex: 1 1 280px; min-width: 240px; }
.sale-form > label:nth-of-type(6) { width: 90px; }   /* qty */
.sale-form > label:nth-of-type(7) { width: 130px; }  /* rate */
#sale-retfee-label { width: 130px; }
.sale-form .btn { height: 41px; white-space: nowrap; flex: 0 0 auto; }
.sale-item-field { position: relative; }

/* ---------- Report ---------- */
.report-controls {
  display: flex;
  gap: 14px;
  align-items: end;
  flex-wrap: wrap;
  padding: 18px 24px;
}
.report-controls .btn { padding: 8px 16px; font-size: 13px; }

.report-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.report-grid .card { margin-bottom: 0; }
.report-title {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #c7d2fe;
  text-shadow: 0 0 14px rgba(129, 140, 248, 0.55);
}

.bar-row {
  display: grid;
  grid-template-columns: 110px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 7px 0;
  font-size: 14px;
}
.bar-label { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track {
  height: 10px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 99px;
  overflow: hidden;
}
.bar-fill {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #6366f1, #a855f7, #22d3ee);
  box-shadow: 0 0 12px rgba(139, 124, 246, 0.7);
  animation: bar-grow 600ms cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes bar-grow { from { width: 0 !important; } }
.bar-value { font-weight: 700; white-space: nowrap; }
.empty-line { color: var(--muted); font-size: 14px; padding: 8px 0; }

/* ---------- Item images ---------- */
.thumb, .thumb-sm, .thumb-lg {
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.04);
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}
.thumb { width: 36px; height: 36px; }
.thumb-sm { width: 28px; height: 28px; }
.thumb-lg { width: 72px; height: 72px; border-radius: 12px; }

span.ph {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}
span.thumb.ph { font-size: 16px; }
span.thumb-sm.ph { font-size: 13px; }
span.thumb-lg.ph { font-size: 28px; }

.thumb-col, .thumb-cell { width: 48px; }
.thumb-cell a { display: inline-flex; }
.thumb-cell .thumb { transition: transform 150ms, box-shadow 200ms; }
.thumb-cell a:hover .thumb { transform: scale(1.9); box-shadow: var(--glow-strong); }

.image-field { display: flex; align-items: center; gap: 14px; }
.image-actions { display: flex; gap: 8px; }
.image-actions .btn { padding: 7px 14px; font-size: 13px; }

/* ---------- Balances ---------- */
.amt-due { color: var(--error) !important; text-shadow: 0 0 12px rgba(251, 113, 133, 0.5); }
.amt-ok { color: var(--success) !important; text-shadow: 0 0 12px rgba(52, 211, 153, 0.45); }
.sub-text { font-size: 11px; color: var(--muted); font-weight: 500; }
.pay-due { font-size: 14px; font-weight: 700; min-height: 18px; }
.adj-item-name { font-size: 15px; font-weight: 700; color: #c7d2fe; }

/* ---------- Empty states ---------- */
.empty { text-align: center; padding: 48px 24px; }
.empty-icon { font-size: 44px; filter: drop-shadow(0 0 18px rgba(129, 140, 248, 0.6)); }
.empty h3 { margin: 12px 0 4px; font-family: var(--font-display); letter-spacing: 0.04em; }
.empty p { color: var(--text-soft); margin: 0; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(5, 5, 12, 0.72);
  backdrop-filter: blur(5px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.modal {
  background: rgba(20, 20, 38, 0.96);
  border: 1px solid rgba(139, 124, 246, 0.35);
  border-radius: 16px;
  box-shadow: 0 30px 70px -20px rgba(0, 0, 0, 0.8), var(--glow-accent);
  width: 100%; max-width: 540px;
  padding: 24px;
  animation: modal-in 220ms cubic-bezier(0.22, 1, 0.36, 1);
  max-height: 90vh;
  overflow-y: auto;
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to { opacity: 1; transform: none; }
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px;
}
.modal h2 {
  margin: 0; font-size: 18px;
  font-family: var(--font-display);
  letter-spacing: 0.04em;
  text-shadow: 0 0 16px rgba(129, 140, 248, 0.6);
}
.modal form { display: flex; flex-direction: column; gap: 14px; }
.modal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

/* ---------- Bulk import ---------- */
.import-help {
  font-size: 14px; color: var(--text-soft);
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 14px;
  margin: 0 0 14px; line-height: 1.7;
}
.import-help a { color: var(--accent); font-weight: 700; }

#import-file { width: 100%; padding: 10px; background: rgba(255, 255, 255, 0.04); }

.import-status { font-size: 13px; color: var(--text-soft); padding: 10px 2px; }

.import-summary {
  font-size: 14px; line-height: 1.7;
  background: rgba(99, 102, 241, 0.10); border: 1px solid rgba(139, 124, 246, 0.4);
  border-radius: var(--radius); padding: 10px 14px; margin-top: 12px;
}

.import-list {
  max-height: 180px; overflow-y: auto;
  font-size: 13px; color: var(--text-soft);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 8px 12px; margin-top: 10px;
  display: flex; flex-direction: column; gap: 4px;
}

.import-errors {
  font-size: 14px; line-height: 1.6; color: var(--error);
  background: rgba(251, 113, 133, 0.08); border: 1px solid rgba(251, 113, 133, 0.4);
  border-radius: var(--radius); padding: 10px 14px; margin-top: 12px;
}

/* ---------- Toasts ---------- */
#toast-wrap {
  position: fixed; bottom: 24px; right: 24px; z-index: 200;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: rgba(16, 16, 30, 0.95);
  backdrop-filter: blur(12px);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 12px 18px;
  font-size: 15px; font-weight: 600;
  animation: toast-in 240ms cubic-bezier(0.22, 1, 0.36, 1);
}
.toast.success { border-left: 3px solid var(--success); box-shadow: -4px 0 18px -6px rgba(52, 211, 153, 0.5), 0 10px 30px -10px rgba(0,0,0,.7); }
.toast.error { border-left: 3px solid var(--error); box-shadow: -4px 0 18px -6px rgba(251, 113, 133, 0.5), 0 10px 30px -10px rgba(0,0,0,.7); }
@keyframes toast-in {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: none; }
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(129, 140, 248, 0.25); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(129, 140, 248, 0.45); }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .bg-glow span { animation: none; }
  .view, .modal, .dropdown, .toast, .bar-fill { animation: none; }
  * { transition: none !important; }
}

/* ---------- Responsive ---------- */
@media (max-width: 920px) {
  body { padding-left: 0; padding-top: 104px; }
  .sidebar {
    bottom: auto; right: 0; width: 100%;
    flex-direction: column;
    padding: 10px 12px;
  }
  .brand { padding: 2px 6px 8px; font-size: 16px; }
  .tabs { flex-direction: row; overflow-x: auto; gap: 6px; padding-bottom: 4px; }
  .nav-label { display: none; }
  .tab { width: auto; white-space: nowrap; padding: 7px 12px; font-size: 13px; }
  .sidebar-foot { display: none; }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .sale-form > label { flex: 1 1 140px; width: auto !important; }
  .sale-form .btn { flex: 1 1 100%; }
  .entry-footer { flex-direction: column; }
  .totals { width: 100%; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .report-grid { grid-template-columns: 1fr; }
  main { padding: 16px 12px 60px; }
  .card { padding: 16px; }
}
