:root {
  /* ── Backgrounds ─────────────────────────────────────────── */
  --bg:               #0a0b0c;
  --card:             #111315;
  --card-hover:       #16181b;
  --surface-2:        #1a1d21;
  --sidebar:          #0d0f11;
  --elevated:         #16181b;

  /* ── Borders ─────────────────────────────────────────────── */
  --line:             rgba(255,255,255,0.08);
  --line-light:       rgba(255,255,255,0.05);
  --line-dark:        rgba(255,255,255,0.14);

  /* ── Text ────────────────────────────────────────────────── */
  --text:             #f1f2f4;
  --text-secondary:   #8b8fa8;
  --muted:            #5a5f74;
  --muted-light:      #3e4254;

  /* ── Primary accent (Linear indigo-purple) ───────────────── */
  --primary:          #5e6ad2;
  --primary-h:        #4f5bbf;
  --primary-light:    rgba(94,106,210,0.15);
  --primary-border:   rgba(94,106,210,0.35);

  /* ── Status colors ───────────────────────────────────────── */
  --ok:               #35ca78;
  --ok-bg:            rgba(53,202,120,0.12);
  --ok-border:        rgba(53,202,120,0.30);
  --warn:             #f5a623;
  --warn-bg:          rgba(245,166,35,0.12);
  --warn-border:      rgba(245,166,35,0.30);
  --bad:              #ef5f5b;
  --bad-bg:           rgba(239,95,91,0.12);
  --bad-border:       rgba(239,95,91,0.30);

  /* ── Radii ───────────────────────────────────────────────── */
  --radius-sm:        5px;
  --radius:           8px;
  --radius-lg:        10px;
  --radius-xl:        14px;

  /* ── Shadows ─────────────────────────────────────────────── */
  --shadow-sm:        0 1px 2px rgba(0,0,0,0.40);
  --shadow:           0 2px 8px rgba(0,0,0,0.50);
  --shadow-md:        0 4px 16px rgba(0,0,0,0.55);
  --shadow-lg:        0 8px 32px rgba(0,0,0,0.65);

  /* ── Typography ──────────────────────────────────────────── */
  --font-sans:        'Inter Variable', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:        'JetBrains Mono', 'Fira Code', 'Cascadia Code', ui-monospace, monospace;
}

/* =============================================================
   0. RESET / GLOBAL BASE
============================================================= */

[hidden] { display: none !important; }

*, *::before, *::after {
  box-sizing: border-box;
}

::selection {
  background: rgba(94,106,210,0.35);
  color: var(--text);
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.22); }
::-webkit-scrollbar-corner { background: transparent; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; transition: color 0.15s ease; }
a:hover { color: var(--primary-h); }

h1, h2, h3, h4, h5, h6 {
  margin: 0 0 0.5em;
  font-weight: 600;
  line-height: 1.25;
  color: var(--text);
  letter-spacing: -0.015em;
}

p { margin: 0 0 1em; color: var(--text-secondary); }

hr { border: none; border-top: 1px solid var(--line); margin: 1.25rem 0; }

code, pre {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--card-hover);
  border-radius: var(--radius-sm);
  color: var(--text);
}
code { padding: 0.15em 0.45em; }
pre  { padding: 1rem; overflow-x: auto; border: 1px solid var(--line); }

/* =============================================================
   1. TOPBAR
============================================================= */

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 54px;
  padding: 0 20px;
  background: var(--sidebar);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 var(--line);
}

.topbar .logo,
.topbar .brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  white-space: nowrap;
  margin-right: 4px;
  text-decoration: none;
}

.topbar .spacer { flex: 1; }

.topbar select,
#storeSel {
  appearance: none;
  -webkit-appearance: none;
  height: 32px;
  padding: 0 32px 0 10px;
  background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b8fa8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 8px center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
  min-width: 140px;
}
.topbar select:hover, #storeSel:hover { border-color: var(--line-dark); background-color: var(--card-hover); }
.topbar select:focus, #storeSel:focus {
  outline: none;
  border-color: var(--primary-border);
  box-shadow: 0 0 0 3px rgba(94,106,210,0.15);
}

.topbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
  white-space: nowrap;
  text-decoration: none;
  outline: none;
}

.topbar-btn.pos-btn {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 1px 3px rgba(94,106,210,0.35);
}
.topbar-btn.pos-btn:hover {
  background: var(--primary-h);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(94,106,210,0.45);
}
.topbar-btn.pos-btn:active { transform: translateY(0); box-shadow: 0 1px 2px rgba(94,106,210,0.25); }

.topbar-btn.admin-btn {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--line);
}
.topbar-btn.admin-btn:hover {
  background: var(--card-hover);
  color: var(--text);
  border-color: var(--line-dark);
}

.topbar-btn.logout-btn {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--line);
}
.topbar-btn.logout-btn:hover {
  background: var(--bad-bg);
  color: var(--bad);
  border-color: var(--bad-border);
}

.topbar-user, #who {
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 4px;
}

.topbar .badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 600;
  background: var(--card-hover);
  color: var(--text-secondary);
  border: 1px solid var(--line);
  line-height: 1;
}
.topbar .badge.ok  { background: var(--ok-bg);  color: var(--ok);  border-color: var(--ok-border);  }
.topbar .badge.bad { background: var(--bad-bg); color: var(--bad); border-color: var(--bad-border); }

/* =============================================================
   2. MAIN LAYOUT
============================================================= */

.layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: calc(100vh - 54px);
  align-items: start;
}

#nav {
  position: sticky;
  top: 54px;
  width: 240px;
  height: calc(100vh - 54px);
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  padding: 12px 0 24px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.08) transparent;
}

.nav-section-label {
  padding: 14px 16px 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  user-select: none;
}

#nav a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 14px 7px 16px;
  margin: 0 8px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 450;
  text-decoration: none;
  transition: all 0.15s ease;
  position: relative;
  border-left: 3px solid transparent;
  user-select: none;
}

#nav a:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text);
  border-left-color: rgba(94,106,210,0.35);
}

#nav a.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 550;
  border-left-color: var(--primary);
}

#nav a.active .nav-icon { opacity: 1; color: var(--primary); }

.nav-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.75;
  transition: opacity 0.15s ease, color 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}
#nav a:hover .nav-icon { opacity: 1; }

.nav-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-subitems {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 2px 0;
}

.nav-subitem {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 14px 5px 32px;
  margin: 0 8px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 12.5px;
  text-decoration: none;
  transition: all 0.15s ease;
  border-left: 3px solid transparent;
}
.nav-subitem:hover  { background: rgba(255,255,255,0.04); color: var(--text-secondary); border-left-color: rgba(94,106,210,0.25); }
.nav-subitem.active { color: var(--primary); background: var(--primary-light); border-left-color: var(--primary); }

#view {
  padding: 24px 32px;
  max-width: 1600px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

/* =============================================================
   3. PAGE STRUCTURE
============================================================= */

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.page-head h2 {
  font-size: 20px;
  font-weight: 650;
  color: var(--text);
  letter-spacing: -0.025em;
  margin: 0;
}

.actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* =============================================================
   4. BUTTONS
============================================================= */

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  user-select: none;
  outline: none;
  line-height: 1;
  letter-spacing: -0.005em;
}

button:hover:not(:disabled) {
  background: var(--card-hover);
  color: var(--text);
  border-color: var(--line-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

button:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: none;
}

button:focus-visible {
  outline: 3px solid rgba(94,106,210,0.30);
  outline-offset: 2px;
}

button:disabled { opacity: 0.42; cursor: not-allowed; pointer-events: none; }

button.primary {
  background: var(--primary);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 1px 4px rgba(94,106,210,0.30);
}
button.primary:hover:not(:disabled) {
  background: var(--primary-h);
  box-shadow: 0 3px 10px rgba(94,106,210,0.45);
}

button.danger {
  background: transparent;
  color: var(--bad);
  border-color: var(--bad-border);
}
button.danger:hover:not(:disabled) {
  background: var(--bad-bg);
  border-color: var(--bad);
}

button.small, button.sm {
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

button.big {
  height: 42px;
  padding: 0 20px;
  font-size: 15px;
  border-radius: var(--radius-lg);
}

button.link {
  background: transparent;
  border-color: transparent;
  color: var(--primary);
  padding: 0 4px;
  height: auto;
  font-weight: 450;
  box-shadow: none;
}
button.link:hover:not(:disabled) {
  background: transparent;
  color: var(--primary-h);
  transform: none;
  box-shadow: none;
  text-decoration: underline;
}

/* =============================================================
   5. INPUTS
============================================================= */

input, select, textarea {
  font-family: var(--font-sans);
  font-size: 13.5px;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  appearance: none;
  -webkit-appearance: none;
}

input[type=text], input[type=search], input[type=email],
input[type=password], input[type=number], input[type=date],
input[type=time], input[type=tel], input[type=url] {
  height: 34px;
  padding: 0 10px;
  width: 100%;
}

textarea {
  padding: 8px 10px;
  resize: vertical;
  min-height: 90px;
  width: 100%;
  line-height: 1.5;
}

select {
  height: 34px;
  padding: 0 32px 0 10px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b8fa8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  cursor: pointer;
  width: 100%;
}

input:hover, select:hover, textarea:hover { border-color: var(--line-dark); }

input:focus, select:focus, textarea:focus {
  border-color: var(--primary-border);
  box-shadow: 0 0 0 3px rgba(94,106,210,0.15);
  background: var(--card-hover);
}

input::placeholder, textarea::placeholder { color: var(--muted); }

input[type=checkbox], input[type=radio] {
  width: 15px; height: 15px;
  flex-shrink: 0;
  background: var(--card-hover);
  border: 1px solid var(--line-dark);
  border-radius: 3px;
  cursor: pointer;
  accent-color: var(--primary);
}

.period-picker {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.period-picker input { width: 140px; }
.period-picker span { color: var(--muted); font-size: 12px; }

/* =============================================================
   6. TABS
============================================================= */

.tab-bar {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
  padding: 0 2px;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  margin-bottom: -1px;
  outline: none;
  height: auto;
}

.tab-btn:hover {
  color: var(--text);
  background: rgba(255,255,255,0.04);
  border-color: var(--line-light);
  transform: none;
  box-shadow: none;
}

.tab-btn.active {
  color: var(--text);
  background: var(--card);
  border-color: var(--line);
  border-bottom-color: var(--card);
  font-weight: 550;
  box-shadow: none;
  transform: none;
}

.tab-btn:focus-visible {
  outline: 3px solid rgba(94,106,210,0.30);
  outline-offset: -2px;
}

/* =============================================================
   7. CARDS / KPIs
============================================================= */

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.kpi {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all 0.15s ease;
  position: relative;
  overflow: hidden;
}

.kpi::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 60%, rgba(255,255,255,0.015));
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.kpi:hover {
  background: var(--card-hover);
  border-color: var(--line-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.kpi:hover::after { opacity: 1; }

.kpi .lbl {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.kpi .num {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.kpi .sub { font-size: 11.5px; color: var(--muted); }

.kpi.warn {
  border-color: var(--warn-border);
  background: linear-gradient(135deg, var(--card) 70%, var(--warn-bg));
}
.kpi.warn .num { color: var(--warn); }

.kpi.bad {
  border-color: var(--bad-border);
  background: linear-gradient(135deg, var(--card) 70%, var(--bad-bg));
}
.kpi.bad .num { color: var(--bad); }

.kpi.ok {
  border-color: var(--ok-border);
  background: linear-gradient(135deg, var(--card) 70%, var(--ok-bg));
}
.kpi.ok .num { color: var(--ok); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  margin-bottom: 16px;
}
.card:hover { border-color: var(--line-dark); }
.card.narrow { max-width: 540px; }

.cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}

.bars { display: flex; flex-direction: column; gap: 8px; padding: 4px 0; }

.bar { display: flex; flex-direction: column; gap: 4px; }

.bar .bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
}

.bar .track { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }

.bar .fill {
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
  transition: width 0.4s cubic-bezier(0.4,0,0.2,1);
}

/* =============================================================
   8. TABLES — CRITICAL (Tailwind !important overrides)
============================================================= */

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--card);
  box-shadow: var(--shadow-sm);
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.08) transparent;
}

table,
table.grid,
table.data-grid,
table.table,
.table-wrap > table {
  display: table !important;
  width: 100% !important;
  border-collapse: collapse !important;
  border-spacing: 0 !important;
  font-size: 13.5px !important;
  color: var(--text) !important;
  background: transparent !important;
}

table thead,
table.grid thead,
table.data-grid thead,
table.table thead,
.table-wrap > table thead {
  display: table-header-group !important;
  background: var(--surface-2) !important;
  border-bottom: 1px solid var(--line) !important;
}

table tbody,
table.grid tbody,
table.data-grid tbody,
table.table tbody,
.table-wrap > table tbody {
  display: table-row-group !important;
}

table tr,
table.grid tr,
table.data-grid tr,
table.table tr,
.table-wrap > table tr {
  display: table-row !important;
  border-bottom: 1px solid var(--line-light) !important;
  transition: background 0.1s ease !important;
}

table tbody tr:hover,
table.grid tbody tr:hover,
table.data-grid tbody tr:hover,
table.table tbody tr:hover,
.table-wrap > table tbody tr:hover {
  background: rgba(255,255,255,0.03) !important;
  border-left: 2px solid rgba(94,106,210,0.20) !important;
}

table tbody tr:last-child,
table.grid tbody tr:last-child,
.table-wrap > table tbody tr:last-child {
  border-bottom: none !important;
}

table th,
table.grid th,
table.data-grid th,
table.table th,
.table-wrap > table th {
  display: table-cell !important;
  padding: 9px 14px !important;
  text-align: left !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  letter-spacing: 0.06em !important;
  text-transform: uppercase !important;
  color: var(--text-secondary) !important;
  white-space: nowrap !important;
  user-select: none !important;
}

table td,
table.grid td,
table.data-grid td,
table.table td,
.table-wrap > table td {
  display: table-cell !important;
  padding: 10px 14px !important;
  vertical-align: middle !important;
  color: var(--text) !important;
  font-size: 13.5px !important;
}

td.r, th.r, .r { text-align: right !important; }
td.c, th.c, .c { text-align: center !important; }

tr.click { cursor: pointer !important; }

.doc-lines-wrap {
  overflow-x: auto;
  overflow-y: auto;
  max-height: 60vh;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.doc-lines-wrap table {
  display: table !important;
  table-layout: fixed !important;
  width: 100% !important;
}

.doc-lines-wrap thead {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface-2) !important;
}

/* =============================================================
   9. FINANCIAL / P&L
============================================================= */

.pnl-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
}

table.pnl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  color: var(--text);
}

table.pnl td, table.pnl th {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line-light);
}

table.pnl th {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.pnl tr.total td {
  font-weight: 700;
  border-top: 2px solid var(--line-dark);
  color: var(--text);
  font-size: 14.5px;
}

.pnl tr.pnl-highlight td { color: var(--ok); font-weight: 600; background: var(--ok-bg); }
.pnl tr.pnl-highlight.bad td { color: var(--bad); background: var(--bad-bg); }

/* =============================================================
   10. BADGES / STATUS TAGS
============================================================= */

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  border: 1px solid var(--line);
  background: var(--card-hover);
  color: var(--text-secondary);
  white-space: nowrap;
  line-height: 1.6;
}

.badge.ok   { background: var(--ok-bg);   color: var(--ok);   border-color: var(--ok-border);   }
.badge.warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-border); }
.badge.bad  { background: var(--bad-bg);  color: var(--bad);  border-color: var(--bad-border);  }

.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  border: 1px solid;
  line-height: 1.6;
  white-space: nowrap;
}

.tag.draft {
  background: rgba(90,95,116,0.15);
  color: var(--text-secondary);
  border-color: rgba(90,95,116,0.30);
}
.tag.posted, .tag.active, .tag.received {
  background: var(--ok-bg); color: var(--ok); border-color: var(--ok-border);
}
.tag.cancelled, .tag.closed, .tag.expired {
  background: rgba(90,95,116,0.10);
  color: var(--muted);
  border-color: rgba(90,95,116,0.20);
  text-decoration: line-through;
}
.tag.sent, .tag.in_transit, .tag.partial {
  background: var(--primary-light); color: var(--primary); border-color: var(--primary-border);
}
.tag.discrepancy {
  background: var(--bad-bg); color: var(--bad); border-color: var(--bad-border);
}
.tag.received_pending_sync {
  background: var(--warn-bg); color: var(--warn); border-color: var(--warn-border);
}

/* =============================================================
   11. ALERTS
============================================================= */

.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--warn-border);
  background: var(--warn-bg);
  color: var(--warn);
  font-size: 13.5px;
  line-height: 1.5;
  margin-bottom: 14px;
}
.alert.ok  { border-color: var(--ok-border);  background: var(--ok-bg);  color: var(--ok);  }
.alert.bad { border-color: var(--bad-border); background: var(--bad-bg); color: var(--bad); }

/* =============================================================
   12. MODALS
============================================================= */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: rgba(0,0,0,0.70);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: overlayIn 0.15s ease;
}

@keyframes overlayIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal {
  position: relative;
  width: 100%;
  max-width: 540px;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  background: var(--elevated);
  border: 1px solid var(--line-dark);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255,255,255,0.03);
  overflow: hidden;
  animation: modalIn 0.15s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.97) translateY(6px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal.wide        { max-width: 820px; }
.modal.extra-wide  { max-width: 1100px; }
.modal.product-modal { max-width: 720px; }

.modal.fullscreen,
.modal.full-screen {
  max-width: 100%;
  max-height: 100%;
  width: calc(100vw - 32px);
  height: calc(100vh - 32px);
  border-radius: var(--radius-lg);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--elevated);
  flex-shrink: 0;
}

.modal-head h2, .modal-head h3 {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--text);
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.08) transparent;
}

.modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: rgba(0,0,0,0.20);
  flex-shrink: 0;
}

.modal.fullscreen .modal-body,
.modal.full-screen .modal-body {
  display: flex;
  flex-direction: column;
  padding: 16px;
}

.modal.fullscreen .doc-lines-wrap,
.modal.full-screen .doc-lines-wrap {
  flex: 1;
  max-height: none;
  overflow: auto;
}

/* =============================================================
   13. FORMS ADVANCED
============================================================= */

.form { display: flex; flex-direction: column; gap: 14px; }

.form.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 20px;
}

.form-compact { display: flex; flex-direction: column; gap: 10px; }

.field { display: flex; flex-direction: column; gap: 5px; }

.field label {
  font-size: 12px;
  font-weight: 550;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
}

.field .hint {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.4;
  margin-top: 2px;
}

.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.spread { justify-content: space-between; }
.row.end    { justify-content: flex-end; }
.row.top    { align-items: flex-start; }

.form-section {
  padding-top: 10px;
  margin-top: 4px;
  border-top: 1px solid var(--line);
}

.form-section h3 {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.err    { font-size: 12px; color: var(--bad); display: flex; align-items: center; gap: 5px; }
.ok-msg { font-size: 12px; color: var(--ok);  display: flex; align-items: center; gap: 5px; }
.muted  { color: var(--muted) !important; font-size: 12.5px; }
.small  { font-size: 12px !important; }

/* =============================================================
   14. CATALOG
============================================================= */

.catalog-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 16px;
  align-items: start;
  min-height: 400px;
}

.catalog-sidebar {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: sticky;
  top: 70px;
}

.cat-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.all-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 1px solid var(--line-light);
  transition: all 0.15s ease;
}
.all-row:hover  { background: rgba(255,255,255,0.04); color: var(--text); }
.all-row.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }

.cat-tree {
  overflow-y: auto;
  max-height: calc(100vh - 200px);
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.08) transparent;
}

.cat-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  border-left: 2px solid transparent;
}

.cat-row:hover {
  background: rgba(255,255,255,0.04);
  color: var(--text);
  border-left-color: rgba(94,106,210,0.25);
}

.cat-row.active {
  background: var(--primary-light);
  color: var(--primary);
  border-left-color: var(--primary);
  font-weight: 550;
}

.cat-toggle {
  flex-shrink: 0;
  width: 16px; height: 16px;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted);
  transition: transform 0.15s ease;
  cursor: pointer;
}
.cat-toggle.open { transform: rotate(90deg); }

.cat-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.cat-actions {
  display: flex;
  align-items: center;
  gap: 3px;
  opacity: 0;
  transition: opacity 0.15s ease;
  flex-shrink: 0;
}
.cat-row:hover .cat-actions { opacity: 1; }

/* =============================================================
   15. CHECKBOXES / FLAG CARDS
============================================================= */

.check, .check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.check input[type=checkbox] {
  width: 15px; height: 15px;
  flex-shrink: 0;
  accent-color: var(--primary);
  cursor: pointer;
}

.check .check-label {
  font-size: 13.5px;
  color: var(--text-secondary);
  transition: color 0.15s ease;
}
.check:hover .check-label { color: var(--text); }

.check.check-card, .check.flag-card {
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--line);
  transition: all 0.15s ease;
}

.check.check-card:hover, .check.flag-card:hover {
  background: var(--card-hover);
  border-color: var(--line-dark);
}

.check.check-card:has(input:checked),
.check.flag-card:has(input:checked) {
  background: var(--primary-light);
  border-color: var(--primary-border);
}

.check.check-card:has(input:checked) .check-label,
.check.flag-card:has(input:checked) .check-label {
  color: var(--primary);
}

/* =============================================================
   16. POS TERMINAL
============================================================= */

.center-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 54px);
  padding: 20px;
}

.pos-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 0;
  height: calc(100vh - 54px);
  overflow: hidden;
}

.pos-left {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid var(--line);
  background: var(--bg);
}

.pos-right {
  display: flex;
  flex-direction: column;
  background: var(--sidebar);
  overflow: hidden;
}

.scan {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--card);
  position: relative;
}

.scan input {
  width: 100%;
  height: 42px;
  padding: 0 14px;
  font-size: 15px;
  background: var(--bg);
  border: 1px solid var(--line-dark);
  border-radius: var(--radius);
  color: var(--text);
}
.scan input:focus {
  border-color: var(--primary-border);
  box-shadow: 0 0 0 3px rgba(94,106,210,0.15);
}

.results {
  position: absolute;
  top: calc(100% - 1px);
  left: 0; right: 0;
  z-index: 50;
  background: var(--elevated);
  border: 1px solid var(--line-dark);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  max-height: 340px;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.08) transparent;
}

.result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--line-light);
  transition: background 0.1s ease;
}
.result:hover { background: rgba(255,255,255,0.05); }
.result:last-child { border-bottom: none; }

.result-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.result-name {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-meta { font-size: 11.5px; color: var(--muted); }

.result-price {
  font-size: 14px;
  font-weight: 650;
  color: var(--text);
  white-space: nowrap;
  letter-spacing: -0.02em;
}

table.cart {
  display: table !important;
  width: 100% !important;
  border-collapse: collapse !important;
  font-size: 13px !important;
  color: var(--text) !important;
}
table.cart thead { display: table-header-group !important; background: var(--surface-2) !important; }
table.cart tbody { display: table-row-group !important; }
table.cart tr    { display: table-row !important; border-bottom: 1px solid var(--line-light) !important; }
table.cart th {
  display: table-cell !important;
  padding: 8px 10px !important;
  font-size: 10.5px !important;
  font-weight: 600 !important;
  letter-spacing: 0.06em !important;
  text-transform: uppercase !important;
  color: var(--text-secondary) !important;
  border-bottom: 1px solid var(--line) !important;
}
table.cart td {
  display: table-cell !important;
  padding: 9px 10px !important;
  border-bottom: 1px solid var(--line-light) !important;
  vertical-align: middle !important;
}
table.cart tbody tr:hover { background: rgba(255,255,255,0.03) !important; }

.totals {
  padding: 14px 16px;
  background: var(--card);
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.totals .totals-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--text-secondary);
}

.totals .grand {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.025em;
}

/* =============================================================
   17. LOGIN PAGE
============================================================= */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 24px;
  position: relative;
}

.login-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 60% 40% at 50% 0%, rgba(94,106,210,0.08) 0%, transparent 70%);
  pointer-events: none;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border: 1px solid var(--line-dark);
  border-radius: var(--radius-xl);
  padding: 36px 32px;
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.login-card h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text);
  text-align: center;
  margin: 0;
}

.login-card .login-sub {
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
  margin-top: -12px;
}

.login-card .field label { font-size: 12.5px; font-weight: 550; color: var(--text-secondary); }
.login-card .field input { height: 38px; font-size: 14px; }
.login-card button.primary { width: 100%; height: 40px; font-size: 14.5px; font-weight: 600; }

/* =============================================================
   18. AUTOCOMPLETE / MULTI-SELECT
============================================================= */

.multi-select-wrap { position: relative; width: 100%; }

.multi-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  min-height: 34px;
  padding: 4px 8px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: text;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.multi-tags:focus-within {
  border-color: var(--primary-border);
  box-shadow: 0 0 0 3px rgba(94,106,210,0.15);
}

.multi-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  background: var(--primary-light);
  border: 1px solid var(--primary-border);
  color: var(--primary);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.multi-tag-rm {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 14px; height: 14px;
  border-radius: 2px;
  cursor: pointer;
  color: var(--primary);
  opacity: 0.7;
  transition: opacity 0.1s ease, background 0.1s ease;
  flex-shrink: 0;
}
.multi-tag-rm:hover { opacity: 1; background: rgba(94,106,210,0.25); }

.multi-placeholder { font-size: 13px; color: var(--muted); user-select: none; }

.multi-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  z-index: 200;
  background: var(--elevated);
  border: 1px solid var(--line-dark);
  border-radius: var(--radius);
  max-height: 260px;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.08) transparent;
}

.multi-dd-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.1s ease;
  border-bottom: 1px solid var(--line-light);
}
.multi-dd-item:last-child { border-bottom: none; }
.multi-dd-item:hover    { background: rgba(255,255,255,0.05); color: var(--text); }
.multi-dd-item.selected { color: var(--primary); background: var(--primary-light); }

.ac-wrap { position: relative; width: 100%; }

.ac-input {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13.5px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.ac-input:focus {
  border-color: var(--primary-border);
  box-shadow: 0 0 0 3px rgba(94,106,210,0.15);
  outline: none;
}

.ac-drop {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  z-index: 200;
  background: var(--elevated);
  border: 1px solid var(--line-dark);
  border-radius: var(--radius);
  max-height: 280px;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.08) transparent;
}

.ac-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--line-light);
  transition: background 0.1s ease;
}
.ac-item:last-child { border-bottom: none; }
.ac-item:hover  { background: rgba(255,255,255,0.05); }
.ac-item.focused { background: var(--primary-light); }

.ac-name {
  flex: 1;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ac-meta  { font-size: 11.5px; color: var(--muted); flex-shrink: 0; }
.ac-price { font-size: 13px; font-weight: 650; color: var(--text); flex-shrink: 0; letter-spacing: -0.02em; }

/* =============================================================
   19. UTILITY CLASSES
============================================================= */

.text-ok      { color: var(--ok) !important; }
.text-warn    { color: var(--warn) !important; }
.text-bad     { color: var(--bad) !important; }
.text-muted   { color: var(--muted) !important; }
.text-secondary { color: var(--text-secondary) !important; }

.bg-card     { background: var(--card); }
.bg-elevated { background: var(--elevated); }

.border-wrap  { border: 1px solid var(--line); }
.border-round { border-radius: var(--radius); }

.divider { border-top: 1px solid var(--line); margin: 12px 0; }

.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.w-full { width: 100%; }
.mt-1   { margin-top: 4px; }
.mt-2   { margin-top: 8px; }
.mt-3   { margin-top: 12px; }
.mt-4   { margin-top: 16px; }
.mb-1   { margin-bottom: 4px; }
.mb-2   { margin-bottom: 8px; }
.mb-3   { margin-bottom: 12px; }
.mb-4   { margin-bottom: 16px; }

.font-mono   { font-family: var(--font-mono); }
.font-bold   { font-weight: 700; }
.font-medium { font-weight: 500; }

.opacity-50 { opacity: 0.5; }
.opacity-75 { opacity: 0.75; }

canvas { max-width: 100%; }

.chart-wrap { position: relative; width: 100%; min-height: 200px; }

/* =============================================================
   20. LOADING / SPINNER / SKELETON
============================================================= */

.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--line-dark);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
  background: linear-gradient(90deg,
    var(--card) 25%,
    var(--card-hover) 50%,
    var(--card) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer {
  0%   { background-position: 200% center; }
  100% { background-position: -200% center; }
}

/* =============================================================
   21. TOASTS
============================================================= */

.toast-wrap {
  position: fixed;
  bottom: 20px; right: 20px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  background: var(--elevated);
  border: 1px solid var(--line-dark);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  font-size: 13.5px;
  color: var(--text);
  min-width: 260px;
  pointer-events: all;
  animation: toastIn 0.2s ease;
}
.toast.ok  { border-color: var(--ok-border); }
.toast.bad { border-color: var(--bad-border); }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* =============================================================
   22. DROPDOWN MENUS
============================================================= */

.dropdown-menu {
  position: absolute;
  z-index: 300;
  min-width: 180px;
  background: var(--elevated);
  border: 1px solid var(--line-dark);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 4px 0;
  overflow: hidden;
  animation: dropIn 0.1s ease;
}
@keyframes dropIn {
  from { opacity: 0; transform: scale(0.97) translateY(-4px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.1s ease, color 0.1s ease;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: var(--font-sans);
}
.dropdown-item:hover { background: rgba(255,255,255,0.05); color: var(--text); }
.dropdown-item.danger:hover { background: var(--bad-bg); color: var(--bad); }
.dropdown-item.separator { border-top: 1px solid var(--line); margin: 3px 0; padding: 0; height: 0; cursor: default; }

/* =============================================================
   23. PAGINATION
============================================================= */

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 16px 0;
}

.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px; height: 30px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-secondary);
  background: var(--card);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: var(--font-sans);
}
.page-btn:hover  { background: var(--card-hover); color: var(--text); border-color: var(--line-dark); }
.page-btn.active { background: var(--primary); color: #fff; border-color: transparent; }

/* =============================================================
   24. EMPTY STATE
============================================================= */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 56px 24px;
  color: var(--muted);
  text-align: center;
}
.empty-state .icon { width: 40px; height: 40px; opacity: 0.35; }
.empty-state h3 { font-size: 15px; font-weight: 550; color: var(--text-secondary); margin: 0; }
.empty-state p  { font-size: 13px; color: var(--muted); margin: 0; }

/* =============================================================
   25. RESPONSIVE
============================================================= */

@media (max-width: 1024px) {
  .layout { grid-template-columns: 200px 1fr; }
  #nav { width: 200px; }
  #view { padding: 16px 20px; }
  .cols { grid-template-columns: 1fr; }
  .catalog-layout { grid-template-columns: 220px 1fr; }
  .form.grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .layout { grid-template-columns: 1fr; }
  #nav { display: none; }
  #view { padding: 14px 16px; }
  .topbar { padding: 0 14px; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .pos-grid { grid-template-columns: 1fr; }
  .catalog-layout { grid-template-columns: 1fr; }
  .modal { max-width: 100%; }
  .modal.wide { max-width: 100%; }
  .overlay { padding: 10px; }
}

@media (max-width: 480px) {
  .kpis { grid-template-columns: 1fr; }
  .kpi .num { font-size: 20px; }
  .tab-bar { overflow-x: auto; gap: 0; }
  .tab-btn { flex-shrink: 0; }
}

/* =============================================================
   26. PRINT
============================================================= */

@media print {
  .topbar,
  #nav,
  .tab-bar,
  .actions,
  button,
  .topbar-btn,
  .modal-foot,
  .pagination,
  .cat-toolbar,
  .cat-actions,
  .nav-subitems {
    display: none !important;
  }

  body { background: #fff; color: #000; font-size: 12px; }
  .layout { display: block; }
  #view { padding: 0; max-width: 100%; }

  .card, .kpi, .table-wrap {
    border: 1px solid #ccc;
    background: #fff;
    box-shadow: none;
  }

  table th, table td { color: #000 !important; border-color: #ddd !important; }
  thead { background: #f5f5f5 !important; }

  .badge, .tag { color: #333 !important; border-color: #bbb !important; background: #f9f9f9 !important; }
  a { color: #000 !important; }

  .modal {
    position: static;
    box-shadow: none;
    border: none;
    max-width: 100%;
    max-height: none;
  }

  .overlay {
    position: static;
    background: none;
    backdrop-filter: none;
  }
}
