/* ================================================================
   Aditude Finance – Theme System
   ================================================================ */

/* ── Theme 1: Dark (default) ── */
:root,
[data-theme="dark"] {
  --bg-base:      #0b0d14;
  --bg-surface:   #111420;
  --bg-card:      #161929;
  --bg-elevated:  #1c2035;
  --bg-input:     #252a3d;
  --border:       #343a55;
  --border-light: #3d4468;

  --text-primary:   #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted:     #64748b;

  --accent:        #6366f1;
  --accent-hover:  #4f52d9;
  --accent-light:  rgba(99,102,241,0.12);
  --accent-2:      #8b5cf6;

  --sidebar-bg:       #111420;
  --sidebar-border:   #343a55;
  --sidebar-text:     #94a3b8;
  --sidebar-hover-bg: #1c2035;
  --sidebar-hover-tx: #e2e8f0;
  --topbar-bg:        #111420;
  --topbar-border:    #343a55;

  --shadow: 0 4px 24px rgba(0,0,0,0.4);
}

/* ── Theme 2: Light (bright content + dark sidebar) ── */
[data-theme="light"] {
  --bg-base:      #f0f4f8;
  --bg-surface:   #ffffff;
  --bg-card:      #ffffff;
  --bg-elevated:  #f8fafc;
  --bg-input:     #f1f5f9;
  --border:       #e2e8f0;
  --border-light: #cbd5e1;

  --text-primary:   #0f172a;
  --text-secondary: #475569;
  --text-muted:     #94a3b8;

  --accent:        #6366f1;
  --accent-hover:  #4f52d9;
  --accent-light:  rgba(99,102,241,0.08);
  --accent-2:      #8b5cf6;

  --sidebar-bg:       #1a1f35;
  --sidebar-border:   #2a304d;
  --sidebar-text:     #94a3b8;
  --sidebar-hover-bg: #252b44;
  --sidebar-hover-tx: #e2e8f0;
  --topbar-bg:        #ffffff;
  --topbar-border:    #e2e8f0;

  --success-bg:  rgba(16,185,129,0.08);
  --warning-bg:  rgba(245,158,11,0.08);
  --danger-bg:   rgba(239,68,68,0.08);
  --info-bg:     rgba(59,130,246,0.08);
  --shadow: 0 4px 24px rgba(0,0,0,0.08);
}

/* ── Theme 3: Neutral (fully light, grey tones) ── */
[data-theme="neutral"] {
  --bg-base:      #f5f5f5;
  --bg-surface:   #ffffff;
  --bg-card:      #ffffff;
  --bg-elevated:  #f0f0f0;
  --bg-input:     #fafafa;
  --border:       #e0e0e0;
  --border-light: #ebebeb;

  --text-primary:   #1a1a1a;
  --text-secondary: #555555;
  --text-muted:     #999999;

  --accent:        #555555;
  --accent-hover:  #333333;
  --accent-light:  rgba(85,85,85,0.08);
  --accent-2:      #777777;

  --sidebar-bg:       #f0f0f0;
  --sidebar-border:   #e0e0e0;
  --sidebar-text:     #666666;
  --sidebar-hover-bg: #e6e6e6;
  --sidebar-hover-tx: #1a1a1a;
  --topbar-bg:        #ffffff;
  --topbar-border:    #e0e0e0;

  --success-bg:  rgba(16,185,129,0.08);
  --warning-bg:  rgba(245,158,11,0.08);
  --danger-bg:   rgba(239,68,68,0.08);
  --info-bg:     rgba(59,130,246,0.08);
  --shadow: 0 4px 24px rgba(0,0,0,0.06);
}

/* ── Theme 4: Midnight (near-black + electric blue) ── */
[data-theme="midnight"] {
  --bg-base:      #060810;
  --bg-surface:   #0c0f1c;
  --bg-card:      #101424;
  --bg-elevated:  #141829;
  --bg-input:     #1c2138;
  --border:       #252c48;
  --border-light: #2e3658;

  --text-primary:   #e0eaff;
  --text-secondary: #7e95c4;
  --text-muted:     #4d6080;

  --accent:        #3b82f6;
  --accent-hover:  #2563eb;
  --accent-light:  rgba(59,130,246,0.12);
  --accent-2:      #60a5fa;

  --sidebar-bg:       #0c0f1c;
  --sidebar-border:   #252c48;
  --sidebar-text:     #7e95c4;
  --sidebar-hover-bg: #141829;
  --sidebar-hover-tx: #e0eaff;
  --topbar-bg:        #0c0f1c;
  --topbar-border:    #252c48;

  --shadow: 0 4px 32px rgba(0,0,0,0.6);
}

/* ── Theme 5: Ocean (dark teal) ── */
[data-theme="ocean"] {
  --bg-base:      #071520;
  --bg-surface:   #0d2030;
  --bg-card:      #112636;
  --bg-elevated:  #162e40;
  --bg-input:     #1e3a50;
  --border:       #2a4d66;
  --border-light: #355e7a;

  --text-primary:   #d8edf8;
  --text-secondary: #7fb3cc;
  --text-muted:     #4e7d99;

  --accent:        #06b6d4;
  --accent-hover:  #0891b2;
  --accent-light:  rgba(6,182,212,0.12);
  --accent-2:      #22d3ee;

  --sidebar-bg:       #081926;
  --sidebar-border:   #2a4d66;
  --sidebar-text:     #7fb3cc;
  --sidebar-hover-bg: #162e40;
  --sidebar-hover-tx: #d8edf8;
  --topbar-bg:        #0d2030;
  --topbar-border:    #2a4d66;

  --shadow: 0 4px 24px rgba(0,0,0,0.5);
}

/* ── Theme 6: Sunset (dark warm + amber/orange) ── */
[data-theme="sunset"] {
  --bg-base:      #130e0a;
  --bg-surface:   #1c1510;
  --bg-card:      #221a13;
  --bg-elevated:  #2a2018;
  --bg-input:     #352819;
  --border:       #4a3824;
  --border-light: #5c4730;

  --text-primary:   #f5e8d8;
  --text-secondary: #b8977a;
  --text-muted:     #7a5e42;

  --accent:        #f59e0b;
  --accent-hover:  #d97706;
  --accent-light:  rgba(245,158,11,0.12);
  --accent-2:      #fb923c;

  --sidebar-bg:       #100c08;
  --sidebar-border:   #4a3824;
  --sidebar-text:     #b8977a;
  --sidebar-hover-bg: #2a2018;
  --sidebar-hover-tx: #f5e8d8;
  --topbar-bg:        #1c1510;
  --topbar-border:    #4a3824;

  --shadow: 0 4px 24px rgba(0,0,0,0.5);
}

/* ── Shared sizing / semantic tokens ── */
:root {
  --success:   #10b981;
  --success-bg: rgba(16,185,129,0.1);
  --warning:   #f59e0b;
  --warning-bg: rgba(245,158,11,0.1);
  --danger:    #ef4444;
  --danger-bg:  rgba(239,68,68,0.1);
  --info:      #3b82f6;
  --info-bg:    rgba(59,130,246,0.1);

  --sidebar-w: 240px;
  --topbar-h:  60px;
  --radius:    10px;
  --radius-lg: 16px;
  --transition: 0.2s ease;
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Utilities ──────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Dashboard tip banner ───────────────────────────────────── */
.dashboard-tip {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; margin-bottom: 20px;
  border-left: 3px solid var(--accent); background: var(--accent-light); flex-wrap: wrap;
}
.dashboard-tip-icon { width: 18px; height: 18px; fill: var(--accent); flex-shrink: 0; }
.dashboard-tip-text { flex: 1 1 220px; font-size: 13px; color: var(--text-primary); min-width: 0; }
.dashboard-tip-action { flex-shrink: 0; }
.dashboard-tip-dismiss { background: none; border: none; cursor: pointer; color: var(--text-muted); font-size: 16px; padding: 0 4px; flex-shrink: 0; }
@media (max-width: 480px) {
  .dashboard-tip-text { flex-basis: 100%; order: -1; }
}
html { font-size: 15px; scroll-behavior: smooth; -webkit-tap-highlight-color: transparent; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-hover); }
img { max-width: 100%; }
button { cursor: pointer; font-family: inherit; }

/* ── Layout ─────────────────────────────────────────────────── */
.layout { display: flex; min-height: 100vh; }

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
  overflow-y: auto;
}

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

.company-logo {
  width: 40px; height: 40px;
  border-radius: 8px;
  object-fit: contain;
  background: var(--bg-card);
  padding: 2px;
  flex-shrink: 0;
}
.company-logo-placeholder {
  width: 40px; height: 40px;
  border-radius: 8px;
  background: var(--accent-light);
  border: 1px solid var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700; color: var(--accent);
  flex-shrink: 0;
}
.company-info { overflow: hidden; }
.company-name { display: block; font-weight: 600; font-size: 13px; color: var(--sidebar-hover-tx); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.company-role { display: block; font-size: 11px; color: var(--sidebar-text); text-transform: capitalize; }

.sidebar-nav { flex: 1; padding: 12px 8px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 8px;
  color: var(--sidebar-text); font-size: 14px; font-weight: 500;
  transition: all var(--transition); position: relative;
}
.nav-item svg { width: 18px; height: 18px; fill: currentColor; flex-shrink: 0; }
.nav-item:hover { background: var(--sidebar-hover-bg); color: var(--sidebar-hover-tx); }
.nav-item.active { background: var(--accent-light); color: var(--accent); }
.badge-running { margin-left: auto; color: var(--success); font-size: 10px; animation: pulse 1.5s infinite; }
.nav-badge-count {
    margin-left: auto; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700;
    line-height: 1; padding: 2px 7px; border-radius: 999px; min-width: 18px; text-align: center;
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--sidebar-border);
  display: flex; align-items: center; gap: 8px;
}
.user-profile { display: flex; align-items: center; gap: 10px; flex: 1; overflow: hidden; color: var(--sidebar-text); }
.user-profile:hover { color: var(--sidebar-hover-tx); }
.user-name { display: block; font-size: 13px; font-weight: 500; color: var(--sidebar-hover-tx); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-email { display: block; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--sidebar-text); }

.avatar-sm {
  width: 32px; height: 32px; border-radius: 50%;
  object-fit: cover; flex-shrink: 0;
}
.avatar-initials {
  background: var(--accent-light); border: 1px solid var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; color: var(--accent);
}

.btn-logout {
  padding: 6px; border-radius: 6px; color: var(--sidebar-text);
  transition: all var(--transition); flex-shrink: 0;
}
.btn-logout svg { width: 18px; height: 18px; fill: currentColor; display: block; }
.btn-logout:hover { background: var(--danger-bg); color: var(--danger); }

/* ── Main content ───────────────────────────────────────────── */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Top-bar menu layout (alternative to sidebar) ──────────────── */
.layout.nav-topbar { flex-direction: column; }
.layout.nav-topbar .main-content { margin-left: 0; }
.topnav {
  height: var(--topbar-h);
  background: var(--sidebar-bg);
  border-bottom: 1px solid var(--sidebar-border);
  display: flex; align-items: center; gap: 8px;
  padding: 0 20px;
  position: sticky; top: 0; z-index: 100;
}
.topnav-brand { display: flex; align-items: center; flex-shrink: 0; text-decoration: none; }
.topnav-brand .company-logo { width: 32px; height: 32px; }
.topnav-brand .company-logo-placeholder { width: 32px; height: 32px; font-size: 15px; }
.topnav-toggle { display: none; background: none; border: none; color: var(--sidebar-text); padding: 4px; margin-left: 4px; }
.topnav-toggle svg { width: 22px; height: 22px; fill: currentColor; }
.topnav-nav {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 2px;
  overflow-x: auto; scrollbar-width: none; min-width: 0;
}
.topnav-nav::-webkit-scrollbar { display: none; }
.topnav-nav .nav-item { flex-shrink: 0; padding: 8px 12px; }
.topnav-nav .nav-item svg { display: none; }
.topnav-user { display: flex; align-items: center; flex-shrink: 0; }
.topnav .btn-logout { flex-shrink: 0; }

@media (max-width: 900px) {
  .topnav-toggle { display: flex; order: 4; }
  .topnav-nav {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch; justify-content: flex-start; background: var(--sidebar-bg);
    border-bottom: 1px solid var(--sidebar-border); padding: 8px; gap: 0;
    max-height: calc(100vh - var(--topbar-h)); overflow-y: auto;
  }
  .topnav-nav.open { display: flex; }
  .topnav-nav .nav-item { padding: 10px 12px; }
  .topnav .btn-logout { order: 2; margin-left: auto; }
  .topnav-user { order: 3; }
}

/* ── Topbar ─────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--topbar-border);
  display: flex; align-items: center;
  padding: 0 24px; gap: 16px;
  position: sticky; top: 0; z-index: 50;
}
.sidebar-toggle { display: none; background: none; border: none; color: var(--text-secondary); padding: 4px; }
.sidebar-toggle svg { width: 22px; height: 22px; fill: currentColor; }
.topbar-brand { display: none; align-items: center; flex-shrink: 0; text-decoration: none; }
.topbar-brand .company-logo { width: 32px; height: 32px; }
.topbar-brand .company-logo-placeholder { width: 32px; height: 32px; font-size: 15px; }
.topbar-center { flex: 1; display: flex; justify-content: center; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-date { font-size: 13px; color: var(--text-muted); }
.topbar-mobile-user, .topbar-mobile-logout { display: none; }

/* Timer widget */
.timer-widget {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 20px; padding: 6px 14px;
  font-size: 13px;
}
.timer-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); animation: pulse 1.5s infinite; }
.timer-colon { animation: timerColonBlink 1s steps(1) infinite; }
.timer-project { color: var(--text-secondary); max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timer-display { font-weight: 700; color: var(--success); font-size: 14px; }
.btn-timer-stop { background: var(--danger-bg); color: var(--danger); border-radius: 12px; padding: 3px 10px; font-size: 12px; font-weight: 600; }
.timer-widget-floating {
  position: fixed; right: 20px; bottom: 20px; z-index: 150;
  box-shadow: var(--shadow);
}
@media (max-width: 600px) {
  .timer-widget-floating { right: 12px; bottom: 12px; left: 12px; }
  .timer-widget-floating .timer-project { max-width: none; flex: 1; }
}
.timer-widget-floating-mobile { display: none; }
@media (max-width: 900px) {
  .timer-widget-floating-mobile { display: flex; }
  .topbar-center .timer-widget { display: none; }
}
.btn-timer-stop:hover { background: var(--danger); color: #fff; }

/* ── Page content ───────────────────────────────────────────── */
.page-content { flex: 1; padding: 28px 32px; }
.page-container { max-width: 1200px; margin: 0 auto; }

.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 28px; gap: 16px; flex-wrap: wrap;
}
.page-title { font-size: 22px; font-weight: 700; color: var(--text-primary); }
.page-subtitle { font-size: 14px; color: var(--text-secondary); margin-top: 2px; }

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.card-title { font-size: 15px; font-weight: 600; }
.inv-pdf-extras-body { padding: 0 20px 20px; }
.inv-pdf-extras-block + .inv-pdf-extras-block { margin-top: 14px; padding-top: 14px; border-top: 2px solid var(--border); }
.inv-pdf-extras-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 1px;
  color: var(--text-muted); font-weight: 700; margin-bottom: 6px;
}
.inv-pdf-extras-text { font-size: 13px; color: var(--text-secondary); line-height: 1.6; margin: 0; }
.inv-pdf-extras-pre { white-space: pre-wrap; color: var(--text-primary); }

/* ── Stat cards ─────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px; margin-bottom: 28px;
}
.stats-grid-3col { grid-template-columns: repeat(3, 1fr); margin-bottom: 20px; }
/* Grid items default to a min-width based on their content (e.g. a chart's min-width:700px
   inner scroller), which can blow a column out past its fair 1/3 share — reset it so all
   3 columns actually end up equal width, with any overflow scrolling inside the card instead. */
.stats-grid-3col > * { min-width: 0; }
.stats-grid-4col { grid-template-columns: repeat(4, 1fr); margin-bottom: 20px; }
.stats-grid-4col > * { min-width: 0; }
.stat-subtext { font-size: 14px; color: var(--text-secondary); margin-top: 4px; }
.stats-grid-note { font-size: 12px; color: var(--text-muted); margin: -12px 0 16px; }
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px;
  display: flex; align-items: flex-start; gap: 16px;
}
.stat-icon {
  width: 44px; height: 44px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 22px; height: 22px; fill: currentColor; }
.stat-icon.purple { background: rgba(99,102,241,0.15); color: var(--accent); }
.stat-icon.green  { background: rgba(16,185,129,0.15);  color: var(--success); }
.stat-icon.amber  { background: rgba(245,158,11,0.15);  color: var(--warning); }
.stat-icon.blue   { background: rgba(59,130,246,0.15);  color: var(--info); }
.stat-icon.red    { background: var(--danger-bg);        color: var(--danger); }
.stat-label { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-value { font-size: 22px; font-weight: 700; color: var(--text-primary); line-height: 1; }
.stat-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ── Grids ──────────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 20px; }

/* ── Tables ─────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border); max-width: 1200px; margin: 0 auto; }
table { width: 100%; border-collapse: collapse; font-size: 16px; }
th {
  background: var(--bg-elevated); color: var(--text-muted);
  font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px;
  padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border);
}
td { padding: 14px 16px; border-bottom: 1px solid var(--border); color: var(--text-primary); vertical-align: middle; }

tr:last-child td { border-bottom: none; }
@media (hover: hover) {
  tr:hover td { background: var(--bg-elevated); }
}

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 500;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger); }
.badge-info    { background: var(--info-bg);    color: var(--info); }
.badge-muted   { background: var(--bg-elevated); color: var(--text-muted); }
.badge-sent    { background: var(--success);     color: #fff; font-weight: 600; }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 8px; font-size: 14px;
  font-weight: 500; border: none; transition: all var(--transition);
  cursor: pointer; white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; fill: currentColor; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); color: #fff; }
.btn-secondary { background: var(--bg-elevated); color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; color: #fff; }
.btn-danger { background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(239,68,68,0.3); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-ghost { background: none; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-elevated); color: var(--text-primary); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 13px 24px; font-size: 15px; }
.btn-full { width: 100%; justify-content: center; }
.remove-line-btn {
    appearance: none; -webkit-appearance: none; background: none; border: none; outline: none;
    color: var(--text-muted); cursor: pointer; font-size: 16px; line-height: 1;
    width: 28px; height: 28px; border-radius: 6px; transition: background .12s, color .12s;
}
.remove-line-btn:hover { background: var(--danger-light, rgba(239,68,68,.1)); color: var(--danger); }
.remove-line-btn:focus-visible { box-shadow: 0 0 0 2px var(--danger-light, rgba(239,68,68,.2)); }
.line-move-btn {
    appearance: none; -webkit-appearance: none; background: none; border: none; outline: none;
    color: var(--text-muted); cursor: pointer; font-size: 9px; line-height: 1;
    width: 20px; height: 15px; border-radius: 4px; transition: background .12s, color .12s;
    display: flex; align-items: center; justify-content: center;
}
.line-move-btn:hover { background: var(--bg-elevated); color: var(--accent); }

/* ── Timesheet timer buttons (start/stop pills on a row, quick-add) ────────── */
.btn-start-timer,
.ts-row-stop-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: 8px; padding: 9px 14px; width: 140px; height:40px;
  font-size: 14px; font-weight: 600; color: #fff; cursor: pointer; white-space: nowrap;
}

/* Hover */
.btn-start-timer:hover { background: var(--accent-hover); }
.ts-row-stop-btn:hover { background: #059669; }

.btn-start-timer svg, .ts-row-stop-btn svg { width: 19px; height: 19px; fill: currentColor; flex-shrink: 0; }
.btn-start-timer { background: var(--accent); }
.ts-row-stop-btn { background: var(--success); }
.btn-quickadd-start {
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  background: var(--success); color: #fff; border: none; border-radius: 8px;
  width: 41px; height: 41px; cursor: pointer;
}
.btn-quickadd-start svg { width: 18px; height: 18px; fill: currentColor; }

/* ── Forms ──────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
label { display: block; font-size: 13px; font-weight: 500; color: var(--text-secondary); margin-bottom: 6px; }
label .required { color: var(--danger); margin-left: 2px; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="tel"],
input[type="url"],
select, textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text-primary);
  font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  appearance: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}
input::placeholder, textarea::placeholder { color: var(--text-secondary); opacity: 0.6; }
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; }
textarea { min-height: 90px; resize: vertical; }
select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='%2364748b'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }

.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 4px; }

/* ── Alerts ─────────────────────────────────────────────────── */
.alert {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 14px 16px; border-radius: var(--radius);
  margin-bottom: 16px; font-size: 14px;
}
.alert-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.alert-success { background: var(--success-bg); border: 1px solid rgba(16,185,129,0.25); color: var(--success); }
.alert-error   { background: var(--danger-bg);  border: 1px solid rgba(239,68,68,0.25);  color: var(--danger); }
.alert-warning { background: var(--warning-bg); border: 1px solid rgba(245,158,11,0.25); color: var(--warning); }
.alert-info    { background: var(--info-bg);    border: 1px solid rgba(59,130,246,0.25); color: var(--info); }

/* Flash messages render as bottom-center toasts (see renderFlash()) instead of an inline
   .alert, so they never push page content down — they float in, then auto-dismiss. */
.toast-container {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  z-index: 2000; display: flex; flex-direction: column; gap: 10px;
  width: max-content; max-width: calc(100vw - 40px); pointer-events: none;
}
.toast-container .alert {
  /* Solid backing instead of the ~8%-alpha .alert-* background — that reads fine inline
     against a fixed page background, but washes out floating over arbitrary content. */
  background: var(--bg-card); border: 1px solid var(--border); border-left: 4px solid currentColor;
  margin-bottom: 0; box-shadow: var(--shadow); pointer-events: auto; cursor: pointer;
  animation: toastIn .25s ease-out, toastOut .3s ease-in 5.5s forwards;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes toastOut {
  from { opacity: 1; }
  to   { opacity: 0; visibility: hidden; }
}
@media (max-width: 600px) {
  .toast-container { left: 12px; right: 12px; bottom: 12px; transform: none; width: auto; max-width: none; }
}

/* ── Notice box (clearer, title + body, used for cautionary messages) ── */
.notice-box {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 16px 18px; border-radius: var(--radius);
  margin-bottom: 20px; border: 1px solid var(--border);
  background: var(--bg-elevated);
}
.notice-box-icon {
  flex-shrink: 0; width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; margin-top: 1px;
}
.notice-box-body { font-size: 13px; line-height: 1.55; color: var(--text-secondary); }
.notice-box-title { font-size: 14px; font-weight: 600; margin-bottom: 4px; display: block; }
.notice-box-warning { background: #9a3412; border-color: #9a3412; }
.notice-box-warning .notice-box-icon { background: rgba(255,255,255,0.18); color: #fff; }
.notice-box-warning .notice-box-title { color: #fff; }
.notice-box-warning .notice-box-body { color: rgba(255,255,255,0.9); }
.notice-box-danger { background: #991b1b; border-color: #991b1b; }
.notice-box-danger .notice-box-icon { background: rgba(255,255,255,0.18); color: #fff; }
.notice-box-danger .notice-box-title { color: #fff; }
.notice-box-danger .notice-box-body { color: rgba(255,255,255,0.9); }

/* ── Empty state ────────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state svg { width: 56px; height: 56px; fill: var(--border); margin-bottom: 16px; }
.empty-state h3 { font-size: 16px; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state p { font-size: 14px; margin-bottom: 20px; }
/* Narrower cards (e.g. the 3-col dashboard row) need a much less roomy empty state —
   the default's 60px padding + 56px icon reads as a lot of dead space in a slim column. */
.empty-state-compact { padding: 20px 16px; }
.empty-state-compact svg { width: 32px; height: 32px; margin-bottom: 8px; }
.empty-state-compact h3 { font-size: 13px; margin-bottom: 4px; }
.empty-state-compact p { font-size: 12px; margin-bottom: 12px; }

/* ── Modal ──────────────────────────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.6); z-index: 1000;
  align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 28px;
  max-width: 520px; width: 100%;
  animation: modalIn 0.2s ease;
}
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-title { font-size: 17px; font-weight: 600; }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 20px; padding: 4px; }
.modal-close:hover { color: var(--text-primary); }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; }
@media (max-width: 600px) {
  /* 2-3 full-width buttons fit narrow screens better than a cramped shrinking row. */
  .modal { padding: 20px; }
  .modal-footer { flex-wrap: wrap; flex-direction: column-reverse; }
  .modal-footer > button, .modal-footer > form, .modal-footer > form > button { width: 100%; }
}

/* ── Guest layout (auth pages) ──────────────────────────────── */
.guest-layout {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-base);
  padding: 20px;
}
.auth-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 40px;
  width: 100%; max-width: 420px;
}
.auth-logo { text-align: center; margin-bottom: 28px; }
.auth-logo h1 { font-size: 22px; font-weight: 700; background: linear-gradient(135deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.auth-logo p { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.auth-title { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.auth-subtitle { font-size: 14px; color: var(--text-secondary); margin-bottom: 28px; }
.auth-footer { text-align: center; margin-top: 20px; font-size: 13px; color: var(--text-muted); }

/* ── Landing page ───────────────────────────────────────────── */
.landing { background: var(--bg-base); }
.landing-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 40px; border-bottom: 1px solid var(--border);
  background: var(--bg-surface); position: sticky; top: 0; z-index: 50;
}
.landing-nav .logo { font-size: 18px; font-weight: 700; background: linear-gradient(135deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.nav-links { display: flex; gap: 12px; align-items: center; }

.hero {
  text-align: center; padding: 100px 40px 80px;
  max-width: 800px; margin: 0 auto;
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent-light); border: 1px solid rgba(99,102,241,0.3);
  color: var(--accent); border-radius: 20px; padding: 6px 14px;
  font-size: 13px; font-weight: 500; margin-bottom: 24px;
}
.hero h1 {
  font-size: 54px; font-weight: 800; line-height: 1.15; margin-bottom: 20px;
  background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.hero h1 span { background: linear-gradient(135deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.hero p { font-size: 18px; color: var(--text-secondary); margin-bottom: 36px; line-height: 1.7; }
.hero-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.features {
  padding: 80px 40px;
  max-width: 1100px; margin: 0 auto;
}
.features-title { text-align: center; font-size: 32px; font-weight: 700; margin-bottom: 8px; }
.features-sub { text-align: center; color: var(--text-secondary); margin-bottom: 48px; }
.features-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.feature-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 28px;
  transition: border-color var(--transition), transform var(--transition);
}
.feature-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.feature-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
  background: var(--accent-light);
}
.feature-icon svg { width: 24px; height: 24px; fill: var(--accent); }
.feature-card h3 { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
.feature-card p { font-size: 14px; color: var(--text-secondary); }

.cta-section {
  background: var(--bg-surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  padding: 80px 40px; text-align: center;
}
.cta-section h2 { font-size: 32px; font-weight: 700; margin-bottom: 12px; }
.cta-section p { color: var(--text-secondary); margin-bottom: 28px; font-size: 16px; }

.landing-footer {
  padding: 28px 40px; text-align: center;
  color: var(--text-muted); font-size: 13px;
  border-top: 1px solid var(--border);
}

/* ── Timer entry list ───────────────────────────────────────── */
.time-entry {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 0; border-bottom: 1px solid var(--border);
}
.time-entry:last-child { border-bottom: none; }
.time-entry-project { flex: 1; }
.time-entry-project strong { display: block; font-size: 14px; }
.time-entry-project span { font-size: 12px; color: var(--text-muted); }
.time-entry-hours { font-size: 15px; font-weight: 600; color: var(--text-primary); white-space: nowrap; }
.time-entry-actions { display: flex; gap: 6px; }

/* ── Invoice status ─────────────────────────────────────────── */
.status-draft    { background: var(--bg-elevated); color: var(--text-muted); }
.status-sent     { background: var(--info-bg); color: var(--info); }
.status-paid     { background: var(--success-bg); color: var(--success); }
.status-overdue  { background: var(--danger-bg); color: var(--danger); }
.status-cancelled { background: var(--bg-elevated); color: var(--text-muted); }

/* ── Progress bar ───────────────────────────────────────────── */
.progress { height: 6px; background: var(--bg-elevated); border-radius: 3px; overflow: hidden; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 3px; transition: width 0.5s ease; }

/* ── Checkbox / Toggle ──────────────────────────────────────── */
.toggle-switch { position: relative; display: inline-block; width: 40px; height: 22px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0; cursor: pointer;
  background: var(--border); border-radius: 22px; transition: var(--transition);
}
.toggle-slider::before {
  content: ''; position: absolute;
  width: 16px; height: 16px; background: #fff; border-radius: 50%;
  left: 3px; top: 3px; transition: var(--transition);
}
input:checked + .toggle-slider { background: var(--accent); }
input:checked + .toggle-slider::before { transform: translateX(18px); }

/* ── Animations ─────────────────────────────────────────────── */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
@keyframes timerColonBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(-10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn 0.3s ease; }

/* ── Tabs ───────────────────────────────────────────────────── */
.tabs {
  display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 24px;
  overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  padding: 10px 18px; font-size: 14px; font-weight: 500;
  color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent;
  transition: all var(--transition); background: none; border-top: none; border-left: none; border-right: none;
  margin-bottom: -1px; flex-shrink: 0; white-space: nowrap;
}
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ── Search/filter bar ──────────────────────────────────────── */
.filter-bar { display: flex; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; align-items: center; }
.filter-bar input { flex: 1; min-width: 200px; }
.filter-bar select { min-width: 140px; }

/* ── Dropdown actions ───────────────────────────────────────── */
/* td er overflow:visible som standard, men vi sætter position:relative eksplicit */
table { overflow: visible; }
td { overflow: visible; }
.action-menu { position: relative; display: inline-block; }
.action-btn { background: none; border: 1px solid var(--border); color: var(--text-secondary); padding: 6px 8px; border-radius: 6px; height:40px; }
.action-btn:hover { border-color: var(--accent); color: var(--accent); }
.action-btn svg { width: 16px; height: 16px; fill: currentColor; display: block; }
.dropdown {
  display: none; position: fixed;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); min-width: 160px; z-index: 1000;
  box-shadow: var(--shadow); overflow: hidden;
}
.dropdown.open { display: block; }
.dropdown a, .dropdown button {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; font-size: 13px; color: var(--text-secondary);
  transition: all var(--transition); width: 100%; text-align: left;
  background: none; border: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.dropdown a:hover, .dropdown button:hover { background: var(--bg-elevated); color: var(--text-primary); }
.dropdown a.danger, .dropdown button.danger { color: var(--danger); }
.dropdown a.danger:hover, .dropdown button.danger:hover { background: var(--danger-bg); }
.dropdown svg { width: 14px; height: 14px; fill: currentColor; }

/* ── Upload / avatar ────────────────────────────────────────── */
.upload-area {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 32px; text-align: center; cursor: pointer;
  transition: border-color var(--transition);
}
.upload-area:hover { border-color: var(--accent); }
.upload-area p { color: var(--text-muted); font-size: 14px; }
.avatar-upload { display: flex; align-items: center; gap: 16px; }
.avatar-lg {
  width: 80px; height: 80px; border-radius: 50%;
  object-fit: cover; border: 2px solid var(--border);
}
.avatar-lg-placeholder {
  width: 80px; height: 80px; border-radius: 50%;
  background: var(--accent-light); border: 2px solid var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 700; color: var(--accent);
}

.file-upload-input {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.file-upload-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg-elevated); color: var(--text-secondary);
  font-size: 13px; font-weight: 500; cursor: pointer;
  transition: all var(--transition);
}
.file-upload-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }
.file-upload-btn:has(.file-upload-input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.file-upload-btn svg { width: 16px; height: 16px; fill: currentColor; flex-shrink: 0; }
.file-upload-filename {
  font-size: 12px; color: var(--text-secondary); margin-top: 6px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow); }
  .main-content { margin-left: 0; }
  .sidebar-toggle { display: flex; }
  .features-grid { grid-template-columns: 1fr 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .hero h1 { font-size: 36px; }
  .page-content { padding: 20px 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 600px) {
  .features-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr; }
  .landing-nav { padding: 16px 20px; }
  .hero { padding: 60px 20px 50px; }
  .auth-card { padding: 28px 20px; }
}

/* ── Timesheet ──────────────────────────────────────────────── */
.ts-project-link { color: var(--accent); text-decoration: none; }
.ts-project-link:hover { text-decoration: underline; }
.ts-nav { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.ts-view-toggle { display: flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; font-size: 13px; font-weight: 500; }
.ts-view-toggle a { padding: 7px 16px; text-decoration: none; background: var(--bg-elevated); color: var(--text-secondary); }
.ts-view-toggle a + a { border-left: 1px solid var(--border); }
.ts-view-toggle a.active { background: var(--accent); color: #fff; }
.ts-period-label { font-size: 15px; font-weight: 600; min-width: 180px; text-align: center; }
.ts-viewall-toggle { margin-left: auto; }

.ts-today { background: var(--accent-light); }
th.ts-today { color: var(--accent); }
th.ts-day-head.ts-editing { color: #000; }

input.cell-input {
  width: 64px; text-align: right; padding: 6px 8px; font-size: 15px;
  border: 1.5px solid var(--text-muted); border-radius: 6px; background: var(--bg-elevated);
}
.row-action-btn {
  background: none; border: 1px solid var(--text-muted); border-radius: 4px;
  cursor: pointer; color: var(--text-muted); padding: 2px;
  display: inline-flex; align-items: center; justify-content: center;
  line-height: 0;
}
.row-action-btn.is-locked { cursor: not-allowed; opacity: 0.35; }

input.ts-quickadd-date { font-size: 15px; padding: 9px 10px; width: 140px; }
select.ts-quickadd-select { font-size: 15px; padding: 9px 10px; width: 100%; }
select.ts-quickadd-tasktype { font-size: 15px; padding: 9px 10px; flex: 0 1 160px; min-width: 80px; }
input.ts-quickadd-desc { font-size: 15px; padding: 9px 10px; flex: 1 1 120px; min-width: 80px; }
input.ts-quickadd-hours { font-size: 18px; font-weight: 700; padding: 9px 8px; width: 72px; text-align: right; }

.ts-quickadd-card { padding: 16px 20px; margin-bottom: 20px; }
.ts-quickadd-label {
  font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-muted); margin-bottom: 12px;
}
.ts-quickadd-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ts-quickadd-row .ts-quickadd-select { flex: 1 1 240px; width: auto; min-width: 180px; }

/* ── Table-style project picker (Kunde/Opgave in two aligned columns) ───────── */
.tbl-select { position: relative; }
.tbl-select-trigger {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; font-size: 15px; padding: 9px 10px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg-card); color: var(--text-primary); text-align: left; cursor: pointer;
}
.tbl-select-trigger:hover { border-color: var(--accent); }
.tbl-select-trigger.disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.tbl-select-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbl-select-label.placeholder { color: var(--text-muted); }
.tbl-select-caret { width: 16px; height: 16px; fill: var(--text-muted); flex-shrink: 0; }
.tbl-select-panel {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 50;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2); max-height: min(60vh, 480px); overflow-y: auto;
}
.tbl-select-head, .tbl-select-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 8px 12px;
}
.tbl-select-head {
  font-size: 11px; text-transform: uppercase; letter-spacing: .5px; font-weight: 700;
  color: var(--text-muted); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--bg-card);
}
.tbl-select-row { cursor: pointer; font-size: 13px; border-bottom: 1px solid var(--border); }
.tbl-select-row:last-child { border-bottom: none; }
.tbl-select-row:hover { background: var(--bg-elevated); }
.tbl-select-row .tbl-select-task { color: var(--text-secondary); }

@media (max-width: 600px) {
  .ts-nav { gap: 8px; }
  /* Week view is a wide grid that doesn't work well on a phone screen — only offer day view here. */
  .ts-week-toggle { display: none; }
  .ts-view-toggle a:only-child { border-radius: 7px; }
  .ts-period-label { min-width: 0; flex: 1 1 auto; order: -1; width: 100%; margin-bottom: 4px; }
  .ts-viewall-toggle { margin-left: 0; width: 100%; text-align: center; }
  input.cell-input { width: 52px; padding: 5px 6px; font-size: 14px; }
  .row-action-btn { padding: 5px; }
  .row-action-btn svg { width: 14px; height: 14px; }
  .ts-quickadd-date, .ts-quickadd-hours { width: 90px; }
  .ts-header-btn { width: 100%; justify-content: center; }

  /* Day-view list: collapse the wide table into compact single-line-height rows —
     customer/project (stacked) on the left, menu + play/stop + hours on the right,
     all vertically centered against each other. */
  .ts-day-list thead { display: none; }
  .ts-day-list, .ts-day-list tbody { display: block; width: 100%; }
  .ts-day-list tbody tr {
    display: grid; width: 100%;
    grid-template-columns: 1fr auto auto;
    grid-template-areas: "customer actions hours" "project actions hours" "desc actions hours";
    column-gap: 10px; row-gap: 1px; align-items: center;
    padding: 10px 4px; border-bottom: 1px solid var(--border);
    -webkit-tap-highlight-color: transparent;
  }
  .ts-day-list td { display: block; border: none !important; padding: 0 !important; text-align: left !important; background: transparent !important; }
  .ts-day-list tbody tr:hover,
  .ts-day-list tbody tr:active,
  .ts-day-list tbody tr:hover td,
  .ts-day-list tbody tr:active td { background: transparent !important; }
  .ts-day-list td.ts-col-user { display: none; }
  .ts-day-list td.ts-col-customer { grid-area: customer; font-size: 12px; color: var(--text-muted); align-self: end; }
  .ts-day-list td.ts-col-project { grid-area: project; font-size: 15px; font-weight: 600; color: var(--text-primary); }
  .ts-day-list td.ts-col-desc:empty { display: none; }
  .ts-day-list td.ts-col-desc { grid-area: desc; font-size: 13px; color: var(--text-secondary); margin-top: 2px; align-self: start; }
  .ts-day-list td.ts-col-hours { grid-area: hours; font-size: 15px; font-weight: 700; text-align: right !important; align-self: center; }
  .ts-day-list td.ts-col-actions { grid-area: actions; align-self: center; }
  .ts-day-list td.ts-col-actions > div { align-items: center; }
  /* Menu (⋮) before the play/stop control, matching the compact mobile layout */
  .ts-day-list td.ts-col-actions .action-menu { order: 1; }
  .ts-day-list td.ts-col-actions > div > form,
  .ts-day-list td.ts-col-actions > div > button.btn-start-timer { order: 2; }
  /* Start/stop controls become icon-only squares on mobile — the elapsed number is
     already shown right next to them in the hours column, so the button doesn't repeat it. */
  .ts-day-list .btn-start-timer,
  .ts-day-list .ts-row-stop-btn { width: 36px !important; height: 36px !important; padding: 0 !important; }
  .ts-day-list .btn-start-timer-label,
  .ts-day-list .ts-row-stop-btn-label { display: none; }
  /* Rows that don't follow the entry grid (empty state, totals) opt out */
  .ts-day-list tbody tr:has(> td[colspan]) { display: block; }
  .ts-day-list tbody tr:has(> td[colspan]) > td { width: 100%; }
}

/* ── Utilities ──────────────────────────────────────────────── */
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); font-size: 13px; }
.text-sm { font-size: 13px; }
.font-mono { font-family: inherit; }
.flex { display: flex; } .items-center { align-items: center; } .justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; }
.w-full { width: 100%; }
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* ── Date-picker calendar ───────────────────────────────────── */
.datepicker-wrap { position: relative; display: flex; gap: 8px; align-items: center; }
.datepicker-wrap input[type="text"] { flex: 1; cursor: pointer; }
.datepicker-clear { background: none; border: none; color: var(--text-muted); font-size: 18px; line-height: 1; padding: 0 4px; cursor: pointer; }
.datepicker-clear:hover { color: var(--danger); }
.cal-popup {
  position: fixed; z-index: 2000;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
  padding: 16px; width: 280px;
  animation: modalIn 0.15s ease;
}
.cal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cal-nav { background: none; border: none; color: var(--text-secondary); font-size: 18px; padding: 4px 8px; cursor: pointer; border-radius: var(--radius); }
.cal-nav:hover { background: var(--bg-elevated); color: var(--text-primary); }
.cal-month-label { font-weight: 600; font-size: 14px; color: var(--text-primary); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-day-name { text-align: center; font-size: 11px; font-weight: 600; color: var(--text-muted); padding: 4px 0 6px; text-transform: uppercase; }
.cal-day {
  text-align: center; font-size: 13px; padding: 6px 2px;
  border-radius: 6px; cursor: pointer; color: var(--text-secondary);
  border: none; background: none;
}
.cal-day:hover { background: var(--bg-elevated); color: var(--text-primary); }
.cal-day.today { color: var(--accent); font-weight: 700; }
.cal-day.selected { background: var(--accent); color: #fff; font-weight: 600; }
.cal-day.other-month { color: var(--text-muted); opacity: 0.4; }
.cal-day.empty { cursor: default; }

/* ── Wall / project activity ────────────────────────────────── */
.wall-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
.wall-main { min-width: 0; }
.wall-sidebar { position: sticky; top: 24px; display: flex; flex-direction: column; gap: 24px; }

.wall-composer { padding: 24px; margin-bottom: 24px; }
.wall-composer-form { display: flex; gap: 16px; align-items: flex-start; }
.wall-composer-body { flex: 1; min-width: 0; }
.wall-composer-label {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--text-primary); margin-bottom: 8px;
}
.wall-composer-input {
  width: 100%; min-height: 88px; resize: vertical;
  padding: 16px; font-size: 15px; line-height: 1.6;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg-base); color: var(--text-primary);
  transition: border-color .15s, box-shadow .15s;
}
.wall-composer-input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}
.wall-composer-actions {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 12px; margin-top: 12px;
}

.wall-activity-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; padding: 0 4px;
}
.wall-activity-header h2 {
  font-size: 16px; font-weight: 700; color: var(--text-primary); margin: 0;
}
.wall-activity-count { font-size: 13px; color: var(--text-muted); }

.wall-feed { display: flex; flex-direction: column; gap: 0; }
.wall-item {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 0 16px;
  padding: 0 0 24px;
}
.wall-item-rail { display: flex; flex-direction: column; align-items: center; }
.wall-item-line {
  flex: 1; width: 2px; min-height: 24px; margin-top: 8px;
  background: var(--border); border-radius: 1px;
}
.wall-item-content { min-width: 0; }
.wall-item-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; margin-bottom: 10px;
}
.wall-item-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-muted);
}
.wall-item-meta strong { font-size: 14px; color: var(--text-primary); font-weight: 600; }
.wall-item-meta time { color: var(--text-muted); }
.wall-item-badge {
  display: inline-block; padding: 2px 8px; border-radius: 4px;
  font-size: 11px; font-weight: 600; letter-spacing: .02em;
  background: var(--accent-light); color: var(--accent);
}
.wall-item-menu {
  background: none; border: none; padding: 4px; border-radius: 6px;
  color: var(--text-muted); cursor: pointer; line-height: 0;
}
.wall-item-menu:hover { background: var(--bg-elevated); color: var(--text-primary); }
.wall-item-menu svg { width: 18px; height: 18px; fill: currentColor; }
.wall-item-body {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 10px; padding: 16px;
  font-size: 15px; line-height: 1.75; color: var(--text-secondary);
  white-space: pre-wrap; word-break: break-word;
}
.wall-item-edit {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 10px; padding: 16px;
}
.wall-item-edit textarea {
  width: 100%; min-height: 120px; resize: vertical;
  padding: 0; font-size: 15px; line-height: 1.75;
  border: none; border-radius: 0;
  background: transparent; color: var(--text-primary);
  margin-bottom: 12px;
}
.wall-item-edit textarea:focus { outline: none; }
.wall-item-edit-actions { display: flex; gap: 8px; justify-content: flex-end; }

.wall-empty {
  text-align: center; padding: 56px 32px;
}
.wall-empty-icon {
  width: 64px; height: 64px; margin: 0 auto 20px;
  border-radius: 16px; background: var(--bg-elevated);
  display: flex; align-items: center; justify-content: center;
}
.wall-empty-icon svg { width: 32px; height: 32px; fill: var(--text-muted); opacity: .5; }
.wall-empty h3 { font-size: 18px; font-weight: 600; color: var(--text-primary); margin: 0 0 8px; }
.wall-empty p { font-size: 14px; color: var(--text-muted); margin: 0; max-width: 360px; margin-inline: auto; line-height: 1.6; }

.wall-todo-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.wall-todo-header .wall-sidebar-title { margin: 0; }
.wall-todo-form { display: flex; gap: 8px; margin-bottom: 14px; }
.wall-todo-form input[type="text"] {
  flex: 1 1 auto; min-width: 0; font-size: 13px; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 6px; background: var(--bg-elevated);
  color: var(--text-primary);
}
.wall-time-form, .wall-expense-form { display: grid; grid-template-columns: 1fr; gap: 8px; margin-bottom: 14px; }
.wall-time-form input, .wall-time-form select, .wall-expense-form input {
  font-size: 13px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--bg-elevated); color: var(--text-primary); width: 100%;
}
.wall-expense-form-row { display: flex; gap: 8px; align-items: stretch; }
.wall-expense-form-row .wall-expense-amount-wrap { flex: 1 1 auto; }
.wall-expense-form-row .btn { flex: 0 0 auto; }
.wall-time-hours-wrap { display: flex; align-items: center; gap: 8px; }
.wall-time-hours-wrap #wallTimeHoursInput { width: 64px; flex: 0 0 auto; }
.wall-time-input-unit { font-size: 13px; color: var(--text-muted); white-space: nowrap; }
.wall-time-form button { justify-self: start; }
.wall-time-today-label {
  font-size: 12px; font-weight: 600; color: var(--text-muted);
  margin: 0 0 8px;
}
.wall-time-list { margin-top: 0; }
.wall-expense-amount-wrap {
  display: flex; align-items: center;
  border: 1px solid var(--border); border-radius: 6px; background: var(--bg-elevated);
  overflow: hidden;
}
.wall-expense-amount-wrap input[type="text"] {
  width: 100%; border: none !important; background: none !important; text-align: right;
}
.wall-expense-currency {
  font-size: 12px; font-weight: 600; color: var(--text-muted); padding: 0 10px 0 2px; white-space: nowrap;
}
.wall-todo-empty { font-size: 13px; color: var(--text-muted); margin: 0; }
.wall-expense-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.wall-expense-meta { font-size: 12px; color: var(--text-muted); }
.wall-expense-amount { font-size: 13px; font-weight: 600; white-space: nowrap; }
.wall-todo-text-wrap { white-space: normal; }
.wall-todo-list { list-style: none; margin: 0; padding: 0; }
.wall-todo-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 0;
  border-bottom: 1px solid var(--border);
}
.wall-todo-item:last-child { border-bottom: none; }
.wall-todo-toggle-form, .wall-todo-delete-form { margin: 0; display: flex; }
.wall-todo-edit-form { margin: 0; flex: 1 1 auto; min-width: 0; }
.wall-todo-item .font-mono { margin-left: auto; padding-left: 10px; }
.wall-invoice-link { flex: 1 1 auto; min-width: 0; text-decoration: none; color: inherit; }
.wall-invoice-link:hover .wall-todo-text { text-decoration: underline; }
.wall-todo-item .badge { flex-shrink: 0; min-width: 72px; justify-content: center; }
.wall-todo-text {
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 6px; margin: -2px -6px; border-radius: 4px;
  flex-wrap: wrap; min-width: 0;
}
.wall-todo-text::after {
  content: ""; width: 13px; height: 13px; flex-shrink: 0;
  background: currentColor;
  -webkit-mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a1 1 0 0 0-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z"/></svg>') center / contain no-repeat;
  mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a1 1 0 0 0-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z"/></svg>') center / contain no-repeat;
  color: var(--text-muted); opacity: 0; transition: opacity .15s;
}
.wall-todo-text:hover { background: var(--bg-elevated); }
.wall-todo-text:hover::after { opacity: 1; }
.wall-todo-edit-input {
  width: 100%; font-size: 14px; font-family: inherit; color: var(--text-primary);
  background: var(--bg-elevated); border: 1px solid var(--accent); border-radius: 4px;
  padding: 2px 6px; margin: -3px -6px;
}
.wall-todo-check {
  width: 20px; height: 20px; flex-shrink: 0; border-radius: 5px;
  border: 1.5px solid var(--border); background: var(--bg-elevated);
  display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0;
}
.wall-todo-check svg { width: 14px; height: 14px; fill: #fff; }
.wall-todo-done .wall-todo-check { background: var(--success); border-color: var(--success); }
.wall-todo-text { flex: 1 1 auto; font-size: 14px; color: var(--text-primary); word-break: break-word; }
.wall-todo-done .wall-todo-text { color: var(--text-muted); text-decoration: line-through; }
.wall-todo-delete {
  width: 22px; height: 22px; flex-shrink: 0; border: none; background: transparent;
  color: var(--text-muted); cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0;
  opacity: 0; transition: opacity .15s;
}
.wall-todo-delete svg { width: 16px; height: 16px; fill: currentColor; }
.wall-todo-item:hover .wall-todo-delete { opacity: 1; }
.wall-todo-delete:hover { color: var(--danger); }
.wall-time-entry-link:hover .wall-todo-text { text-decoration: underline; }
.wall-todo-project-link {
  display: block; flex: 1 0 100%; font-size: 11px; color: var(--text-muted); text-decoration: none; margin-top: 1px;
}
.wall-todo-project-link:hover { color: var(--accent); }
.wall-todo-more { font-size: 12px; color: var(--text-muted); margin: 10px 0 0; text-align: center; }
.wall-todo-done-divider {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-muted); margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border);
}

.wall-sidebar-card { padding: 20px 22px; }
.wall-sidebar-title {
  font-size: 13px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--text-muted); margin: 0 0 16px;
}
.wall-details { margin: 0; }
.wall-detail-row {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.wall-detail-row:last-of-type { border-bottom: none; }
.wall-detail-row dt { color: var(--text-muted); font-weight: 500; margin: 0; flex-shrink: 0; }
.wall-detail-row dd { margin: 0; text-align: right; color: var(--text-primary); font-weight: 500; }
.wall-deadline-overdue { color: var(--danger); }
.wall-deadline-soon { color: var(--warning); }
.wall-deadline-tag {
  display: inline-block; margin-left: 6px; padding: 1px 7px;
  border-radius: 4px; font-size: 11px; font-weight: 600;
  background: var(--bg-elevated); color: var(--text-muted);
}
.wall-deadline-overdue .wall-deadline-tag { background: var(--danger-bg); color: var(--danger); }
.wall-deadline-soon .wall-deadline-tag { background: var(--warning-bg); color: var(--warning); }
.wall-sidebar-desc {
  margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border);
}
.wall-sidebar-desc h4 {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--text-muted); margin: 0 0 10px;
}
.wall-sidebar-desc p {
  font-size: 14px; line-height: 1.65; color: var(--text-secondary); margin: 0;
}

.wall-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  overflow: hidden; flex-shrink: 0;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
}
.wall-avatar-lg { width: 44px; height: 44px; }
.wall-avatar img { width: 100%; height: 100%; object-fit: cover; }
.wall-avatar span { color: #fff; font-size: 13px; font-weight: 700; }
.wall-avatar-lg span { font-size: 15px; }

@media (max-width: 960px) {
  .wall-layout { grid-template-columns: 1fr; }
  .wall-sidebar { position: static; order: -1; }
}

/* ── Invoice paper (mobile) ─────────────────────────────────── */
/* ── Topbar (mobile) ────────────────────────────────────────── */
@media (max-width: 600px) {
  .topbar { padding: 0 12px; gap: 8px; }
  .topbar-date { display: none; }
  .timer-widget { padding: 5px 10px; gap: 6px; font-size: 12px; max-width: 100%; min-width: 0; }
  .timer-project { max-width: 90px; }
  .btn-timer-stop { padding: 3px 8px; flex-shrink: 0; }
}

@media (max-width: 900px) {
  .topbar-brand { display: flex; }
  .topbar-mobile-user, .topbar-mobile-logout { display: flex; }
}

.invoice-nr-badge { margin-top: 4px; }
.invoice-nr-badge .badge { font-size: 11px; padding: 2px 8px; }

@media (max-width: 600px) {
  .table-compact-mobile th, .table-compact-mobile td { padding: 10px 10px; font-size: 13px; }
  .table-compact-mobile td:first-child, .table-compact-mobile th:first-child { white-space: nowrap; }
  .table-compact-mobile td:nth-child(2), .table-compact-mobile th:nth-child(2) {
    max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .table-compact-mobile td.font-mono { white-space: nowrap; }
  .table-compact-mobile .badge { padding: 2px 8px; font-size: 11px; }
}

/* ── Invoice paper preview (invoices/view.php) ─────────────────
   Always white/light regardless of theme — it's a facsimile of the sent PDF.
   .invoice-paper h1's color is set inline per-invoice (company brand color). */
.invoice-paper {
    background: #fff;
    color: #1a202c;
    max-width: 760px;
    margin: 0;
    border-radius: 4px;
    box-shadow: 0 4px 32px rgba(0,0,0,0.35);
    padding: 56px 64px;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    line-height: 1.6;
}
.invoice-paper h1 { font-size: 40px; font-weight: 900; letter-spacing: -1px; margin: 0; }
.invoice-paper .inv-number { font-size: 15px; font-weight: 700; color: #1a202c; margin-top: 4px; }
.paper-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 44px; }
.paper-addresses { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; margin-bottom: 36px; }
.paper-label { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: #94a3b8; font-weight: 700; margin-bottom: 6px; }
.paper-addresses strong { font-size: 15px; display: block; margin-bottom: 4px; }
.paper-addresses p { font-size: 13px; color: #4a5568; line-height: 1.3; margin: 0; }
.paper-meta { display: flex; gap: 32px; background: #f8fafc; border-radius: 8px; padding: 16px 20px; margin-bottom: 32px; }
.paper-meta div .paper-label { margin-bottom: 3px; }
.paper-meta div strong { font-size: 13px; color: #1a202c; }
.paper-table { width: 100%; border-collapse: collapse; margin-bottom: 20px; }
.paper-table thead th { background: #f7f8ff; color: #94a3b8; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; padding: 10px 2px; text-align: left; border-bottom: 2px solid #e2e8f0; }
.paper-table thead th:not(:first-child) { text-align: right; }
.paper-table tbody td { padding: 10px 2px; border-bottom: 1px solid #e2e8f0; color: #1a202c; font-size: 13px; }
.paper-table tbody td:not(:first-child) { text-align: right; color: #4a5568; }
.paper-table tbody tr:hover td { background: transparent; }
.paper-totals { display: flex; justify-content: flex-end; margin-bottom: 28px; }
.paper-totals-inner { min-width: 260px; }
.paper-totals-inner .trow { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid #e2e8f0; font-size: 13px; color: #4a5568; }
.paper-totals-inner .trow span:last-child { padding-right: 2px; }
.paper-grand { display: flex; justify-content: space-between; padding: 12px 0; font-size: 18px; font-weight: 700; color: #1a202c; }
.paper-grand span:last-child { color: #1a202c; padding-right: 2px; }
.paper-divider { border: none; border-top: 2px solid #e2e8f0; margin: 20px 0; }
.paper-notes { font-size: 13px; color: #4a5568; line-height: 1.8; white-space: pre-wrap; }

@media (max-width: 600px) {
  .invoice-paper { padding: 24px 20px; }
  .invoice-paper h1 { font-size: 28px; }
  .paper-header { flex-wrap: wrap; gap: 16px; margin-bottom: 28px; }
  .paper-addresses { grid-template-columns: 1fr; gap: 20px; margin-bottom: 24px; }
  .paper-meta { flex-wrap: wrap; gap: 16px; padding: 14px 16px; margin-bottom: 24px; }
  .paper-totals-inner { min-width: 0; width: 100%; }
}

/* ── Guide page ─────────────────────────────────────────────── */
.guide-wrap { max-width: 720px; }
.guide-toc {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px;
}
.guide-toc a {
  font-size: 13px; font-weight: 500; padding: 7px 14px; border-radius: 999px;
  background: var(--bg-elevated); border: 1px solid var(--border); color: var(--text-secondary);
}
.guide-toc a:hover { border-color: var(--accent); color: var(--accent); }
.guide-section { margin-bottom: 28px; padding: 24px 28px; scroll-margin-top: calc(var(--topbar-h) + 20px); }
.guide-section h2 {
  font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 10px;
  margin-bottom: 16px; color: var(--text-primary);
}
.guide-section h4 { color: var(--text-primary); font-size: 14px; margin: 16px 0 4px; }
.guide-section h4:first-of-type { margin-top: 0; }
.guide-section p, .guide-section li { color: var(--text-secondary); font-size: 14px; line-height: 1.7; }
.guide-section ul { padding-left: 20px; margin: 4px 0; }
.guide-section code { background: var(--bg-elevated); padding: 1px 6px; border-radius: 4px; font-size: 12px; }
