:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #15202b;
  --muted: #64748b;
  --line: #d9e2ef;
  --primary: #116466;
  --primary-2: #0a7c86;
  --green: #1f8a5b;
  --amber: #b7791f;
  --red: #c24141;
  --shadow: 0 18px 50px rgba(15, 23, 42, .08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 "Inter", "Segoe UI", Arial, sans-serif;
}
a { color: var(--primary-2); text-decoration: none; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; }
input, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  color: var(--ink);
  background: #fff;
}
label { display: grid; gap: 6px; color: var(--muted); font-weight: 700; }
h1, h2, p { margin-top: 0; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 250px;
  padding: 18px;
  background: #102a43;
  color: #fff;
}
.logo { display: flex; align-items: center; gap: 10px; color: #fff; margin-bottom: 24px; }
.logo span, .brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #2dd4bf;
  color: #082f49;
  font-weight: 900;
}
.sidebar nav { display: grid; gap: 6px; }
.sidebar nav a {
  color: #cbd5e1;
  padding: 11px 12px;
  border-radius: 8px;
  font-weight: 700;
}
.sidebar nav a.active, .sidebar nav a:hover { background: rgba(255,255,255,.12); color: #fff; }
.shell { margin-left: 250px; min-height: 100vh; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 26px;
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar span, .muted, small { color: var(--muted); }
.content { padding: 26px; display: grid; gap: 22px; }
.page-title { display: flex; justify-content: space-between; align-items: end; gap: 20px; }
.page-title h1 { margin-bottom: 2px; font-size: 30px; }
.page-title span { color: var(--muted); }
.hero-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 30px;
  border-radius: 8px;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(17,100,102,.96), rgba(16,42,67,.95)),
    radial-gradient(circle at 75% 20%, rgba(45,212,191,.45), transparent 28%);
  box-shadow: var(--shadow);
}
.hero-band h1 { font-size: 34px; margin-bottom: 8px; letter-spacing: 0; }
.hero-band p { max-width: 680px; color: #d7fffb; margin-bottom: 0; }
.eyebrow { color: #8ee8dd; font-weight: 900; text-transform: uppercase; font-size: 12px; }
.hero-meter {
  min-width: 210px;
  padding: 20px;
  border-radius: 8px;
  background: rgba(255,255,255,.13);
  border: 1px solid rgba(255,255,255,.25);
}
.hero-meter strong { display: block; font-size: 28px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.stat, .panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.stat { padding: 18px; border-left: 5px solid var(--primary); }
.stat span { color: var(--muted); font-weight: 800; }
.stat strong { display: block; margin-top: 8px; font-size: 26px; }
.stat.green { border-left-color: var(--green); }
.stat.amber { border-left-color: var(--amber); }
.stat.red { border-left-color: var(--red); }
.panel { padding: 18px; overflow: auto; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 14px; }
.panel-head h2, .panel h2 { font-size: 18px; margin-bottom: 0; }
.grid { display: grid; gap: 18px; }
.grid.two { grid-template-columns: minmax(0, 1.4fr) minmax(320px, .8fr); }
.pos-grid { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; margin-bottom: 18px; }
.stack { display: grid; gap: 14px; }
.btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 14px;
  background: #fff;
  color: var(--ink);
  font-weight: 900;
  cursor: pointer;
}
.btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn.ghost { background: transparent; }
.btn.small { min-height: 34px; padding: 6px 10px; font-size: 13px; }
.alert { margin: 16px 26px 0; padding: 12px 14px; border-radius: 8px; background: #e7f8f5; color: #075e54; border: 1px solid #a7f3d0; }
.alert.danger { background: #fff1f2; color: #9f1239; border-color: #fecdd3; }
.pill {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 999px;
  background: #e7f8f5;
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
}
.list { display: grid; gap: 10px; }
.list > div { display: flex; justify-content: space-between; gap: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
.list span { color: var(--muted); }
.sale-items { display: grid; gap: 10px; margin-bottom: 12px; }
.sale-row { display: grid; grid-template-columns: 1fr 110px; gap: 10px; }
.checkout { position: sticky; top: 82px; }
.warn-row td { background: #fff8e6; }
.bar-chart, .line-chart { width: 100%; min-height: 260px; }
.footer { color: var(--muted); padding: 10px 26px 28px; }

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    linear-gradient(135deg, rgba(16,42,67,.92), rgba(17,100,102,.9)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cpath d='M0 80h160M80 0v160' stroke='%23ffffff' stroke-opacity='.08'/%3E%3C/svg%3E");
}
.auth-card {
  width: min(440px, 100%);
  background: #fff;
  border-radius: 8px;
  padding: 30px;
  box-shadow: 0 28px 80px rgba(0,0,0,.24);
}
.auth-card h1 { margin: 14px 0 6px; }

.invoice-page { max-width: 980px; margin: 0 auto; }
.print-actions { display: flex; justify-content: flex-end; gap: 10px; }
.invoice-sheet {
  background: #fff;
  border-radius: 8px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 34px;
}
.invoice-head, .invoice-parties {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
  margin-bottom: 18px;
}
.invoice-meta { display: grid; gap: 4px; text-align: right; }
.invoice-parties > div { display: grid; gap: 3px; }
.invoice-parties span { color: var(--muted); text-transform: uppercase; font-size: 12px; font-weight: 900; }
.totals { width: min(340px, 100%); margin-left: auto; display: grid; gap: 8px; padding-top: 18px; }
.totals div { display: flex; justify-content: space-between; }
.totals .grand { border-top: 2px solid var(--ink); padding-top: 10px; font-size: 18px; }
.receipt-footer { text-align: center; margin-top: 24px; color: var(--muted); }

@media (max-width: 920px) {
  .sidebar { position: static; width: auto; }
  .shell { margin-left: 0; }
  .sidebar nav { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .stats-grid, .grid.two, .pos-grid, .form-grid { grid-template-columns: 1fr; }
  .hero-band, .page-title, .invoice-head, .invoice-parties { align-items: stretch; flex-direction: column; }
  .checkout { position: static; }
}

@media print {
  body { background: #fff; }
  .sidebar, .topbar, .footer, .print-actions, .alert { display: none !important; }
  .shell, .content, .invoice-page { margin: 0; padding: 0; max-width: none; }
  .invoice-sheet { box-shadow: none; border: 0; border-radius: 0; }
  body.print-thermal .invoice-sheet { width: 80mm; padding: 5mm; font-size: 11px; }
  body.print-thermal .invoice-head, body.print-thermal .invoice-parties { display: block; text-align: center; }
  body.print-thermal .invoice-meta { text-align: center; }
  body.print-thermal th:nth-child(2), body.print-thermal td:nth-child(2),
  body.print-thermal th:nth-child(3), body.print-thermal td:nth-child(3) { display: none; }
  body.print-thermal th, body.print-thermal td { padding: 5px 3px; }
  body.print-a4 .invoice-sheet { width: 210mm; min-height: 297mm; padding: 15mm; }
}
