:root {
  --bg: #F5F0E4;
  --panel: #FFFFFF;
  --panel-2: #FBF7EE;
  --ink: #262220;
  --ink-dim: #746C60;
  --line: #E3D9C3;
  --accent: #B8631E;
  --accent-ink: #FFFFFF;
  --warehouse: #3E6C99;
  --warehouse-bg: #E3EAF2;
  --onsite: #B8631E;
  --onsite-bg: #F5E4D2;
  --holiday: #3F8F70;
  --holiday-bg: #DFEFE7;
  --sick: #A5424B;
  --sick-bg: #F3DEE0;
  --off: #7A7468;
  --off-bg: #EAE5D9;
  --toil: #7B5EA7;
  --toil-bg: #ECE6F5;
  --danger: #A5424B;
  --shadow: 0 1px 2px rgba(40,30,10,0.08), 0 4px 14px rgba(40,30,10,0.06);
  --radius-card: 3px;
  --radius-tag: 2px;
  --font-ui: 'Barlow', system-ui, sans-serif;
  --font-head: 'Barlow Semi Condensed', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1B1C1E;
    --panel: #232527;
    --panel-2: #2A2C2F;
    --ink: #ECE7DC;
    --ink-dim: #9B958A;
    --line: #37393C;
    --accent: #E3A438;
    --accent-ink: #241A06;
    --warehouse: #7CA3D4;
    --warehouse-bg: #26313F;
    --onsite: #E3A438;
    --onsite-bg: #3B2E15;
    --holiday: #62C6A0;
    --holiday-bg: #1D3A31;
    --sick: #E08A90;
    --sick-bg: #3A2124;
    --off: #9B958A;
    --off-bg: #2E2F30;
    --toil: #B79BE0;
    --toil-bg: #302741;
    --danger: #E08A90;
    --shadow: 0 1px 2px rgba(0,0,0,0.3), 0 4px 14px rgba(0,0,0,0.25);
  }
}
:root[data-theme="dark"] {
  --bg: #1B1C1E;
  --panel: #232527;
  --panel-2: #2A2C2F;
  --ink: #ECE7DC;
  --ink-dim: #9B958A;
  --line: #37393C;
  --accent: #E3A438;
  --accent-ink: #241A06;
  --warehouse: #7CA3D4;
  --warehouse-bg: #26313F;
  --onsite: #E3A438;
  --onsite-bg: #3B2E15;
  --holiday: #62C6A0;
  --holiday-bg: #1D3A31;
  --sick: #E08A90;
  --sick-bg: #3A2124;
  --off: #9B958A;
  --off-bg: #2E2F30;
  --toil: #B79BE0;
  --toil-bg: #302741;
  --danger: #E08A90;
  --shadow: 0 1px 2px rgba(0,0,0,0.3), 0 4px 14px rgba(0,0,0,0.25);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
#app { max-width: 1240px; margin: 0 auto; padding: 0 16px 64px; }

a { color: var(--accent); }
button { font-family: var(--font-ui); cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

/* ---------- Header ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 0 14px; gap: 12px; flex-wrap: wrap;
}
.brand { display: flex; align-items: baseline; gap: 10px; }
.brand .mark {
  font-family: var(--font-head); font-weight: 700; font-size: 22px;
  letter-spacing: 0.01em;
}
.brand .mark span { color: var(--accent); }
.brand .sub { font-size: 12.5px; color: var(--ink-dim); font-family: var(--font-mono); }

.theme-toggle {
  background: none; border: 1px solid var(--line); color: var(--ink-dim);
  border-radius: var(--radius-tag); padding: 6px 10px; font-size: 13px;
}
.theme-toggle:hover { color: var(--ink); border-color: var(--ink-dim); }
/* Button that switches between DK Timesheet and DK Jobs */
.app-switch { text-decoration: none; border-color: var(--accent); color: var(--accent); font-weight: 600; }
.app-switch:hover { background: var(--accent); color: var(--accent-ink); }

.header-actions { display: flex; gap: 8px; align-items: center; }
.app-version { font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-dim); }
.sync-btn {
  display: inline-flex; align-items: center; gap: 7px;
  background: none; border: 1px solid var(--line); color: var(--ink-dim);
  border-radius: var(--radius-tag); padding: 6px 10px; font-size: 13px;
}
.sync-btn:hover { color: var(--ink); border-color: var(--ink-dim); }
.sync-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-dim); flex-shrink: 0; }
.sync-dot.off { background: var(--ink-dim); }
.sync-dot.connecting, .sync-dot.syncing { background: var(--onsite); animation: pulse 1.2s ease-in-out infinite; }
.sync-dot.synced { background: var(--holiday); }
.sync-dot.error { background: var(--danger); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }

.gate-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
}
.gate-card { width: 100%; max-width: 320px; padding: 30px 26px; text-align: center; }
.gate-mark { font-family: var(--font-head); font-weight: 700; font-size: 24px; margin-bottom: 4px; }
.gate-mark span { color: var(--accent); }
.gate-sub { font-size: 13px; color: var(--ink-dim); margin-bottom: 18px; }
.gate-error { font-size: 12.5px; color: var(--danger); margin-top: 10px; }
.gate-info { font-size: 12.5px; color: var(--ink-dim); margin-top: 10px; line-height: 1.5; }
#authForm { text-align: left; }
.auth-label { display: block; font-size: 11.5px; color: var(--ink-dim); margin: 10px 0 4px; }
.auth-input { width: 100%; padding: 10px; font-size: 15px; }
.auth-submit { width: 100%; margin-top: 14px; justify-content: center; }
.link-btn {
  background: none; border: none; color: var(--ink-dim); font-size: 12.5px;
  margin-top: 12px; padding: 4px; text-decoration: underline; cursor: pointer;
}
.link-btn:hover { color: var(--ink); }

.doc-upload { padding: 16px 18px; margin-bottom: 16px; }
.doc-upload .form-grid { grid-template-columns: 1fr 1fr; }
.doc-list-wrap { overflow-x: auto; }
.doc-row {
  display: flex; align-items: center; gap: 12px; padding: 11px 16px; border-bottom: 1px solid var(--line);
}
.doc-row:last-child { border-bottom: none; }
.doc-icon { font-size: 20px; flex-shrink: 0; width: 26px; text-align: center; }
.doc-main { flex: 1; min-width: 0; }
.doc-name { font-size: 13.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-meta { font-size: 12px; color: var(--ink-dim); font-family: var(--font-mono); margin-top: 2px; }
.doc-actions { display: flex; gap: 4px; flex-shrink: 0; }
.doc-badge {
  display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; color: var(--ink-dim);
  background: var(--panel-2); border-radius: var(--radius-tag); padding: 1px 6px; margin-left: 6px;
  border: none; cursor: pointer; font-family: var(--font-ui);
}
.doc-badge:hover { color: var(--ink); }

.calc-card { padding: 16px 18px; margin-bottom: 16px; }
.calc-card .form-grid { grid-template-columns: repeat(3, 1fr); }
.calc-card select:disabled, .calc-card input:disabled { opacity: 0.5; }

.tabs {
  display: flex; gap: 2px; box-shadow: inset 0 -2px 0 var(--line); margin-bottom: 20px;
  position: relative; overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  background: none; border: none; padding: 10px 4px; margin-right: 22px;
  font-family: var(--font-head); font-weight: 600; font-size: 16px;
  color: var(--ink-dim); border-bottom: 2px solid transparent;
  white-space: nowrap; flex-shrink: 0;
}
.tab.active { color: var(--ink); border-bottom-color: var(--accent); }
.tab:hover:not(.active) { color: var(--ink); }

/* ---------- Settings ---------- */
.settings-title { font-family: var(--font-head); font-size: 16px; font-weight: 600; margin: 0 0 4px; }
.settings-help { font-size: 13px; color: var(--ink-dim); margin: 0 0 12px; }
.settings-options { display: flex; flex-direction: column; gap: 2px; }
.settings-option {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border-radius: var(--radius-tag); cursor: pointer;
}
.settings-option:hover { background: var(--panel-2); }
.settings-example { font-family: var(--font-mono); font-size: 13.5px; }
.settings-section + .settings-section { margin-top: 0; }
.type-color-row {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.type-color-row:last-child { border-bottom: none; padding-bottom: 0; }
.type-color-row .tag { width: 92px; text-align: center; flex-shrink: 0; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatch {
  width: 24px; height: 24px; border-radius: 50%; border: 2px solid transparent;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.15); padding: 0; cursor: pointer;
}
.swatch:hover { transform: scale(1.12); }
.swatch.selected { border-color: var(--ink); box-shadow: inset 0 0 0 2px var(--panel); }
.custom-color { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-dim); cursor: pointer; }
.custom-color input[type="color"] {
  width: 30px; height: 26px; padding: 0; border: 1px solid var(--line);
  border-radius: var(--radius-tag); background: none; cursor: pointer;
}
.type-color-row .link-btn { margin-top: 0; }

/* ---------- Expenses ---------- */
.section-sub { font-family: var(--font-ui); font-weight: 400; font-size: 12.5px; color: var(--ink-dim); margin-left: 6px; }
.bar-tag.exp-cat { width: 120px; text-align: left; padding-left: 0; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.exp-cat-amount { width: 92px; text-align: right; font-family: var(--font-mono); font-size: 13px; }
.exp-muted { color: var(--ink-dim); font-size: 12.5px; }
.month-table tr.exp-gone td { color: var(--ink-dim); }
.month-table td.exp-name-cell, .month-table td.exp-cat-cell, .month-table td.exp-status { font-family: var(--font-ui); }
.month-table td.exp-status { color: var(--ink-dim); font-size: 12.5px; }
.month-table tr.exp-future td { color: var(--ink-dim); }
.month-table tr.exp-current td { background: var(--panel-2); }
.month-table tfoot td { border-top: 2px solid var(--line); font-weight: 600; }
.exp-neg { color: var(--danger); }
.month-table td.num { white-space: nowrap; }
.exp-pos { color: var(--holiday); }
.exp-table .exp-name-cell { font-weight: 500; max-width: 220px; }
.exp-note { font-size: 12px; color: var(--ink-dim); font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.exp-table tr.exp-paused td:not(.actions-cell) { opacity: 0.55; }
.exp-year-select { width: auto; min-width: 150px; }
.category-row { display: flex; align-items: center; gap: 10px; padding: 5px 0; }
.category-row .field-input { flex: 1; min-width: 0; max-width: 260px; }
.category-used { min-width: 0; white-space: nowrap; }
.category-row .link-btn { margin-top: 0; }
.category-add { margin-top: 8px; }
.salary-list { margin-top: 10px; padding-top: 6px; border-top: 1px solid var(--line); }
.salary-row { flex-wrap: wrap; align-items: flex-end; }
.salary-field { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; color: var(--ink-dim); flex: 1; min-width: 130px; max-width: 200px; }
.salary-field .field-input { max-width: none; }
.salary-month { padding-bottom: 9px; }
.salary-row .link-btn { padding-bottom: 9px; }
.salary-list .btn { margin-top: 8px; }
.tax-basis { display: flex; align-items: center; gap: 4px 14px; flex-wrap: wrap; margin-top: 10px; font-size: 13.5px; }
.tax-basis .settings-option { padding: 4px 6px; }
.tax-code-input { max-width: 200px; font-family: var(--font-mono); text-transform: uppercase; }
.tax-code-hint { font-size: 12.5px; color: var(--ink-dim); margin-top: 5px; line-height: 1.5; }
.tax-code-hint.bad { color: var(--danger); }
.earn-input-wrap { display: inline-flex; align-items: center; gap: 3px; }
.month-table .earn-input { width: 104px; padding: 4px 6px; font-family: var(--font-mono); font-size: 13px; text-align: right; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: var(--radius-tag); border: 1px solid var(--line);
  background: var(--panel); color: var(--ink); padding: 8px 13px;
  font-size: 13.5px; font-weight: 500;
}
.btn:hover { border-color: var(--ink-dim); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn-primary:hover { filter: brightness(1.06); }
.btn-ghost { border-color: transparent; background: none; }
.btn-ghost:hover { background: var(--panel-2); }
.btn-danger { color: var(--danger); }
.btn-sm { padding: 5px 9px; font-size: 12.5px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Cards ---------- */
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius-card); box-shadow: var(--shadow);
}
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 14px; }
.stat-card { padding: 16px 18px; }
.stat-label { font-size: 12px; color: var(--ink-dim); text-transform: none; margin-bottom: 6px; }
.stat-value { font-family: var(--font-mono); font-size: 26px; font-weight: 600; line-height: 1.1; }
.stat-value small { font-size: 14px; font-weight: 500; color: var(--ink-dim); }
.stat-sub { font-size: 12.5px; color: var(--ink-dim); margin-top: 4px; }
.due-track { margin-top: 10px; height: 6px; }

.section-title {
  font-family: var(--font-head); font-weight: 600; font-size: 15px;
  margin: 26px 0 10px; color: var(--ink);
}

/* ---------- Breakdown bars ---------- */
.breakdown { padding: 16px 18px; }
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.bar-row:last-child { margin-bottom: 0; }
.bar-tag {
  width: 92px; flex-shrink: 0; font-size: 12.5px; font-weight: 600;
  padding: 2px 7px; border-radius: var(--radius-tag); text-align: center;
}
.bar-track { flex: 1; height: 9px; background: var(--panel-2); border-radius: 5px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 5px; }
.bar-pct { width: 44px; text-align: right; font-family: var(--font-mono); font-size: 13px; color: var(--ink-dim); }

.tag { font-size: 12px; font-weight: 600; padding: 2px 7px; border-radius: var(--radius-tag); white-space: nowrap; }
/* Day type colours. --t-* default to the theme colours above; a custom
   colour from Settings overrides them (see applyTypeColors in settings.js). */
:root {
  --t-warehouse: var(--warehouse); --t-warehouse-bg: var(--warehouse-bg);
  --t-onsite: var(--onsite); --t-onsite-bg: var(--onsite-bg);
  --t-holiday: var(--holiday); --t-holiday-bg: var(--holiday-bg);
  --t-sick: var(--sick); --t-sick-bg: var(--sick-bg);
  --t-off: var(--off); --t-off-bg: var(--off-bg);
  --t-toil: var(--toil); --t-toil-bg: var(--toil-bg);
}
.tag-Warehouse { color: var(--t-warehouse); background: var(--t-warehouse-bg); }
.tag-OnSite { color: var(--t-onsite); background: var(--t-onsite-bg); }
.tag-Holiday { color: var(--t-holiday); background: var(--t-holiday-bg); }
.tag-Sick { color: var(--t-sick); background: var(--t-sick-bg); }
.tag-Off { color: var(--t-off); background: var(--t-off-bg); }
.tag-TOIL { color: var(--t-toil); background: var(--t-toil-bg); }
.tag-none { color: var(--ink-dim); background: var(--panel-2); }

/* ---------- Monthly table ---------- */
table { width: 100%; border-collapse: collapse; }
.month-table { padding: 4px 0; overflow-x: auto; }
.month-table table { }
.month-table th, .month-table td { padding: 9px 14px; text-align: left; font-size: 13.5px; }
.month-table th { color: var(--ink-dim); font-weight: 500; font-size: 12px; border-bottom: 1px solid var(--line); }
.month-table td { border-bottom: 1px solid var(--line); font-family: var(--font-mono); }
.month-table td.m-label { font-family: var(--font-ui); font-weight: 500; }
.month-table tr:last-child td { border-bottom: none; }
.month-table tr.busiest td { background: var(--onsite-bg); }
.num { text-align: right; }

/* ---------- Log toolbar ---------- */
.log-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 14px; flex-wrap: wrap;
}
.bulk-bar { padding: 10px 14px; margin-bottom: 14px; border-color: var(--accent); font-size: 13.5px; }
.bulk-bar .btn-row { flex-wrap: wrap; }
.bulk-bar select { font-size: 13px; }
.bulk-fields {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 14px;
  margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line);
}
.bulk-field-row { display: flex; flex-direction: column; gap: 5px; }
.bulk-field-check {
  display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-dim); cursor: pointer;
}
.bulk-field-row:has(.bulk-field-on:checked) .bulk-field-check { color: var(--ink); font-weight: 500; }
.bulk-field-row .field-input:disabled { opacity: 0.45; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
select, .field-input {
  font-family: var(--font-ui); font-size: 13.5px; color: var(--ink);
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-tag);
  padding: 7px 9px;
}
#docFile {
  font-family: var(--font-ui); font-size: 13px; color: var(--ink);
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-tag);
  padding: 6px 8px; width: 100%;
}

.empty-state {
  text-align: center; padding: 56px 20px; color: var(--ink-dim);
}
.empty-state .big { font-family: var(--font-head); font-size: 19px; color: var(--ink); margin-bottom: 6px; }
.empty-state .btn-row { justify-content: center; margin-top: 16px; }

/* ---------- Entry form ---------- */
.entry-form {
  padding: 16px 18px; margin-bottom: 16px; border-color: var(--accent);
}
.form-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px 12px; margin-bottom: 12px;
}
.form-grid .full { grid-column: 1 / -1; }
.field label {
  display: block; font-size: 11.5px; color: var(--ink-dim); margin-bottom: 4px;
}
.field input, .field select { width: 100%; }
.form-preview { font-family: var(--font-mono); font-size: 13px; color: var(--ink-dim); margin-bottom: 12px; }
.form-preview b { color: var(--ink); font-weight: 600; }
.toil-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: 13.5px; }
.toil-bank { display: inline-flex; align-items: center; gap: 6px; }
.toil-field [hidden] { display: none !important; }
.field .toil-bank input { width: 84px; }
.toil-split { font-size: 12.5px; color: var(--ink-dim); margin-top: 6px; }
.toil-badge { font-size: 11px; font-weight: 600; color: var(--t-toil); white-space: nowrap; }
.toil-neg { color: var(--danger); }
.toil-day-field { display: block; max-width: 360px; }
.toil-day-field input { margin-top: 4px; }
/* Pop-up (import clashes) */
.ts-modal-scrim { position: fixed; inset: 0; z-index: 60; background: rgba(15,18,35,0.45); display: flex; align-items: center; justify-content: center; padding: 16px; }
.ts-modal { background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); width: 100%; max-width: 560px; max-height: calc(100vh - 32px); overflow: auto; padding: 20px; }
.ts-modal-head { display: flex; gap: 14px; align-items: flex-start; }
.ts-modal-icon { flex: none; width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; color: var(--t-onsite); background: var(--t-onsite-bg); }
.ts-modal-title { font-family: var(--font-head); font-weight: 700; font-size: 16px; margin-bottom: 4px; }
.ts-modal-text { font-size: 13.5px; color: var(--ink-dim); line-height: 1.5; }
.clash-list { margin: 14px 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.clash-row { display: grid; grid-template-columns: 7.5em minmax(0, 1fr) minmax(0, 1fr); gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.clash-row:last-child { border-bottom: none; }
.clash-date { font-family: var(--font-mono); font-weight: 600; }
.clash-label { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-dim); margin-bottom: 2px; }
.clash-side { line-height: 1.5; }
.clash-about { color: var(--ink-dim); }
.clash-gap { height: 6px; }
.clash-more { padding: 8px 12px; font-size: 12.5px; color: var(--ink-dim); background: var(--panel-2); }
.ts-modal-btns { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 8px; }
.ts-modal-wide { max-width: 640px; }
.clash-list { max-height: 50vh; overflow-y: auto; }
.clash-pick { grid-column: 2 / -1; display: inline-flex; flex-wrap: wrap; gap: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; justify-self: start; margin-top: 4px; }
.clash-opt { display: inline-flex; cursor: pointer; }
.clash-opt input { position: absolute; opacity: 0; pointer-events: none; }
.clash-opt span { padding: 5px 11px; font-size: 12.5px; font-weight: 600; color: var(--ink-dim); border-left: 1px solid var(--line); }
.clash-opt:first-child span { border-left: none; }
.clash-opt input:checked + span { background: var(--accent); color: #fff; }
.clash-opt input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -2px; }
.clash-all { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 12px; font-size: 12.5px; color: var(--ink-dim); }
.clash-count { margin-right: auto; font-size: 12.5px; color: var(--ink-dim); }
@media (max-width: 520px) {
  .clash-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .clash-date { grid-column: 1 / -1; }
  .clash-pick { grid-column: 1 / -1; }
  .ts-modal-btns .btn { flex: 1 1 40%; justify-content: center; text-align: center; }
  .clash-count { flex-basis: 100%; margin: 0 0 2px; }
}
/* Holiday & TOIL tab */
.leave-allow-row { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 10px; }
.leave-table td, .leave-table th { white-space: nowrap; }
.leave-table td.leave-what { white-space: normal; }
.leave-note { font-size: 11.5px; color: var(--ink-dim); max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.leave-table td, .leave-table th { padding-left: 8px; padding-right: 8px; }
.log-table.leave-table { min-width: 0; }
.leave-future td { color: var(--ink-dim); }
.leave-booked { font-family: var(--font-ui); font-size: 11px; font-weight: 600; color: var(--accent); margin-left: 4px; }
.leave-open td { font-style: italic; color: var(--ink-dim); background: var(--panel-2); }
.leave-scroll { overflow-x: auto; }
.leave-bank-table { min-width: 520px; }
.leave-sub { font-size: 11px; color: var(--ink-dim); font-family: var(--font-ui); }
.leave-year-note { margin-left: 0; }
.copy-title { font-family: var(--font-head); font-weight: 700; font-size: 15px; }
.copy-source { font-family: var(--font-mono); font-size: 13px; color: var(--ink-dim); margin: 2px 0 12px; }
.copy-day-row { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.copy-day, .copy-check { display: inline-flex !important; align-items: center; gap: 6px; font-size: 13px !important; color: var(--ink) !important; margin: 0 16px 0 0 !important; }
.copy-day input, .copy-check input { width: auto; }
.copy-form .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* ---------- Data table ---------- */
.log-table-wrap { overflow-x: auto; }
.log-table { min-width: 760px; }
.log-table th {
  text-align: left; font-size: 11.5px; color: var(--ink-dim); font-weight: 600;
  padding: 8px 8px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel);
}
.log-table td {
  padding: 8px 8px; border-bottom: 1px solid var(--line); font-size: 13.5px; vertical-align: middle;
}
.log-table td.mono, .log-table th.num { font-family: var(--font-mono); }
.log-table td.date-cell { white-space: nowrap; }
.log-table td.num { text-align: right; font-family: var(--font-mono); }
.log-table th.center, .log-table td.center { text-align: center; }
.log-table tr:hover td { background: var(--panel-2); }
.log-table .notes-cell { color: var(--ink-dim); font-size: 12.5px; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Edit/Delete stay pinned to the right edge when the table scrolls sideways */
.log-table th.actions-col, .log-table td.actions-cell {
  position: sticky; right: 0; background: var(--panel);
}
.log-table th.actions-col { z-index: 2; }
.log-table tr:hover td.actions-cell { background: var(--panel-2); }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.icon-btn {
  background: none; border: none; color: var(--ink-dim); padding: 4px 6px; border-radius: var(--radius-tag); font-size: 13px;
}
.icon-btn:hover { color: var(--ink); background: var(--panel-2); }
.icon-btn.danger:hover { color: var(--danger); }

.footnote { font-size: 12px; color: var(--ink-dim); margin-top: 14px; line-height: 1.6; }

#fileInput { display: none; }

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: var(--radius-tag);
  font-size: 13.5px; box-shadow: var(--shadow); opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }

@media (max-width: 640px) {
  .stat-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: repeat(2, 1fr); }
  .bar-tag { width: 76px; font-size: 11.5px; }
  .bar-tag.exp-cat { width: 90px; }
  .exp-due .exp-cat-cell, .exp-due th.exp-cat-head { display: none; }
  .month-table th, .month-table td { padding: 9px 10px; }
  .exp-cat-amount { width: 76px; font-size: 12px; }
  /* Fade the right edge so it's clear more tabs scroll into view */
  .tabs {
    padding-right: 32px;
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent);
  }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
