/* ── Clockt — Design system ────────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;450;500;600;700&family=Red+Hat+Display:wght@500;600;700;800;900&display=swap');

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

:root {
  /* Font stacks
     Inter: body text, UI labels, buttons — clean, neutral, legible at small sizes
     Red Hat Display: page titles, large headings — geometric, distinctive
     SF Mono / ui-monospace: time values, invoice numbers, code */
  --font:      'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-disp: 'Red Hat Display', 'Inter', -apple-system, sans-serif;
  --font-mono: 'SF Mono', ui-monospace, 'Cascadia Code', 'Fira Code',
               'Menlo', monospace;

  /* Type scale */
  --text-xs:   11px;
  --text-sm:   13px;
  --text-base: 15px;
  --text-md:   17px;
  --text-lg:   20px;
  --text-xl:   24px;
  --text-2xl:  28px;
  --text-3xl:  34px;

  /* Surfaces */
  --bg:           #F5F5F2;
  --surface:      #FFFFFF;
  --surface-2:    #F5F5F2;
  --sidebar-bg:   rgba(245, 245, 242, 0.92);

  /* Text */
  --text-primary:   #1D1D1F;
  --text-secondary: #6E6E73;
  --text-tertiary:  #AEAEB2;

  /* Borders */
  --border:       rgba(0, 0, 0, 0.07);
  --border-med:   rgba(0, 0, 0, 0.12);

  /* Aliases */
  --text-muted:   #6E6E73;   /* same as --text-secondary, used in inline styles */

  /* Accent / semantic */
  --brand:        #0F6E56;
  --brand-light:  rgba(15, 110, 86, 0.1);
  --green:        #34C759;
  --green-light:  #E8F8ED;
  --orange:       #FF9500;
  --orange-light: #FFF3E0;
  --red:          #E24B4A;
  --red-light:    #FFF0F0;
  --purple:       #AF52DE;
  --purple-light: #F5EEFB;

  /* Layout */
  --sidebar-w:    220px;
  --radius-sm:    8px;
  --radius-md:    12px;
  --radius-lg:    16px;

  /* Shadows */
  --shadow-sm:    0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:    0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
}

/* Dark token set — applied by system preference OR explicit [data-theme="dark"] */
.dark-tokens {
  --bg:           #0E1116;
  --surface:      #161B22;
  --surface-2:    #1E2530;
  --sidebar-bg:   rgba(14, 17, 22, 0.92);
  --text-primary:   #F5F5F2;
  --text-secondary: #AEAEB2;
  --text-tertiary:  #636366;
  --text-muted:     #AEAEB2;
  --border:       rgba(255, 255, 255, 0.08);
  --border-med:   rgba(255, 255, 255, 0.14);
  --brand:        #1D9E75;
  --brand-light:  rgba(29, 158, 117, 0.15);
  --green-light:  rgba(52, 199, 89, 0.15);
  --orange-light: rgba(255, 149, 0, 0.15);
  --red-light:    rgba(228, 75, 74, 0.15);
  --purple-light: rgba(175, 82, 222, 0.15);
}

/* System dark mode (only when no explicit data-theme override is set) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:           #0E1116;
    --surface:      #161B22;
    --surface-2:    #1E2530;
    --sidebar-bg:   rgba(14, 17, 22, 0.92);
    --text-primary:   #F5F5F2;
    --text-secondary: #AEAEB2;
    --text-tertiary:  #636366;
    --text-muted:     #AEAEB2;
    --border:       rgba(255, 255, 255, 0.08);
    --border-med:   rgba(255, 255, 255, 0.14);
    --brand:        #1D9E75;
    --brand-light:  rgba(29, 158, 117, 0.15);
    --green-light:  rgba(52, 199, 89, 0.15);
    --orange-light: rgba(255, 149, 0, 0.15);
    --red-light:    rgba(228, 75, 74, 0.15);
    --purple-light: rgba(175, 82, 222, 0.15);
  }
}

/* Explicit dark override — beats system preference */
[data-theme="dark"] {
  --bg:           #0E1116;
  --surface:      #161B22;
  --surface-2:    #1E2530;
  --sidebar-bg:   rgba(14, 17, 22, 0.92);
  --text-primary:   #F5F5F2;
  --text-secondary: #AEAEB2;
  --text-tertiary:  #636366;
  --text-muted:     #AEAEB2;
  --border:       rgba(255, 255, 255, 0.08);
  --border-med:   rgba(255, 255, 255, 0.14);
  --brand:        #1D9E75;
  --brand-light:  rgba(29, 158, 117, 0.15);
  --green-light:  rgba(52, 199, 89, 0.15);
  --orange-light: rgba(255, 149, 0, 0.15);
  --red-light:    rgba(228, 75, 74, 0.15);
  --purple-light: rgba(175, 82, 222, 0.15);
}

/* Explicit light override — beats system preference */
[data-theme="light"] {
  --bg:           #F5F5F2;
  --surface:      #FFFFFF;
  --surface-2:    #F5F5F2;
  --sidebar-bg:   rgba(245, 245, 242, 0.92);
  --text-primary:   #1D1D1F;
  --text-secondary: #6E6E73;
  --text-tertiary:  #AEAEB2;
  --text-muted:     #6E6E73;
  --border:       rgba(0, 0, 0, 0.07);
  --border-med:   rgba(0, 0, 0, 0.12);
  --brand:        #0F6E56;
  --brand-light:  rgba(15, 110, 86, 0.1);
  --green-light:  #E8F8ED;
  --orange-light: #FFF3E0;
  --red-light:    #FFF0F0;
  --purple-light: #F5EEFB;
}

/* ── Theme picker component ──────────────────────────────────────────────── */
.theme-picker {
  display: inline-flex;
  border: 1px solid var(--border-med);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.theme-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  font-size: var(--text-sm); font-weight: 500;
  color: var(--text-secondary);
  background: var(--surface);
  border: none; cursor: pointer;
  transition: background 0.15s, color 0.15s;
  border-right: 1px solid var(--border-med);
}

.theme-btn:last-child { border-right: none; }

.theme-btn:hover { background: var(--surface-2); color: var(--text-primary); }

.theme-btn.active {
  background: var(--brand-light);
  color: var(--brand);
  font-weight: 600;
}

.theme-btn svg { width: 14px; height: 14px; flex-shrink: 0; }

html, body {
  height: 100%;
  font-family: var(--font);
  font-size: var(--text-base);
  line-height: 1.47059;           /* SF Pro's native line height at 17px equivalent */
  color: var(--text-primary);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  /* Inter feature flags: kern, ligatures, contextual alts, open digits */
  font-feature-settings: "kern" 1, "liga" 1, "calt" 1, "cv05" 1, "cv11" 1;
}

/* Numbers in tables / data displays render at equal width */
.tabular-nums,
.data-table td,
.data-table th {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* ── App shell ───────────────────────────────────────────────────────────── */

.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 0.5px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100vh;
}

.sidebar-header {
  padding: 20px 16px 12px;
  border-bottom: 0.5px solid var(--border);
}

.wordmark {
  display: block;
  color: var(--text-primary);
  line-height: 0;
}

.wordmark svg {
  width: 120px;
  height: auto;
}

.nav-list {
  list-style: none;
  padding: 8px 8px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: -0.008em;
  transition: background 0.15s, color 0.15s;
}

.nav-link:hover {
  background: var(--border);
  color: var(--text-primary);
}

.nav-item.active .nav-link {
  background: var(--brand-light);
  color: var(--brand);
}

.nav-link--muted { color: var(--text-tertiary); }

.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.sidebar-footer {
  margin-top: auto;
  border-top: 0.5px solid var(--border);
  padding: 8px;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-sm);
  margin-top: 4px;
}

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.user-avatar--img {
  object-fit: cover;
  background: var(--surface-2);
}

.user-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-email {
  font-size: 11px;
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Main content ────────────────────────────────────────────────────────── */

.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 32px 40px;
}

/* ── Page header ─────────────────────────────────────────────────────────── */

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.page-title {
  font-family: var(--font-disp);
  font-size: var(--text-2xl);
  font-weight: 800;
  letter-spacing: -0.03em;     /* Red Hat Display sits wide — pull it in */
  color: var(--text-primary);
  line-height: 1.1;
}

.page-subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: 3px;
  letter-spacing: -0.01em;
}

/* ── Cards ───────────────────────────────────────────────────────────────── */

.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 0.5px solid var(--border);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
}

/* ── Section headings ────────────────────────────────────────────────────── */

/* Card-level section titles (Workspace, Line items, Invoice details, etc.) */
.section-title {
  font-family: var(--font-disp);
  font-size: var(--text-md);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 20px;
}

/* ── Today card (dashboard live view) ───────────────────────────────────── */

.today-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 0.5px solid var(--border);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
  border-left: 3px solid var(--brand);
}

.today-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 16px;
}

.today-title {
  font-family: var(--font-disp);
  font-size: var(--text-md);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.today-meta {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  letter-spacing: 0.01em;
}

.today-grid {
  display: flex;
  align-items: flex-start;
  gap: 32px;
  flex-wrap: wrap;
}

.today-metric {
  min-width: 80px;
}

.today-value {
  font-family: var(--font-disp);
  font-size: var(--text-2xl);
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text-primary);
  line-height: 1;
}

.today-value--green { color: var(--brand); }

.today-label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  margin-top: 4px;
}

.today-apps {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-left: 1px solid var(--border);
  padding-left: 24px;
  min-width: 200px;
}

.today-app-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: var(--text-sm);
}

.today-app-name {
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.today-app-mins {
  font-family: var(--font-mono);
  font-size: 0.9em;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.today-note {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-top: 14px;
  letter-spacing: 0.01em;
}

.today-empty {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  padding: 8px 0;
}

/* ── Tab bar ─────────────────────────────────────────────────────────────── */

.tab-bar {
  display: flex;
  gap: 2px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}

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

.tab--active {
  color: var(--brand);
  border-bottom-color: var(--brand);
}

.tab-count,
.tab-badge {
  font-size: 11px;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--text-secondary);
  padding: 1px 6px;
  border-radius: 20px;
}

.tab-badge--green {
  background: var(--green-light);
  color: var(--green);
}

/* ── Metric cards ────────────────────────────────────────────────────────── */

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}

.metric-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 0.5px solid var(--border);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}

.metric-label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  margin-bottom: 6px;
}

.metric-value {
  font-family: var(--font-disp);
  font-size: var(--text-3xl);
  font-weight: 800;
  letter-spacing: -0.04em;       /* Red Hat Display at large size — tight */
  color: var(--text-primary);
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.metric-sub {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  letter-spacing: -0.005em;
  margin-top: 5px;
}

.metric-card--alert .metric-value { color: var(--orange); }
.metric-card--money .metric-value { color: var(--green); }

a.metric-card {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: transform 0.12s, box-shadow 0.12s;
}
a.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* ── Keyboard shortcut overlay ───────────────────────────────────────────── */
.kbd-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.kbd-overlay.hidden { display: none; }
.kbd-modal {
  background: var(--surface);
  border: 1px solid var(--border-med);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  min-width: 320px;
  box-shadow: var(--shadow-lg);
}
.kbd-modal h3 {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 16px;
  color: var(--text-primary);
}
.kbd-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-secondary);
}
.kbd-row:last-child { border-bottom: none; }
kbd {
  display: inline-block;
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  font-weight: 600;
  background: var(--surface-2);
  border: 1px solid var(--border-med);
  border-radius: 4px;
  padding: 2px 7px;
  color: var(--text-primary);
  box-shadow: 0 1px 0 var(--border-med);
}

/* ── Time entry list ─────────────────────────────────────────────────────── */

.entry-list { display: flex; flex-direction: column; gap: 8px; }

.entry-row {
  background: var(--surface);
  border-radius: var(--radius-md);
  border: 0.5px solid var(--border);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s;
}

.entry-row:hover { box-shadow: var(--shadow-md); }

.entry-row--pending,
.entry-row--pending_review {
  border-left: 3px solid var(--orange);
  background: var(--orange-light);
}

.entry-row--approved .entry-desc  { color: var(--text-secondary); }
.entry-row--approved .entry-meta  { color: var(--text-tertiary); }
.entry-row--invoiced .entry-desc  { color: var(--text-tertiary); }
.entry-row--invoiced .entry-meta  { color: var(--text-tertiary); }

.entry-source {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.entry-source--manual        { background: var(--brand); }
.entry-source--activitywatch { background: var(--purple); }
.entry-source--ai            { background: var(--purple); }
.entry-source--outlook       { background: var(--orange); }
.entry-source--quo           { background: var(--green); }

.entry-desc {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.entry-client,
.entry-meta {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.entry-duration {
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  min-width: 52px;
  text-align: right;
}

.entry-amount {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  min-width: 68px;
  text-align: right;
}

/* ── Badges ──────────────────────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.badge--pending   { background: var(--orange-light); color: var(--orange); }
.badge--approved  { background: var(--green-light);  color: var(--green); }
.badge--ai        { background: var(--purple-light); color: var(--purple); }

/* Invoice status badges */
.badge--draft     { background: var(--surface-2);    color: var(--text-secondary); }
.badge--sent      { background: var(--brand-light);  color: var(--brand); }
.badge--paid      { background: var(--green-light);  color: var(--green); }
.badge--invoiced  { background: var(--brand-light);  color: var(--brand); }
.badge--void      { background: var(--red-light);    color: var(--red); opacity: .7; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: -0.008em;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: opacity 0.15s, transform 0.1s;
}

.btn:active { transform: scale(0.98); }

.btn--primary {
  background: var(--brand);
  color: #fff;
}

.btn--primary:hover { opacity: 0.88; }

.btn--secondary {
  background: var(--surface-2);
  color: var(--text-primary);
  border: 0.5px solid var(--border-med);
}

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

.btn--danger {
  background: var(--red-light);
  color: var(--red);
}

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

/* ── Forms ───────────────────────────────────────────────────────────────── */

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

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

label {
  display: block;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  border: 0.5px solid var(--border-med);
  background: var(--surface);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(15, 110, 86, 0.15);
}

/* ── Data table ──────────────────────────────────────────────────────────── */

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.data-table th {
  padding: 10px 16px;
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
  line-height: 1.4;
}

.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--surface-2); }

/* ── Detail rows (invoice view, settings) ────────────────────────────────── */

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}

.detail-row:last-child { border-bottom: none; }
.detail-row > span:first-child { color: var(--text-secondary); }

/* ── Empty states ────────────────────────────────────────────────────────── */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 60px 24px;
  text-align: center;
}

.empty-icon {
  width: 48px;
  height: 48px;
  color: var(--text-secondary);
  opacity: .5;
  margin-bottom: 16px;
}

.empty-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
}

.empty-body {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  letter-spacing: -0.008em;
  line-height: 1.5;
  max-width: 320px;
}

/* ── Flash messages ──────────────────────────────────────────────────────── */

.flash-stack {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.flash {
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: -0.008em;
  box-shadow: var(--shadow-md);
  max-width: 360px;
}

.flash--error   { background: var(--red-light);    color: var(--red); }
.flash--success { background: var(--green-light);  color: var(--green); }
.flash--info    { background: var(--brand-light);   color: var(--brand); }

/* ── Auth pages ──────────────────────────────────────────────────────────── */

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

.auth-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 0.5px solid var(--border);
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-md);
}

.auth-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 28px;
}

/* ── REC dot animation ───────────────────────────────────────────────────── */

@keyframes rec-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* ── Mono / time display ─────────────────────────────────────────────────── */

/* Use SF Mono for time durations, invoice numbers, and any numeric readout */
.mono,
code,
.invoice-number,
.duration-display {
  font-family: var(--font-mono);
  font-size: 0.93em;             /* mono fonts read large — scale down slightly */
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

/* ── Utility ─────────────────────────────────────────────────────────────── */

.text-muted    { color: var(--text-secondary); }
.text-sm       { font-size: var(--text-sm); }
.text-xs       { font-size: var(--text-xs); }
.mt-1          { margin-top: 8px; }
.mt-2          { margin-top: 16px; }
.mt-3          { margin-top: 24px; }
.flex          { display: flex; }
.items-center  { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2         { gap: 8px; }
.w-full        { width: 100%; }

/* ── Empty state alias ───────────────────────────────────────────────────── */
.empty-sub { font-size: var(--text-sm); color: var(--text-secondary); margin-top: 4px; }

/* ── Sidebar nav badge ───────────────────────────────────────────────────── */

.nav-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  background: var(--orange);
  color: #fff;
  padding: 1px 6px;
  border-radius: 20px;
  line-height: 1.6;
}

/* ── Sidebar nav sub-links (List / Calendar / Timesheet) ────────────────── */

.nav-sub {
  display: flex;
  gap: 2px;
  padding: 4px 12px 6px 40px;
}
.nav-sub-link {
  font-size: 12px;
  color: var(--text-tertiary);
  text-decoration: none;
  padding: 2px 8px;
  border-radius: 100px;
  transition: background 0.12s, color 0.12s;
}
.nav-sub-link:hover { color: var(--text-primary); background: var(--surface-2); }
.nav-sub-link.active { color: var(--brand); font-weight: 600; }

/* ── Metric value color variant ──────────────────────────────────────────── */

.metric-value--green { color: var(--brand); }

/* ── Confidence pill ─────────────────────────────────────────────────────── */

.confidence-pill {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 20px;
}

.confidence-pill--high { background: var(--green-light);  color: var(--green); }
.confidence-pill--med  { background: var(--orange-light); color: var(--orange); }
.confidence-pill--low  { background: var(--red-light);    color: var(--red); }

/* ── Filter bar ──────────────────────────────────────────────────────────── */

.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 0;
}

.filter-bar--active {
  background: var(--brand-light);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 4px;
}

.filter-select,
.filter-input {
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 0.5px solid var(--border-med);
  background: var(--surface);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 13px;
  outline: none;
  width: auto;
}

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

.filter-check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  text-transform: none;
  font-weight: 400;
  letter-spacing: normal;
  margin-bottom: 0;
}

.filter-check input[type="checkbox"] {
  width: auto;
  padding: 0;
  border: none;
  cursor: pointer;
  accent-color: var(--brand);
}

.filter-clear {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-tertiary);
  text-decoration: none;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  border: 0.5px solid var(--border-med);
}

.filter-clear:hover { color: var(--red); border-color: var(--red); }

/* ── Bulk select bar (top of list) ───────────────────────────────────────── */

.bulk-select-bar {
  display: flex;
  align-items: center;
  padding: 8px 4px 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}

/* ── Bulk action floating bar (bottom, shows when items checked) ──────────── */

.bulk-action-bar {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 0.5px solid var(--border-med);
  border-radius: var(--radius-lg);
  padding: 12px 20px;
  box-shadow: var(--shadow-md), 0 8px 32px rgba(0,0,0,0.12);
  z-index: 100;
  animation: slideUp 0.18s ease;
}

@keyframes slideUp {
  from { transform: translateX(-50%) translateY(20px); opacity: 0; }
  to   { transform: translateX(-50%) translateY(0);    opacity: 1; }
}

.bulk-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

/* ── Calendar view ───────────────────────────────────────────────────────── */

.cal-header {
  display: grid;
  grid-template-columns: 56px repeat(7, 1fr);
  border-bottom: 1px solid var(--border);
}

.cal-gutter {
  border-right: 1px solid var(--border);
  position: relative;
}

.cal-day-header {
  padding: 12px 8px;
  text-align: center;
  border-left: 1px solid var(--border);
}

.cal-day-header--today { background: var(--brand-light); }

.cal-day-name {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
}

.cal-day-num {
  display: inline-block;
  font-size: 20px;
  font-weight: 700;
  font-family: var(--font-disp);
  color: var(--text-primary);
  margin-top: 2px;
  width: 36px;
  height: 36px;
  line-height: 36px;
  border-radius: 50%;
  text-align: center;
}

.cal-day-num--today {
  background: var(--brand);
  color: #fff;
}

.cal-body {
  display: grid;
  grid-template-columns: 56px repeat(7, 1fr);
  height: 900px;  /* 15 hours * 60px */
  overflow-y: auto;
  position: relative;
}

.cal-hour-label {
  position: absolute;
  right: 8px;
  font-size: 10px;
  font-weight: 500;
  color: var(--text-tertiary);
  transform: translateY(-50%);
  white-space: nowrap;
}

.cal-day-col {
  position: relative;
  border-left: 1px solid var(--border);
  height: 900px;
}

.cal-day-col--today { background: var(--brand-light); }

.cal-gridline {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px solid var(--border);
  pointer-events: none;
}

.cal-gridline--half {
  border-top-style: dashed;
  opacity: 0.5;
}

.cal-slot {
  position: absolute;
  left: 0;
  right: 0;
  display: block;
  transition: background 0.1s;
  z-index: 1;
}

.cal-slot:hover { background: rgba(29, 158, 117, 0.08); }

.cal-entry {
  position: absolute;
  left: 3px;
  right: 3px;
  border-radius: 6px;
  padding: 4px 7px;
  overflow: hidden;
  text-decoration: none;
  z-index: 2;
  transition: filter 0.15s, box-shadow 0.15s;
  border-left: 3px solid transparent;
}

.cal-entry:hover { filter: brightness(0.94); box-shadow: var(--shadow-md); }

.cal-entry--pending_review,
.cal-entry--pending {
  background: var(--orange-light);
  border-left-color: var(--orange);
}

.cal-entry--approved {
  background: var(--green-light);
  border-left-color: var(--brand);
}

.cal-entry--invoiced {
  background: var(--brand-light);
  border-left-color: var(--brand);
  opacity: 0.7;
}

.cal-entry--activitywatch { border-left-color: var(--purple); }

.cal-entry-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.cal-entry-meta {
  font-size: 10px;
  color: var(--text-secondary);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Client rows with project budget bars ────────────────────────────────── */

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

.client-row--archived { opacity: 0.55; }

.client-projects {
  background: var(--surface-2);
  border: 0.5px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  padding: 10px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.project-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.project-color {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.budget-bar {
  height: 4px;
  background: var(--border-med);
  border-radius: 2px;
  margin-top: 5px;
  overflow: hidden;
}

.budget-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s ease;
}

.budget-bar-fill--ok     { background: var(--brand); }
.budget-bar-fill--warn   { background: var(--orange); }
.budget-bar-fill--danger { background: var(--red); }

/* ── Reports page ────────────────────────────────────────────────────────── */

.report-charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.report-legend {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 10px;
}

.report-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

/* ── Print styles (invoice) ──────────────────────────────────────────────── */

@media print {
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }

  .app-shell  { display: block; }
  .sidebar    { display: none !important; }
  .flash-stack { display: none !important; }

  .main-content {
    padding: 24px 32px;
  }

  .no-print { display: none !important; }

  .card {
    box-shadow: none;
    border: 0.5px solid #ccc;
  }

  .page-header .btn,
  .page-header form { display: none !important; }

  a { color: inherit; text-decoration: none; }
}

/* ── Form layout utilities ───────────────────────────────────────────────── */

/* 2-column form grid (used on new/edit entry forms) */
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* Form button row */
.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  flex-wrap: wrap;
}

/* ── Additional badge variants ───────────────────────────────────────────── */
.badge--archived { background: var(--surface-2); color: var(--text-tertiary); }

/* ── Calendar drag-to-create overlay ────────────────────────────────────── */
.cal-drag-overlay {
  position: absolute;
  left: 3px;
  right: 3px;
  background: rgba(29, 158, 117, 0.18);
  border: 1.5px solid var(--brand);
  border-radius: 6px;
  pointer-events: none;
  z-index: 10;
}

/* ── Entry row layout utilities ──────────────────────────────────────────── */

/* Flex wrapper for the text column (description + meta) */
.entry-body { flex: 1; min-width: 0; }

/* Flex wrapper for right-side data (badge, duration, amount) */
.entry-row-data {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* Flex wrapper for action buttons */
.entry-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Non-billable badge */
.badge--non-billable {
  background: var(--surface-2);
  color: var(--text-tertiary);
}

/* Empty amount dash */
.entry-amount--empty { color: var(--text-tertiary); }

/* Page header button group */
.page-header-actions { display: flex; gap: 8px; }

/* ── Settings section dividers ───────────────────────────────────────────── */

.settings-section-divider {
  border-top: 1px solid var(--border);
  margin-top: 20px;
  padding-top: 16px;
  margin-bottom: 16px;
}

.settings-section-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 12px;
}

/* ── First-run setup checklist (dashboard) ───────────────────────────────── */

.setup-checklist-title {
  font-weight: 600;
  margin-bottom: 12px;
}

.setup-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
}

.setup-step:last-child { border-bottom: none; }

.setup-step-circle {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border-med);
  flex-shrink: 0;
}

.setup-step-label { font-size: 14px; }

.setup-step-arrow {
  margin-left: auto;
  font-size: 13px;
  color: var(--brand);
}

/* ── Calendar now-line ───────────────────────────────────────────────────── */
.cal-now-line {
  position: absolute;
  left: -2px;
  right: 0;
  height: 2px;
  background: var(--red);
  z-index: 6;
  pointer-events: none;
}
.cal-now-line::before {
  content: '';
  position: absolute;
  left: -3px;
  top: -4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--red);
}

/* ── Weekly timesheet grid ───────────────────────────────────────────────── */
.ts-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: fixed;
}
.ts-table th,
.ts-table td {
  padding: 0;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.ts-table th:last-child,
.ts-table td:last-child { border-right: none; }
.ts-label-col { width: 200px; min-width: 140px; }
.ts-day-col   { width: calc((100% - 200px) / 8); }
.ts-total-col { width: calc((100% - 200px) / 8); background: var(--surface-2); }

.ts-header th {
  padding: 8px 10px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--surface-2);
  white-space: nowrap;
  font-size: 12px;
}
.ts-header th.ts-today {
  color: var(--brand);
  background: var(--brand-light);
}
.ts-row td { vertical-align: middle; }
.ts-row-label {
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ts-row-color {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.ts-row-name { font-weight: 500; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ts-row-client { font-size: 11px; color: var(--text-tertiary); }
.ts-cell {
  text-align: center;
  padding: 0;
  height: 48px;
}
.ts-cell a, .ts-cell span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  text-decoration: none;
  font-variant-numeric: tabular-nums;
}
.ts-cell a { color: var(--text-primary); }
.ts-cell a:hover { background: var(--surface-2); }
.ts-cell a.ts-has-time { font-weight: 600; color: var(--brand); }
.ts-cell span { color: var(--text-tertiary); }
.ts-total-cell {
  text-align: center;
  padding: 0;
  height: 48px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.ts-total-cell span {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}
.ts-footer td {
  padding: 10px;
  font-weight: 600;
  background: var(--surface-2);
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--text-primary);
}
.ts-footer td:first-child {
  text-align: left;
  padding-left: 12px;
  color: var(--text-secondary);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* ── Calendar entry resize handle ────────────────────────────────────────── */
.cal-entry-resize {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 6px;
  cursor: ns-resize;
  border-radius: 0 0 4px 4px;
}
.cal-entry:hover .cal-entry-resize {
  background: rgba(0, 0, 0, 0.2);
}

/* ── Print styles (Invoice PDF) ──────────────────────────────────────────── */
@media print {
  .sidebar,
  .no-print,
  .flash-stack,
  .nav-sub,
  .page-header-actions { display: none !important; }

  body { background: #fff !important; }

  .app-shell {
    display: block !important;
  }

  .main-content {
    margin: 0 !important;
    padding: 20px !important;
    max-width: none !important;
    min-height: unset !important;
  }

  .card {
    box-shadow: none !important;
    border: 1px solid #d0d0d0 !important;
    break-inside: avoid;
    margin-bottom: 16px !important;
  }

  .data-table tr { break-inside: avoid; }

  a { color: inherit !important; text-decoration: none !important; }

  /* Force light palette regardless of OS theme */
  :root,
  [data-theme="dark"] {
    --surface:        #ffffff;
    --surface-2:      #f5f5f5;
    --text-primary:   #0e1116;
    --text-secondary: #444444;
    --text-muted:     #666666;
    --text-tertiary:  #888888;
    --border:         #e0e0e0;
    --border-med:     #cccccc;
    --brand:          #0f6e56;
  }
}

/* ── Avatar settings ─────────────────────────────────────────────────────── */
.avatar-settings-row {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.avatar-preview-wrap {
  flex-shrink: 0;
}
.avatar-preview-img {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-med);
  display: block;
}
.avatar-preview-initial {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 28px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}
.avatar-settings-controls {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}
.btn--ghost {
  background: transparent;
  border: none;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}
.btn--ghost:hover {
  background: var(--surface-2);
}

/* ── Popup / menu bar popover mode ─────────────────────────────────────────── */
body.popup-mode .sidebar { display: none !important; }
body.popup-mode .app-shell { grid-template-columns: 1fr !important; }
body.popup-mode .main-content { padding: 16px !important; }
body.popup-mode .page-header { padding-top: 0 !important; margin-bottom: 12px !important; }
body.popup-mode .page-title { font-size: 16px !important; }
body.popup-mode .page-subtitle { font-size: 12px !important; }

/* ── Process-now pill progress button ──────────────────────────────────────── */
.btn--pill-progress {
  position: relative;
  overflow: hidden;
  border-radius: 100px !important;
  cursor: wait !important;
  min-width: 140px;
  border-color: var(--brand) !important;
  color: var(--brand) !important;
  background: var(--brand-light) !important;
  transition: border-radius 0.25s ease;
}
.btn--pill-progress::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.28) 50%, transparent 100%);
  transform: translateX(-100%);
  animation: pill-sweep 1.1s ease-in-out infinite;
}
@keyframes pill-sweep {
  to { transform: translateX(200%); }
}

/* ── App exclusion tags ──────────────────────────────────────────────────── */
.exclusion-tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 12px;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.exclusion-tag:hover {
  background: rgba(226,75,74,.08);
  border-color: var(--red);
  color: var(--red);
}

/* ── Approve button ──────────────────────────────────────────────────────── */
.btn--approve {
  background: #e8f7f2;
  color: var(--brand);
  border: 1px solid var(--brand);
  font-weight: 600;
}
.btn--approve:hover { background: var(--brand); color: #fff; }

/* ── Paused button state ─────────────────────────────────────────────────── */
.btn--paused {
  background: var(--red);
  color: #fff !important;
  border: 1px solid var(--red);
  animation: btn-blink 0.8s ease-in-out infinite;
}
@keyframes btn-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.25; }
}

/* ── Help / User Guide ───────────────────────────────────────────────────── */
.help-p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 12px;
}
.help-row {
  display: flex;
  gap: 16px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  align-items: flex-start;
}
.help-row:last-child { border-bottom: none; }
.help-label {
  flex: 0 0 160px;
  font-weight: 500;
  color: var(--text-primary);
}
.help-desc {
  flex: 1;
  color: var(--text-secondary);
  line-height: 1.5;
}
kbd {
  display: inline-block;
  padding: 1px 6px;
  font-size: 12px;
  font-family: var(--font-mono);
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-primary);
}
