* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  color-scheme: dark;
  --bg-page: #070707;
  --bg-page-alt: #0d0d0d;
  --bg-surface: rgba(16, 16, 16, 0.92);
  --bg-elevated: #1a1a1a;
  --bg-sidebar: rgba(12, 12, 12, 0.98);
  --bg-input: #111;
  --border-subtle: rgba(255, 255, 255, 0.05);
  --border-default: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.18);
  --text-primary: #ece8df;
  --text-secondary: #d7d1c7;
  --text-muted: #9a9488;
  --text-faint: #6f6b64;
  --accent: #d8a05a;
  --accent-soft: rgba(216, 160, 90, 0.12);
  --chart-primary: #d8a05a;
  --chart-secondary: #7f8b91;
  --status-success: #84ad8b;
  --status-danger: #bd7772;
  --track: #1b1b1b;
  --shadow-soft: 0 20px 40px rgba(0, 0, 0, 0.18);
  --shell-bg: var(--bg-page);
  --shell-bg-alt: var(--bg-page-alt);
  --shell-panel: var(--bg-surface);
  --shell-border: var(--border-default);
  --shell-border-soft: var(--border-subtle);
  --shell-text: var(--text-primary);
  --shell-muted: var(--text-muted);
  --shell-accent: var(--accent);
  --shell-track: var(--track);
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg-page: #f4f0e8;
    --bg-page-alt: #ebe5da;
    --bg-surface: #fffdf8;
    --bg-elevated: #ffffff;
    --bg-sidebar: rgba(232, 226, 215, 0.98);
    --bg-input: #fbf8f1;
    --border-subtle: rgba(49, 45, 39, 0.08);
    --border-default: rgba(49, 45, 39, 0.14);
    --border-strong: rgba(49, 45, 39, 0.28);
    --text-primary: #25231f;
    --text-secondary: #45413b;
    --text-muted: #6f6960;
    --text-faint: #918a80;
    --accent: #a96f32;
    --accent-soft: rgba(169, 111, 50, 0.12);
    --chart-primary: #a96f32;
    --chart-secondary: #687981;
    --status-success: #557c5d;
    --status-danger: #9a5753;
    --track: #e7e0d5;
    --shadow-soft: 0 14px 30px rgba(75, 66, 54, 0.08);
  }

  .filmstrip {
    opacity: 0.62;
    filter: grayscale(1) contrast(0.58);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.24), inset 0 -1px 0 rgba(42,39,35,0.22);
  }

  .sidebar-logo {
    filter: invert(1) grayscale(1) contrast(0.72);
    opacity: 0.9;
  }

  .badge-offer,
  .badge-incomplete {
    color: #765026;
  }

  .badge-planned,
  .badge-sent,
  .badge-corrected {
    color: #3f6170;
  }

  .badge-postprocess,
  .badge-paid {
    color: #45664b;
  }

  .badge-invoiced,
  .badge-draft {
    color: var(--text-secondary);
    border-color: var(--border-default);
  }

  .badge-lost,
  .badge-disabled,
  .badge-credit {
    color: #8b4947;
  }

  body::after { opacity: 0.018; }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg-page: #070707;
  --bg-page-alt: #0d0d0d;
  --bg-surface: rgba(16, 16, 16, 0.92);
  --bg-elevated: #1a1a1a;
  --bg-sidebar: rgba(12, 12, 12, 0.98);
  --bg-input: #111;
  --border-subtle: rgba(255, 255, 255, 0.05);
  --border-default: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.18);
  --text-primary: #ece8df;
  --text-secondary: #d7d1c7;
  --text-muted: #9a9488;
  --text-faint: #6f6b64;
  --accent: #d8a05a;
  --accent-soft: rgba(216, 160, 90, 0.12);
  --chart-primary: #d8a05a;
  --chart-secondary: #7f8b91;
  --status-success: #84ad8b;
  --status-danger: #bd7772;
  --track: #1b1b1b;
  --shadow-soft: 0 20px 40px rgba(0, 0, 0, 0.18);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg-page: #f4f0e8;
  --bg-page-alt: #ebe5da;
  --bg-surface: #fffdf8;
  --bg-elevated: #ffffff;
  --bg-sidebar: rgba(232, 226, 215, 0.98);
  --bg-input: #fbf8f1;
  --border-subtle: rgba(49, 45, 39, 0.08);
  --border-default: rgba(49, 45, 39, 0.14);
  --border-strong: rgba(49, 45, 39, 0.28);
  --text-primary: #25231f;
  --text-secondary: #45413b;
  --text-muted: #6f6960;
  --text-faint: #918a80;
  --accent: #a96f32;
  --accent-soft: rgba(169, 111, 50, 0.12);
  --chart-primary: #a96f32;
  --chart-secondary: #687981;
  --status-success: #557c5d;
  --status-danger: #9a5753;
  --track: #e7e0d5;
  --shadow-soft: 0 14px 30px rgba(75, 66, 54, 0.08);
}

:root[data-theme="light"] .filmstrip {
  opacity: 0.62;
  filter: grayscale(1) contrast(0.58);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.24), inset 0 -1px 0 rgba(42,39,35,0.22);
}

:root[data-theme="light"] .sidebar-logo {
  filter: invert(1) grayscale(1) contrast(0.72);
  opacity: 0.9;
}

:root[data-theme="light"] .badge-offer,
:root[data-theme="light"] .badge-incomplete { color: #765026; }

:root[data-theme="light"] .badge-planned,
:root[data-theme="light"] .badge-sent,
:root[data-theme="light"] .badge-corrected { color: #3f6170; }

:root[data-theme="light"] .badge-postprocess,
:root[data-theme="light"] .badge-paid { color: #45664b; }

:root[data-theme="light"] .badge-invoiced,
:root[data-theme="light"] .badge-draft {
  color: var(--text-secondary);
  border-color: var(--border-default);
}

:root[data-theme="light"] .badge-lost,
:root[data-theme="light"] .badge-disabled,
:root[data-theme="light"] .badge-credit { color: #8b4947; }

:root[data-theme="light"] body::after { opacity: 0.018; }

body {
  font-family: Inter, 'Helvetica Neue', Helvetica, Arial, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(216, 160, 90, 0.08), transparent 24%),
    radial-gradient(circle at bottom right, rgba(255, 255, 255, 0.03), transparent 20%),
    linear-gradient(180deg, var(--shell-bg), var(--shell-bg-alt));
  color: var(--shell-text);
  min-height: 100vh;
  display: flex;
  position: relative;
  overflow-x: hidden;
  padding-top: 28px;
  padding-bottom: 28px;
}

/* ── Film Grain Overlay ── */
body::after {
  content: '';
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  opacity: 0.035;
  z-index: 9999;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='1'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}

.filmstrip {
  position: fixed;
  left: 0;
  right: 0;
  height: 28px;
  z-index: 9998;
  pointer-events: none;
  background-color: #0b0b0b;
  background-repeat: repeat-x;
  background-position: left top;
  background-size: 1536px 28px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), inset 0 -1px 0 rgba(0,0,0,0.85);
}

.filmstrip-top {
  top: 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1536 28' preserveAspectRatio='none'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%23070707'/%3E%3Cstop offset='0.5' stop-color='%23161616'/%3E%3Cstop offset='1' stop-color='%23070707'/%3E%3C/linearGradient%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.95' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3C/defs%3E%3Crect width='1536' height='28' fill='url(%23g)'/%3E%3Crect width='1536' height='28' filter='url(%23n)' opacity='.03'/%3E%3Cg fill='%23000000' fill-opacity='.94'%3E%3Crect x='20' y='5' rx='2' width='12' height='16'/%3E%3Crect x='56' y='5' rx='2' width='12' height='16'/%3E%3Crect x='92' y='5' rx='2' width='12' height='16'/%3E%3Crect x='128' y='5' rx='2' width='12' height='16'/%3E%3Crect x='164' y='5' rx='2' width='12' height='16'/%3E%3Crect x='200' y='5' rx='2' width='12' height='16'/%3E%3Crect x='236' y='5' rx='2' width='12' height='16'/%3E%3Crect x='272' y='5' rx='2' width='12' height='16'/%3E%3Crect x='308' y='5' rx='2' width='12' height='16'/%3E%3Crect x='344' y='5' rx='2' width='12' height='16'/%3E%3Crect x='380' y='5' rx='2' width='12' height='16'/%3E%3Crect x='416' y='5' rx='2' width='12' height='16'/%3E%3Crect x='452' y='5' rx='2' width='12' height='16'/%3E%3Crect x='488' y='5' rx='2' width='12' height='16'/%3E%3Crect x='524' y='5' rx='2' width='12' height='16'/%3E%3Crect x='560' y='5' rx='2' width='12' height='16'/%3E%3Crect x='596' y='5' rx='2' width='12' height='16'/%3E%3Crect x='632' y='5' rx='2' width='12' height='16'/%3E%3Crect x='668' y='5' rx='2' width='12' height='16'/%3E%3Crect x='704' y='5' rx='2' width='12' height='16'/%3E%3Crect x='740' y='5' rx='2' width='12' height='16'/%3E%3Crect x='776' y='5' rx='2' width='12' height='16'/%3E%3Crect x='812' y='5' rx='2' width='12' height='16'/%3E%3Crect x='848' y='5' rx='2' width='12' height='16'/%3E%3Crect x='884' y='5' rx='2' width='12' height='16'/%3E%3Crect x='920' y='5' rx='2' width='12' height='16'/%3E%3Crect x='956' y='5' rx='2' width='12' height='16'/%3E%3Crect x='992' y='5' rx='2' width='12' height='16'/%3E%3Crect x='1028' y='5' rx='2' width='12' height='16'/%3E%3Crect x='1064' y='5' rx='2' width='12' height='16'/%3E%3Crect x='1100' y='5' rx='2' width='12' height='16'/%3E%3Crect x='1136' y='5' rx='2' width='12' height='16'/%3E%3Crect x='1172' y='5' rx='2' width='12' height='16'/%3E%3Crect x='1208' y='5' rx='2' width='12' height='16'/%3E%3Crect x='1244' y='5' rx='2' width='12' height='16'/%3E%3Crect x='1280' y='5' rx='2' width='12' height='16'/%3E%3Crect x='1316' y='5' rx='2' width='12' height='16'/%3E%3Crect x='1352' y='5' rx='2' width='12' height='16'/%3E%3Crect x='1388' y='5' rx='2' width='12' height='16'/%3E%3Crect x='1424' y='5' rx='2' width='12' height='16'/%3E%3Crect x='1460' y='5' rx='2' width='12' height='16'/%3E%3Crect x='1496' y='5' rx='2' width='12' height='16'/%3E%3C/g%3E%3Cg font-family='Inter, Helvetica, Arial, sans-serif' font-size='10' letter-spacing='1.4' fill='%238f7b5a' opacity='.72'%3E%3Ctext x='22' y='10'%3EKODAK 400TX%3C/text%3E%3Ctext x='270' y='10'%3E25%3C/text%3E%3Ctext x='530' y='10'%3E26%3C/text%3E%3Ctext x='938' y='10'%3EKODAK 400TX%3C/text%3E%3C/g%3E%3C/svg%3E");
}

.filmstrip-bottom {
  bottom: 0;
  border-top: 1px solid rgba(255,255,255,0.06);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1536 28' preserveAspectRatio='none'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%23070707'/%3E%3Cstop offset='0.5' stop-color='%23161616'/%3E%3Cstop offset='1' stop-color='%23070707'/%3E%3C/linearGradient%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.95' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3C/defs%3E%3Crect width='1536' height='28' fill='url(%23g)'/%3E%3Crect width='1536' height='28' filter='url(%23n)' opacity='.03'/%3E%3Cg fill='%23000000' fill-opacity='.94'%3E%3Crect x='20' y='5' rx='2' width='12' height='16'/%3E%3Crect x='56' y='5' rx='2' width='12' height='16'/%3E%3Crect x='92' y='5' rx='2' width='12' height='16'/%3E%3Crect x='128' y='5' rx='2' width='12' height='16'/%3E%3Crect x='164' y='5' rx='2' width='12' height='16'/%3E%3Crect x='200' y='5' rx='2' width='12' height='16'/%3E%3Crect x='236' y='5' rx='2' width='12' height='16'/%3E%3Crect x='272' y='5' rx='2' width='12' height='16'/%3E%3Crect x='308' y='5' rx='2' width='12' height='16'/%3E%3Crect x='344' y='5' rx='2' width='12' height='16'/%3E%3Crect x='380' y='5' rx='2' width='12' height='16'/%3E%3Crect x='416' y='5' rx='2' width='12' height='16'/%3E%3Crect x='452' y='5' rx='2' width='12' height='16'/%3E%3Crect x='488' y='5' rx='2' width='12' height='16'/%3E%3Crect x='524' y='5' rx='2' width='12' height='16'/%3E%3Crect x='560' y='5' rx='2' width='12' height='16'/%3E%3Crect x='596' y='5' rx='2' width='12' height='16'/%3E%3Crect x='632' y='5' rx='2' width='12' height='16'/%3E%3Crect x='668' y='5' rx='2' width='12' height='16'/%3E%3Crect x='704' y='5' rx='2' width='12' height='16'/%3E%3Crect x='740' y='5' rx='2' width='12' height='16'/%3E%3Crect x='776' y='5' rx='2' width='12' height='16'/%3E%3Crect x='812' y='5' rx='2' width='12' height='16'/%3E%3Crect x='848' y='5' rx='2' width='12' height='16'/%3E%3Crect x='884' y='5' rx='2' width='12' height='16'/%3E%3Crect x='920' y='5' rx='2' width='12' height='16'/%3E%3Crect x='956' y='5' rx='2' width='12' height='16'/%3E%3Crect x='992' y='5' rx='2' width='12' height='16'/%3E%3Crect x='1028' y='5' rx='2' width='12' height='16'/%3E%3Crect x='1064' y='5' rx='2' width='12' height='16'/%3E%3Crect x='1100' y='5' rx='2' width='12' height='16'/%3E%3Crect x='1136' y='5' rx='2' width='12' height='16'/%3E%3Crect x='1172' y='5' rx='2' width='12' height='16'/%3E%3Crect x='1208' y='5' rx='2' width='12' height='16'/%3E%3Crect x='1244' y='5' rx='2' width='12' height='16'/%3E%3Crect x='1280' y='5' rx='2' width='12' height='16'/%3E%3Crect x='1316' y='5' rx='2' width='12' height='16'/%3E%3Crect x='1352' y='5' rx='2' width='12' height='16'/%3E%3Crect x='1388' y='5' rx='2' width='12' height='16'/%3E%3Crect x='1424' y='5' rx='2' width='12' height='16'/%3E%3Crect x='1460' y='5' rx='2' width='12' height='16'/%3E%3Crect x='1496' y='5' rx='2' width='12' height='16'/%3E%3C/g%3E%3Cg font-family='Inter, Helvetica, Arial, sans-serif' font-size='10' letter-spacing='1.4' fill='%238f7b5a' opacity='.72'%3E%3Ctext x='22' y='10'%3E24A%3C/text%3E%3Ctext x='270' y='10'%3E25%3C/text%3E%3Ctext x='520' y='10'%3E25A%3C/text%3E%3Ctext x='776' y='10'%3E26%3C/text%3E%3Ctext x='1026' y='10'%3E26A%3C/text%3E%3C/g%3E%3C/svg%3E");
}

/* ── Sidebar ── */
.sidebar {
  width: 242px;
  min-width: 242px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--shell-border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: inset -1px 0 0 rgba(255,255,255,0.02);
}

.sidebar-header {
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--shell-border-soft);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}

.sidebar-logo {
  width: 160px;
  height: auto;
  max-width: 100%;
  display: block;
  filter: drop-shadow(0 0 12px rgba(255,255,255,0.03));
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  margin: 0 10px 6px;
  color: var(--shell-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease;
  border: 1px solid transparent;
  border-radius: 14px;
}

.sidebar-nav a:hover {
  color: var(--shell-text);
  background: var(--border-subtle);
  transform: translateX(2px);
}

.sidebar-nav a.active {
  color: var(--shell-text);
  border-color: var(--border-default);
  background: var(--accent-soft);
  box-shadow: var(--shadow-soft);
}

.sidebar-nav a .icon {
  font-size: 15px;
  width: 20px;
  text-align: center;
  opacity: 0.72;
}

.sidebar-nav a.active .icon {
  opacity: 1;
}

/* ── Sidebar Footer ── */
.sidebar-footer {
  border-top: 1px solid var(--shell-border-soft);
  padding: 10px 12px 16px;
}

.sidebar-footer-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  color: var(--shell-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease;
  border: 1px solid transparent;
  border-radius: 14px;
}

.sidebar-footer-link:hover {
  color: var(--shell-text);
  background: var(--border-subtle);
  transform: translateX(2px);
}

.sidebar-footer-link.active {
  color: var(--shell-text);
  border-color: var(--border-default);
  background: var(--accent-soft);
}

.sidebar-footer-link .icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
  opacity: 0.6;
}

.sidebar-footer-link.active .icon {
  opacity: 1;
}

.sidebar-user-area {
  margin-top: 6px;
  padding: 10px 4px 0;
  border-top: 1px solid var(--border-subtle);
}

.sidebar-locale-switcher {
  padding: 8px 14px;
  margin-top: 2px;
}

.sidebar-locale-label {
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.sidebar-locale-links {
  display: flex;
  gap: 6px;
}

.sidebar-locale-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 26px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--shell-text);
  text-decoration: none;
  font-size: 11px;
  line-height: 1;
  transition: all 0.15s ease;
}

.sidebar-locale-links a:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.sidebar-locale-links a.active {
  background: var(--accent-soft);
  border-color: var(--border-default);
  color: var(--shell-text);
}

.sidebar-account-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.sidebar-company-name {
  font-size: 11px;
  color: var(--shell-muted);
  letter-spacing: 0.04em;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-logout-form {
  margin: 0;
}

.btn-logout {
  background: none;
  border: 1px solid var(--border-default);
  color: var(--shell-muted);
  padding: 6px 9px;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  font-family: inherit;
  border-radius: 10px;
  transition: all 0.15s;
}

.btn-logout:hover {
  border-color: var(--border-strong);
  color: var(--shell-text);
  background: var(--border-subtle);
}

.sidebar-version {
  font-size: 9px;
  color: var(--text-faint);
  letter-spacing: 0.16em;
  margin-top: 8px;
}

/* ── Main Content ── */
.main {
  flex: 1;
  min-width: 0;
  padding: 28px 32px 42px;
  overflow-y: auto;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.012), rgba(255,255,255,0.0)),
    linear-gradient(180deg, rgba(255,255,255,0.004), transparent 18%);
}

.main-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 26px;
  padding: 14px 18px;
  border: 1px solid var(--shell-border);
  border-radius: 20px;
  background: var(--shell-panel);
  box-shadow: var(--shadow-soft);
}

.main-toolbar-copy {
  display: grid;
  gap: 4px;
}

.main-toolbar-kicker {
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--shell-text);
}

.main-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.toolbar-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-default);
  background: var(--bg-elevated);
  color: var(--shell-text);
  text-decoration: none;
  font-size: 12px;
  letter-spacing: 0.04em;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.toolbar-action:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
  background: var(--accent-soft);
}

.toolbar-action-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  font-size: 14px;
  color: var(--shell-accent);
}

.page-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--shell-border-soft);
}

.page-header h2 {
  min-width: 0;
  font-size: 23px;
  font-weight: 300;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--shell-text);
  font-family: Georgia, 'Times New Roman', serif;
}

/* ── Cards ── */
.card {
  background: var(--shell-panel);
  border: 1px solid var(--shell-border);
  border-radius: 18px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-soft);
}

/* ── Buttons ── */
.btn {
  display: inline-block;
  padding: 9px 16px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid var(--border-default);
  font-family: inherit;
  color: var(--shell-text);
  background: var(--bg-elevated);
  transition: all 0.15s;
}

.btn:hover {
  background: var(--accent-soft);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.btn-sm {
  padding: 5px 12px;
  font-size: 11px;
}

.btn-primary {
  background: linear-gradient(180deg, #f5e0c7, #d8a05a);
  color: #191308;
  border-color: #efcca2;
  box-shadow: 0 10px 20px rgba(216, 160, 90, 0.18);
}

.btn-primary:hover {
  background: linear-gradient(180deg, #f9e7d2, #e2b070);
  border-color: #f3d4ad;
  color: #100a05;
}

.btn-danger {
  border-color: rgba(255,112,112,0.22);
  color: #e6a0a0;
}

.btn-danger:hover {
  border-color: rgba(255,112,112,0.38);
  color: #fff;
  background: rgba(255,112,112,0.08);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-default);
  color: var(--shell-muted);
}

.btn-outline:hover {
  background: var(--accent-soft);
  border-color: var(--border-strong);
  color: var(--shell-text);
}

.btn-ghost {
  background: transparent;
  border: none;
  color: var(--shell-muted);
  padding: 4px 8px;
}

.btn-ghost:hover {
  color: var(--shell-text);
}

/* Equal-width invoice list action buttons */
.inv-row-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  align-items: stretch;
}
.btn-equal {
  flex: 1 1 0;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  padding-left: 6px;
  padding-right: 6px;
}
.inv-addr-missing {
  color: #c9732a;
  font-style: italic;
}

/* ── Tables ── */
.table {
  width: 100%;
  border-collapse: collapse;
}

.table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--shell-muted);
  border-bottom: 1px solid var(--shell-border-soft);
}

.table td {
  padding: 12px 14px;
  border-top: 1px solid var(--border-subtle);
  font-size: 13px;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.table tr:hover td {
  background: var(--accent-soft);
}

/* ── Badges ── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge-offer { background: rgba(216,160,90,0.10); color: #f0c58c; border: 1px solid rgba(216,160,90,0.18); }
.badge-planned { background: rgba(102,179,255,0.10); color: #9fccff; border: 1px solid rgba(102,179,255,0.18); }
.badge-postprocess { background: rgba(139,212,156,0.10); color: #bfe8c6; border: 1px solid rgba(139,212,156,0.18); }
.badge-invoiced { background: rgba(255,255,255,0.06); color: #ddd8cf; border: 1px solid rgba(255,255,255,0.10); }
.badge-draft { background: rgba(255,255,255,0.04); color: #b8b2a7; border: 1px solid rgba(255,255,255,0.08); }
.badge-sent { background: rgba(102,179,255,0.08); color: #b8d9ff; border: 1px solid rgba(102,179,255,0.14); }
.badge-paid { background: rgba(139,212,156,0.08); color: #c8ebd0; border: 1px solid rgba(139,212,156,0.14); }
.badge-lost { background: rgba(255,112,112,0.10); color: #ffb6b6; border: 1px solid rgba(255,112,112,0.18); }

.badge-disabled { background: rgba(255,112,112,0.10); color: #ffb6b6; border: 1px solid rgba(255,112,112,0.18); }

.badge-incomplete { background: rgba(216,160,90,0.10); color: #f0c58c; border: 1px solid rgba(216,160,90,0.18); }

/* Info-hint tooltip (reusable; used on dashboard alerts + customer detail) */
.info-hint {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  margin-left: 6px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
  font-size: 9px;
  font-style: italic;
  cursor: help;
  vertical-align: middle;
  text-decoration: none;
  line-height: 1;
}
.info-hint:hover, .info-hint:focus { color: var(--text-primary); border-color: var(--accent); }
.info-hint .tip {
  position: absolute;
  bottom: 140%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.4;
  padding: 8px 10px;
  border-radius: 4px;
  width: 240px;
  z-index: 10;
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s;
  font-style: normal;
  letter-spacing: 0;
  text-transform: none;
  text-align: left;
  font-weight: 400;
}
.info-hint:hover .tip, .info-hint:focus .tip { opacity: 1; }

/* ── Search, filters, and pagination ── */
.filter-bar,
[data-live-search] {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

[data-live-search] input[type="search"],
.select-filter {
  min-height: 38px;
  padding: 9px 12px;
  border: 1px solid var(--border-default) !important;
  border-radius: 10px !important;
  outline: none;
  background: var(--bg-input) !important;
  color: var(--text-primary) !important;
  font-family: inherit;
  font-size: 13px;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

[data-live-search] input[type="search"] {
  width: 100%;
  max-width: 420px;
}

[data-live-search] input[type="search"]::placeholder {
  color: var(--text-faint);
}

[data-live-search] input[type="search"]:focus,
.select-filter:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.select-filter {
  padding-right: 36px;
  cursor: pointer;
}

.filter-bar-spacer {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.filter-label {
  color: var(--text-muted);
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
  padding: 12px 0;
  color: var(--text-muted);
  font-size: 12px;
}

.pagination-pages {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.pagination-link {
  display: inline-flex;
  min-width: 34px;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border: 1px solid var(--border-default);
  border-radius: 10px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.pagination-link:hover {
  border-color: var(--border-strong);
  background: var(--accent-soft);
  color: var(--text-primary);
}

.pagination-link.is-current {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text-primary);
}

.pagination-link.is-disabled {
  opacity: 0.4;
  pointer-events: none;
}

.pagination-ellipsis {
  padding: 0 4px;
  color: var(--text-faint);
}

@media (max-width: 600px) {
  .filter-bar-spacer {
    width: 100%;
    margin-left: 0;
  }

  .pagination {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* ── Theme-aware kanban surfaces ── */
.kanban-column {
  padding: 12px;
  border: 1px solid var(--border-default);
  border-radius: 18px;
  background: var(--bg-surface);
}

.kanban-column.drag-over {
  border-radius: 18px;
  outline: 1px dashed var(--border-strong);
  background: var(--accent-soft);
}

.kanban-column-header {
  margin-bottom: 12px;
  padding: 8px 0;
  border-bottom: 2px solid var(--border-default);
}

.kanban-column-title {
  color: var(--text-muted);
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.kanban-column-count,
.kanban-card-meta,
.kanban-card-note,
.kanban-column-summary,
.kanban-empty {
  color: var(--text-faint);
}

.kanban-card-title {
  margin-bottom: 6px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
}

.kanban-card-customer {
  margin-bottom: 4px;
  color: var(--text-muted);
  font-size: 11px;
}

.kanban-card-meta,
.kanban-card-note,
.kanban-column-summary {
  font-size: 11px;
}

.kanban-card-price {
  margin-top: 6px;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 400;
}

.kanban-card-note {
  cursor: help;
}

.kanban-empty {
  padding: 30px;
  font-size: 12px;
  text-align: center;
}

.kanban-column-footer {
  margin-top: 4px;
  padding: 8px;
  border-top: 1px solid var(--border-subtle);
  font-size: 11px;
  text-align: center;
}

/* ── Forms ── */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 6px;
  color: var(--text-muted);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-default);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  background: var(--bg-input);
  color: var(--text-primary);
  transition: border-color 0.15s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--border-strong);
}

.form-group textarea {
  min-height: 80px;
  resize: vertical;
}

/* ── Select dropdown custom arrow ── */
.form-group select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23555'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

/* ── Date/time input calendar icon ── */
.form-group input[type="date"]::-webkit-calendar-picker-indicator,
.form-group input[type="time"]::-webkit-calendar-picker-indicator {
  filter: invert(0.5);
  cursor: pointer;
  opacity: 0.6;
}

.form-group input[type="date"]::-webkit-calendar-picker-indicator:hover,
.form-group input[type="time"]::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}

/* ── Morale Badges ── */
.morale-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 2px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.morale-excellent { background: #1a2a1a; color: #aaa; border: 1px solid #2a3a2a; }
.morale-good { background: #1a1a2a; color: #aaa; border: 1px solid #2a2a3a; }
.morale-average { background: #2a2a1a; color: #aaa; border: 1px solid #3a3a2a; }
.morale-poor { background: #2a1a1a; color: #aaa; border: 1px solid #3a2a2a; }

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #555;
}

.empty-state .icon {
  font-size: 36px;
  margin-bottom: 12px;
  opacity: 0.4;
}

/* ── Film Frame Borders ── */
.film-border {
  border: 2px solid #1a1a1a;
  box-shadow: inset 0 0 0 1px #222, 0 0 0 1px #111;
}

/* ── Alerts ── */
.alert {
  padding: 12px 16px;
  border: 1px solid var(--border-default);
  border-left: 3px solid var(--text-muted);
  margin-bottom: 8px;
  font-size: 13px;
  background: var(--bg-surface);
}

.alert strong {
  display: block;
  color: var(--text-primary);
  margin-bottom: 2px;
  font-size: 12px;
}

.alert .meta {
  font-size: 11px;
  color: var(--text-muted);
}

.alert.alert-warning { border-left-color: #888; }
.alert.alert-danger { border-left-color: #999; }
.alert.alert-info { border-left-color: #666; }

/* ── Clickable alert / action card ── */
.alert-action {
  display: block;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: all 0.15s;
}

.alert-action:hover {
  border-color: var(--border-strong);
  background: var(--bg-elevated);
}

.alert-action:hover strong {
  color: var(--text-primary);
}

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

/* ── Modal ── */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.8);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: 14px;
  padding: 24px;
  min-width: 400px;
  max-width: 500px;
}

.modal h3 {
  font-size: 16px;
  font-weight: 300;
  letter-spacing: 1px;
  margin-bottom: 20px;
  color: var(--text-primary);
}

.payment-modal {
  width: 100%;
  min-width: 0;
  max-width: 380px;
}

.modal-head {
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
}

.modal-sub {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
  margin: 0 0 16px;
}

.modal-date {
  width: 100%;
  margin-bottom: 16px;
}

.modal-actions {
  margin-top: 20px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.modal-actions.modal-actions--equal {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: stretch;
  justify-content: initial;
}

.modal-actions.modal-actions--equal .btn {
  width: 100%;
  text-align: center;
}

/* ── Dashboard recommended actions ── */
.rec-actions-section {
  margin-bottom: 28px;
}

.rec-actions-heading {
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.5px;
  color: #999;
  margin-bottom: 12px;
}

.dashboard-action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  min-width: 0;
}

.dashboard-action-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  position: relative;
  padding: 10px 16px 10px 18px;
  min-height: 66px;
  border-radius: 24px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  box-shadow: var(--shadow-soft);
}

.dashboard-action-card:hover {
  border-color: var(--border-strong);
  background: var(--bg-elevated);
}

.dashboard-action-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 3px;
  height: 100%;
  border-radius: 24px 0 0 24px;
  background: transparent;
}

.dashboard-action-card .dashboard-action-kicker {
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dashboard-action-card .dashboard-action-value {
  font-size: 16px;
  font-weight: 300;
  line-height: 1.1;
  letter-spacing: 0.01em;
  color: var(--text-primary);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dashboard-action-card .dashboard-action-meta {
  font-size: 9px;
  color: var(--text-muted);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.dashboard-action-card--accent::before {
  display: none;
}

.dashboard-action-card--accent {
  padding-left: 15px;
  border-left: 3px solid rgba(224, 181, 74, 0.95);
}

/* ── Dashboard Grid Layouts (desktop defaults) ── */
.dashboard-stat-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 28px;
  min-width: 0;
}
.dashboard-pipeline-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 28px;
  min-width: 0;
}

.dashboard-metric-card {
  text-align: center;
}

.dashboard-metric-label,
.dashboard-pipeline-label {
  margin-bottom: 8px;
  color: var(--text-muted);
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.dashboard-metric-value {
  color: var(--text-primary);
  font-size: 28px;
  font-weight: 300;
}

.dashboard-metric-meta,
.dashboard-pipeline-meta,
.dashboard-chart-label,
.dashboard-empty-state {
  color: var(--text-faint);
  font-size: 10px;
}

.dashboard-metric-meta {
  margin-top: 4px;
}

.dashboard-pipeline-card {
  border-left: 3px solid var(--chart-secondary);
}

.dashboard-pipeline-card:nth-child(2) {
  border-left-color: var(--accent);
}

.dashboard-pipeline-card:nth-child(3) {
  border-left-color: var(--status-success);
}

.dashboard-pipeline-label {
  margin-bottom: 6px;
}

.dashboard-pipeline-value {
  color: var(--text-primary);
  font-size: 22px;
  font-weight: 300;
}

.dashboard-calendar-card {
  margin-bottom: 28px;
}

.dashboard-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.dashboard-calendar-heading {
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.5px;
}

.dashboard-calendar-subtitle {
  margin: 4px 0 0;
  color: var(--text-faint);
  font-size: 10px;
  line-height: 1.4;
}

.dashboard-calendar-summary {
  flex: 0 0 auto;
  min-width: 92px;
  text-align: right;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-input);
}

.dashboard-calendar-summary-value {
  display: block;
  color: var(--text-primary);
  font-size: 28px;
  font-weight: 300;
}

.dashboard-calendar-summary-label {
  display: block;
  color: var(--text-muted);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.dashboard-calendar {
  min-width: 0;
}

.dashboard-calendar-scroll {
  min-width: 0;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: thin;
}

.dashboard-calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}

.dashboard-calendar-weekdays div {
  color: var(--text-faint);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-align: center;
}

.dashboard-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.dashboard-calendar-day {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 140px;
  padding: 10px;
  border-radius: 18px;
  border: 1px solid var(--border-default);
  background: var(--bg-surface);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.dashboard-calendar-day.is-outside {
  opacity: 0.45;
  background: var(--bg-input);
  box-shadow: none;
}

.dashboard-calendar-day.is-today {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent-soft), var(--shadow-soft);
}

.dashboard-calendar-day-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.dashboard-calendar-day-number {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
}

.dashboard-calendar-day-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--text-primary);
  font-size: 10px;
  font-weight: 600;
}

.dashboard-calendar-day-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
}

.dashboard-calendar-shoot {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 8px 9px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-input);
  color: inherit;
  text-decoration: none;
}

.dashboard-calendar-shoot:hover {
  border-color: var(--border-strong);
  background: var(--bg-elevated);
}

.dashboard-calendar-shoot-time {
  color: var(--text-muted);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.dashboard-calendar-shoot-name {
  color: var(--text-primary);
  font-size: 12px;
  line-height: 1.2;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.dashboard-calendar-shoot-meta {
  color: var(--text-faint);
  font-size: 10px;
  line-height: 1.2;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.dashboard-calendar-more {
  padding-top: 2px;
  color: var(--text-faint);
  font-size: 10px;
  text-align: center;
}

.dashboard-chart-heading {
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.5px;
}

.dashboard-chart-column {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
}

.dashboard-chart-label:first-child {
  margin-bottom: 4px;
}

.dashboard-chart-label:last-child {
  margin-top: 6px;
}

.dashboard-chart-bar {
  width: 100%;
  max-width: 40px;
  min-height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--chart-primary);
  transition: height 0.3s;
}

.dashboard-empty-state {
  padding: 40px;
  text-align: center;
}

.period-tab {
  border: 1px solid var(--border-default);
  background: transparent;
  color: var(--text-muted);
}

.period-tab:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.period-tab.active-period {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text-primary);
}
.dashboard-rec-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

/* ── Responsive ── */

/* Tablet (<=1024px): stat cards 5→3, pipeline stays 3, rec actions 2→2 (ok) */
@media (max-width: 1024px) {
  .dashboard-stat-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .dashboard-action-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Small tablet/portrait (<=768px): sidebar collapses, stat cards 3→2, pipeline 3→1, rec actions 2→1 */
@media (max-width: 768px) {
  /* Sidebar: collapse to icon-only column */
  .sidebar {
    width: 48px;
    min-width: 48px;
  }
  .sidebar-logo { display: none; }
  .sidebar-header { padding: 12px 6px; }
  .sidebar-brand-copy { display: none; }
  .sidebar-nav { padding: 4px 0; }
  .sidebar-nav a {
    justify-content: center;
    padding: 10px 0;
    border-left: none;
    border-bottom: 1px solid var(--border-subtle);
  }
  .sidebar-nav a .icon {
    margin: 0;
    font-size: 18px;
    opacity: 0.8;
    display: block;
  }
  .sidebar-nav a span { display: none; }
  .sidebar-nav a.active { border-left: none; background: var(--accent-soft); }
  .sidebar-footer-link span { display: none; }
  .sidebar-footer-link {
    justify-content: center;
    padding: 8px 0;
    margin-left: 0;
    border-left: none;
    border-top: 1px solid var(--border-subtle);
  }
  .sidebar-footer-link .icon { font-size: 18px; opacity: 0.8; display: block; margin: 0; }
  .sidebar-user-area { display: none; }
  .sidebar-footer { padding: 8px 0; display: flex; flex-direction: column; align-items: center; }

  /* Main content */
  .main { padding: 18px 14px 24px; margin-left: 0; }
  .main-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .main-toolbar-actions {
    justify-content: flex-start;
  }

  /* Page header */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .page-header h2 { font-size: 20px; }

  /* Dashboard cards: 3 → 2 columns */
  .dashboard-stat-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
  }
  .dashboard-stat-grid .card { padding: 16px 12px; }
  .dashboard-metric-value { font-size: 22px; }

  /* Pipeline: 3 → 1 column */
  .dashboard-pipeline-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 20px;
  }

  .dashboard-card-header {
    flex-direction: column;
  }
  .dashboard-calendar-summary {
    text-align: left;
  }
  .dashboard-calendar-grid,
  .dashboard-calendar-weekdays {
    min-width: 720px;
    gap: 5px;
  }
  .dashboard-calendar-day {
    min-height: 108px;
    padding: 8px;
    border-radius: 14px;
  }
  .dashboard-calendar-shoot {
    padding: 7px 8px;
    border-radius: 10px;
  }

  /* Rec actions: 2 → 1 column */
  .dashboard-action-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .rec-actions-section { margin-bottom: 20px; }
  .dashboard-action-card {
    padding: 10px 14px 10px 16px;
    min-height: 62px;
  }

  /* Revenue chart */
  #revenue-chart { height: 120px; gap: 4px; }
  .dashboard-chart-bar { max-width: 28px; }
  .period-tab { padding: 4px 8px; font-size: 10px; }

  /* Cards */
  .card { padding: 16px; margin-bottom: 12px; }

  /* Tables */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table { min-width: 600px; }

  /* Buttons */
  .btn { padding: 7px 14px; font-size: 11px; }
  .btn-sm { padding: 4px 10px; font-size: 10px; }

  /* Modal */
  .modal { min-width: 90vw; max-width: 95vw; padding: 20px 16px; margin: 12px; }
  .modal-actions { flex-direction: column; gap: 8px; }
  .modal-actions .btn { width: 100%; text-align: center; }
  .modal-actions.modal-actions--equal { grid-template-columns: 1fr; }

  /* Form grids */
  .form-grid-2 { grid-template-columns: 1fr; }
  .form-grid-3 { grid-template-columns: 1fr; }
  .pwd-grid { grid-template-columns: 1fr; }

  /* Preferences grid */
  .pref-grid { grid-template-columns: 1fr; }
}

/* Mobile (<=480px): stat cards 2→1, sidebar even tighter */
@media (max-width: 480px) {
  /* Sidebar: narrower */
  .sidebar {
    width: 44px;
    min-width: 44px;
  }
  .sidebar-nav a { padding: 8px 0; }
  .sidebar-nav a .icon { font-size: 16px; }
  .sidebar-footer-link .icon { font-size: 16px; }

  /* Dashboard: 2 → 1 column */
  .dashboard-stat-grid {
    grid-template-columns: 1fr;
  }
  .dashboard-stat-grid .card { text-align: center; }

  /* Main */
  .main { padding: 14px 10px 20px; }
  .main-toolbar-actions { gap: 6px; }
  .toolbar-action {
    width: 100%;
    justify-content: center;
  }

  /* Revenue chart */
  #revenue-chart { height: 100px; gap: 3px; }
  .dashboard-chart-bar { max-width: 22px; }
  .dashboard-chart-label { font-size: 9px; }

  /* Cards */
  .card { padding: 12px; }

  /* Alerts */
  .alert { padding: 10px 12px; font-size: 12px; }
  .alert strong { font-size: 11px; }
  .alert .meta { font-size: 10px; }

  /* Forms — 16px prevents iOS zoom */
  .form-group input,
  .form-group select,
  .form-group textarea { padding: 12px 12px; font-size: 16px; }

  /* Tables */
  .table th, .table td { padding: 8px 10px; font-size: 12px; }
  .badge { padding: 2px 8px; font-size: 9px; }

  /* Modal full width */
  .modal { min-width: 100vw; max-width: 100vw; border-radius: 0; margin: 0; height: 100vh; max-height: 100vh; }
  .modal-overlay { align-items: flex-end; }

  /* Orders stat grid */
  .orders-stat-grid { grid-template-columns: 1fr; }
}

/* ── Orders stat grid ── */
.orders-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
@media (max-width: 1024px) {
  .orders-stat-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Form grids ── */
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.pwd-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

 /* Credit note badge */
 .badge-credit {
   background: #2a1a1a;
   color: #e08;
   border: 1px solid #5a2a2a;
 }
 .badge-corrected {
   background: #1a1a2a;
   color: #66b3ff;
   border: 1px solid #2a3a5a;
 }

 /* Invoice document styles */
 .inv-doc {
   background: #141414;
   border: 1px solid #2a2a2a;
   border-radius: 4px;
   padding: 36px;
   margin-bottom: 20px;
 }
 .inv-doc.doc-dobropis {
   border-color: #5a2a2a;
 }
 .inv-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin-bottom: 28px; }
 .inv-issuer { font-size: 13px; color: #bbb; line-height: 1.6; }
 .inv-issuer .co { color: #fff; font-size: 15px; font-weight: 500; margin-bottom: 6px; }
 .inv-recipient { font-size: 13px; color: #bbb; line-height: 1.6; text-align: right; }
 .inv-recipient .nm { color: #fff; font-size: 15px; font-weight: 500; margin-bottom: 6px; }
 .inv-title { font-size: 12px; text-transform: uppercase; letter-spacing: 2px; color: #888; border-bottom: 1px solid #242424; padding-bottom: 10px; margin-bottom: 18px; }
 .inv-meta { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px; }
 .inv-meta .lab { font-size: 9px; color: #555; text-transform: uppercase; letter-spacing: 1px; }
 .inv-meta .val { font-size: 13px; color: #ddd; margin-top: 3px; }
 .inv-lines { width: 100%; border-collapse: collapse; margin-bottom: 18px; }
 .inv-lines th { font-size: 9px; color: #555; text-transform: uppercase; letter-spacing: 1px; text-align: left; padding: 8px 6px; border-bottom: 1px solid #242424; }
 .inv-lines td { font-size: 13px; color: #ccc; padding: 9px 6px; border-bottom: 1px solid #1c1c1c; vertical-align: top; }
 .inv-lines td.num { text-align: right; white-space: nowrap; }
 .inv-totals { margin-left: auto; width: 320px; }
 .inv-totals .row { display: flex; justify-content: space-between; font-size: 13px; padding: 5px 0; color: #ccc; }
 .inv-totals .row.gross { border-top: 1px solid #2a2a2a; margin-top: 6px; padding-top: 10px; font-size: 16px; color: #fff; }
 .inv-totals .row.muted { color: #777; font-size: 11px; }
 .inv-notice { margin-top: 14px; font-size: 11px; color: #888; border-left: 2px solid #444; padding-left: 10px; }
 .inv-pay { background: #111; border: 1px solid #2a2a2a; border-radius: 4px; padding: 16px; margin-top: 18px; }
 .line-form { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr auto auto; gap: 8px; align-items: end; margin-bottom: 12px; }
 .line-form input { padding: 7px 9px; background: #111; border: 1px solid #2a2a2a; border-radius: 3px; color: #ddd; font-family: inherit; font-size: 12px; }

/* ── User administration ── */
.admin-page-intro {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 12px;
}

.admin-create-card h3,
.admin-users-table + h3,
.admin-create-card + .card h3 {
  margin-bottom: 16px;
  color: var(--text-primary);
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 18px;
  font-weight: 400;
}

.admin-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 16px;
}

.admin-users-table td {
  vertical-align: middle;
}

.admin-edit-row td {
  padding-top: 4px;
  background: var(--bg-page-alt);
}

.admin-inline-form {
  display: grid;
  grid-template-columns: 1fr 1.4fr 1fr 0.7fr auto;
  gap: 8px;
}

.admin-inline-form input,
.admin-inline-form select {
  min-width: 0;
  padding: 7px 9px;
  border: 1px solid var(--border-default);
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text-primary);
  font: inherit;
  font-size: 12px;
}

.admin-account-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

@media (max-width: 768px) {
  .admin-form-grid {
    grid-template-columns: 1fr;
  }

  .admin-inline-form {
    grid-template-columns: 1fr;
  }
}
