/* =====================================================================
   THEME TOKENS – the only place where colours are defined.
   Every component uses these variables; no hard-coded colours elsewhere.
   Rules for each theme (verified by tests/e2e contrast scan, WCAG AA):
   - --text / --text-secondary / --text-muted >= 4.5:1 on --bg, --bg-elevated, --bg-card
   - accent colours (--primary, --success, --danger, --warning, --forever, --zinzino, --purple)
     are text-safe on cards and on their own *-bg tint
   - --on-accent is the text colour on solid accent fills, --on-primary on --primary-dark
   ===================================================================== */
:root, [data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1120;
  --bg-elevated: #111827;
  --bg-card: #1e293b;
  --bg-card-hover: #263449;
  --bg-inset: rgba(15, 23, 42, 0.55);
  --surface-tint: rgba(255, 255, 255, 0.05);
  --border: #334155;
  --border-subtle: rgba(255, 255, 255, 0.07);
  --border-strong: #475569;
  --text: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --primary: #38bdf8;
  --primary-dark: #0369a1;
  --primary-hover: #075985;
  --on-primary: #ffffff;
  --primary-soft: rgba(56, 189, 248, 0.14);
  --primary-border: rgba(56, 189, 248, 0.35);
  --forever: #fbbf24;
  --forever-bg: rgba(245, 158, 11, 0.14);
  --forever-border: rgba(245, 158, 11, 0.35);
  --zinzino: #5eead4;
  --zinzino-bg: rgba(45, 212, 191, 0.14);
  --zinzino-border: rgba(45, 212, 191, 0.35);
  --success: #4ade80;
  --success-bg: rgba(34, 197, 94, 0.14);
  --success-border: rgba(34, 197, 94, 0.35);
  --danger: #fca5a5;
  --danger-bg: rgba(239, 68, 68, 0.14);
  --danger-border: rgba(239, 68, 68, 0.35);
  --warning: #fbbf24;
  --warning-bg: rgba(245, 158, 11, 0.14);
  --warning-border: rgba(245, 158, 11, 0.4);
  --purple: #c084fc;
  --purple-bg: rgba(168, 85, 247, 0.16);
  --purple-border: rgba(168, 85, 247, 0.35);
  --neutral-bg: rgba(148, 163, 184, 0.15);
  --on-accent: #0b1120;
  --nav-text: #cbd5e1;
  --nav-active-bg: rgba(56, 189, 248, 0.15);
  --nav-active-text: #38bdf8;
  --overlay: rgba(2, 6, 23, 0.72);
  --auth-bg: radial-gradient(circle at top right, #1e293b 0%, #0b1120 70%);
  --focus-ring: 0 0 0 3px rgba(56, 189, 248, 0.45);
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f8fb;
  --bg-elevated: #eef2f7;
  --bg-card: #ffffff;
  --bg-card-hover: #f4f7fb;
  --bg-inset: #f1f5f9;
  --surface-tint: rgba(15, 23, 42, 0.04);
  --border: #cbd5e1;
  --border-subtle: #e2e8f0;
  --border-strong: #94a3b8;
  --text: #0f172a;
  --text-secondary: #334155;
  --text-muted: #475569;
  --primary: #075985;
  --primary-dark: #0369a1;
  --primary-hover: #075985;
  --on-primary: #ffffff;
  --primary-soft: rgba(3, 105, 161, 0.09);
  --primary-border: rgba(3, 105, 161, 0.35);
  --forever: #92400e;
  --forever-bg: rgba(217, 119, 6, 0.10);
  --forever-border: rgba(180, 83, 9, 0.35);
  --zinzino: #115e59;
  --zinzino-bg: rgba(13, 148, 136, 0.10);
  --zinzino-border: rgba(15, 118, 110, 0.35);
  --success: #166534;
  --success-bg: rgba(22, 163, 74, 0.10);
  --success-border: rgba(22, 101, 52, 0.35);
  --danger: #b91c1c;
  --danger-bg: rgba(220, 38, 38, 0.08);
  --danger-border: rgba(185, 28, 28, 0.35);
  --warning: #92400e;
  --warning-bg: rgba(217, 119, 6, 0.10);
  --warning-border: rgba(180, 83, 9, 0.4);
  --purple: #7e22ce;
  --purple-bg: rgba(147, 51, 234, 0.08);
  --purple-border: rgba(126, 34, 206, 0.35);
  --neutral-bg: rgba(71, 85, 105, 0.10);
  --on-accent: #ffffff;
  --nav-text: #334155;
  --nav-active-bg: rgba(3, 105, 161, 0.12);
  --nav-active-text: #075985;
  --overlay: rgba(15, 23, 42, 0.45);
  --auth-bg: radial-gradient(circle at top right, #e0f2fe 0%, #f6f8fb 70%);
  --focus-ring: 0 0 0 3px rgba(3, 105, 161, 0.35);
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.10);
}

/* OLIVOVÝ – jemný přírodní motiv: teplé neutrální pozadí, olivové prvky, tmavý text */
[data-theme="olive"] {
  color-scheme: light;
  --bg: #f4f2ea;
  --bg-elevated: #ebe7da;
  --bg-card: #fffdf6;
  --bg-card-hover: #f8f5ea;
  --bg-inset: #f0ece0;
  --surface-tint: rgba(48, 52, 27, 0.05);
  --border: #d3cdb8;
  --border-subtle: #e4dfcf;
  --border-strong: #9e977d;
  --text: #1e2114;
  --text-secondary: #363b25;
  --text-muted: #4f553b;
  --primary: #465320;
  --primary-dark: #55652a;
  --primary-hover: #465320;
  --on-primary: #ffffff;
  --primary-soft: rgba(85, 101, 42, 0.12);
  --primary-border: rgba(85, 101, 42, 0.40);
  --forever: #874308;
  --forever-bg: rgba(180, 100, 20, 0.10);
  --forever-border: rgba(135, 67, 8, 0.35);
  --zinzino: #0f5a54;
  --zinzino-bg: rgba(20, 120, 110, 0.10);
  --zinzino-border: rgba(15, 90, 84, 0.35);
  --success: #2e5f19;
  --success-bg: rgba(60, 120, 30, 0.10);
  --success-border: rgba(46, 95, 25, 0.35);
  --danger: #a3261b;
  --danger-bg: rgba(190, 50, 35, 0.08);
  --danger-border: rgba(163, 38, 27, 0.35);
  --warning: #874308;
  --warning-bg: rgba(180, 100, 20, 0.10);
  --warning-border: rgba(135, 67, 8, 0.40);
  --purple: #69307f;
  --purple-bg: rgba(120, 60, 140, 0.08);
  --purple-border: rgba(105, 48, 127, 0.35);
  --neutral-bg: rgba(79, 85, 59, 0.10);
  --on-accent: #ffffff;
  --nav-text: #363b25;
  --nav-active-bg: rgba(85, 101, 42, 0.14);
  --nav-active-text: #3a451a;
  --overlay: rgba(30, 33, 20, 0.45);
  --auth-bg: radial-gradient(circle at top right, #e3e8cc 0%, #f4f2ea 70%);
  --focus-ring: 0 0 0 3px rgba(85, 101, 42, 0.40);
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 4px 20px -2px rgba(30, 33, 20, 0.12);
}

/* SMARAGDOVÝ – elegantní zelený motiv: světlé neutrální pozadí, smaragdové akcenty */
[data-theme="emerald"] {
  color-scheme: light;
  --bg: #f3f7f5;
  --bg-elevated: #e8f0ec;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f7f4;
  --bg-inset: #edf4f1;
  --surface-tint: rgba(6, 60, 45, 0.04);
  --border: #c5d6cf;
  --border-subtle: #dde8e3;
  --border-strong: #8ca79c;
  --text: #0c1f19;
  --text-secondary: #213d34;
  --text-muted: #3b574e;
  --primary: #05634a;
  --primary-dark: #047857;
  --primary-hover: #065f46;
  --on-primary: #ffffff;
  --primary-soft: rgba(4, 120, 87, 0.10);
  --primary-border: rgba(4, 120, 87, 0.38);
  --forever: #874308;
  --forever-bg: rgba(180, 100, 20, 0.10);
  --forever-border: rgba(135, 67, 8, 0.35);
  --zinzino: #0b5870;
  --zinzino-bg: rgba(14, 116, 144, 0.10);
  --zinzino-border: rgba(11, 88, 112, 0.35);
  --success: #14612f;
  --success-bg: rgba(22, 130, 60, 0.10);
  --success-border: rgba(20, 97, 47, 0.35);
  --danger: #b0221b;
  --danger-bg: rgba(200, 40, 30, 0.08);
  --danger-border: rgba(176, 34, 27, 0.35);
  --warning: #874308;
  --warning-bg: rgba(180, 100, 20, 0.10);
  --warning-border: rgba(135, 67, 8, 0.40);
  --purple: #6b2bb5;
  --purple-bg: rgba(120, 60, 200, 0.08);
  --purple-border: rgba(107, 43, 181, 0.35);
  --neutral-bg: rgba(59, 87, 78, 0.10);
  --on-accent: #ffffff;
  --nav-text: #213d34;
  --nav-active-bg: rgba(4, 120, 87, 0.12);
  --nav-active-text: #054d39;
  --overlay: rgba(12, 31, 25, 0.45);
  --auth-bg: radial-gradient(circle at top right, #d1f0e2 0%, #f3f7f5 70%);
  --focus-ring: 0 0 0 3px rgba(4, 120, 87, 0.35);
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 4px 20px -2px rgba(12, 31, 25, 0.10);
}

/* High contrast: stronger text and borders on top of the selected theme */
[data-theme="dark"][data-contrast="high"],
:root[data-contrast="high"]:not([data-theme]) {
  --text-secondary: #f1f5f9;
  --text-muted: #e2e8f0;
  --nav-text: #f8fafc;
  --border: #94a3b8;
  --border-subtle: rgba(255, 255, 255, 0.22);
  --border-strong: #cbd5e1;
}

[data-theme="olive"][data-contrast="high"] {
  --text-secondary: #1e2114;
  --text-muted: #2a2e1c;
  --nav-text: #1e2114;
  --border: #6b6650;
  --border-subtle: #a39d86;
  --border-strong: #4f4b38;
  --primary: #344016;
  --nav-active-text: #2b3512;
}

[data-theme="emerald"][data-contrast="high"] {
  --text-secondary: #0c1f19;
  --text-muted: #17302a;
  --nav-text: #0c1f19;
  --border: #4d6a60;
  --border-subtle: #8ca79c;
  --border-strong: #2f4a41;
  --primary: #044a37;
  --nav-active-text: #033a2b;
}

[data-theme="light"][data-contrast="high"] {
  --text-secondary: #0f172a;
  --text-muted: #1e293b;
  --nav-text: #0f172a;
  --border: #475569;
  --border-subtle: #94a3b8;
  --border-strong: #334155;
  --primary: #0c4a6e;
  --nav-active-text: #0c4a6e;
}

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

html {
  /* typographic scale: every font-size is in rem, so one setting scales the whole app */
  font-size: 15px;
}
html[data-font-size="13"] { font-size: 13px; }
html[data-font-size="14"] { font-size: 14px; }
html[data-font-size="15"] { font-size: 15px; }
html[data-font-size="16"] { font-size: 16px; }
html[data-font-size="17"] { font-size: 17px; }
html[data-font-size="18"] { font-size: 18px; }

body {
  font-size: 1rem;
}

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--primary);
  text-decoration: none;
}

button, input, select {
  font-family: inherit;
  font-size: inherit;
}

.hidden {
  display: none !important;
}

/* AUTHENTICATION VIEWS */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--auth-bg);
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 32px 28px;
  box-shadow: var(--shadow);
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 14px;
}

.auth-card h1 {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.auth-subtitle {
  color: var(--text-muted);
  font-size: 0.9333rem;
  margin-bottom: 24px;
}

.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 0.8667rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrap input,
.filter-input,
.filter-select {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s;
}

.input-wrap input.has-eye {
  padding-right: 44px;
}

.input-wrap input:focus,
.filter-input:focus,
.filter-select:focus {
  border-color: var(--primary);
}

.eye-btn {
  position: absolute;
  right: 8px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.eye-btn:hover {
  color: var(--text);
  background: var(--surface-tint);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
}

.btn-primary {
  background: var(--primary-dark);
  color: var(--on-primary);
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8667rem;
}

.btn-block {
  width: 100%;
}

.auth-links {
  margin-top: 18px;
  display: flex;
  justify-content: space-between;
  font-size: 0.8667rem;
}

.alert {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  margin-bottom: 16px;
}

.alert-error {
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: var(--danger);
}

.alert-success {
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  color: var(--success);
}

/* APP SHELL LAYOUT */
.app-layout {
  display: flex;
  min-height: 100vh;
  width: 100%;
  min-width: 0;
}

.sidebar {
  width: 260px;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 40;
}

.sidebar-header {
  padding: 20px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo {
  width: 38px;
  height: 38px;
  border-radius: 10px;
}

.sidebar-title {
  font-size: 1.0667rem;
  font-weight: 800;
  line-height: 1.2;
}

.sidebar-sub {
  font-size: 0.7667rem;
  color: var(--text-muted);
}

.nav-list {
  list-style: none;
  padding: 14px 10px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  max-height: calc(100vh - 140px);
}

.nav-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--nav-text);
  font-weight: 600;
  font-size: 0.9333rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s;
}

.nav-btn:hover {
  background: var(--bg-card);
  color: var(--text);
}

.nav-btn.active {
  background: var(--nav-active-bg);
  color: var(--nav-active-text);
  border-left: 3px solid var(--primary);
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  font-size: 0.8333rem;
  color: var(--text-muted);
}

.main-area {
  flex: 1;
  min-width: 0; /* wide tables scroll inside .table-wrap instead of widening the page */
  margin-left: 260px;
  padding: 24px 28px 90px 28px;
  max-width: 1600px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.page-title {
  font-size: 1.6rem;
  font-weight: 800;
}

.page-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
}

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

.topbar-cart-btn {
  background: linear-gradient(135deg, #047857 0%, #065f46 100%) !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  font-weight: 700 !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  box-shadow: 0 2px 6px rgba(4, 120, 87, 0.35) !important;
  cursor: pointer;
  transition: all 0.2s ease !important;
}

.topbar-cart-btn:hover {
  background: linear-gradient(135deg, #065f46 0%, #064e3b 100%) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(4, 120, 87, 0.45) !important;
}

.topbar-cart-badge {
  background: #ffffff !important;
  color: #064e3b !important;
  font-size: 0.72rem !important;
  font-weight: 800 !important;
  padding: 1px 7px !important;
  border-radius: 9999px !important;
  line-height: 1.3 !important;
}

#cart-drawer-toggle-btn {
  background: linear-gradient(135deg, #047857 0%, #065f46 100%) !important;
  color: #ffffff !important;
  border: none !important;
  font-weight: 700 !important;
  box-shadow: 0 2px 8px rgba(4, 120, 87, 0.3) !important;
}

#cart-drawer-toggle-btn #cart-summary-total {
  color: #ffffff !important;
}

#cart-drawer-toggle-btn #cart-badge-count {
  background: #ffffff !important;
  color: #064e3b !important;
}

#cart-drawer-toggle-btn #cart-summary-cc {
  background: #064e3b !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.3) !important;
}

/* GRID & CARDS */
.card {
  min-width: 0;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}

.card-forever {
  border-top: 3px solid var(--forever);
}

.card-zinzino {
  border-top: 3px solid var(--zinzino);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.card-title {
  font-size: 1.1333rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.kpi-box {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 13px 14px;
}

.kpi-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.kpi-value {
  font-size: 1.3333rem;
  font-weight: 800;
}

.kpi-sub {
  font-size: 0.7667rem;
  color: var(--text-muted);
  margin-top: 3px;
}

/* BADGES */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.7667rem;
  font-weight: 700;
  white-space: nowrap;
}

.badge-forever {
  background: var(--forever-bg);
  color: var(--forever);
  border: 1px solid var(--forever-border);
}

.badge-zinzino {
  background: var(--zinzino-bg);
  color: var(--zinzino);
  border: 1px solid var(--zinzino-border);
}

.badge-owner {
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid var(--primary-border);
}

.badge-success {
  background: var(--success-bg);
  color: var(--success);
}

.badge-danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.badge-neutral {
  background: var(--neutral-bg);
  color: var(--text-secondary);
}

/* FILTER BAR */
.filter-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  align-items: center;
}

.filter-bar .filter-input {
  flex: 1;
  min-width: 220px;
}

.filter-bar .filter-select {
  width: auto;
  min-width: 170px;
}

/* TABLES */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th {
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.9333rem;
  vertical-align: middle;
}

tr:last-child td {
  border-bottom: none;
}

tr.clickable-row {
  cursor: pointer;
  transition: background 0.12s;
}

tr.clickable-row:hover {
  background: var(--bg-card-hover);
}

tr.owner-row {
  background: var(--primary-soft);
}

/* CC BAR CHART */
.cc-bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cc-bar-row {
  display: grid;
  grid-template-columns: 90px 1fr 180px;
  align-items: center;
  gap: 12px;
  font-size: 0.8667rem;
}

.cc-bar-track {
  height: 14px;
  background: var(--bg-card);
  border-radius: 999px;
  overflow: hidden;
  display: flex;
}

.cc-bar-personal {
  background: var(--primary);
  height: 100%;
}

.cc-bar-downline {
  background: var(--forever);
  height: 100%;
}

/* MATERIALS & PHOTO GALLERY */
.materials-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 16px;
}

.material-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
}

.material-title {
  font-weight: 700;
  font-size: 1rem;
  margin-top: 6px;
}

.material-desc {
  font-size: 0.8667rem;
  color: var(--text-muted);
}

.material-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.photo-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 16px;
}

.photo-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s, border-color 0.15s;
}

.photo-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
}

.photo-thumb-wrap {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
}

.photo-thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 8px;
}

.photo-info {
  padding: 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
}

.photo-title {
  font-size: 0.8667rem;
  font-weight: 700;
  line-height: 1.35;
}

/* MODAL / DRAWER */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  backdrop-filter: blur(3px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-box {
  width: 100%;
  max-width: 880px;
  max-height: 90vh;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-title {
  font-size: 1.2rem;
  font-weight: 800;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

/* MOBILE BOTTOM NAV */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  z-index: 50;
  padding: 6px 4px env(safe-area-inset-bottom, 6px) 4px;
  justify-content: space-around;
  gap: 2px;
}

.bottom-nav-btn {
  flex: 1 1 0;
  min-width: 0;
  background: transparent;
  border: none;
  color: var(--text-muted);
  /* the bar has a fixed width per item, so its labels follow the scale only up to 11.5 px */
  font-size: min(0.7333rem, 11.5px);
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 2px;
  border-radius: 8px;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bottom-nav-btn.active {
  color: var(--primary);
  background: var(--nav-active-bg);
}

@media (max-width: 1024px) {
  .grid-2 {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 820px) {
  .sidebar {
    display: none;
  }
  .main-area {
    margin-left: 0;
    padding: 16px 14px 86px 14px;
  }
  .bottom-nav {
    display: flex;
  }
  .cc-bar-row {
    grid-template-columns: 75px 1fr 120px;
  }
}

/* ===============================================================
   PHASE 2 STYLES: CRM, CONTACTS, ATTENTION, HISTORY, HERMES
   =============================================================== */

/* Attention Banner & Cards */
.attention-widget {
  background: linear-gradient(135deg, var(--danger-bg) 0%, var(--warning-bg) 100%);
  border: 1px solid var(--danger-border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 24px;
}

.pills-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0 16px 0;
}

.pill-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.8333rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.pill-btn:hover {
  border-color: var(--primary);
  color: var(--text);
}

.pill-btn.active {
  background: var(--primary-dark);
  border-color: var(--primary);
  color: var(--on-primary);
}

.attention-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 14px;
}

.attention-item {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  transition: transform 0.15s, border-color 0.15s;
}

.attention-item:hover {
  border-color: var(--warning-border);
  transform: translateY(-2px);
}

/* Contacts Directory Grid */
.contacts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.contact-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.contact-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}

.contact-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.contact-avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.0667rem;
  flex-shrink: 0;
}

.contact-avatar.forever {
  background: var(--forever-bg);
  color: var(--forever);
  border: 1px solid var(--forever-border);
}

.contact-avatar.zinzino {
  background: var(--zinzino-bg);
  color: var(--zinzino);
  border: 1px solid var(--zinzino-border);
}

.contact-info {
  flex: 1;
  min-width: 0;
}

.contact-name {
  font-size: 1.0667rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact-sub {
  font-size: 0.8333rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 2px;
}

/* Mobile Quick Communication Buttons */
.comm-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.comm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 11px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  transition: opacity 0.15s, transform 0.1s;
}

.comm-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.comm-btn-phone { background: var(--primary-soft); color: var(--primary); border: 1px solid var(--primary-border); }
.comm-btn-sms { background: var(--purple-bg); color: var(--purple); border: 1px solid var(--purple-border); }
.comm-btn-wa { background: var(--success-bg); color: var(--success); border: 1px solid var(--success-border); }
.comm-btn-tg { background: var(--primary-soft); color: var(--primary); border: 1px solid var(--primary-border); }
.comm-btn-email { background: var(--warning-bg); color: var(--warning); border: 1px solid var(--warning-border); }

/* Contact Stats & Details Row */
.contact-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  background: var(--bg-elevated);
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
}

.c-stat-box {
  text-align: center;
}

.c-stat-val {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
}

.c-stat-lbl {
  font-size: 0.7333rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 1px;
}

/* CRM Fields & Tags */
.crm-block {
  background: var(--bg-inset);
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 10px;
  font-size: 0.8333rem;
}

.tag-list {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.tag-pill {
  font-size: 0.7333rem;
  background: var(--neutral-bg);
  color: var(--text-secondary);
  padding: 2px 7px;
  border-radius: 4px;
}

/* Expandable Orders within Card */
.orders-drawer {
  border-top: 1px solid var(--border);
  padding-top: 10px;
  margin-top: 4px;
}

.orders-drawer-list {
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.order-mini-item {
  background: var(--bg-elevated);
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid var(--border-subtle);
}

/* Timeline & History Chart */
.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}

.chart-bars-wrap {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 180px;
  padding: 15px 0 25px 0;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
}

.chart-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 38px;
  height: 100%;
  justify-content: flex-end;
}

.chart-bar-group {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 100%;
}

.c-bar {
  width: 12px;
  border-radius: 4px 4px 0 0;
  transition: height 0.3s ease;
}

.c-bar-flp {
  background: var(--forever);
}

.c-bar-zz {
  background: var(--zinzino);
}

.chart-date-lbl {
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Hermes Chat UI */
.hermes-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 170px);
  height: calc(100dvh - 170px);
  min-height: 480px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.hermes-header {
  padding: 14px 20px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.hermes-identity {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1 1 280px;
}

.hermes-avatar {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 10px;
  background: var(--primary-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.33em;
}

.hermes-identity-text {
  min-width: 0;
}

.hermes-title {
  font-weight: 700;
  font-size: 1em;
  color: var(--text);
}

.hermes-subtitle {
  font-size: 0.8em;
  color: var(--text-muted);
}

.hermes-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.ai-source-label {
  font-size: 0.73em;
  font-weight: 700;
  color: var(--text-muted);
  padding: 0 6px;
}

.hermes-chat-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-bubble {
  max-width: 82%;
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 0.9333rem;
  line-height: 1.5;
  white-space: normal;
  overflow-wrap: anywhere;
}

.chat-bubble.user {
  white-space: pre-wrap;
  align-self: flex-end;
  background: var(--primary-dark);
  color: var(--on-primary);
  border-bottom-right-radius: 4px;
}

.chat-bubble.assistant {
  align-self: flex-start;
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.chat-bubble.assistant strong {
  color: var(--primary);
}

.hermes-quick-chips {
  padding: 10px 16px;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  gap: 8px;
  overflow-x: auto;
  white-space: nowrap;
}

.chip-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.8rem;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s;
}

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

.hermes-input-bar {
  padding: 14px 20px;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
}

.hermes-input-bar textarea {
  flex: 1 1 auto;
  min-width: 0;
  resize: none;
  font: inherit;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  overflow-y: hidden;
  max-height: calc(8 * 1.45em + 20px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  outline: none;
}

.hermes-input-bar textarea:focus {
  border-color: var(--primary);
}

.hermes-input-bar button {
  flex: 0 0 auto;
  align-self: flex-end;
}

/* Spinner indicator */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===============================================================
   ACTIVITY & QUALIFICATION STYLES
   =============================================================== */
.activity-banner {
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  border-left: 5px solid var(--warning);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  margin-bottom: 20px;
}

.activity-banner.danger {
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  border-left: 5px solid var(--danger);
}

.activity-banner.success {
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  border-left: 5px solid var(--success);
}

.activity-banner-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.activity-banner-title {
  font-size: 1.0667rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.activity-banner-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.activity-banner-col {
  background: var(--bg-inset);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.activity-progress-bar {
  background: var(--neutral-bg);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
  margin: 6px 0;
}

.activity-progress-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.4s ease;
}

.activity-progress-fill.success { background: var(--success); }
.activity-progress-fill.warning { background: var(--warning); }
.activity-progress-fill.danger { background: var(--danger); }

.hermes-guide-box {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin: 12px 20px 0 20px;
  padding: 10px 14px;
  flex: 0 0 auto;
}

.hermes-guide-box summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 0.87em;
  color: var(--primary);
}

.hermes-guide-box p {
  margin: 8px 0;
  font-size: 0.83em;
  color: var(--text-secondary);
}

.hermes-guide-box ul {
  margin: 0;
  padding-left: 18px;
  font-size: 0.83em;
  color: var(--text-muted);
  line-height: 1.6;
}

.chat-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 8px;
  margin-bottom: 6px;
  white-space: normal;
}

.chat-head strong {
  color: var(--text);
}

.chat-tag {
  font-size: 0.72em;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  background: var(--neutral-bg);
}

.answer-model .chat-tag {
  color: var(--success);
  background: var(--success-bg);
  border-color: var(--success-border);
}

.answer-template .chat-tag {
  color: var(--warning);
  background: var(--warning-bg);
  border-color: var(--warning-border);
}

.chat-time {
  font-size: 0.72em;
  color: var(--text-muted);
  margin-left: auto;
}

.chat-notice {
  font-size: 0.8em;
  color: var(--text-secondary);
  background: var(--warning-bg);
  border-left: 3px solid var(--warning);
  border-radius: 4px;
  padding: 6px 10px;
  margin-bottom: 8px;
  white-space: normal;
}

.chat-bubble.answer-error {
  border-color: var(--danger-border);
  color: var(--danger);
}

.chat-bubble.chat-typing {
  color: var(--text-muted);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 820px) {
  /* compact page header on phones: one scrollable row of actions, no subtitle */
  .topbar {
    margin-bottom: 12px;
    gap: 8px;
  }
  .topbar > div:first-child {
    min-width: 0;
    width: 100%;
  }
  .page-title {
    font-size: 1.3rem;
    line-height: 1.25;
  }
  .topbar .page-subtitle {
    display: none;
  }
  .topbar-actions {
    flex-wrap: nowrap;
    overflow-x: auto;
    width: 100%;
    scrollbar-width: none;
  }
  .topbar-actions > * {
    flex: 0 0 auto;
  }
  #refresh-view-label {
    display: none;
  }
  /* Hermes fills the screen between the page header and the bottom bar */
  .hermes-shell {
    height: calc(100dvh - 130px - 3.6rem);
    min-height: 360px;
  }
  .hermes-header,
  .hermes-input-bar {
    padding: 10px 12px;
  }
  .hermes-header {
    gap: 8px;
  }
  /* on phones the status pill carries the state; the long sentence stays in its tooltip */
  .hermes-subtitle {
    display: none;
  }
  .hermes-avatar {
    width: 30px;
    height: 30px;
    flex-basis: 30px;
  }
  .hermes-guide-box {
    margin: 10px 12px 0 12px;
  }
  .chat-bubble {
    max-width: 94%;
  }
}

.refresh-toast {
  position: fixed;
  bottom: 80px;
  right: 20px;
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--primary);
  padding: 10px 16px;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  font-size: 0.8667rem;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: fadeIn 0.2s ease;
}

/* AI SOURCE BUTTONS */
.ai-source-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-elevated);
  padding: 3px 5px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.ai-source-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  padding: 5px 12px;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ai-source-btn:hover {
  color: var(--text);
  background: var(--surface-tint);
}

.ai-source-btn.active[data-source="OLI"],
.ai-source-btn.active#btn-ai-oli {
  background: var(--primary);
  color: var(--on-accent);
  box-shadow: 0 2px 8px rgba(56, 189, 248, 0.3);
}

.ai-source-btn.active[data-source="iPad"],
.ai-source-btn.active#btn-ai-ipad {
  background: var(--purple);
  color: var(--on-accent);
  box-shadow: 0 2px 8px rgba(168, 85, 247, 0.3);
}

.ai-source-btn.active[data-source="ANT"],
.ai-source-btn.active#btn-ai-ant {
  background: var(--warning);
  color: var(--on-accent);
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

/* SETTINGS VIEW STYLES */
.settings-card {
  transition: transform 0.15s ease;
}


.order-expand-btn {
  width: 100%;
  padding: 10px;
  margin-top: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--primary);
  font-weight: 600;
  font-size: 0.8667rem;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s ease;
}

.order-expand-btn:hover {
  background: var(--bg-card-hover);
}



/* NEW VERSION NOTICE */
.update-banner {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 120;
  width: min(640px, calc(100% - 24px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 16px;
  padding: 12px 16px;
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--primary-border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}

.update-banner-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.9em;
  min-width: 0;
}

.update-banner-text span {
  color: var(--text-secondary);
  font-size: 0.9em;
}

.update-banner-actions {
  display: flex;
  gap: 8px;
}

@media (max-width: 820px) {
  .update-banner {
    bottom: 80px;
  }
}

/* APPEARANCE SETTINGS */
.settings-save-status {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.theme-picker {
  border: 0;
  padding: 0;
  margin: 0 0 18px 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.theme-picker legend {
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  font-size: 0.9rem;
}

.theme-option {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  cursor: pointer;
  min-width: 0;
}

.theme-option:hover {
  border-color: var(--border-strong);
}

.theme-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.theme-option:has(input:checked) {
  border-color: var(--primary);
  box-shadow: inset 0 0 0 1px var(--primary);
}

.theme-option:has(input:focus-visible) {
  box-shadow: var(--focus-ring);
}

.theme-option-name {
  font-weight: 700;
  color: var(--text);
}

.theme-option-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.theme-preview {
  display: block;
  height: 58px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  padding: 6px;
  overflow: hidden;
}

.theme-preview .tp-bar {
  display: block;
  height: 8px;
  width: 60%;
  border-radius: 4px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}

.theme-preview .tp-card {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 5px;
  padding: 5px;
  border-radius: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
}

.theme-preview .tp-card b {
  display: block;
  height: 4px;
  border-radius: 2px;
  background: var(--text);
}

.theme-preview .tp-card b + b {
  width: 60%;
  background: var(--text-muted);
}

.theme-preview .tp-btn {
  display: block;
  float: right;
  width: 30%;
  height: 7px;
  margin-top: -14px;
  border-radius: 3px;
  background: var(--primary-dark);
}

.theme-preview-split {
  display: flex;
  padding: 0;
}

.theme-preview-split > span {
  flex: 1;
  background: var(--bg);
  padding: 6px;
}

.theme-preview-split .tp-bar {
  width: 80%;
}

.appearance-selects {
  margin-bottom: 8px;
}

@media (max-width: 820px) and (max-height: 720px) {
  /* short phones: keep the conversation, the composer and the model switch; drop the extras */
  .hermes-guide-box,
  .hermes-quick-chips,
  .hermes-identity {
    display: none;
  }
  .hermes-header {
    padding: 6px 12px;
  }
  .hermes-conv-bar {
    padding: 4px 12px;
  }
}

/* ACTIVITY / QUALIFICATION */
.activity-widget,
.activity-top {
  margin-bottom: 24px;
}

.activity-widget-head,
.activity-top,
.activity-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
}

.activity-widget-head h3,
.activity-card-head h3 {
  margin: 4px 0 0 0;
  font-size: 1.1rem;
}

.activity-top h2 {
  margin: 0;
  font-size: 1.3333rem;
}

.activity-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  min-width: 0;
}

.activity-box-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  font-weight: 700;
  font-size: 0.9333rem;
}

.activity-box-foot,
.data-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  background: var(--surface-tint);
  border-radius: 6px;
  padding: 8px;
  margin-top: 6px;
}

.data-box {
  margin: 10px 0 14px 0;
}

.brand-zinzino {
  color: var(--zinzino);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.03em;
}

.brand-forever {
  color: var(--forever);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.03em;
}

.activity-box-head .brand-zinzino,
.activity-box-head .brand-forever {
  font-size: 0.9333rem;
}

.rules-box {
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 14px;
  font-size: 0.8333rem;
  color: var(--text);
}

.rules-zinzino {
  background: var(--zinzino-bg);
  border: 1px solid var(--zinzino-border);
}

.rules-forever {
  background: var(--forever-bg);
  border: 1px solid var(--forever-border);
}

.req-row {
  margin-bottom: 12px;
}

.req-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 0.8667rem;
  margin-bottom: 4px;
}

.req-note {
  font-size: 0.7667rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.activity-progress-bar.unknown {
  background: repeating-linear-gradient(45deg, var(--neutral-bg), var(--neutral-bg) 6px, transparent 6px, transparent 12px);
}

.rec-list {
  margin: 6px 0 14px 0;
  padding-left: 20px;
  font-size: 0.8333rem;
  line-height: 1.6;
}

.activity-card-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  border-top: 1px solid var(--border);
  padding-top: 12px;
  font-size: 0.7667rem;
  color: var(--text-muted);
}

.activity-cards {
  gap: 24px;
  margin-bottom: 24px;
}

.goals-card {
  margin-bottom: 24px;
}

.goals-card h4 {
  margin: 0 0 6px 0;
}

.goals-card ul {
  margin: 8px 0 0 0;
  padding-left: 20px;
  line-height: 1.6;
}

.link-btn {
  background: none;
  border: 0;
  padding: 0;
  color: var(--primary);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

/* DASHBOARD DATA FRESHNESS BANNER */
.sync-banner {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 18px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sync-banner-items {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  font-size: 0.8667rem;
}

.sync-banner-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
}

.sync-banner .muted {
  color: var(--text-muted);
}

.sync-banner-warning {
  color: var(--danger);
  font-weight: 700;
  font-size: 0.8rem;
}

.text-unverified {
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.8667rem;
}

/* MOBILE "VÍCE" MENU */
.more-menu {
  position: fixed;
  right: 8px;
  bottom: calc(64px + env(safe-area-inset-bottom, 0px));
  z-index: 60;
  display: flex;
  flex-direction: column;
  min-width: 250px;
  max-width: calc(100% - 16px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  padding: 6px;
}

.more-menu button {
  background: transparent;
  border: 0;
  color: var(--text);
  text-align: left;
  font: inherit;
  font-size: 0.9333rem;
  padding: 10px 12px;
  border-radius: 6px;
  cursor: pointer;
}

.more-menu button:hover,
.more-menu button.active {
  background: var(--nav-active-bg);
  color: var(--nav-active-text);
}

@media (min-width: 821px) {
  .more-menu {
    display: none !important;
  }
}

/* PERSONAL GOALS SETTINGS */
.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  color: var(--text);
  cursor: pointer;
}

.goals-fields {
  border: 0;
  padding: 0;
  margin: 0 0 14px 0;
  min-width: 0;
}

.goals-fields:disabled {
  opacity: 0.55;
}

/* HERMES CONVERSATIONS */
.hermes-conv-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  min-width: 0;
}

.hermes-conv-current {
  flex: 1 1 auto;
  min-width: 0;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hermes-conv-drawer {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 20;
  width: min(340px, 92%);
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.hermes-conv-drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.hermes-conv-list {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 6px;
}

.hermes-conv-item {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  border-radius: 8px;
}

.hermes-conv-item.active,
.hermes-conv-item:hover {
  background: var(--nav-active-bg);
}

.hermes-conv-open {
  flex: 1 1 auto;
  min-width: 0;
  text-align: left;
  background: transparent;
  border: 0;
  padding: 8px 10px;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.hermes-conv-open strong {
  display: block;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hermes-conv-open span {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.hermes-conv-rename {
  background: transparent;
  border: 0;
  color: var(--text-muted);
  padding: 8px;
  cursor: pointer;
  font: inherit;
}

@media (max-width: 820px) {
  .hermes-conv-bar {
    padding: 6px 12px;
  }
}

/* SETTINGS: SYNC SOURCES */
.sync-source-box {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  min-width: 0;
}

.sync-source-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.sync-source-facts {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px 12px;
  font-size: 0.8333rem;
  margin: 0 0 10px 0;
}

.sync-source-facts dt {
  color: var(--text-muted);
}

.sync-source-facts dd {
  margin: 0;
  color: var(--text);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.sync-source-problem {
  font-size: 0.8rem;
  color: var(--danger);
  background: var(--danger-bg);
  border-radius: 6px;
  padding: 6px 10px;
  margin-bottom: 8px;
}

.sync-source-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* SETTINGS SECTION NAVIGATION (one section visible at a time) */
.settings-nav-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 18px;
  overflow-x: auto;
  scrollbar-width: thin;
  padding-bottom: 2px;
}

.settings-subnav-btn {
  flex: 0 0 auto;
  white-space: nowrap;
  font: inherit;
  font-size: 0.8667rem;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
}

.settings-subnav-btn:hover {
  border-color: var(--primary);
  color: var(--text);
}

.settings-subnav-btn.active {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  color: var(--on-primary);
}

/* the page header (Obnovit / Synchronizovat) stays reachable on desktop – no scrolling up needed */
@media (min-width: 821px) {
  .topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    background: var(--bg);
    padding: 12px 0;
    margin-top: -12px;
    border-bottom: 1px solid var(--border-subtle);
  }
}

/* LIVE SYNC PROGRESS */
.sync-status-pill {
  font: inherit;
  font-size: 0.7333rem;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  max-width: 340px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sync-progress-panel {
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sync-progress-title {
  font-weight: 700;
  color: var(--text);
}

.sync-progress-empty,
.sync-progress-note {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.sync-progress-row {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  min-width: 0;
}

.sync-progress-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.sync-percent {
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--text);
  margin-left: auto;
}

.sync-bar {
  height: 10px;
  border-radius: 999px;
  background: var(--neutral-bg);
  overflow: hidden;
  position: relative;
}

.sync-bar > span {
  display: block;
  height: 100%;
  background: var(--primary-dark);
  border-radius: 999px;
  transition: width 0.4s ease;
}

.sync-bar.indeterminate > span {
  position: absolute;
  width: 35%;
  animation: sync-indeterminate 1.6s ease-in-out infinite;
}

@keyframes sync-indeterminate {
  0% { left: -35%; }
  100% { left: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .sync-bar.indeterminate > span {
    animation: none;
    left: 0;
    width: 100%;
    opacity: 0.5;
  }
}

.sync-progress-step {
  margin-top: 8px;
  font-size: 0.8667rem;
  color: var(--text);
  overflow-wrap: anywhere;
}

.sync-progress-meta {
  margin-top: 4px;
  font-size: 0.8rem;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.hermes-conv-bar.is-new .hermes-conv-current {
  color: var(--primary);
}

.hermes-conv-bar.is-new {
  box-shadow: inset 3px 0 0 var(--primary);
}

/* COMMUNICATION CRM (person first, orders last) */
button.comm-btn {
  font: inherit;
  font-size: 0.8667rem;
  font-weight: 700;
  cursor: pointer;
  min-height: 44px;            /* comfortable touch target */
}

.comm-bar-main {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

.comm-bar-main .comm-btn {
  padding: 8px 6px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.comm-btn-whatsapp { background: var(--success-bg); color: var(--success); border: 1px solid var(--success-border); }
.comm-btn-telegram { background: var(--primary-soft); color: var(--primary); border: 1px solid var(--primary-border); }

.comm-btn.preferred {
  box-shadow: 0 0 0 2px var(--primary);
}

.comm-btn-missing {
  background: transparent;
  color: var(--text-muted);
  border: 1px dashed var(--border);
}

.comm-btn-missing:hover {
  color: var(--text);
  border-color: var(--primary);
}

#person-modal .comm-bar-main .comm-btn {
  font-size: 0.9333rem;
  min-height: 52px;
}

.contact-name-btn {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-weight: 700;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  max-width: 100%;
  white-space: normal;      /* long names wrap instead of being cut (large font sizes) */
  overflow-wrap: anywhere;
}

.contact-name-btn:hover { text-decoration: underline; }

.contact-facts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 10px;
  margin: 0;
  font-size: 0.8333rem;
}

.contact-facts dt { color: var(--text-muted); }
.contact-facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; color: var(--text); }

.contact-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.reminder-chips { display: flex; flex-wrap: wrap; gap: 6px; }

.reminder-chip {
  font-size: 0.7667rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--warning-bg);
  color: var(--text);
  border: 1px solid var(--warning-border);
}

.reminder-chip.overdue { background: var(--danger-bg); border-color: var(--danger-border); }
.reminder-chip.today { background: var(--success-bg); border-color: var(--success-border); }

.btn-xs {
  padding: 3px 8px;
  font-size: 0.7667rem;
  min-height: 28px;
}

.person-modal-box { max-width: 760px; }

.person-head {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.person-name {
  font-size: 1.3333rem;
  font-weight: 800;
  color: var(--text);
  overflow-wrap: anywhere;
}

.person-primary-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0 4px;
}

.person-section {
  border-top: 1px solid var(--border-subtle);
  padding-top: 12px;
  margin-top: 14px;
}

.person-section h3 {
  font-size: 0.8667rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  margin: 0 0 8px;
  display: flex;
  gap: 8px;
  align-items: center;
}

.contact-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 5px 0;
  font-size: 0.8667rem;
  flex-wrap: wrap;
}

.contact-value {
  text-align: right;
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--text);
}

.source-tag {
  font-size: 0.7rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1px 5px;
  margin-left: 4px;
  white-space: nowrap;
}

.timeline {
  list-style: none;
  margin: 0;
  padding: 0 0 0 14px;
  border-left: 2px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.timeline-item { position: relative; min-width: 0; }

.timeline-item::before {
  content: "";
  position: absolute;
  left: -20px;
  top: 6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
}

.timeline-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.timeline-when { font-weight: 700; color: var(--text); font-size: 0.8667rem; }
.timeline-head .btn-xs { margin-left: auto; }
.timeline-topic { margin-top: 4px; font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.timeline-text { margin-top: 2px; font-size: 0.8667rem; color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; }
.timeline-meta { margin-top: 4px; font-size: 0.7333rem; color: var(--text-muted); }

.crm-fieldset {
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 10px 12px 2px;
  margin: 0 0 14px;
  min-width: 0;
}

.crm-fieldset legend {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
  padding: 0 6px;
}

.field-hint {
  display: block;
  font-size: 0.7667rem;
  color: var(--text-muted);
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.composer-person {
  background: var(--bg-card);
  padding: 10px 14px;
  border-radius: 10px;
  margin-bottom: 14px;
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.composer-channels, .composer-actions, .quick-dates {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.quick-dates input { flex: 1 1 160px; min-width: 0; }

.relations-widget { margin-bottom: 20px; }

.reminder-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.reminder-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--warning);
  background: var(--bg-elevated);
}

.reminder-row.overdue { border-left-color: var(--danger); }
.reminder-row.today { border-left-color: var(--success); }

.reminder-main {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.reminder-text { color: var(--text); font-size: 0.8667rem; }
.reminder-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.reminder-unknown {
  margin-top: 12px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

@media (max-width: 820px) {
  .person-modal-box { max-height: 100dvh; height: 100dvh; border-radius: 0; }
  #person-modal { padding: 0; }
  .comm-bar-main .comm-btn { font-size: 0.8rem; }
  .contact-value { text-align: left; }
}

/* dialogs opened from the person card stay above it */
#crm-edit-modal, #comm-log-modal, #template-message-modal { z-index: 110; }
#comm-confirm-modal { z-index: 120; }
#cart-modal { z-index: 130; }
#detail-modal { z-index: 140; }

/* =====================================================================
   COLLAPSIBLE SIDEBAR GROUPS
   ===================================================================== */
.nav-group {
  margin-top: 6px;
  margin-bottom: 2px;
}

.nav-group-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.15s ease;
}

.nav-group-header:hover {
  color: var(--text);
  background: var(--bg-card);
}

.nav-group-title {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-group-chevron {
  font-size: 0.75rem;
  transition: transform 0.2s ease;
  display: inline-block;
  user-select: none;
}

.nav-group.collapsed .nav-group-chevron {
  transform: rotate(-90deg);
}

.nav-sublist {
  list-style: none;
  padding: 0 0 0 8px;
  margin: 2px 0 0 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-group.collapsed .nav-sublist {
  display: none;
}

.nav-sub-btn {
  padding: 8px 12px;
  font-size: 0.875rem;
  font-weight: 500;
}

/* =====================================================================
   FOREVER PRODUCT CATALOG & CART STYLES
   ===================================================================== */
.catalog-categories-wrap {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}

.category-chip {
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 9999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.category-chip:hover {
  border-color: var(--primary);
  color: var(--text);
}

.category-chip.active {
  background: var(--primary-dark);
  color: #ffffff;
  border-color: var(--primary);
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.product-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.product-card:hover {
  border-color: var(--primary-border);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.product-card-thumb-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: var(--bg-inset);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
}

.product-card-thumb {
  max-width: 85%;
  max-height: 85%;
  object-fit: contain;
  transition: transform 0.2s ease;
}

.product-card:hover .product-card-thumb {
  transform: scale(1.04);
}

.product-sku-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  font-family: monospace;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg-card);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.product-cc-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 9999px;
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
}

.product-card-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.product-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 4px 0;
  line-height: 1.3;
  cursor: pointer;
}

.product-card-title:hover {
  color: var(--primary);
}

.product-card-pack {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.product-card-prices {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 12px;
}

.product-price-member {
  display: flex;
  flex-direction: column;
}

.product-price-member-val {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text);
}

.product-price-member-lbl {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.product-price-retail {
  text-align: right;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.product-price-retail-val {
  text-decoration: line-through;
}

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

.product-qty-stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  overflow: hidden;
}

.product-qty-btn {
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 700;
  width: 28px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.product-qty-btn:hover {
  background: var(--bg-card-hover);
}

.product-qty-input {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 700;
  text-align: center;
  -moz-appearance: textfield;
}

.product-qty-input::-webkit-outer-spin-button,
.product-qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* CART MODAL & ITEM ROWS */
.cart-items-table {
  width: 100%;
  border-collapse: collapse;
}

.cart-items-table th {
  text-align: left;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}

.cart-item-row {
  border-bottom: 1px solid var(--border-subtle);
}

.cart-item-row:hover {
  background: var(--surface-tint);
}

.cart-item-row td {
  padding: 10px;
  vertical-align: middle;
}

.cart-item-thumb {
  width: 44px;
  height: 44px;
  object-fit: contain;
  background: var(--bg-inset);
  border-radius: 6px;
  padding: 2px;
  border: 1px solid var(--border-subtle);
}

/* DEV BANNER */
.dev-banner {
  background: #f59e0b;
  color: #000000;
  font-weight: 700;
  font-size: 0.82rem;
  padding: 6px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  letter-spacing: 0.03em;
  border-bottom: 2px solid #b45309;
}

.dev-banner-tag {
  background: #000000;
  color: #f59e0b;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 900;
  font-size: 0.75rem;
  margin-right: 8px;
}

@media (max-width: 640px) {
  .products-grid {
    grid-template-columns: 1fr;
  }
  .cart-items-table th:nth-child(3),
  .cart-items-table td:nth-child(3) {
    display: none;
  }
}

