/* ============================================================
   CNYT Core – Design System
   Outfit (UI/body) + JetBrains Mono (data/code)
   ============================================================ */

/* System font stack — no external requests */

/* ---- 1. CSS Variables (Light) -------------------------------- */
:root {
  --heller-blue:   #3b82f6;
  --heller-magenta:#c026a0;
  /* Brand Accents */
  --accent:            #c026a0;
  --accent-finance:    #c026a0;
  --accent-products:   #a855f7;
  --accent-ai:         #ec4899;
  --accent-infra:      #22c55e;
  --accent-documents:  #f59e0b;
  --accent-backup:     #14b8a6;
  --accent-audit:      #64748b;
  --accent-email:      #6366f1;
  --accent-forecast:   #f97316;
  --accent-settings:   #94a3b8;

  /* Neutrals */
  --bg:             #f8fafc;
  --bg-surface:     #ffffff;
  --bg-elevated:    #f1f5f9;
  --border:         #e2e8f0;
  --border-subtle:  #f1f5f9;

  /* Text */
  --text:           #0f172a;
  --text-muted:     #64748b;
  --text-faint:     #94a3b8;
  --text-invert:    #ffffff;

  /* Sidebar — light mode: neutral dark charcoal */
  --sidebar-bg:     #1c1d21;
  --sidebar-text:   #9ca3af;
  --sidebar-active: #ffffff;
  --sidebar-hover:  rgba(255,255,255,0.07);
  --sidebar-active-bg: rgba(192,38,160,0.20);
  --sidebar-w:      240px;
  --sidebar-w-coll: 64px;

  /* Status */
  --success:   #22c55e;
  --warning:   #f59e0b;
  --danger:    #ef4444;
  --info:      #3b82f6;

  /* Header */
  --header-h: 56px;

  /* Misc */
  --radius:    8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow:    0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.12);
  --transition: 150ms ease;
}

/* ---- Dark Theme ------------------------------------------- */
[data-theme="dark"] {
  --bg:             #0f0f11;
  --bg-surface:     #18181b;
  --bg-elevated:    #222228;
  --border:         #2e2e33;
  --border-subtle:  #1e1e23;
  --text:           #f1f5f9;
  --text-muted:     #9ca3af;
  --text-faint:     #4b5563;
  --sidebar-bg:     #111114;
  --sidebar-hover:  rgba(255,255,255,0.06);
  --shadow-sm:      0 1px 3px rgba(0,0,0,0.4);
  --shadow:         0 4px 12px rgba(0,0,0,0.4);
}

/* ---- 2. Reset & Base --------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Outfit', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

/* ---- 3. Scrollbar ------------------------------------------ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

/* ---- 4. Layout -------------------------------------------- */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: width var(--transition);
  overflow: hidden;
}

.sidebar.collapsed { width: var(--sidebar-w-coll); }

.sidebar-header {
  height: var(--header-h);
  display: flex;
  align-items: center;
  padding: 0;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
  overflow: hidden;
}

/* Logo image in sidebar */
.logo-img {
  height: 24px;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
}

/* Logo link — fills remaining width after toggle */
.logo-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0 1rem 0 0.75rem;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  opacity: 1;
  transition: opacity var(--transition);
}

.sidebar.collapsed .logo-link { opacity: 0; pointer-events: none; }

.logo-text {
  font-size: 0.93rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-logo {
  width: 32px; height: 32px;
  background: var(--accent);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; font-size: 0.8rem;
  flex-shrink: 0;
}

.sidebar-name {
  font-weight: 700; font-size: 1rem; color: #fff;
  white-space: nowrap; overflow: hidden;
  transition: opacity var(--transition);
}

.sidebar.collapsed .sidebar-name { opacity: 0; pointer-events: none; }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 0;
}

.nav-group { margin-bottom: 0.25rem; }

.nav-label {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 0.5rem 1rem 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity var(--transition);
}

.sidebar.collapsed .nav-label { opacity: 0; }

.nav-item {
  display: block;
  color: var(--sidebar-text);
  border-radius: 0;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
  position: relative;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 1rem;
  width: 100%;
  font-size: 0.875rem;
  font-weight: 500;
  color: inherit;
  text-decoration: none;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

.nav-item.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active);
}

.nav-item .nav-icon {
  font-size: 1rem;
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}

.nav-item .nav-text {
  overflow: hidden;
  transition: opacity var(--transition), width var(--transition);
}

.sidebar.collapsed .nav-text { opacity: 0; width: 0; }

.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 10px;
  padding: 0 0.4rem;
  min-width: 18px;
  text-align: center;
}

.sidebar.collapsed .nav-badge { display: none; }

.sidebar-footer {
  border-top: 1px solid rgba(255,255,255,0.06);
  padding: 0.6rem 0.875rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sidebar-footer-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* Label next to toggle/button — hidden when collapsed */
.sidebar-footer-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--sidebar-text);
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex: 1;
  transition: opacity var(--transition);
}

/* Logout pushed to right when sidebar open */
.sidebar-footer-logout { margin-left: auto; }

/* Collapsed: center each row, hide labels */
.sidebar.collapsed .sidebar-footer { padding: 0.6rem 0; align-items: center; }
.sidebar.collapsed .sidebar-footer-row { justify-content: center; }
.sidebar.collapsed .sidebar-footer-label { display: none; }
.sidebar.collapsed .sidebar-footer-logout { margin-left: 0; }

/* Collapse toggle — always visible at exactly collpased-sidebar width */
.sidebar-toggle {
  flex: 0 0 var(--sidebar-w-coll);
  height: var(--header-h);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: none;
  border: none;
  border-right: 1px solid rgba(255,255,255,0.07);
  color: var(--sidebar-text);
  cursor: pointer;
  padding: 0;
  transition: color var(--transition), background var(--transition);
}

.sidebar-toggle:hover {
  color: #fff;
  background: var(--sidebar-hover);
}

/* Hamburger lines */
.sidebar-toggle span {
  display: block;
  width: 16px;
  height: 1.5px;
  background: currentColor;
  border-radius: 2px;
}

.sidebar-toggle:hover { color: #fff; }

/* Main content area */
.main-wrap {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition);
}

.sidebar.collapsed ~ .main-wrap { margin-left: var(--sidebar-w-coll); }

/* Header */
.app-header {
  height: var(--header-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
  position: sticky; top: 0;
  z-index: 50;
}

.app-header .header-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  flex: 1;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.ssl-warning-badge {
  background: var(--warning);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 20px;
  padding: 0.2rem 0.6rem;
  cursor: pointer;
}

/* Page content */
.page-content {
  flex: 1;
  padding: 1.5rem;
  max-width: 1400px;
  width: 100%;
}

/* ---- 5. Typography Utilities ------------------------------ */
.text-muted  { color: var(--text-muted) !important; }
.text-faint  { color: var(--text-faint) !important; }
.text-success { color: var(--success) !important; }
.text-warning, .text-warn { color: var(--warning) !important; }
.text-danger { color: var(--danger) !important; }
.text-info   { color: var(--info) !important; }
.text-sm     { font-size: 0.813rem; }
.text-xs     { font-size: 0.75rem; }
.mono        { font-family: 'JetBrains Mono', monospace; font-size: 0.875em; }
.font-bold   { font-weight: 700; }

/* ---- 6. Cards --------------------------------------------- */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.25rem;
}

.card-link { cursor: pointer; transition: box-shadow var(--transition), transform var(--transition); }
.card-link:hover { box-shadow: var(--shadow); transform: translateY(-1px); }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
}

.card-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

/* ---- 7. KPI Grid ------------------------------------------ */
.kpi-grid {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.kpi-grid-2 { grid-template-columns: repeat(2, 1fr); }
.kpi-grid-3 { grid-template-columns: repeat(3, 1fr); }
.kpi-grid-4 { grid-template-columns: repeat(4, 1fr); }
.kpi-grid-5 { grid-template-columns: repeat(5, 1fr); }
.kpi-grid-6 { grid-template-columns: repeat(6, 1fr); }

.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.9rem 1.1rem;
  box-shadow: var(--shadow-sm);
  cursor: default;
  transition: box-shadow var(--transition);
}

.kpi-card:hover { box-shadow: var(--shadow); }

/* Accented top border */
/* ---- Product Cards --------------------------------------- */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-top: 1rem;
}

.product-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-decoration: none;
  color: inherit;
  display: block;
  transition: box-shadow var(--transition), border-color var(--transition);
}

.product-card:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--accent-products);
}

.product-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.product-card-name {
  font-weight: 700;
  font-size: 1rem;
  flex: 1;
  color: var(--text);
}

.product-card-domain {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.product-card-stats {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-subtle);
}

.product-card-stats .stat {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.product-card-stats .stat-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.product-card-stats .stat-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.product-card-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  text-transform: uppercase;
}

.badge-active, .product-card-badge.badge-active { background: rgba(34,197,94,0.15); color: #22c55e; }
.badge-development { background: rgba(168,85,247,0.15); color: #a855f7; }
.badge-planned { background: rgba(59,130,246,0.15); color: #3b82f6; }
.badge-paused { background: rgba(148,163,184,0.15); color: #94a3b8; }
.badge-inactive { background: rgba(239,68,68,0.15); color: #ef4444; }

/* ---- KPI accents ----------------------------------------- */
.kpi-accent-finance  { border-top: 3px solid var(--accent-finance); }
.kpi-accent-products { border-top: 3px solid var(--accent-products); }
.kpi-accent-ai       { border-top: 3px solid var(--accent-ai); }
.kpi-accent-infra    { border-top: 3px solid var(--accent-infra); }
.kpi-accent-docs     { border-top: 3px solid var(--accent-documents); }
.kpi-accent-backup   { border-top: 3px solid var(--accent-backup); }

.kpi-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.kpi-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
  margin-bottom: 0.25rem;
  font-family: 'JetBrains Mono', monospace;
}

.kpi-value-sm {
  font-size: 1.15rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text);
}

.kpi-delta {
  font-size: 0.78rem;
  margin-top: 0.3rem;
  color: var(--text-muted);
}

.kpi-delta.positive { color: var(--success); }
.kpi-delta.negative { color: var(--danger); }

/* ---- 8. Tables -------------------------------------------- */
.table-wrapper { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table th {
  padding: 0.625rem 1rem;
  text-align: left;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--bg-elevated); }
.data-table .row-unread td { font-weight: 600; }
.data-table .actions { text-align: right; white-space: nowrap; }

td.empty, li.empty {
  text-align: center;
  padding: 2rem;
  color: var(--text-faint);
  font-style: italic;
  list-style: none;
}

/* ---- 9. Buttons ------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-family: 'Outfit', sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), opacity var(--transition);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary   { background: var(--accent-finance); color: #fff; }
.btn-primary:hover:not(:disabled) { background: #005fa3; }

.btn-secondary { background: var(--bg-elevated); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--border); }

.btn-outline   { background: transparent; border-color: var(--border); color: var(--text); }
.btn-outline:hover { background: var(--bg-elevated); }

.btn-danger    { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }

.btn-warn      { background: #d97706; color: #fff; }
.btn-warn:hover { background: #b45309; }

.btn-success   { background: var(--success); color: #fff; }

.btn-xs {
  padding: 0.25rem 0.6rem;
  font-size: 0.75rem;
  border-radius: 6px;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  border-radius: 6px;
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover { background: var(--bg-elevated); color: var(--text); border-color: var(--border); }

.select-sm {
  padding: 0.3rem 0.6rem;
  font-size: 0.82rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.select-sm:focus { outline: none; border-color: var(--accent); }

.inline-form {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.btn-icon {
  padding: 0.5rem;
  width: 36px; height: 36px;
}

/* ---- 10. Badges ------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  background: var(--bg-elevated);
  color: var(--text-muted);
  white-space: nowrap;
  border: 1px solid var(--border);
}

/* Module badges */
.badge-module-finance    { background: rgba(192,38,160,.12); color: var(--accent-finance); border-color: rgba(192,38,160,.25); }
.badge-module-products   { background: #a855f720; color: var(--accent-products);   border-color: #a855f740; }
.badge-module-ai         { background: #ec489920; color: var(--accent-ai);         border-color: #ec489940; }
.badge-module-infra      { background: #22c55e20; color: var(--accent-infra);      border-color: #22c55e40; }
.badge-module-documents  { background: #f59e0b20; color: var(--accent-documents);  border-color: #f59e0b40; }
.badge-module-backup     { background: #14b8a620; color: var(--accent-backup);     border-color: #14b8a640; }
.badge-module-email      { background: #6366f120; color: var(--accent-email);      border-color: #6366f140; }
.badge-module-audit      { background: #64748b20; color: var(--accent-audit);      border-color: #64748b40; }
.badge-module-forecast   { background: #f9731620; color: var(--accent-forecast);   border-color: #f9731640; }
.badge-module-settings   { background: #94a3b820; color: var(--accent-settings);   border-color: #94a3b840; }
.badge-module-auth       { background: #3b82f620; color: var(--info);              border-color: #3b82f640; }

/* Backup type badges */
.badge-type-manual   { background: rgba(59,130,246,0.12);  color: #3b82f6;  border-color: rgba(59,130,246,0.3); }
.badge-type-daily    { background: rgba(20,184,166,0.12);  color: #14b8a6;  border-color: rgba(20,184,166,0.3); }
.badge-type-monthly  { background: rgba(168,85,247,0.12);  color: #a855f7;  border-color: rgba(168,85,247,0.3); }
.badge-type-vault    { background: rgba(167,139,250,0.12); color: #a78bfa;  border-color: rgba(167,139,250,0.3); }

/* Status badges */
.badge-active    { background: #22c55e20; color: var(--success); border-color: #22c55e40; }
.badge-inactive  { background: #94a3b820; color: var(--text-muted); }
.badge-beta      { background: #f59e0b20; color: var(--warning); border-color: #f59e0b40; }
.badge-failed    { background: #ef444420; color: var(--danger); border-color: #ef444440; }
.badge-sent      { background: #22c55e20; color: var(--success); border-color: #22c55e40; }
.badge-success   { background: #22c55e20; color: var(--success); border-color: #22c55e40; }
.badge-provider  { background: var(--bg-elevated); color: var(--text-muted); }

/* Status dot */
.status-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-faint);
  margin-right: 0.3rem;
}
.status-online, .status-active { background: var(--success) !important; }
.status-offline  { background: var(--danger) !important; }
.status-maintenance { background: var(--warning) !important; }
.status-beta     { background: var(--warning) !important; }
.status-development { background: var(--info) !important; }

.dot-unread {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent-finance);
}

/* ---- 11. Forms -------------------------------------------- */
.form-group { margin-bottom: 1rem; }

.form-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.form-input, .form-select, .form-textarea {
  display: block;
  width: 100%;
  padding: 0.55rem 0.875rem;
  font-family: 'Outfit', sans-serif;
  font-size: 0.875rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  -webkit-appearance: none;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent-finance);
  box-shadow: 0 0 0 3px rgba(0, 114, 181, 0.15);
}

.form-textarea { resize: vertical; min-height: 80px; line-height: 1.5; }

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
  cursor: pointer;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-row { display: flex; gap: 1rem; align-items: flex-end; }
.form-row .form-group { flex: 1; margin-bottom: 0; }

.form-hint { font-size: 0.75rem; color: var(--text-faint); margin-top: 0.25rem; }

input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--accent-finance);
  margin-right: 0.5rem;
  cursor: pointer;
}

/* ---- 12. Modals ------------------------------------------- */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  align-items: center;
  justify-content: center;
}

.modal.open { display: flex; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(2px);
}

.modal-content {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: min(540px, 96vw);
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.5rem;
}

.modal-wide { width: min(720px, 96vw); }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.modal-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  transition: background var(--transition);
}

.modal-close:hover { background: var(--bg-elevated); }

.modal-footer {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.25rem;
  justify-content: flex-end;
}

/* ---- 12b. Period Bar -------------------------------------- */
.period-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  padding: 0.6rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.period-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ---- 13. Action Bar --------------------------------------- */
.action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.action-bar-left, .action-bar-right { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }

.page-title { font-size: 1.35rem; font-weight: 700; color: var(--text); }

.page-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.page-actions { display: flex; gap: 0.75rem; margin-left: auto; }

/* ---- 14. Search / Filters --------------------------------- */
.filter-bar { padding: 0.75rem 1rem; border-bottom: 1px solid var(--border-subtle); }

/* ---- Compact filter card ----------------------------------------- */
.filter-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 120px;
}

.filter-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.filter-select,
.filter-input {
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.8rem;
  padding: 0.35rem 0.6rem;
  height: 2rem;
  min-width: 0;
}

.filter-select:focus,
.filter-input:focus {
  outline: none;
  border-color: var(--accent);
}

.filter-actions {
  display: flex;
  gap: 0.4rem;
  align-items: flex-end;
  padding-bottom: 0;
}

/* Live current-month row */
.row-current-month td {
  background: color-mix(in srgb, var(--accent) 6%, transparent);
  border-bottom: 1px solid var(--border);
}

.search-form {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.search-input { width: auto; flex: 1 1 200px; }

/* ---- 15. Charts ------------------------------------------- */
.chart-wrapper { position: relative; width: 100%; }

.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

/* ---- 16. Card/Product Grids lll---------------------------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.two-col-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

/* ---- 17. Pagination --------------------------------------- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.pagination-pages { display: flex; gap: 0.25rem; }

.pagination-pages a, .pagination-pages span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: 6px;
  border: 1px solid transparent;
  font-size: 0.8rem;
  color: var(--text-muted);
  transition: background var(--transition);
}

.pagination-pages a:hover { background: var(--bg-elevated); }

.pagination-pages .current {
  background: var(--accent-finance);
  color: #fff;
  border-color: var(--accent-finance);
}

/* ---- 18. Infrastructure Styles ----------------------------- */
.server-list, .domain-list { list-style: none; padding: 0; }

.server-item, .domain-item {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--transition);
}

.server-item:last-child, .domain-item:last-child { border-bottom: none; }
.server-item:hover, .domain-item:hover { background: var(--bg-elevated); }
.domain-warn { border-left: 3px solid var(--warning); }

.server-header { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.3rem; }
.server-meta, .domain-meta { display: flex; gap: 1rem; font-size: 0.8rem; flex-wrap: wrap; }
.server-products { margin-top: 0.4rem; display: flex; gap: 0.35rem; flex-wrap: wrap; }

/* ---- 19. Email Styles ------------------------------------- */
.email-list { list-style: none; padding: 0; }

.email-item {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 0 0.5rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
}

.email-item:last-child { border-bottom: none; }
.email-item:hover { background: var(--bg-elevated); }
.email-unread { background: rgba(0, 114, 181, 0.04); }

.email-from { font-weight: 600; font-size: 0.875rem; }
.email-subject { font-size: 0.8rem; color: var(--text-muted); grid-column: 1; }
.email-date { font-size: 0.7rem; color: var(--text-faint); grid-row: 1; }
.email-meta { grid-column: 1/-1; display: flex; gap: 0.5rem; align-items: center; margin-top: 0.25rem; }

/* ---- 20. Activity Feed ------------------------------------ */
.activity-feed { list-style: none; padding: 0; }

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.65rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.8rem;
}

.activity-item:last-child { border-bottom: none; }

.activity-icon {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  flex-shrink: 0;
}

.activity-text { flex: 1; }
.activity-time { color: var(--text-faint); font-size: 0.7rem; white-space: nowrap; }

/* ---- 21. Settings Sections -------------------------------- */
.settings-section {
  border-bottom: 1px solid var(--border);
  padding-bottom: 1.5rem;
  margin-bottom: 1.5rem;
}

.settings-section:last-child { border-bottom: none; margin-bottom: 0; }

.settings-section-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ---- 22. Login Page --------------------------------------- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--sidebar-bg);
  background-image: radial-gradient(ellipse at 60% 20%, rgba(192,38,160,0.18) 0%, transparent 60%),
                    radial-gradient(ellipse at 20% 80%, rgba(168,85,247,0.12) 0%, transparent 60%);
}

.login-card {
  background: var(--bg-surface);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  width: min(400px, 94vw);
  box-shadow: var(--shadow-lg);
}

.login-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 2rem;
  gap: 0.75rem;
}

.login-logo img {
  height: 48px;
  width: auto;
  object-fit: contain;
}

.login-logo-mark {
  width: 56px; height: 56px;
  background: var(--accent-finance);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
}

.login-logo-name {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
}

.login-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
}

.login-error {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  color: var(--danger);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

/* ---- 23. AI Chat ------------------------------------------ */
.ai-chat-container {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1.25rem;
  align-items: start;
}

.chat-messages {
  min-height: 320px;
  max-height: 500px;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.chat-message {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.chat-message.user { flex-direction: row-reverse; }

.chat-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.chat-bubble {
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  line-height: 1.55;
  max-width: 80%;
}

.chat-message.user .chat-bubble {
  background: var(--accent-finance);
  color: #fff;
}

.chat-message.assistant .chat-bubble { border: 1px solid var(--border); }

.quick-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; padding: 0.75rem 1rem; border-bottom: 1px solid var(--border-subtle); }

.quick-action {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0.3rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-muted);
  transition: background var(--transition), color var(--transition);
}

.quick-action:hover { background: var(--accent-finance); color: #fff; border-color: var(--accent-finance); }

/* ---- 24. Backup Status ------------------------------------ */
.backup-status-icon {
  font-size: 2rem;
  display: block;
  margin-bottom: 0.5rem;
}

/* ---- 25. Toast Notifications ------------------------------ */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1.25rem;
  box-shadow: var(--shadow);
  font-size: 0.875rem;
  pointer-events: all;
  animation: slideIn 0.2s ease;
  min-width: 240px;
}

.toast-success { border-left: 3px solid var(--success); }
.toast-error   { border-left: 3px solid var(--danger); }
.toast-info    { border-left: 3px solid var(--info); }

@keyframes slideIn {
  from { transform: translateX(60px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ---- 26. Theme Toggle ------------------------------------- */
.theme-toggle {
  background: none;
  border: none;
  border-radius: 0;
  padding: 0;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--text-muted);
  transition: opacity var(--transition);
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
}

.theme-toggle:hover { opacity: 0.8; background: none; }

/* ---- 27. Mobile Bottom Nav + Quick Actions ----------------
     (Styles live in section 29 "Responsive" and after it)   */
/* ---- Mobile-only helper ----------------------------------- */
.mobile-only { display: none; }

/* ---- 28. Misc UI ------------------------------------------ */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

.alert-warning { background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.3); color: #92400e; }
.alert-danger  { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); color: #991b1b; }
.alert-info    { background: rgba(59,130,246,0.1); border: 1px solid rgba(59,130,246,0.3); color: #1e40af; }
.alert-success { background: rgba(34,197,94,0.1); border: 1px solid rgba(34,197,94,0.3); color: #166534; }

[data-theme="dark"] .alert-warning { color: #fbbf24; }
[data-theme="dark"] .alert-danger  { color: #f87171; }
[data-theme="dark"] .alert-info    { color: #93c5fd; }
[data-theme="dark"] .alert-success { color: #86efac; }

.divider { border: none; border-top: 1px solid var(--border); margin: 1.25rem 0; }

code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8em;
  background: var(--bg-elevated);
  padding: 0.1em 0.4em;
  border-radius: 4px;
  color: var(--accent-ai);
}

.doc-icon { margin-right: 0.5rem; }

/* ---- 29. Responsive --------------------------------------- */
@media (max-width: 1024px) {
  .sidebar { width: var(--sidebar-w-coll); }
  .sidebar .sidebar-name,
  .sidebar .nav-text,
  .sidebar .nav-label { opacity: 0; width: 0; overflow: hidden; }
  .main-wrap { margin-left: var(--sidebar-w-coll); }
  .kpi-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .kpi-grid-6 { grid-template-columns: repeat(3, 1fr); }
  .two-col-grid { grid-template-columns: 1fr; }
  .ai-chat-container { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar { display: none !important; }
  .main-wrap { margin-left: 0; padding-bottom: 80px; }
  .mobile-bottom-nav { display: flex; }
  .page-content { padding: 0.875rem; }

  /* --- Header: compact on mobile --- */
  .app-header { padding: 0 0.875rem; gap: 0.5rem; }
  .mobile-menu-btn { display: flex; align-items: center; justify-content: center; }
  .user-badge { display: none; }      /* hide email — saves space */

  /* --- Sidebar as slide-in overlay on mobile --- */
  .sidebar {
    display: flex !important;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 200;
    box-shadow: 4px 0 20px rgba(0,0,0,0.4);
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 199;
  }
  .sidebar-backdrop.open { display: block; }

  /* --- KPI grids --- */
  .kpi-grid-3,
  .kpi-grid-4,
  .kpi-grid-5,
  .kpi-grid-6 { grid-template-columns: 1fr 1fr; }
  .kpi-grid-2 { grid-template-columns: 1fr; }

  /* --- Forms --- */
  .form-grid { grid-template-columns: 1fr; }
  .form-input, .form-select, .form-textarea, select, input[type="text"],
  input[type="email"], input[type="password"], input[type="number"],
  input[type="date"], input[type="tel"] {
    min-height: 46px;
    font-size: 1rem; /* prevents iOS zoom on focus */
  }

  /* --- Action bar --- */
  .action-bar { flex-direction: column; align-items: stretch; }
  .action-bar .btn { justify-content: center; }

  /* --- Search --- */
  .search-form { flex-direction: column; }
  .search-input { width: 100%; }

  /* --- Tables: scroll instead of hiding columns --- */
  .table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .data-table { min-width: 480px; }
  .data-table th:nth-child(n+5),
  .data-table td:nth-child(n+5) { display: none; }

  /* --- Cards: tighter padding --- */
  .card-header { padding: 0.875rem 1rem; }

  /* --- Invoice drop zone: large tap target --- */
  .invoice-drop-zone { min-height: 160px; }
  .invoice-review-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .kpi-grid-3,
  .kpi-grid-4 { grid-template-columns: 1fr; }
  .card-grid { grid-template-columns: 1fr; }
  .page-content { padding: 0.75rem; }
}

/* ---- Bottom nav with center FAB -------------------------------- */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 64px;
  background: var(--sidebar-bg);
  border-top: 1px solid rgba(255,255,255,0.08);
  z-index: 100;
  align-items: center;
  justify-content: space-around;
  padding: 0 0.25rem;
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  color: var(--sidebar-text);
  font-size: 0.62rem;
  font-weight: 500;
  padding: 0.3rem 0.5rem;
  border-radius: 10px;
  min-width: 52px;
  text-align: center;
  transition: color var(--transition);
  background: none;
  border: none;
  cursor: pointer;
  flex: 1;
}

.mobile-nav-item span:first-child { font-size: 1.35rem; line-height: 1; }
.mobile-nav-item.active { color: var(--accent); }
.mobile-nav-item:hover { color: #fff; }

/* Center FAB button */
.mobile-nav-fab {
  flex: 0 0 56px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(192,38,160,0.5);
  margin-bottom: 8px;
  transition: transform 150ms ease, box-shadow 150ms ease;
}
.mobile-nav-fab:hover { transform: scale(1.08); box-shadow: 0 6px 20px rgba(192,38,160,0.6); }
.mobile-nav-fab.open { transform: rotate(45deg); }

/* Quick action sheet */
.quick-action-sheet {
  display: none;
  position: fixed;
  bottom: 64px; left: 0; right: 0;
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  border-radius: 20px 20px 0 0;
  padding: 1.25rem 1rem 1rem;
  z-index: 99;
  box-shadow: 0 -8px 32px rgba(0,0,0,0.2);
  animation: slideUp 200ms ease;
}
.quick-action-sheet.open { display: block; }

@keyframes slideUp {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.quick-action-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  text-align: center;
}

.quick-action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.quick-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
  text-align: center;
  text-decoration: none;
}
.quick-action-btn span:first-child { font-size: 1.75rem; line-height: 1; }
.quick-action-btn:hover, .quick-action-btn:active { background: var(--bg-card, var(--bg-elevated)); border-color: var(--accent); }

.quick-action-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 98;
  background: rgba(0,0,0,0.4);
}
.quick-action-overlay.open { display: block; }

/* ---- More Menu (mobile) ----------------------------------- */
.more-menu {
  display: none;
  position: fixed;
  bottom: 64px; left: 0; right: 0;
  background: var(--sidebar-bg);
  border-top: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px 20px 0 0;
  padding: 1.25rem 1rem 1rem;
  z-index: 99;
  box-shadow: 0 -8px 32px rgba(0,0,0,0.3);
  animation: slideUp 200ms ease;
}
.more-menu.open { display: block; }

.more-menu-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

.more-menu-grid a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--sidebar-text);
  font-size: 0.8rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius);
  background: rgba(255,255,255,0.05);
  transition: background var(--transition);
}
.more-menu-grid a:hover { background: rgba(255,255,255,0.12); }

/* ---- 30. Print -------------------------------------------- */
@media print {
  .sidebar, .app-header, .mobile-bottom-nav, .btn, .action-bar { display: none !important; }
  .main-wrap { margin-left: 0; }
  .page-content { padding: 0; }
}

/* ---- 31. Infra: Linked Expenses & Phases ------------------- */
.infra-expenses {
  margin-top: 0.6rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.expense-phase-group {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.expense-phase-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.phase-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #22c55e;
  background: rgba(34,197,94,.12);
  border-radius: 3px;
  padding: 1px 5px;
}

/* ---- 32. Expense Link Section (modals) -------------------- */
.expense-link-section {
  border-top: 1px solid var(--border);
  margin-top: 1rem;
  padding-top: 0.75rem;
}

.expense-link-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
}

.expense-link-title {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text);
}

.cost-mode-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.cost-mode-tab {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  cursor: pointer;
  padding: 0.3rem 0.65rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  transition: border-color .15s, background .15s;
  user-select: none;
}
.cost-mode-tab:has(input:checked) {
  border-color: var(--accent);
  background: rgba(192,38,160,.1);
  color: var(--accent);
}
.cost-mode-tab input { display: none; }

.phases-header {
  display: flex;
  align-items: center;
  margin-bottom: 0.4rem;
}

.phase-row { margin-bottom: 0.5rem; }

.phase-row-inner {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.6rem;
  background: var(--surface-alt);
  border-radius: 8px;
  border: 1px solid var(--border);
}
.phase-row-inner .phase-label {
  margin-top: 1.4rem;
  white-space: nowrap;
}

/* ---- 33. Modal sizes --------------------------------------- */
.modal-content.modal-lg { width: min(680px, 96vw); }

/* ---- 34. Recurring: grouped phases table ------------------ */
.phase-group-header td {
  background: var(--surface-alt);
  font-weight: 600;
  font-size: 0.82rem;
  border-bottom: none;
  padding-bottom: 0.2rem;
}
.phase-group-row td {
  padding-top: 0.15rem;
  padding-bottom: 0.15rem;
  border-bottom: none;
}
.phase-group-row.last-phase td {
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}
.phase-connector {
  display: inline-block;
  margin-right: 0.3rem;
  color: var(--text-muted);
  font-size: 0.8rem;
}
.infra-badge {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  border-radius: 3px;
  padding: 1px 5px;
  background: rgba(99,179,237,.12);
  color: #63b3ed;
  border: 1px solid rgba(99,179,237,.25);
}

/* ── Section 35: ELAILA Invoice & Settings ──────────────────────────────── */

/* Settings subtitle (subheading inside section) */
.settings-section-subtitle {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

/* ELAILA budget bar */
.elaila-budget-bar {
  display: inline-block;
  vertical-align: middle;
  width: 80px;
  height: 6px;
  background: var(--bg-elevated);
  border-radius: 3px;
  margin-left: 0.4rem;
  overflow: hidden;
}
.elaila-budget-bar span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.3s;
}

/* Invoice upload drop zone */
.invoice-upload-card {
  max-width: 560px;
  margin: 2rem auto;
}
@media (max-width: 768px) {
  .invoice-upload-card { max-width: 100%; margin: 0; }
}

.invoice-drop-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 2.5rem 1rem;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  text-align: center;
}
.invoice-drop-zone:hover,
.invoice-drop-zone.drag-over { border-color: var(--accent); background: rgba(192,38,160,.05); }
.invoice-drop-zone.has-file   { border-color: #22c55e; background: rgba(34,197,94,.05); }
.drop-icon { font-size: 2rem; line-height: 1; }
.drop-text { font-size: 0.95rem; font-weight: 600; color: var(--text-primary); }
.drop-hint { font-size: 0.75rem; color: var(--text-muted); }

/* Invoice preview bar */
.invoice-preview-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-elevated);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
}

/* Invoice review two-column grid */
.invoice-review-grid {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 1.25rem;
  align-items: start;
}
@media (max-width: 800px) {
  .invoice-review-grid { grid-template-columns: 1fr; }
}

/* Invoice document info box */
.invoice-doc-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-elevated);
  border-radius: 8px;
  padding: 0.75rem;
}
.invoice-doc-icon { font-size: 2rem; line-height: 1; }

/* Confidence badge */
.confidence-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  letter-spacing: .02em;
}
.confidence-badge.confidence-high   { background: rgba(34,197,94,.15); color: #22c55e; }
.confidence-badge.confidence-medium { background: rgba(234,179,8,.15); color: #ca8a04; }
.confidence-badge.confidence-low    { background: rgba(239,68,68,.15); color: #ef4444; }

/* Invoice pending dashboard banner */
.invoice-pending-banner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(0,114,181,.1);
  border: 1px solid rgba(0,114,181,.25);
  border-radius: 8px;
  padding: 0.65rem 1rem;
  color: var(--text-primary);
  font-size: 0.9rem;
}

/* btn-danger-outline */
.btn-danger-outline {
  border-color: var(--danger, #ef4444);
  color: var(--danger, #ef4444);
}
.btn-danger-outline:hover { background: rgba(239,68,68,.1); }

/* ---- 36. Settings Sub-Navigation -------------------------- */
.settings-subnav {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  background: var(--bg-elevated);
  border-radius: var(--radius);
  padding: 0.35rem;
  border: 1px solid var(--border);
}

.settings-subnav-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: calc(var(--radius) - 2px);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
}

.settings-subnav-item:hover {
  background: var(--bg-card);
  color: var(--text);
}

.settings-subnav-item.active {
  background: var(--accent);
  color: #fff;
}

@media (max-width: 600px) {
  .settings-subnav { gap: 0.25rem; padding: 0.25rem; }
  .settings-subnav-item { padding: 0.45rem 0.65rem; font-size: 0.78rem; }
  .settings-subnav-item span:last-child { display: none; }
}

/* ---- 38. Unified Product + Infra Cards -------------------- */
.product-compact-card { overflow: hidden; transition: box-shadow 0.15s; }
.product-compact-card.expanded { box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.product-compact-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  cursor: pointer;
  user-select: none;
  transition: background 0.1s;
}
.product-compact-header:hover { background: var(--surface-alt, rgba(0,0,0,0.015)); }
.product-compact-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
}
.product-compact-stats {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
}
.product-compact-toggle {
  flex-shrink: 0;
  width: 1.5rem;
  text-align: center;
}
.product-chevron {
  font-size: 0.65rem;
  color: var(--text-muted);
  transition: transform 0.15s;
}
.product-detail-body {
  border-top: 1px solid var(--border);
}
.product-unified-card { overflow: hidden; }
.product-unified-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}
.product-unified-left {
  padding: 1rem 1.25rem;
  border-right: 1px solid var(--border);
}
.product-unified-right {
  padding: 1rem 1.25rem;
  background: var(--surface-alt, var(--surface));
}
.product-unified-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.product-sort-btns {
  display: flex;
  gap: 0.1rem;
  flex-shrink: 0;
}
.product-unified-stats {
  display: flex;
  gap: 1.25rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}
.stat-mini {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.stat-mini-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
}
.stat-mini-value {
  font-size: 0.95rem;
  font-weight: 600;
}
.product-subs-compact {
  margin-top: 0.6rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.sub-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}
.infra-mini-card {
  background: var(--bg, #fff);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem 0.65rem;
  margin-bottom: 0.4rem;
}
.infra-mini-card.infra-warn {
  border-color: var(--warn, #f59e0b);
  background: rgba(245,158,11,0.04);
}
.infra-mini-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.infra-mini-meta {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.2rem;
  flex-wrap: wrap;
}

@media (max-width: 768px) {
  .product-unified-row {
    grid-template-columns: 1fr;
  }
  .product-unified-left {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .product-compact-stats { display: none; }
}

/* ---- 39. Resource Cards -------------------- */
.resource-card {
  background: var(--bg, #fff);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.45rem 0.65rem;
  margin-bottom: 0.4rem;
}
.resource-card-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.resource-icon {
  font-size: 1rem;
  flex-shrink: 0;
}
.resource-actions {
  display: flex;
  gap: 0.1rem;
  margin-left: auto;
  flex-shrink: 0;
}

/* ============================================================
   HELLER Module — Toggle + Styles
   ============================================================ */

/* ── HELLER toggle switch in sidebar footer ─────────────────── */
.heller-toggle {
  flex-shrink: 0;
  width: 36px;
  height: 20px;
  background: var(--heller-magenta, #c026a0); /* default = CNYT aktiv = Magenta */
  border: none;
  border-radius: 100px;
  margin-right: 0;
  cursor: pointer;
  position: relative;
  transition: background 220ms ease;
  padding: 0;
  display: flex;
  align-items: center;
}

.heller-toggle-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--sidebar-text);
  white-space: nowrap;
  flex: 1;
  transition: opacity var(--transition);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.heller-toggle-label { display: none; } /* replaced by .sidebar-footer-label */
.sidebar-footer-label.heller { color: var(--heller-magenta, #c026a0); }
.heller-toggle.active + .sidebar-footer-label { color: var(--heller-blue, #0072b5); }

.heller-toggle-thumb {
  position: absolute;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  transition: left 220ms ease;
  pointer-events: none;
}

.heller-toggle.active {
  background: var(--heller-blue);
}

.heller-toggle.active .heller-toggle-thumb {
  left: 19px;
}

/* ── Sidebar in HELLER mode — blue accent ───────────────────── */
.sidebar.heller-mode .nav-item.active {
  background: rgba(59,130,246,0.20);
}

.sidebar.heller-mode .sidebar-active-bg { color: var(--heller-blue); }

/* ── HELLER Zeiten table specific styles ───────────────────── */
.heller-zeiten-table .heller-weekend td {
  opacity: 0.45;
}

.heller-zeiten-table .heller-nowork td {
  color: var(--text-muted);
  font-style: italic;
}

.heller-zeiten-table .heller-month-separator td {
  background: var(--bg-elevated);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ── HELLER filter pills ────────────────────────────────────── */
.heller-pill {
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.heller-pill:hover {
  background: var(--bg-elevated);
  color: var(--text);
}
.heller-pill.active {
  background: var(--heller-blue);
  border-color: var(--heller-blue);
  color: #fff;
}

/* ── HELLER Nah/Fern badges ─────────────────────────────────── */
.heller-badge {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.badge-nah  { background: rgba(14,165,233,0.15); color: #0ea5e9; border: 1px solid rgba(14,165,233,0.3); }
.badge-fern { background: rgba(99,102,241,0.15); color: #6366f1; border: 1px solid rgba(99,102,241,0.3); }

/* ── Alert banner ───────────────────────────────────────────── */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  border: 1px solid transparent;
}

.alert-warning {
  background: rgba(245,158,11,0.12);
  border-color: rgba(245,158,11,0.3);
  color: #d97706;
}

/* ── Modal box (generic) ────────────────────────────────────── */
.modal-box {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: min(540px, 96vw);
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.5rem;
}

.modal-body { margin-top: 0.5rem; }

/* ── form-control alias (bootstrap-compat) ─────────────────── */
.form-control {
  display: block;
  width: 100%;
  padding: 0.45rem 0.7rem;
  font-size: 0.875rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  font-family: 'Outfit', sans-serif;
  transition: border-color var(--transition);
}
.form-control:focus { border-color: var(--heller-blue); }
.form-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

