/* ═══════════════════════════════════════════════════════════════════════════
   WebWelle Business Suite — Design System
   Dark Dashboard · Syne + DM Sans · Emil Kowalski Animation Philosophy
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Fonts ──────────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Syne:wght@700;800&family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,400&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── Design Tokens ──────────────────────────────────────────────────────── */
:root {
  /* Brand */
  --brand-300: #33d4f0;
  --brand-400: #00b8e0;
  --brand-500: #0095b8;
  --brand-600: #007a96;
  --brand-700: #005f80;

  /* Dark surfaces */
  --bg:        #090b0f;
  --surface-1: #0f1117;
  --surface-2: #161922;
  --surface-3: #1c2030;
  --surface-4: #232840;

  /* Borders */
  --border:       rgba(255,255,255,0.07);
  --border-strong:rgba(255,255,255,0.13);
  --border-focus: rgba(0,149,184,0.5);

  /* Text */
  --text-1: #e2e8f0;
  --text-2: #94a3b8;
  --text-3: #4a5568;
  --text-brand: var(--brand-400);

  /* Semantic */
  --success:    #22c55e; --success-bg:  rgba(34,197,94,0.1);
  --warning:    #f59e0b; --warning-bg:  rgba(245,158,11,0.1);
  --danger:     #ef4444; --danger-bg:   rgba(239,68,68,0.1);
  --info:       #3b82f6; --info-bg:     rgba(59,130,246,0.1);
  --violet:     #8b5cf6; --violet-bg:   rgba(139,92,246,0.1);

  /* Layout */
  --sidebar-w:    240px;
  --sidebar-cw:   64px;
  --topbar-h:     56px;
  --content-max:  1400px;

  /* Radius */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 18px;

  /* Shadows */
  --shadow-sm:   0 1px 4px rgba(0,0,0,0.5);
  --shadow-md:   0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg:   0 8px 32px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 0 1px var(--brand-600), 0 0 24px rgba(0,149,184,0.12);

  /* Animation (Emil Kowalski philosophy) */
  --ease-out:    cubic-bezier(0.23, 1, 0.32, 1);
  --ease-spring: cubic-bezier(0.32, 0.72, 0, 1);
  --dur-fast:    150ms;
  --dur-normal:  220ms;
  --dur-slow:    320ms;
}

/* Light mode */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg:        #f4f6fa;
    --surface-1: #ffffff;
    --surface-2: #f0f2f8;
    --surface-3: #e8ecf4;
    --surface-4: #dde3ef;
    --border:        rgba(0,0,0,0.08);
    --border-strong: rgba(0,0,0,0.14);
    --text-1: #0f172a;
    --text-2: #475569;
    --text-3: #94a3b8;
  }
}
[data-theme="light"] {
  --bg:        #f4f6fa;
  --surface-1: #ffffff;
  --surface-2: #f0f2f8;
  --surface-3: #e8ecf4;
  --surface-4: #dde3ef;
  --border:        rgba(0,0,0,0.08);
  --border-strong: rgba(0,0,0,0.14);
  --text-1: #0f172a;
  --text-2: #475569;
  --text-3: #94a3b8;
}

/* ── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text-1);
  line-height: 1.6;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, video { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
a { color: var(--text-brand); text-decoration: none; }
input, textarea, select { font-family: inherit; font-size: inherit; }
:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 2px; border-radius: var(--r-sm); }

/* ── Scrollbar ──────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ══════════════════════════════════════════════════════════════════════════
   LAYOUT
   ══════════════════════════════════════════════════════════════════════════ */

.app-shell {
  display: flex;
  min-height: 100dvh;
}

/* ── Sidebar ────────────────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--surface-1);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: width var(--dur-normal) var(--ease-out),
              transform var(--dur-normal) var(--ease-spring);
  overflow: hidden;
}

.sidebar.collapsed { width: var(--sidebar-cw); }

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--border);
  min-height: 64px;
  overflow: hidden;
  white-space: nowrap;
}
.sidebar-logo-mark {
  width: 32px; height: 32px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-family: 'Syne', sans-serif; font-weight: 800; font-size: 16px;
  letter-spacing: -0.5px;
  box-shadow: 0 2px 8px rgba(0,149,184,0.35);
}
.sidebar-logo-text {
  overflow: hidden;
  transition: opacity var(--dur-normal), width var(--dur-normal);
}
.sidebar-logo-text strong {
  font-family: 'Syne', sans-serif;
  font-weight: 800; font-size: 14px;
  color: var(--text-1); display: block; line-height: 1.1;
}
.sidebar-logo-text span {
  font-size: 11px; color: var(--text-3); font-weight: 500;
}
.sidebar.collapsed .sidebar-logo-text { opacity: 0; width: 0; overflow: hidden; }

.sidebar-nav {
  flex: 1;
  padding: 10px 8px;
  overflow-y: auto;
  overflow-x: hidden;
}

.nav-section-label {
  font-size: 10px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-3);
  padding: 12px 10px 4px;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity var(--dur-normal);
}
.sidebar.collapsed .nav-section-label { opacity: 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--r-md);
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  transition: background var(--dur-fast), color var(--dur-fast), transform var(--dur-fast);
  position: relative;
  text-decoration: none;
}
.nav-item:hover {
  background: var(--surface-3);
  color: var(--text-1);
}
.nav-item.active {
  background: rgba(0,149,184,0.12);
  color: var(--brand-400);
  font-weight: 600;
}
.nav-item.active::before {
  content: '';
  position: absolute; left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 60%;
  background: var(--brand-500);
  border-radius: 0 2px 2px 0;
}
.nav-item:active { transform: scale(0.97); }
.nav-icon {
  width: 20px; height: 20px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.nav-icon svg { width: 18px; height: 18px; stroke-width: 1.75; }
.nav-label {
  transition: opacity var(--dur-normal), width var(--dur-normal);
  overflow: hidden;
}
.sidebar.collapsed .nav-label { opacity: 0; width: 0; }
.nav-badge {
  margin-left: auto;
  background: var(--surface-3); color: var(--text-2);
  font-size: 10px; font-weight: 600;
  padding: 2px 6px; border-radius: 10px;
  transition: opacity var(--dur-normal);
}
.sidebar.collapsed .nav-badge { opacity: 0; }

.sidebar-footer {
  padding: 10px 8px 12px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
  min-height: 56px;
}
.user-avatar {
  width: 32px; height: 32px; flex-shrink: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-500), var(--violet));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 13px;
  text-transform: uppercase;
}
.user-info { overflow: hidden; flex: 1; }
.user-name { font-size: 13px; font-weight: 600; color: var(--text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: var(--text-3); }
.sidebar.collapsed .user-info { opacity: 0; width: 0; }

/* Sidebar toggle button */
.sidebar-toggle {
  position: fixed;
  top: 16px;
  left: calc(var(--sidebar-w) - 12px);
  width: 24px; height: 24px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  z-index: 210;
  transition: left var(--dur-normal) var(--ease-out), background var(--dur-fast);
  box-shadow: var(--shadow-sm);
}
.sidebar-toggle:hover { background: var(--surface-3); }
.sidebar-toggle svg { width: 12px; height: 12px; color: var(--text-2); transition: transform var(--dur-normal); }
.sidebar.collapsed ~ .sidebar-toggle { left: calc(var(--sidebar-cw) - 12px); }
.sidebar.collapsed ~ .sidebar-toggle svg { transform: rotate(180deg); }

/* ── Top Bar ────────────────────────────────────────────────────────────── */
.topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  height: var(--topbar-h);
  background: rgba(9,11,15,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  z-index: 100;
  transition: left var(--dur-normal) var(--ease-out);
}
[data-theme="light"] .topbar { background: rgba(244,246,250,0.85); }
.sidebar.collapsed ~ .topbar { left: var(--sidebar-cw); }

.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-2);
  flex: 1;
}
.topbar-breadcrumb .page-title {
  font-family: 'Syne', sans-serif;
  font-weight: 700; font-size: 16px;
  color: var(--text-1);
}
.topbar-breadcrumb .sep { color: var(--text-3); }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  width: 36px; height: 36px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2);
  transition: background var(--dur-fast), color var(--dur-fast), transform var(--dur-fast), border-color var(--dur-fast);
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text-1); border-color: var(--border-strong); }
.icon-btn:active { transform: scale(0.93); }
.icon-btn svg { width: 16px; height: 16px; }

/* Mobile menu toggle */
.mobile-menu-btn { display: none; }

/* ── Main Content ────────────────────────────────────────────────────────── */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding-top: var(--topbar-h);
  min-height: 100dvh;
  transition: margin-left var(--dur-normal) var(--ease-out);
}
.sidebar.collapsed ~ .main-content { margin-left: var(--sidebar-cw); }

.page-container {
  padding: 28px 28px 60px;
  max-width: var(--content-max);
  animation: fadeInUp var(--dur-slow) var(--ease-out) both;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Page header */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.page-header-left h1 {
  font-family: 'Syne', sans-serif;
  font-weight: 800; font-size: 26px;
  color: var(--text-1); line-height: 1.15;
}
.page-header-left p {
  font-size: 14px; color: var(--text-2); margin-top: 4px;
}
.page-header-right {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}

/* ══════════════════════════════════════════════════════════════════════════
   TYPOGRAPHY
   ══════════════════════════════════════════════════════════════════════════ */

h1,h2,h3,h4 { font-family: 'Syne', sans-serif; line-height: 1.2; color: var(--text-1); }
h1 { font-size: 28px; font-weight: 800; }
h2 { font-size: 20px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 700; }
h4 { font-size: 14px; font-weight: 700; }

.mono { font-family: 'JetBrains Mono', monospace; }
.num  { font-family: 'JetBrains Mono', monospace; font-variant-numeric: tabular-nums; }

/* ══════════════════════════════════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════════════════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--r-md);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--dur-fast), color var(--dur-fast),
              border-color var(--dur-fast), box-shadow var(--dur-fast),
              transform var(--dur-fast);
  -webkit-user-select: none; user-select: none;
  text-decoration: none;
}
.btn:active { transform: scale(0.97); }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.btn-primary {
  background: var(--brand-500);
  color: #fff;
  border-color: var(--brand-600);
  box-shadow: 0 1px 4px rgba(0,149,184,0.3);
}
.btn-primary:hover {
  background: var(--brand-400);
  box-shadow: 0 2px 12px rgba(0,149,184,0.4);
}

.btn-secondary {
  background: var(--surface-3);
  color: var(--text-1);
  border-color: var(--border-strong);
}
.btn-secondary:hover { background: var(--surface-4); }

.btn-outline {
  background: transparent;
  color: var(--brand-400);
  border-color: var(--brand-600);
}
.btn-outline:hover { background: rgba(0,149,184,0.08); }

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text-1); }

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: rgba(239,68,68,0.3);
}
.btn-danger:hover { background: rgba(239,68,68,0.18); }

.btn-sm { padding: 6px 13px; font-size: 13px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }

.btn:disabled, .btn[data-loading] {
  opacity: 0.55; cursor: not-allowed; pointer-events: none;
}
.btn[data-loading] {
  pointer-events: none;
  position: relative;
}
.btn[data-loading]::after {
  content: '';
  width: 14px; height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-left: 4px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════════════════════════════════════
   CARDS
   ══════════════════════════════════════════════════════════════════════════ */

.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.card-header h3 { font-size: 14px; font-weight: 700; }
.card-header .card-header-actions { display: flex; align-items: center; gap: 8px; }

.card-body { padding: 20px; }

/* Stat cards */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.stat-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
}
.stat-card.brand::before  { background: var(--brand-500); }
.stat-card.success::before{ background: var(--success); }
.stat-card.warning::before{ background: var(--warning); }
.stat-card.danger::before { background: var(--danger); }
.stat-card.violet::before { background: var(--violet); }

.stat-icon {
  width: 36px; height: 36px;
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
  font-size: 16px;
}
.stat-card.brand  .stat-icon { background: rgba(0,149,184,0.12);  color: var(--brand-400); }
.stat-card.success .stat-icon{ background: var(--success-bg); color: var(--success); }
.stat-card.warning .stat-icon{ background: var(--warning-bg); color: var(--warning); }
.stat-card.danger  .stat-icon{ background: var(--danger-bg);  color: var(--danger); }
.stat-card.violet  .stat-icon{ background: var(--violet-bg);  color: var(--violet); }
.stat-icon svg { width: 18px; height: 18px; }

.stat-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 24px; font-weight: 700;
  color: var(--text-1); line-height: 1;
  margin-bottom: 5px;
  font-variant-numeric: tabular-nums;
}
.stat-label { font-size: 12px; color: var(--text-3); font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; }

/* ══════════════════════════════════════════════════════════════════════════
   DATA TABLE
   ══════════════════════════════════════════════════════════════════════════ */

.table-wrap {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.table-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.table-toolbar-left  { display: flex; align-items: center; gap: 8px; flex: 1; flex-wrap: wrap; }
.table-toolbar-right { display: flex; align-items: center; gap: 8px; }

/* Tabs */
.tab-group {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--surface-2);
  border-radius: var(--r-md);
  padding: 3px;
  flex-wrap: wrap;
}
.tab {
  padding: 5px 13px;
  border-radius: calc(var(--r-md) - 2px);
  font-size: 13px; font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: background var(--dur-fast), color var(--dur-fast);
  border: none; background: transparent;
  white-space: nowrap;
  text-decoration: none;
  display: inline-flex; align-items: center; gap: 5px;
}
.tab.active {
  background: var(--surface-1);
  color: var(--text-1);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.tab-count {
  background: var(--surface-3);
  color: var(--text-3);
  font-size: 10px; font-weight: 600;
  padding: 1px 5px;
  border-radius: 8px;
}
.tab.active .tab-count {
  background: rgba(0,149,184,0.15);
  color: var(--brand-400);
}

/* Search */
.search-box {
  position: relative;
  flex: 1; min-width: 180px; max-width: 320px;
}
.search-box svg {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  width: 14px; height: 14px; color: var(--text-3); pointer-events: none;
}
.search-box input {
  width: 100%;
  padding: 8px 12px 8px 32px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text-1);
  font-size: 13px;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.search-box input:focus {
  border-color: var(--brand-600);
  box-shadow: 0 0 0 3px rgba(0,149,184,0.15);
  outline: none;
}
.search-box input::placeholder { color: var(--text-3); }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.data-table thead th {
  padding: 11px 14px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--dur-fast);
}
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table td {
  padding: 12px 14px;
  color: var(--text-1);
  vertical-align: middle;
}
.data-table td.muted { color: var(--text-2); font-size: 13px; }

.td-num  { font-family: 'JetBrains Mono', monospace; font-size: 13px; font-weight: 500; color: var(--brand-400); }
.td-money{ font-family: 'JetBrains Mono', monospace; font-weight: 600; font-variant-numeric: tabular-nums; }
.td-actions { text-align: right; white-space: nowrap; }
.td-actions .action-group { display: flex; align-items: center; justify-content: flex-end; gap: 4px; }

.action-btn {
  width: 30px; height: 30px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  background: transparent;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-2);
  cursor: pointer;
  transition: background var(--dur-fast), color var(--dur-fast), border-color var(--dur-fast), transform var(--dur-fast);
  text-decoration: none;
}
.action-btn:hover {
  background: var(--surface-3);
  color: var(--text-1);
  border-color: var(--border);
}
.action-btn:active { transform: scale(0.9); }
.action-btn.danger:hover { background: var(--danger-bg); color: var(--danger); border-color: rgba(239,68,68,0.2); }
.action-btn svg { width: 14px; height: 14px; }

.empty-state {
  padding: 60px 20px;
  text-align: center;
}
.empty-state svg {
  width: 48px; height: 48px;
  color: var(--text-3);
  margin: 0 auto 16px;
}
.empty-state h3 { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.empty-state p { color: var(--text-2); font-size: 14px; margin-bottom: 20px; }

/* Table footer / pagination */
.table-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface-2);
  flex-wrap: wrap;
}
.table-count { font-size: 13px; color: var(--text-2); }
.pagination { display: flex; align-items: center; gap: 4px; }
.page-btn {
  min-width: 32px; height: 32px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--text-2);
  font-size: 13px; font-weight: 500;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; text-decoration: none;
  transition: all var(--dur-fast);
  padding: 0 8px;
}
.page-btn:hover { background: var(--surface-3); color: var(--text-1); }
.page-btn.active { background: var(--brand-500); color: #fff; border-color: var(--brand-600); }

/* ══════════════════════════════════════════════════════════════════════════
   FORMS
   ══════════════════════════════════════════════════════════════════════════ */

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}
.form-col { display: flex; flex-direction: column; gap: 16px; }

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.field label {
  font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-2);
}
.field label .req { color: var(--danger); margin-left: 2px; }

.input {
  width: 100%;
  padding: 10px 13px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  color: var(--text-1);
  font-size: 14px;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast), background var(--dur-fast);
  outline: none;
}
.input:focus {
  border-color: var(--brand-600);
  box-shadow: 0 0 0 3px rgba(0,149,184,0.15);
  background: var(--surface-1);
}
.input::placeholder { color: var(--text-3); }
.input:read-only { opacity: 0.6; cursor: default; }

textarea.input { resize: vertical; min-height: 80px; line-height: 1.6; }

select.input {
  appearance: none;
  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='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}
select.input option { background: #161922; }

.input-group {
  display: flex;
  align-items: stretch;
}
.input-group .input { border-radius: var(--r-md) 0 0 var(--r-md); border-right: none; flex: 1; }
.input-group .input-addon {
  padding: 10px 13px;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  color: var(--text-2); font-size: 13px;
  display: flex; align-items: center;
  white-space: nowrap;
}

.field-error { font-size: 12px; color: var(--danger); }
.input.has-error { border-color: var(--danger); }

/* Company radio cards */
.company-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}
.company-card {
  position: relative;
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px;
  cursor: pointer;
  transition: border-color var(--dur-fast), background var(--dur-fast), transform var(--dur-fast);
}
.company-card:hover { background: var(--surface-2); }
.company-card input[type="radio"] {
  position: absolute; opacity: 0; width: 0; height: 0;
}
.company-card.active {
  border-color: var(--brand-500);
  background: rgba(0,149,184,0.06);
}
.company-card:active { transform: scale(0.98); }
.company-card-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  position: absolute; top: 12px; right: 12px;
  transition: all var(--dur-fast);
}
.company-card.active .company-card-dot {
  background: var(--brand-500);
  border-color: var(--brand-500);
}
.company-card-color {
  width: 28px; height: 4px;
  border-radius: 2px;
  margin-bottom: 10px;
}
.company-card strong { font-size: 13px; font-weight: 700; display: block; margin-bottom: 2px; line-height: 1.2; }
.company-card span   { font-size: 11px; color: var(--text-2); display: block; line-height: 1.4; }

/* Language picker */
.lang-picker {
  display: flex;
  gap: 8px;
}
.lang-option {
  flex: 1;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer; font-size: 13px; font-weight: 500; color: var(--text-2);
  transition: all var(--dur-fast);
}
.lang-option:hover { border-color: var(--border-strong); color: var(--text-1); }
.lang-option input { position: absolute; opacity: 0; width: 0; height: 0; }
.lang-option.active { border-color: var(--brand-500); color: var(--brand-400); background: rgba(0,149,184,0.06); font-weight: 600; }

/* Item rows (invoice / offer) */
.items-section { display: flex; flex-direction: column; gap: 0; }
.items-header {
  display: grid;
  grid-template-columns: 24px 1fr 80px 110px 110px 32px;
  gap: 8px;
  padding: 8px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-2);
}
.items-header.bonus-header {
  grid-template-columns: 24px 1fr 32px;
  background: rgba(139,92,246,0.06);
  color: var(--violet);
  border-bottom-color: rgba(139,92,246,0.15);
}
.item-row {
  display: grid;
  grid-template-columns: 24px 1fr 80px 110px 110px 32px;
  gap: 8px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  align-items: center;
  transition: background var(--dur-fast);
  animation: rowSlideIn 200ms var(--ease-out) both;
}
.item-row:hover { background: var(--surface-2); }
.item-row.bonus-row {
  grid-template-columns: 24px 1fr 32px;
}
.item-row-num {
  font-size: 11px; color: var(--text-3); font-weight: 600;
  font-variant-numeric: tabular-nums; text-align: center;
}
.item-input {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  padding: 6px 8px;
  color: var(--text-1);
  font-size: 13px;
  width: 100%;
  transition: border-color var(--dur-fast), background var(--dur-fast);
  outline: none;
}
.item-input:focus {
  border-color: var(--brand-600);
  background: var(--surface-2);
}
.item-input.right { text-align: right; font-family: 'JetBrains Mono', monospace; font-size: 12px; }
.item-total-display {
  text-align: right; padding: 6px 8px;
  font-family: 'JetBrains Mono', monospace; font-size: 12px;
  font-weight: 600; color: var(--text-1);
}
.bonus-label {
  font-size: 10px; font-weight: 700; letter-spacing: 0.05em;
  color: var(--violet); text-transform: uppercase;
  background: var(--violet-bg); padding: 3px 8px; border-radius: 4px;
}
.remove-row-btn {
  width: 24px; height: 24px;
  border-radius: var(--r-sm);
  border: none; background: transparent;
  color: var(--text-3);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: color var(--dur-fast), background var(--dur-fast), transform var(--dur-fast);
}
.remove-row-btn:hover { color: var(--danger); background: var(--danger-bg); }
.remove-row-btn:active { transform: scale(0.9); }
.remove-row-btn svg { width: 13px; height: 13px; }

@keyframes rowSlideIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Totals box */
.totals-box {
  margin-top: 16px;
  display: flex; justify-content: flex-end;
}
.totals-table {
  min-width: 280px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.total-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.total-row:last-child { border-bottom: none; }
.total-row.grand {
  background: var(--brand-500);
  color: #fff; padding: 14px 16px;
}
.total-row .lbl { color: var(--text-2); }
.total-row.grand .lbl { color: rgba(255,255,255,0.75); font-size: 12px; }
.total-row .amt { font-weight: 700; font-family: 'JetBrains Mono', monospace; font-variant-numeric: tabular-nums; }
.total-row.grand .amt { font-size: 20px; font-weight: 800; }

/* Form footer */
.form-footer {
  position: sticky;
  bottom: 0;
  background: rgba(9,11,15,0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  z-index: 10;
  margin: 0 -28px -60px;
}
[data-theme="light"] .form-footer { background: rgba(244,246,250,0.9); }
.form-footer-right { display: flex; align-items: center; gap: 10px; }

/* ══════════════════════════════════════════════════════════════════════════
   BADGES / STATUS
   ══════════════════════════════════════════════════════════════════════════ */

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px;
  border-radius: 100px;
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.badge::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}
.badge-draft   { background: rgba(148,163,184,0.12); color: #94a3b8; }
.badge-draft::before { background: #94a3b8; }
.badge-sent    { background: var(--info-bg);    color: var(--info); }
.badge-sent::before { background: var(--info); }
.badge-paid    { background: var(--success-bg); color: var(--success); }
.badge-paid::before { background: var(--success); }
.badge-overdue { background: var(--danger-bg);  color: var(--danger); }
.badge-overdue::before { background: var(--danger); }
.badge-final   { background: var(--success-bg); color: var(--success); }
.badge-final::before { background: var(--success); }

/* ══════════════════════════════════════════════════════════════════════════
   MODAL
   ══════════════════════════════════════════════════════════════════════════ */

.modal-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-normal);
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}
.modal {
  background: var(--surface-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-xl);
  width: 100%; max-width: 480px;
  box-shadow: var(--shadow-lg);
  transform: scale(0.95) translateY(8px);
  transition: transform var(--dur-normal) var(--ease-out), opacity var(--dur-normal);
  opacity: 0;
}
.modal-overlay.open .modal {
  transform: scale(1) translateY(0);
  opacity: 1;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 16px; font-weight: 700; }
.modal-close {
  width: 28px; height: 28px;
  border-radius: var(--r-sm); border: none;
  background: var(--surface-3); color: var(--text-2);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all var(--dur-fast);
}
.modal-close:hover { background: var(--surface-4); color: var(--text-1); }
.modal-close svg { width: 14px; height: 14px; }
.modal-body { padding: 20px 22px; }
.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
}

/* Bottom sheet on mobile */
@media (max-width: 767px) {
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal {
    max-width: 100%; width: 100%;
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    transform: translateY(100%);
    opacity: 1;
  }
  .modal-overlay.open .modal { transform: translateY(0); }
}

/* ══════════════════════════════════════════════════════════════════════════
   TOASTS
   ══════════════════════════════════════════════════════════════════════════ */

.toast-container {
  position: fixed;
  top: 70px; right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 14px 16px;
  border-radius: var(--r-lg);
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  min-width: 280px; max-width: 380px;
  pointer-events: auto;
  opacity: 0;
  transform: translateX(20px);
  transition: opacity var(--dur-normal) var(--ease-out),
              transform var(--dur-normal) var(--ease-out);
}
.toast.show { opacity: 1; transform: translateX(0); }
.toast.hide {
  opacity: 0;
  transform: translateX(20px);
  transition-duration: 150ms;
}
.toast-icon {
  width: 20px; height: 20px; flex-shrink: 0; margin-top: 1px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
}
.toast-icon svg { width: 12px; height: 12px; color: #fff; }
.toast.success .toast-icon { background: var(--success); }
.toast.error   .toast-icon { background: var(--danger); }
.toast.info    .toast-icon { background: var(--info); }
.toast.warning .toast-icon { background: var(--warning); }
.toast-body { flex: 1; }
.toast-title { font-size: 13px; font-weight: 700; color: var(--text-1); line-height: 1.3; }
.toast-msg   { font-size: 12px; color: var(--text-2); margin-top: 2px; line-height: 1.4; }
.toast-close { color: var(--text-3); cursor: pointer; background: none; border: none; line-height: 1; padding: 0; }
.toast-close:hover { color: var(--text-1); }
.toast-close svg { width: 13px; height: 13px; }

/* ══════════════════════════════════════════════════════════════════════════
   SETTINGS PAGE
   ══════════════════════════════════════════════════════════════════════════ */

.settings-grid {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
  align-items: start;
}
.settings-nav {
  position: sticky; top: calc(var(--topbar-h) + 20px);
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.settings-nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 16px;
  font-size: 13px; font-weight: 500;
  color: var(--text-2);
  border-bottom: 1px solid var(--border);
  cursor: pointer; text-decoration: none;
  transition: background var(--dur-fast), color var(--dur-fast);
}
.settings-nav-item:last-child { border-bottom: none; }
.settings-nav-item:hover { background: var(--surface-2); color: var(--text-1); }
.settings-nav-item.active { background: rgba(0,149,184,0.08); color: var(--brand-400); font-weight: 600; }
.settings-nav-item svg { width: 16px; height: 16px; }

.settings-section { display: none; }
.settings-section.active { display: block; }
.settings-section > .card { margin-bottom: 16px; }

.company-slot-tabs {
  display: flex; gap: 4px;
  margin-bottom: 20px;
}
.slot-tab {
  flex: 1; padding: 9px 12px;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  text-align: center; cursor: pointer;
  font-size: 12px; font-weight: 600; color: var(--text-2);
  transition: all var(--dur-fast);
  position: relative;
}
.slot-tab.active {
  border-color: var(--brand-500);
  color: var(--brand-400);
  background: rgba(0,149,184,0.06);
}
.slot-tab .dot {
  display: inline-block; width: 6px; height: 6px;
  border-radius: 50%; margin-right: 4px; vertical-align: middle;
}

/* Color input */
.color-field {
  display: flex; align-items: center; gap: 10px;
}
.color-swatch {
  width: 36px; height: 36px;
  border-radius: var(--r-sm);
  border: 2px solid var(--border-strong);
  flex-shrink: 0; cursor: pointer; overflow: hidden;
}
.color-swatch input[type="color"] {
  width: 100%; height: 100%;
  border: none; padding: 0; cursor: pointer; opacity: 0; position: absolute;
}
.color-swatch { position: relative; }

/* ══════════════════════════════════════════════════════════════════════════
   DASHBOARD
   ══════════════════════════════════════════════════════════════════════════ */

.dash-sections {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.dash-list-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  transition: background var(--dur-fast);
  text-decoration: none; color: inherit;
}
.dash-list-item:last-child { border-bottom: none; }
.dash-list-item:hover { background: var(--surface-2); }
.dash-list-item-left {}
.dash-list-item-num { font-family: 'JetBrains Mono', monospace; font-size: 13px; font-weight: 600; color: var(--brand-400); }
.dash-list-item-client { font-size: 13px; font-weight: 500; margin-top: 1px; }
.dash-list-item-date { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.dash-list-item-right { text-align: right; }
.dash-list-item-amount { font-family: 'JetBrains Mono', monospace; font-size: 14px; font-weight: 700; }
.dash-view-all {
  display: block; text-align: center;
  padding: 12px; font-size: 13px; font-weight: 600;
  color: var(--brand-400); text-decoration: none;
  border-top: 1px solid var(--border);
  transition: background var(--dur-fast);
}
.dash-view-all:hover { background: var(--surface-2); }

/* ══════════════════════════════════════════════════════════════════════════
   LOGIN PAGE
   ══════════════════════════════════════════════════════════════════════════ */

.login-page {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.login-page::before {
  content: '';
  position: absolute;
  top: -200px; left: 50%; transform: translateX(-50%);
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(0,149,184,0.1) 0%, transparent 70%);
  pointer-events: none;
}
.login-card {
  background: var(--surface-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-xl);
  padding: 44px 40px;
  width: 100%; max-width: 420px;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(0,149,184,0.05);
  animation: fadeInUp var(--dur-slow) var(--ease-out) both;
}
.login-logo {
  display: flex; flex-direction: column; align-items: center;
  margin-bottom: 32px; text-align: center;
}
.login-logo-mark {
  width: 52px; height: 52px;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
  border-radius: var(--r-lg);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-family: 'Syne', sans-serif; font-weight: 800; font-size: 22px;
  margin-bottom: 14px;
  box-shadow: 0 4px 20px rgba(0,149,184,0.4);
}
.login-logo h1 {
  font-size: 22px; font-weight: 800;
  margin-bottom: 4px;
}
.login-logo p { font-size: 13px; color: var(--text-2); }

.login-error {
  background: var(--danger-bg);
  border: 1px solid rgba(239,68,68,0.25);
  border-radius: var(--r-md);
  padding: 11px 14px;
  font-size: 13px; color: var(--danger);
  margin-bottom: 20px;
}

/* ══════════════════════════════════════════════════════════════════════════
   PWA INSTALL BANNER
   ══════════════════════════════════════════════════════════════════════════ */

.pwa-banner {
  position: fixed;
  bottom: 20px; left: 50%; transform: translateX(-50%) translateY(120px);
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-xl);
  padding: 16px 20px;
  display: flex; align-items: center; gap: 14px;
  box-shadow: var(--shadow-lg);
  z-index: 900;
  max-width: 380px; width: calc(100% - 32px);
  transition: transform var(--dur-slow) var(--ease-spring),
              opacity var(--dur-slow);
  opacity: 0;
}
.pwa-banner.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.pwa-banner-icon {
  width: 40px; height: 40px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 18px; font-weight: 800; font-family: 'Syne', sans-serif;
}
.pwa-banner-text { flex: 1; }
.pwa-banner-text strong { font-size: 13px; font-weight: 700; display: block; }
.pwa-banner-text span   { font-size: 11px; color: var(--text-2); }
.pwa-banner-actions { display: flex; gap: 8px; }

/* ══════════════════════════════════════════════════════════════════════════
   SKELETON LOADING
   ══════════════════════════════════════════════════════════════════════════ */

.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--r-sm);
}
@keyframes shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

/* ══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 1024px) {
  .form-grid { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .settings-nav {
    position: static;
    display: flex; flex-wrap: wrap; border-radius: var(--r-md);
  }
  .settings-nav-item { border-bottom: none; border-right: 1px solid var(--border); flex: 1; }
  .dash-sections { grid-template-columns: 1fr; }
}

@media (max-width: 767px) {
  :root {
    --sidebar-w: 100%;
    --topbar-h: 52px;
  }

  .sidebar {
    transform: translateX(-100%);
    width: 280px !important;
    z-index: 300;
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .sidebar.collapsed { width: 280px !important; }
  .sidebar.collapsed .sidebar-logo-text,
  .sidebar.collapsed .nav-label,
  .sidebar.collapsed .nav-badge,
  .sidebar.collapsed .user-info { opacity: 1; width: auto; }

  .sidebar-overlay {
    position: fixed; inset: 0; z-index: 290;
    background: rgba(0,0,0,0.5);
    opacity: 0; pointer-events: none;
    transition: opacity var(--dur-normal);
  }
  .sidebar-overlay.show { opacity: 1; pointer-events: auto; }

  .sidebar-toggle { display: none; }
  .mobile-menu-btn { display: flex; }

  .topbar { left: 0 !important; }
  .main-content { margin-left: 0 !important; }

  .page-container { padding: 18px 16px 100px; }

  /* Bottom nav */
  .bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0;
    height: 64px;
    background: var(--surface-1);
    border-top: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-around;
    z-index: 9999;
    pointer-events: all;
    padding: 0 8px;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  .bottom-nav-item {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px; padding: 8px 4px;
    color: var(--text-3); font-size: 10px; font-weight: 600;
    text-decoration: none;
    border-radius: var(--r-md);
    transition: color var(--dur-fast), background var(--dur-fast);
    min-height: 44px;
  }
  .bottom-nav-item svg { width: 20px; height: 20px; }
  .bottom-nav-item.active { color: var(--brand-400); }
  .bottom-nav-item.active svg { stroke-width: 2.5; }

  /* Card layout for data tables */
  .data-table-scroll { overflow-x: visible; }
  .data-table, .data-table tbody { display: block; width: 100%; }
  .data-table thead { display: none; }
  .data-table tbody tr {
    display: block;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 12px 14px;
    margin-bottom: 10px;
    animation: none;
  }
  .data-table tbody tr.is-empty-row { background: transparent; border: none; padding: 0; margin: 0; }
  .data-table tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    font-size: 13px;
    min-height: 0;
  }
  .data-table tbody td:last-child { border-bottom: none; }
  .data-table td.hide-mobile { display: none !important; }
  .data-table td::before {
    content: attr(data-label);
    font-size: 10px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.05em;
    color: var(--text-3);
    flex-shrink: 0;
    margin-right: 10px;
    min-width: 60px;
  }
  .data-table td.td-actions { border-bottom: none; padding-top: 8px; }
  .data-table td.td-actions::before { display: none; }
  .data-table td.td-actions .action-group { width: 100%; justify-content: flex-end; gap: 8px; }
  .data-table td.td-actions .action-btn { width: 38px; height: 38px; }
  .data-table td[colspan] { display: block; border-bottom: none; }
  .data-table td[colspan]::before { display: none; }
  /* Toolbar */
  .search-box { min-width: 0; max-width: 100%; flex: 1; }
  .table-toolbar { flex-direction: column; align-items: stretch; }
  .table-toolbar-left, .table-toolbar-right { width: 100%; }
  .table-toolbar-right { flex-wrap: wrap; }
  .pagination { flex-wrap: wrap; justify-content: center; }
  .page-btn { min-width: 44px; height: 44px; }
  .table-footer { flex-direction: column; align-items: flex-start; gap: 8px; }

  /* ── Item rows: stacked card layout ── */
  .items-header { display: none; }
  .items-header.bonus-header { display: grid; grid-template-columns: 20px 1fr 32px; }

  .item-row {
    display: flex !important;
    flex-direction: column !important;
    gap: 0;
    padding: 14px 14px 12px 14px;
    background: var(--surface-2);
    border: 1px solid var(--border-strong) !important;
    border-bottom: none !important;
    border-radius: var(--r-lg);
    margin-bottom: 10px;
    position: relative;
    animation: none;
  }
  .item-row:hover { background: var(--surface-2); }
  .item-row-num { display: none; }

  /* Remove button: absolute top-right corner */
  .item-row > .remove-row-btn {
    position: absolute !important;
    top: 10px; right: 10px;
    width: 30px; height: 30px;
    background: var(--surface-3);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    color: var(--text-2);
  }
  .item-row > .remove-row-btn svg { width: 13px; height: 13px; }

  /* Name/description div: full width, padded so text clears the remove button */
  .item-row > div:not(.item-col-qty):not(.item-col-price):not(.item-col-total) {
    width: 100%;
    padding-right: 42px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 10px;
  }
  .item-row > div:not(.item-col-qty):not(.item-col-price):not(.item-col-total) .item-input {
    width: 100% !important;
    background: var(--surface-1) !important;
    border: 1px solid var(--border-strong) !important;
    border-radius: var(--r-sm);
    padding: 8px 10px;
    font-size: 14px;
    display: block;
    margin-bottom: 5px;
    text-align: left;
  }
  .item-row > div:not(.item-col-qty):not(.item-col-price):not(.item-col-total) .item-input:last-child {
    margin-bottom: 0;
  }

  /* Each field row: label on left, input/value on right */
  .item-col-qty,
  .item-col-price,
  .item-col-total {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
  }
  .item-col-total { border-bottom: none; padding-bottom: 0; }

  /* Labels */
  .item-col-qty::before,
  .item-col-price::before,
  .item-col-total::before {
    content: "";
    flex-shrink: 0;
    width: 52px;
    font-size: 10px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--text-3);
  }
  .item-col-qty::before   { content: "Qty"; }
  .item-col-price::before { content: "Price"; }
  .item-col-total::before { content: "Total"; }

  /* Qty + Price: clearly visible bordered input */
  .item-col-qty .item-input,
  .item-col-price .item-input {
    flex: 1;
    padding: 9px 12px !important;
    font-size: 15px !important;
    text-align: left !important;
    font-family: 'DM Sans', sans-serif !important;
    background: var(--surface-1) !important;
    border: 1.5px solid var(--border-strong) !important;
    border-radius: var(--r-sm);
    min-height: 42px;
    color: var(--text-1);
    font-weight: 500;
    display: block;
  }
  .item-col-qty .item-input:focus,
  .item-col-price .item-input:focus {
    border-color: var(--brand-500) !important;
    box-shadow: 0 0 0 3px rgba(0,149,184,0.15);
    outline: none;
  }

  /* Total: large, bold, brand colour — clearly a computed value */
  .item-col-total .item-total-display,
  .item-col-total .item-input {
    flex: 1;
    font-size: 17px !important;
    font-weight: 800 !important;
    color: var(--brand-400) !important;
    font-family: 'JetBrains Mono', monospace !important;
    font-variant-numeric: tabular-nums;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 2px 0 !important;
    text-align: left !important;
    pointer-events: none;
    display: block;
  }

  /* Bonus rows: stay as a compact single line */
  .item-row.bonus-row {
    flex-direction: row !important;
    flex-wrap: nowrap;
    padding: 10px 48px 10px 12px;
    margin-bottom: 6px;
    gap: 8px;
    align-items: center;
  }
  .item-row.bonus-row .item-row-num { display: none; }
  .item-row.bonus-row > .remove-row-btn { top: 8px; right: 8px; }

  .company-cards { grid-template-columns: 1fr 1fr; }
  .lang-picker { flex-wrap: wrap; }

  .page-header { flex-direction: column; align-items: flex-start; }
  .page-header-right { width: 100%; justify-content: flex-start; }

  .stat-cards { grid-template-columns: 1fr 1fr; }
  .stat-value { font-size: 20px; }

  .topbar-breadcrumb .page-title { font-size: 14px; }

  .form-footer {
    bottom: 64px;
    z-index: 100;
    margin: 0 -16px -100px;
    padding: 12px 16px;
    width: calc(100% + 32px);
  }
  .form-footer .btn { width: 100%; justify-content: center; }

  .field-row { grid-template-columns: 1fr; }
  .totals-box { justify-content: stretch; }
  .totals-table { min-width: auto; width: 100%; }

  .toast-container { top: 60px; left: 12px; right: 12px; }
  .toast { min-width: auto; max-width: 100%; }
}

@media (max-width: 767px) {
  .bottom-nav { display: flex; }
}
@media (min-width: 768px) {
  .bottom-nav { display: none; }
}

/* ══════════════════════════════════════════════════════════════════════════
   UTILITIES
   ══════════════════════════════════════════════════════════════════════════ */

.d-flex { display: flex; }
.d-none { display: none; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.text-sm   { font-size: 13px; }
.text-xs   { font-size: 11px; }
.text-muted{ color: var(--text-2); }
.text-right{ text-align: right; }
.text-center{ text-align: center; }
.fw-700 { font-weight: 700; }
.color-success { color: var(--success); }
.color-danger  { color: var(--danger); }
.color-warning { color: var(--warning); }
.color-brand   { color: var(--brand-400); }

/* Divider */
.divider { height: 1px; background: var(--border); margin: 16px 0; }

/* Section subtitle */
.section-sub {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-3); margin-bottom: 10px; padding-top: 4px;
}

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