/* Tempo — warm orange look: a pale apricot canvas, the sidebar a darker shade
   of the same colour, orange accent, with the logo's yellow, green and red for status. */

:root {
  color-scheme: light;
  --sidebar-bg: #f6dcbf;
  --sidebar-fg: #3a2a1c;
  --sidebar-muted: #7a5b42;
  --sidebar-strong: #1f150c;
  --sidebar-hover: rgba(120, 60, 10, 0.08);
  --sidebar-active: rgba(255, 255, 255, 0.62);
  --sidebar-accent: #a8440a;
  --sidebar-card: rgba(255, 255, 255, 0.45);
  --sidebar-chip: rgba(255, 255, 255, 0.6);
  --sidebar-line: rgba(120, 60, 10, 0.14);
  --sidebar-warn: #a86b00;
  --logo-bg: transparent;

  --accent: #e2600c;
  --accent-strong: #d9580a;
  --accent-hover: #bf4b08;
  --accent-ink: #ffffff;
  --accent-text: #b34a09;
  --accent-glow: rgba(217, 88, 10, 0.35);
  --focus-ring: rgba(226, 96, 12, 0.25);

  --bg: #fcf4ea;
  --surface: #ffffff;
  --surface-2: #faefe2;
  --hover: #f8ebdc;
  --border: #efdfcc;
  --border-strong: #e2cdb4;
  --text: #1f1a16;
  --text-2: #5a4f45;
  --muted: #8b8075;
  --track: #f3e5d4;
  --grid-line: #f0e2d1;
  --grid-line-soft: #f9f0e5;

  --good: #1f9d4c;
  --good-text: #167a3b;
  --warning: #f4b400;
  --critical: #e03a2f;
  --now: #e03a2f;
  --today-bg: rgba(226, 96, 12, 0.04);

  --tooltip-bg: #241a12;
  --tooltip-fg: #ffffff;
  --toast-bg: #241a12;
  --toast-accent: #ffa25a;

  --radius: 8px;
  --shadow: 0 1px 2px rgba(60, 30, 5, 0.05), 0 2px 8px rgba(60, 30, 5, 0.05);
  --shadow-lg: 0 10px 30px rgba(60, 30, 5, 0.18), 0 2px 6px rgba(60, 30, 5, 0.08);
  --font: Inter, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --sidebar-bg: #100c09;
  --sidebar-fg: #ece4da;
  --sidebar-muted: #a39380;
  --sidebar-strong: #ffffff;
  --sidebar-hover: rgba(255, 255, 255, 0.06);
  --sidebar-active: rgba(255, 140, 60, 0.18);
  --sidebar-accent: #ff9a52;
  --sidebar-card: rgba(255, 255, 255, 0.06);
  --sidebar-chip: rgba(255, 255, 255, 0.08);
  --sidebar-line: rgba(255, 255, 255, 0.08);
  --sidebar-warn: var(--warning);
  --logo-bg: #f6e8d8;
  --accent-text: #ffa366;
  --focus-ring: rgba(255, 154, 82, 0.3);
  --bg: #18130f;
  --surface: #211b16;
  --surface-2: #28211b;
  --hover: #2e261f;
  --border: #372e26;
  --border-strong: #473c32;
  --text: #f1ebe4;
  --text-2: #cdc3b8;
  --muted: #988c7f;
  --track: #372e26;
  --grid-line: #342b23;
  --grid-line-soft: #251f19;
  --good-text: #4fca7a;
  --today-bg: rgba(255, 154, 82, 0.06);
  --tooltip-bg: #f1ebe4;
  --tooltip-fg: #211b16;
  --toast-bg: #33291f;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: 0.5; }
a { color: var(--accent-text); }
h1, h2, h3 { line-height: 1.25; }
:focus-visible { outline: 2px solid var(--accent-strong); outline-offset: 2px; }
.muted { color: var(--muted); }
.icon { flex: none; display: block; }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- shell */
.shell {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
}

.sidebar {
  background: var(--sidebar-bg);
  color: var(--sidebar-fg);
  display: flex;
  flex-direction: column;
  padding: 14px 12px 14px;
  gap: 6px;
  overflow-y: auto;
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 0 10px 8px;
  color: var(--sidebar-strong);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-decoration: none;
}
/* The whole logo, never cropped; in dark mode it sits on a light card so the ink octopus shows. */
.brand .logo { width: 148px; max-width: 100%; background: var(--logo-bg); border-radius: 14px; padding: 4px; }
.brand-text { display: flex; flex-direction: column; align-items: center; line-height: 1.1; }
.brand-by { font-size: 11.5px; font-weight: 500; letter-spacing: 0.01em; color: var(--sidebar-muted); }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-section {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--sidebar-muted);
  padding: 14px 12px 6px;
  font-weight: 600;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--sidebar-fg);
  text-decoration: none;
  font-weight: 500;
}
.nav-item:hover { background: var(--sidebar-hover); }
.nav-item.active { background: var(--sidebar-active); color: var(--sidebar-strong); font-weight: 600; }
.nav-item.active .icon { color: var(--sidebar-accent); }
.nav-badge {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  padding: 1px 7px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--sidebar-accent) 20%, transparent);
  color: var(--sidebar-accent);
  white-space: nowrap;
}
.nav-badge[hidden] { display: none; }
.nav-sub { display: flex; flex-direction: column; gap: 1px; margin: 0 0 4px 30px; }
.nav-sub:empty { display: none; }
.nav-sub-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12.5px;
  color: var(--sidebar-muted);
  text-decoration: none;
}
.nav-sub-item:hover { background: var(--sidebar-hover); color: var(--sidebar-fg); }
.nav-sub-item.active { color: var(--sidebar-strong); background: var(--sidebar-hover); }
.nav-sub-item .nav-badge { font-size: 10.5px; padding: 0 6px; }

/* Days without daytime entries, waiting to be filled in. */
.sidebar-alert {
  margin: 12px 4px 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--sidebar-card);
  border: 1px solid color-mix(in srgb, var(--warning) 55%, transparent);
  font-size: 12.5px;
  color: var(--sidebar-fg);
}
.sidebar-alert[hidden] { display: none; }
.sidebar-alert-head { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--sidebar-strong); text-decoration: none; }
.sidebar-alert-head .icon { color: var(--sidebar-warn); flex: none; }
.sidebar-alert-text { color: var(--sidebar-muted); margin: 4px 0 8px; line-height: 1.35; }
.sidebar-alert-days { display: flex; flex-wrap: wrap; gap: 4px; }
.alert-day { display: inline-flex; align-items: center; border-radius: 6px; background: var(--sidebar-chip); }
.alert-day a { color: var(--sidebar-fg); text-decoration: none; padding: 3px 2px 3px 8px; font-size: 12px; white-space: nowrap; }
.alert-day a:hover { color: var(--sidebar-strong); }
.alert-day-x { border: 0; background: none; color: var(--sidebar-muted); padding: 3px 6px 3px 4px; display: inline-grid; place-items: center; opacity: 0.6; }
.alert-day-x:hover { opacity: 1; color: var(--sidebar-strong); }
.sidebar-alert-more { border: 0; background: none; color: var(--sidebar-accent); font-size: 12px; font-weight: 600; padding: 6px 0 0; }
.month-cell.incomplete { box-shadow: inset 0 3px 0 var(--warning); }
.cal-dayhead.incomplete { box-shadow: inset 0 -3px 0 var(--warning); }

.sidebar-running {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--sidebar-card);
  border-radius: 10px;
  padding: 10px;
}
.running-info {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 8px;
  color: var(--sidebar-fg);
  text-decoration: none;
}
.running-pulse {
  grid-row: 1 / 3;
  align-self: center;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.6s ease-in-out infinite;
}
.running-text { display: flex; flex-direction: column; min-width: 0; }
.running-desc { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.running-text .chip { color: var(--sidebar-muted); font-size: 12px; }
.running-text .chip .chip-name { color: var(--sidebar-muted); }
.running-time { grid-column: 2; font-variant-numeric: tabular-nums; font-size: 13px; color: var(--sidebar-strong); }
.running-stop {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 0;
  background: var(--accent);
  color: var(--accent-ink);
  display: grid;
  place-items: center;
  flex: none;
}
@keyframes pulse { 50% { opacity: 0.35; } }

.sidebar-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 4px 0;
  border-top: 1px solid var(--sidebar-line);
  margin-top: 8px;
}
.sidebar-running:not([hidden]) + .sidebar-foot { margin-top: 8px; }
.sidebar-running[hidden] + .sidebar-foot { margin-top: auto; }
.sidebar .icon-btn { color: var(--sidebar-muted); }
.sidebar .icon-btn:hover { background: var(--sidebar-hover); color: var(--sidebar-strong); }

.lang-switch { display: inline-flex; gap: 2px; background: var(--sidebar-card); border-radius: 8px; padding: 3px; }
.lang-btn {
  border: 0;
  background: transparent;
  color: var(--sidebar-muted);
  font-size: 12px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 6px;
}
.lang-btn.active { background: var(--accent); color: var(--accent-ink); }
.auth .lang-switch { background: var(--surface-2); }
.auth .lang-btn { color: var(--text-2); }
.auth .lang-btn.active { color: var(--accent-ink); }

.main {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.view { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.view-scroll { flex: 1; overflow-y: auto; min-height: 0; }
.container { max-width: 1040px; margin: 0 auto; padding: 24px 32px 48px; }
.container-wide { max-width: 1280px; }

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.page-head h1 { margin: 0; font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.page-sub { margin: 4px 0 0; max-width: 640px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- controls */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s;
}
.btn:hover { background: var(--hover); }
.btn-primary { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn-lg { height: 46px; font-size: 15px; }
.btn-danger { background: var(--critical); border-color: transparent; color: #fff; }
.btn-danger:hover { background: #b42f2f; }
.btn-danger-ghost { color: var(--critical); }

.icon-btn {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border-radius: var(--radius);
  border: 0;
  background: transparent;
  color: var(--text-2);
  flex: none;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.danger:hover { color: var(--critical); }

.input {
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  width: 100%;
  min-width: 0;
}
.input:focus { outline: none; border-color: var(--accent-strong); box-shadow: 0 0 0 3px var(--focus-ring); }
.input:disabled { background: var(--surface-2); color: var(--muted); }
.input-sm { height: 32px; font-size: 13px; width: auto; }
.input-lg { height: 46px; font-size: 16px; }
.input.invalid { border-color: var(--critical); }
.input-static { display: flex; align-items: center; color: var(--muted); background: var(--surface-2); }
select.input { padding-right: 6px; cursor: pointer; }
input[type="date"].input, input[type="time"].input { font-variant-numeric: tabular-nums; }

.segmented {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px;
  gap: 2px;
  flex-wrap: wrap;
}
.seg {
  border: 0;
  background: transparent;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  white-space: nowrap;
}
.seg:hover { color: var(--text); }
.seg.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(21, 23, 28, 0.12); }
.segmented-sm .seg { padding: 3px 10px; font-size: 12px; }

.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; color: var(--text-2); }
.check input { accent-color: var(--accent-strong); width: 16px; height: 16px; }

.badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--surface-2);
  color: var(--muted);
  border-radius: 4px;
  padding: 2px 6px;
}

.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c); flex: none; display: inline-block; }
.pillar-mark { width: 10px; height: 10px; border-radius: 3px; background: var(--c); flex: none; display: inline-block; }

.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; min-width: 0; max-width: 100%; }
.chip-name {
  font-weight: 600;
  color: color-mix(in srgb, var(--c) 62%, var(--text));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chip-sub { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip-task { color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.chip-empty { color: var(--muted); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card-head h2 { margin: 0; font-size: 16px; font-weight: 700; }
.card-head-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.check-sm { font-size: 13px; }
.card-empty { margin: 4px 0; }

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  padding: 56px 24px;
  color: var(--text-2);
}
.empty .icon { color: var(--accent-strong); }
.empty h3 { margin: 10px 0 0; color: var(--text); font-size: 18px; }
.empty p { max-width: 480px; margin: 0 0 14px; }
.empty-sm { padding: 24px; }
.empty-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

/* ---------------------------------------------------------------- timer bar */
.timer-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 76px;
  padding: 12px 20px 12px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(21, 23, 28, 0.05);
  position: relative;
  z-index: 2;
}
.timer-desc {
  flex: 1;
  min-width: 120px;
  border: 0;
  background: transparent;
  font-size: 17px;
  padding: 10px 0;
  outline: none;
  color: var(--text);
}
.timer-desc::placeholder { color: var(--muted); }
.timer-project {
  border: 0;
  background: transparent;
  border-radius: var(--radius);
  padding: 6px 8px;
  max-width: 260px;
  min-width: 0;
  display: flex;
  align-items: center;
}
.timer-project:hover { background: var(--hover); }
.timer-task {
  border: 0;
  background: transparent;
  border-radius: var(--radius);
  padding: 6px 8px;
  max-width: 200px;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}
.timer-task[hidden] { display: none; }
.timer-task:hover { background: var(--hover); }
.timer-task.has-value { color: var(--text-2); font-weight: 600; }
.timer-task-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timer-project .chip-empty .icon { color: var(--muted); }
.timer-project:not(.has-value) .chip-empty { color: var(--muted); }
.timer-elapsed {
  border: 0;
  background: transparent;
  font-size: 19px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  min-width: 96px;
  text-align: right;
  padding: 6px 8px;
  border-radius: var(--radius);
  cursor: default;
}
.is-running .timer-elapsed { cursor: pointer; }
.is-running .timer-elapsed:hover { background: var(--hover); }
.start-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 0;
  background: var(--accent-strong);
  color: #fff;
  display: grid;
  place-items: center;
  flex: none;
  box-shadow: 0 3px 10px var(--accent-glow);
  transition: transform 0.12s, background 0.12s;
}
.start-btn:hover { transform: scale(1.05); background: var(--accent-hover); }
.start-btn .icon { margin-left: 2px; }
.is-running .start-btn .icon { margin-left: 0; }
.timer-modes { display: flex; flex-direction: column; gap: 2px; }
.mode-btn {
  width: 26px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
}
.mode-btn.active { color: var(--accent-text); background: var(--hover); }
.timer-manual, .add-btn { display: none; }
.is-manual .timer-manual { display: flex; align-items: center; gap: 6px; }
.is-manual .add-btn { display: inline-flex; }
.is-manual .timer-elapsed, .is-manual .start-btn { display: none; }
.timer-manual-dur { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 64px; text-align: right; }

.suggest-pop { width: min(560px, calc(100vw - 32px)); overflow: hidden; display: flex; flex-direction: column; }
.suggest-wrap { display: flex; flex-direction: column; min-height: 0; }
.suggestions { padding: 6px; max-height: min(440px, 62vh); overflow-y: auto; }
.suggestions-hint { border-top: 1px solid var(--border); padding: 8px 16px; font-size: 12px; color: var(--muted); }
.suggestion-kind { color: var(--muted); font-size: 12px; margin-left: auto; }
.suggestion-create { color: var(--accent-text); font-weight: 700; }
.suggestions-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); padding: 6px 10px; font-weight: 600; }
.suggestion {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: 0;
  background: none;
  border-radius: 6px;
  padding: 8px 10px;
  text-align: left;
}
.suggestion:hover, .suggestion.active { background: var(--hover); }
.suggestion-desc { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.start-edit { padding: 14px; display: flex; flex-direction: column; gap: 10px; width: 280px; }
.start-edit-row { display: grid; grid-template-columns: 1.3fr 1fr; gap: 8px; }

/* ---------------------------------------------------------------- timer list */
.timer-summary { display: flex; align-items: stretch; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.timer-totals { display: flex; gap: 28px; align-items: center; }
.total-item { display: flex; flex-direction: column; }
.total-label { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.total-value { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.today-goals { display: flex; gap: 12px; flex: 1; flex-wrap: wrap; justify-content: flex-end; }
.mini-goal { min-width: 200px; max-width: 260px; flex: 1; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.mini-goal-head { display: flex; align-items: center; gap: 6px; font-size: 12.5px; margin-bottom: 6px; }
.mini-goal-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-goal-val { margin-left: auto; color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }

.day-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.day-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px 10px 18px;
  background: var(--surface-2);
  font-weight: 700;
  font-size: 13px;
  color: var(--text-2);
}
.day-title::first-letter { text-transform: uppercase; }
.day-total { font-variant-numeric: tabular-nums; color: var(--text); padding-right: 74px; }
.entry-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 6px 8px 6px 12px;
  border-top: 1px solid var(--border);
}
.entry-row:hover { background: var(--hover); }
.entry-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; }
.entry-desc, .entry-project, .entry-times, .entry-dur {
  border: 0;
  background: none;
  border-radius: 6px;
  padding: 5px 6px;
  text-align: left;
}
.entry-desc {
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 55%;
  flex-shrink: 0; /* the project chip gives way first */
}
.entry-desc.placeholder { color: var(--muted); }
.entry-desc:hover, .entry-project:hover, .entry-times:hover, .entry-dur:hover { background: var(--surface); box-shadow: inset 0 0 0 1px var(--border-strong); }
.entry-desc-input { max-width: 55%; height: 32px; }
.entry-project { min-width: 0; display: flex; }
.entry-project .chip-empty { opacity: 0; }
.entry-row:hover .entry-project .chip-empty { opacity: 1; }
.entry-meta { display: flex; align-items: center; gap: 2px; flex: none; }
.entry-times { color: var(--text-2); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.entry-dur { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 82px; text-align: right; }
.entry-play, .entry-meta .icon-btn { opacity: 0; }
.entry-row:hover .entry-meta .icon-btn, .entry-meta .icon-btn:focus-visible { opacity: 1; }
.entry-play { color: var(--accent-strong); }
.entry-auto .entry-desc { font-style: italic; }
.entry-auto-badge { width: 66px; display: flex; justify-content: center; }
.load-more { display: flex; margin: 8px auto 0; }

/* ---------------------------------------------------------------- calendar */
.view-calendar { overflow: hidden; }
.cal-toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-wrap: wrap;
}
.cal-nav { display: flex; align-items: center; gap: 4px; }
.cal-title { margin: 0 0 0 10px; font-size: 20px; font-weight: 800; letter-spacing: -0.01em; }
.cal-hint { margin-left: auto; font-size: 12px; }
.cal-body { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--surface); }
.cal-scroll { flex: 1; min-height: 0; overflow: auto; position: relative; overscroll-behavior: contain; }
.cal-head {
  display: grid;
  position: sticky;
  top: 0;
  z-index: 6;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.cal-gutter-head { border-right: 1px solid var(--border); }
.cal-dayhead {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 8px 0 6px;
  border: 0;
  background: transparent;
  color: var(--text-2);
  border-right: 1px solid transparent;
  min-width: 0;
}
.cal-dayhead:hover { background: var(--hover); }
.cal-wd { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.cal-dn {
  font-size: 21px;
  font-weight: 500;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--text);
}
.cal-dayhead.today .cal-wd { color: var(--now); }
.cal-dayhead.today .cal-dn { background: var(--now); color: #fff; font-weight: 700; }
.cal-dt { font-size: 11px; color: var(--muted); min-height: 15px; font-variant-numeric: tabular-nums; }
.cal-grid { display: grid; position: relative; }
.cal-gutter { position: relative; border-right: 1px solid var(--border); }
.cal-hour {
  position: absolute;
  right: 8px;
  transform: translateY(-50%);
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.cal-col {
  position: relative;
  border-right: 1px solid var(--border);
  background-image:
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line-soft) 1px, transparent 1px);
  background-size: 100% 48px, 100% 24px;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}
.cal-col.today { background-color: var(--today-bg); }
.cal-event {
  position: absolute;
  border-radius: 6px;
  background: color-mix(in srgb, var(--c) 17%, var(--surface));
  border-left: 3px solid var(--c);
  box-shadow: 0 0 0 1px var(--surface);
  padding: 3px 6px 3px 7px;
  font-size: 12px;
  line-height: 1.3;
  overflow: hidden;
  cursor: grab;
  color: var(--text);
  z-index: 1;
  transition: background 0.1s;
}
.cal-event:hover { background: color-mix(in srgb, var(--c) 27%, var(--surface)); z-index: 2; }
.cal-event.dragging { cursor: grabbing; box-shadow: var(--shadow-lg); z-index: 5; opacity: 0.92; }
.cal-event.running {
  background-image: repeating-linear-gradient(-45deg, transparent 0 6px, color-mix(in srgb, var(--c) 14%, transparent) 6px 12px);
  cursor: pointer;
}
.cal-event.ghost {
  left: 1px;
  right: 3px;
  background: color-mix(in srgb, var(--accent) 24%, var(--surface));
  border-left-color: var(--accent-strong);
  pointer-events: none;
  z-index: 4;
  box-shadow: var(--shadow-lg);
}
.cal-event.compact { display: flex; align-items: center; padding-top: 0; padding-bottom: 0; }
.cal-event.auto {
  pointer-events: none;
  z-index: 0;
  border-left-style: dashed;
  color: var(--text-2);
  background: repeating-linear-gradient(-45deg, color-mix(in srgb, var(--c) 7%, var(--surface)) 0 7px, color-mix(in srgb, var(--c) 13%, var(--surface)) 7px 14px);
}
.month-ev.auto { opacity: 0.6; }
.cal-event.compact .ev-title { font-size: 11px; }
.ev-title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-time, .ev-sub { color: var(--text-2); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.ev-project { font-weight: 700; color: color-mix(in srgb, var(--c) 72%, var(--text)); }

/* Billable: thin diagonal bands the other way from the running timer, and a "$" badge.
   Invoiced: faded and greyed, with a tick. */
.cal-event.billable {
  background-image: repeating-linear-gradient(45deg, color-mix(in srgb, var(--c) 30%, transparent) 0 2px, transparent 2px 8px);
}
.cal-event.running.billable {
  background-image:
    repeating-linear-gradient(45deg, color-mix(in srgb, var(--c) 30%, transparent) 0 2px, transparent 2px 8px),
    repeating-linear-gradient(-45deg, transparent 0 6px, color-mix(in srgb, var(--c) 14%, transparent) 6px 12px);
}
.cal-event.invoiced {
  background: color-mix(in srgb, var(--c) 5%, var(--surface-2));
  border-left-color: color-mix(in srgb, var(--c) 30%, var(--border-strong));
  color: var(--muted);
}
.cal-event.invoiced:hover { background: color-mix(in srgb, var(--c) 10%, var(--surface-2)); }
.cal-event.invoiced .ev-title { font-weight: 600; }
.cal-event.invoiced .ev-time, .cal-event.invoiced .ev-sub { color: var(--muted); }
.cal-event.invoiced .ev-project { color: inherit; }
.cal-event.billable .ev-title, .cal-event.invoiced .ev-title { padding-right: 18px; }
.ev-bill {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  color: var(--muted);
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--border-strong);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.1s;
  z-index: 1;
}
.cal-event:hover .ev-bill, .ev-bill:focus-visible, .cal-event.billable .ev-bill, .cal-event.invoiced .ev-bill { opacity: 1; }
.cal-event.billable .ev-bill { background: var(--c); color: #fff; box-shadow: none; }
.cal-event.invoiced .ev-bill { background: transparent; color: var(--good-text); box-shadow: none; cursor: default; }
.cal-event.compact .ev-bill { top: 50%; transform: translateY(-50%); width: 15px; height: 15px; font-size: 10px; }
.month-ev.billable .month-ev-title::after { content: ' $'; font-weight: 800; color: color-mix(in srgb, var(--c) 72%, var(--text)); }
.month-ev.invoiced { opacity: 0.5; }
.ev-handle { position: absolute; left: 0; right: 0; height: 7px; cursor: ns-resize; }
.ev-handle.top { top: 0; }
.ev-handle.bottom { bottom: 0; }
.now-line { position: absolute; left: -1px; right: 0; height: 2px; background: var(--now); z-index: 4; pointer-events: none; }
.now-line::before {
  content: "";
  position: absolute;
  left: -5px;
  top: -4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--now);
}

.month { display: flex; flex-direction: column; flex: 1; min-height: 0; padding: 0 16px 16px; }
.month-heads { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.month-head { text-align: left; padding: 10px 10px 6px 14px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; }
.month-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-template-rows: repeat(6, minmax(92px, 1fr));
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
  overflow: auto;
}
.month-cell {
  border: 0;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  padding: 6px 7px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
  min-width: 0;
  color: var(--text);
}
.month-cell:hover { background: var(--hover); }
.month-cell.other { background: var(--surface-2); color: var(--muted); }
.month-cell-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 2px; }
.month-date { font-size: 13px; font-weight: 600; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; }
.month-cell.today .month-date { background: var(--now); color: #fff; }
.month-total { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.month-ev { display: flex; gap: 5px; align-items: center; font-size: 11.5px; white-space: nowrap; overflow: hidden; min-width: 0; }
.month-ev-time { color: var(--muted); font-variant-numeric: tabular-nums; }
.month-ev-title { overflow: hidden; text-overflow: ellipsis; }
.month-more { font-size: 11px; color: var(--muted); font-weight: 600; }

/* ---------------------------------------------------------------- dashboard */
.dash-controls { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.dash-controls-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.period-nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.period-label { font-weight: 700; font-size: 15px; min-width: 150px; text-align: center; }
.filter-label { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 600; }

.kpis { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.kpi-label { font-size: 13px; color: var(--text-2); font-weight: 600; }
.kpi-value { font-size: 24px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.kpi-hero .kpi-value { font-size: 44px; line-height: 1.1; letter-spacing: -0.03em; }
.kpi-text { display: flex; align-items: center; gap: 8px; font-size: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-text .dot { width: 11px; height: 11px; }
.kpi-sub { font-size: 12.5px; margin-top: 2px; }
.kpi-delta { font-size: 13px; font-weight: 600; margin-top: 4px; color: var(--text-2); }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 16px; align-items: start; }

.donut-layout { display: flex; gap: 28px; align-items: center; flex-wrap: wrap; }
.donut-wrap { position: relative; flex: none; }
.donut-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; }
.donut-value { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.donut-label { font-size: 12px; color: var(--muted); }
.donut-slice { stroke: var(--surface); stroke-width: 2; cursor: pointer; transition: opacity 0.15s; }
.donut.hovering .donut-slice:not(.hot) { opacity: 0.4; }
.donut-empty { stroke: var(--track); }
.legend { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 1px; }
.legend-row {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto 50px;
  gap: 10px;
  align-items: center;
  padding: 6px 8px;
  border: 0;
  background: none;
  border-radius: 6px;
  text-align: left;
  font-size: 13px;
}
.legend-row:hover:not(:disabled) { background: var(--hover); }
.legend-row:disabled { opacity: 1; }
.legend-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.legend-value { font-variant-numeric: tabular-nums; font-weight: 600; }
.legend-pct { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.legend-inline { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.legend-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; }

.bars { display: flex; flex-direction: column; padding-left: 40px; }
.bars-plot { position: relative; height: var(--bars-h); }
.bars-grid { position: absolute; inset: 0; pointer-events: none; }
.bars-tick { position: absolute; left: 0; right: 0; border-top: 1px solid var(--grid-line); }
.bars-tick-label {
  position: absolute;
  left: -40px;
  width: 34px;
  text-align: right;
  transform: translateY(-50%);
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.bars-cols { position: absolute; inset: 0; display: flex; align-items: flex-end; gap: 2px; }
.bar-col { flex: 1; height: 100%; display: flex; align-items: flex-end; justify-content: center; border-radius: 4px; min-width: 0; }
.bar-col:hover { background: var(--hover); }
.bar-col.clickable { cursor: pointer; }
.bar {
  width: min(24px, 72%);
  display: flex;
  flex-direction: column-reverse;
  gap: 2px;
  border-radius: 4px 4px 0 0;
  overflow: hidden;
}
.bar-seg { flex-basis: 0; min-height: 1px; }
.bars-labels { display: flex; gap: 2px; margin-top: 6px; }
.bar-label { flex: 1; min-width: 0; text-align: center; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: visible; }
.chart-scroll { overflow-x: auto; padding: 10px 0 6px; }
.chart-scroll .bars { min-width: 100%; width: max-content; }

.strip { display: flex; height: 10px; border-radius: 5px; overflow: hidden; gap: 2px; min-width: 140px; }
.strip-seg { min-width: 2px; }

.progress { position: relative; height: 8px; border-radius: 4px; background: var(--track); }
.progress-fill { height: 100%; border-radius: 4px; background: var(--accent-strong); transition: width 0.3s; }
.progress-met .progress-fill { background: var(--good); }
.progress-ok .progress-fill { background: var(--accent-strong); }
.progress-near .progress-fill { background: var(--warning); }
.progress-over .progress-fill { background: var(--critical); }
.progress-pace { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: var(--text-2); border-radius: 1px; }

.goal-row { padding: 12px 0; border-bottom: 1px solid var(--border); }
.goal-row:last-child { border-bottom: 0; }
.goal-row-head { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; min-width: 0; }
.goal-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.goal-kind { color: var(--muted); font-size: 12px; white-space: nowrap; }
.goal-val { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }
.goal-status { display: flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--text-2); margin-top: 7px; }
.goal-status.ok { color: var(--good-text); font-weight: 600; }
.goal-status.bad { color: var(--critical); font-weight: 600; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left;
  font-weight: 700;
  color: var(--muted);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table td:first-child { display: table-cell; }
.table td .dot, .table td .pillar-mark { margin-right: 9px; vertical-align: middle; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row-pillar td { background: var(--surface-2); }
.row-project td:first-child { padding-left: 32px; }
.row-task td { font-size: 13px; color: var(--text-2); }
.row-task td:first-child { padding-left: 54px; }
.bar-cell { width: 150px; }
.mini-bar { height: 6px; width: 130px; background: var(--track); border-radius: 3px; overflow: hidden; }
.mini-bar > div { height: 100%; border-radius: 3px; }
.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--hover); }
.strip-cell { width: 40%; min-width: 160px; }
.top-series { display: inline-flex; align-items: center; gap: 0; white-space: nowrap; }
.goal-badge { font-weight: 700; font-size: 12px; padding: 2px 8px; border-radius: 10px; background: var(--surface-2); }
.goal-badge.ok { background: color-mix(in srgb, var(--good) 18%, var(--surface)); color: var(--good-text); }
.goal-badge.bad { background: color-mix(in srgb, var(--critical) 14%, var(--surface)); color: var(--critical); }

/* ---------------------------------------------------------------- projects */
.toolbar { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.search-input { width: 260px; }
.pillars { display: flex; flex-direction: column; }
.pillar-card { padding: 0; overflow: hidden; }
.pillar-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 10px 12px 16px;
  border-bottom: 1px solid var(--border);
  box-shadow: inset 4px 0 0 var(--c, #9aa0a8);
}
.pillar-name { margin: 0; font-size: 16px; font-weight: 700; }
.pillar-meta { font-size: 12.5px; }
.pillar-total { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }
.project-list { display: flex; flex-direction: column; }
.project-row { display: flex; align-items: center; gap: 10px; padding: 6px 10px 6px 28px; border-bottom: 1px solid var(--border); }
.project-row:hover { background: var(--hover); }
.project-name { flex: 1; min-width: 0; border: 0; background: none; text-align: left; padding: 4px 0; font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.project-total { font-variant-numeric: tabular-nums; color: var(--text-2); }
.project-meta { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45%; }
.client-mark { display: inline-flex; color: var(--c); flex: none; margin-left: -3px; }
.clients-card .pillar-meta { flex: 1; }
.add-project {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: none;
  color: var(--accent-text);
  font-weight: 600;
  padding: 10px 28px;
  text-align: left;
  font-size: 13px;
}
.add-project:hover { background: var(--hover); }
.archived { opacity: 0.6; }
.onboarding { background: var(--surface); border: 1px dashed var(--border-strong); border-radius: 14px; }

/* ---------------------------------------------------------------- goals */
.goal-section { margin-bottom: 24px; }
.section-title { font-size: 15px; font-weight: 800; margin: 0 0 12px; }
.goal-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.goal-card { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.goal-card-head { display: flex; align-items: center; gap: 8px; }
.goal-card-head h3 { margin: 0; font-size: 15px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.goal-kind-line { color: var(--text-2); font-size: 13px; }
.goal-figure { font-variant-numeric: tabular-nums; }
.goal-big { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; }
.goal-history { display: flex; align-items: center; gap: 8px; font-size: 12px; margin-top: 4px; flex-wrap: wrap; }
.hist-dots { display: inline-flex; gap: 4px; }
.hist-dot {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  background: var(--track);
  color: #fff;
}
.hist-dot.ok { background: var(--good); }
.streak { font-weight: 700; color: var(--good-text); }

/* ---------------------------------------------------------------- settings */
.settings-card h2 { margin: 0 0 4px; font-size: 16px; }
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.setting-row:last-child { border-bottom: 0; padding-bottom: 0; }
.setting-text { flex: 1; min-width: 220px; }
.setting-label { font-weight: 600; }
.setting-hint { font-size: 12.5px; margin-top: 2px; max-width: 460px; }
.setting-warn { color: var(--critical); }
.pw-form { display: flex; flex-direction: column; gap: 8px; width: 280px; max-width: 100%; }
.import-result p { margin: 0 0 8px; }

/* ---------------------------------------------------------------- invoicing */
.billing-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.billing-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
}
.billing-chip:hover { background: var(--hover); }
.billing-chip.active { border-color: var(--accent-strong); color: var(--text); box-shadow: 0 0 0 1px var(--accent-strong); }
.billing-chip .nav-badge { margin-left: 0; color: var(--accent-text); }
.billing { display: flex; flex-direction: column; gap: 16px; }
.billing-month { padding-bottom: 8px; }
.billing-month-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.billing-month-head h2 { margin: 0; font-size: 17px; }
.billing-total { font-weight: 700; font-variant-numeric: tabular-nums; margin-right: auto; }
.billing-month.is-invoiced .billing-month-head h2 { color: var(--text-2); }
.billing-client { border-top: 1px solid var(--border); padding: 8px 0 4px; }
.billing-client-head { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-weight: 700; cursor: pointer; }
.billing-client-name { flex: 1; min-width: 0; }
.billing-sum { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.billing-project { margin: 2px 0 6px 26px; }
.billing-project-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 0; }
.billing-entry {
  display: grid;
  grid-template-columns: 18px 92px minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
  font-size: 13.5px;
  border-bottom: 1px dashed var(--border);
}
.billing-entry:last-child { border-bottom: 0; }
.billing-check { accent-color: var(--accent-strong); width: 16px; height: 16px; margin: 0; cursor: pointer; }
.billing-date { color: var(--text-2); white-space: nowrap; }
.billing-desc { border: 0; background: none; padding: 0; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.billing-desc:hover { text-decoration: underline; }
.billing-time, .billing-when { font-size: 12.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.billing-dur { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 70px; text-align: right; }
.billing-toggle { align-self: flex-start; }
/* Ticked: greyed and crossed out where it was, so you can see what you just did. */
.billing-entry.is-done { opacity: 0.55; }
.billing-entry.is-done .billing-desc, .billing-entry.is-done .billing-dur { text-decoration: line-through; }
.billing-entry .billing-when { display: inline-flex; align-items: center; gap: 4px; color: var(--good-text); }
.billing-client.is-done .billing-client-head { color: var(--muted); }
.billing-all-done { display: inline-flex; align-items: center; gap: 6px; color: var(--good-text); }
.billing-done-now { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 600; color: var(--good-text); background: color-mix(in srgb, var(--good) 12%, transparent); padding: 2px 8px; border-radius: 999px; }
.billing-section { font-size: 15px; margin: 8px 0 0; color: var(--text-2); }

/* $ toggles in the timer bar, entry editor and entry list */
.timer-bill, .bill-btn, .entry-bill {
  font-weight: 800;
  color: var(--muted);
}
.timer-bill {
  border: 0;
  background: transparent;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 16px;
  flex: none;
}
.timer-bill:hover { background: var(--hover); }
.timer-bill.on, .bill-btn.on, .entry-bill.on { color: var(--accent-text); }
.timer-bill.on { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.bill-btn { height: auto; min-height: 36px; padding: 6px 12px; border: 1px dashed var(--border-strong); font-size: 13px; gap: 6px; }
.bill-btn.on { border-style: solid; border-color: var(--accent-strong); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.bill-invoiced { align-self: center; }
.entry-bill { font-size: 14px; opacity: 0; }
.entry-row:hover .entry-bill, .entry-bill:focus-visible, .entry-bill.on, .entry-bill.done { opacity: 1; }
.entry-bill.done { color: var(--good-text); }

/* ---------------------------------------------------------------- layers */
.popover {
  position: fixed;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  min-width: 180px;
  max-width: calc(100vw - 16px);
  max-height: calc(100vh - 16px);
  overflow: auto;
  color: var(--text);
  animation: pop-in 0.12s ease-out;
}
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px); } }
/* On a short window the list shrinks and scrolls instead of leaving the screen. */
.picker-pop { width: 330px; overflow: hidden; display: flex; flex-direction: column; }
.picker { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; }
.picker > :not(.picker-list) { flex: none; }
.picker-search {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--border);
  padding: 13px 14px;
  font-size: 14px;
  background: transparent;
  outline: none;
}
.picker-list { max-height: 330px; overflow-y: auto; padding: 6px; min-height: 0; flex: 1 1 auto; overscroll-behavior: contain; }
.picker-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 10px;
  border: 0;
  background: none;
  border-radius: 6px;
  text-align: left;
  font-size: 13.5px;
}
.picker-item.active { background: var(--hover); }
.picker-item.selected .picker-label { font-weight: 700; }
.picker-pillar .picker-label { font-weight: 700; }
.picker-project { padding-left: 30px; }
.picker-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.picker-header { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); padding: 10px 10px 4px; font-weight: 700; }
.picker-check { color: var(--accent-strong); }
.picker-meta { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40%; }
.picker-context { display: flex; align-items: center; gap: 8px; padding: 10px 14px 0; font-size: 12.5px; font-weight: 600; }
.picker-create-item { color: var(--accent-text); font-weight: 700; }
.picker-empty { padding: 18px; color: var(--muted); font-size: 13px; text-align: center; }
.picker-create {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 0;
  border-top: 1px solid var(--border);
  width: 100%;
  padding: 12px 14px;
  background: none;
  color: var(--accent-text);
  font-weight: 700;
  text-align: left;
}
.picker-create:hover { background: var(--hover); }

.menu { padding: 6px; min-width: 190px; }
.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  background: none;
  border-radius: 6px;
  font-size: 13.5px;
  text-align: left;
}
.menu-item:hover { background: var(--hover); }
.menu-item .icon { color: var(--text-2); }
.menu-item.danger, .menu-item.danger .icon { color: var(--critical); }
.menu-sep { height: 1px; background: var(--border); margin: 4px 0; }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(23, 8, 30, 0.45);
  display: grid;
  place-items: center;
  padding: 16px;
  animation: fade-in 0.12s ease-out;
}
@keyframes fade-in { from { opacity: 0; } }
.modal {
  width: min(470px, 100%);
  max-height: calc(100vh - 32px);
  overflow: auto;
  background: var(--surface);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  animation: pop-in 0.14s ease-out;
}
.modal-wide { width: min(720px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 16px 6px 22px; }
.modal-title { margin: 0; font-size: 18px; font-weight: 800; }
.modal-body { padding: 8px 22px 16px; }
.modal-foot { display: flex; justify-content: flex-end; align-items: center; gap: 8px; padding: 12px 22px 20px; flex-wrap: wrap; }
.confirm-text { margin: 0; color: var(--text-2); }

.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: 12px; font-weight: 700; color: var(--text-2); }
.field-hint { font-size: 12px; color: var(--muted); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field[hidden] { display: none; }
.form-error { color: var(--critical); font-size: 13px; font-weight: 600; }

.swatches { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; }
.swatch {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--c);
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--border-strong);
  padding: 0;
}
.swatch.selected { box-shadow: 0 0 0 2px var(--text); }
.swatch-custom-wrap {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  overflow: hidden;
  position: relative;
  box-shadow: 0 0 0 1px var(--border-strong);
  background: conic-gradient(#e34948, #eda100, #1baf7a, #2a78d6, #6250d6, #e87ba4, #e34948);
  cursor: pointer;
}
.swatch-custom { opacity: 0; width: 100%; height: 100%; cursor: pointer; border: 0; padding: 0; }

.entry-editor { display: flex; flex-direction: column; gap: 12px; }
.editor-times { display: grid; grid-template-columns: 1.35fr 1fr 1fr 1fr; gap: 8px; }
.project-btn { justify-content: flex-start; height: auto; min-height: 36px; padding: 6px 10px; border: 1px dashed var(--border-strong); min-width: 0; }
.editor-assign { display: flex; gap: 8px; flex-wrap: wrap; }
.editor-assign .project-btn { flex: 1 1 auto; }
.task-btn { height: auto; min-height: 36px; padding: 6px 10px; border: 1px dashed var(--border-strong); color: var(--muted); font-size: 13px; max-width: 100%; min-width: 0; }
.task-btn[hidden] { display: none; }
.task-btn.has-value { color: var(--text-2); font-weight: 600; border-style: solid; }
.task-btn-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-editor { display: flex; flex-direction: column; gap: 6px; }
.task-list { display: flex; flex-direction: column; gap: 6px; }
.task-list:empty { display: none; }
.task-row { display: flex; align-items: center; gap: 8px; }
.task-row .input { flex: 1; min-width: 0; }
.add-task { align-self: flex-start; }
.day-hint { color: var(--accent-text); font-weight: 800; }
.editor-foot { display: flex; align-items: center; gap: 6px; width: 100%; }
.spacer { flex: 1; }
.editor-pop { width: 470px; }
.editor-pop-inner { padding: 16px 16px 14px; }
.editor-title { font-weight: 800; font-size: 15px; margin-bottom: 10px; }
.editor-pop .editor-foot { margin-top: 14px; }

.toasts {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 3000;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--toast-bg);
  color: #fff;
  padding: 8px 8px 8px 16px;
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  pointer-events: auto;
  animation: pop-in 0.15s ease-out;
  transition: opacity 0.18s, transform 0.18s;
  max-width: calc(100vw - 32px);
}
.toast-error { background: #a3262a; }
.toast.leaving { opacity: 0; transform: translateY(6px); }
.toast-action { border: 0; background: none; color: var(--toast-accent); font-weight: 800; padding: 4px 6px; }
.toast .icon-btn { width: 26px; height: 26px; color: rgba(255, 255, 255, 0.7); }
.toast .icon-btn:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }

.tooltip {
  position: fixed;
  z-index: 4000;
  pointer-events: none;
  background: var(--tooltip-bg);
  color: var(--tooltip-fg);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12.5px;
  box-shadow: var(--shadow-lg);
  min-width: 150px;
  max-width: 320px;
}
.tip-title { font-weight: 800; margin-bottom: 4px; }
.tip-row { display: grid; grid-template-columns: 9px minmax(0, 1fr) auto auto; gap: 8px; align-items: center; }
.tip-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tip-value { font-variant-numeric: tabular-nums; font-weight: 600; }
.tip-pct { opacity: 0.7; font-variant-numeric: tabular-nums; }
.tip-total { display: flex; justify-content: space-between; gap: 12px; border-top: 1px solid color-mix(in srgb, var(--tooltip-fg) 20%, transparent); margin-top: 5px; padding-top: 5px; font-weight: 700; }
.tooltip .dot { box-shadow: 0 0 0 1px color-mix(in srgb, var(--tooltip-fg) 40%, transparent); }

/* ---------------------------------------------------------------- auth */
.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
  background:
    radial-gradient(circle at 18% 12%, rgba(226, 96, 12, 0.22), transparent 45%),
    radial-gradient(circle at 85% 90%, rgba(244, 180, 0, 0.2), transparent 45%),
    var(--sidebar-bg);
}
.auth-card {
  width: min(410px, 100%);
  background: var(--surface);
  border-radius: 18px;
  padding: 32px;
  box-shadow: var(--shadow-lg);
}
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 26px; font-weight: 800; margin-bottom: 18px; letter-spacing: -0.02em; text-align: center; }
.auth-logo { width: min(240px, 70%); height: auto; }
.auth-by { font-size: 12.5px; font-weight: 600; color: var(--muted); letter-spacing: 0.01em; }
.logo { display: block; flex: none; height: auto; }
.auth-card h1 { margin: 0 0 6px; font-size: 22px; }
.auth-card p { margin: 0; }
.auth-form { display: flex; flex-direction: column; gap: 10px; margin-top: 22px; }
.auth-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 22px; font-size: 12.5px; }
.auth-foot .muted { display: inline-flex; align-items: center; gap: 4px; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: 1fr 1fr; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .cal-hint { display: none; }
}

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .sidebar { flex-direction: row; align-items: center; padding: 8px 10px; gap: 4px; overflow-x: auto; overflow-y: hidden; }
  .brand { flex-direction: row; padding: 0 6px 0 2px; font-size: 0; }
  .brand .logo { width: 46px; padding: 0; }
  .brand-text { display: none; }
  .brand-by { display: none; }
  .nav { flex-direction: row; gap: 2px; }
  .nav-section { display: none; }
  .nav-sub { display: none; }
  .sidebar-alert { margin: 0; padding: 6px 8px; flex: none; }
  .sidebar-alert-head span, .sidebar-alert-text, .sidebar-alert-days, .sidebar-alert-more { display: none; }
  .billing-entry { grid-template-columns: 18px minmax(0, 1fr) auto; }
  .billing-date, .billing-time, .billing-when { display: none; }
  .nav-item { padding: 8px 10px; gap: 6px; font-size: 13px; white-space: nowrap; }
  .nav-item span { display: none; }
  .nav-item.active span { display: inline; }
  .sidebar-running { margin: 0 0 0 auto; padding: 4px 6px; }
  .running-text { display: none; }
  .sidebar-foot { border: 0; margin: 0 !important; padding: 0; gap: 4px; }
  .container { padding: 18px 16px 40px; }
  .timer-bar { flex-wrap: wrap; padding: 10px 16px; gap: 8px; }
  .timer-desc { flex-basis: 100%; }
  /* Project and task share what is left of the second row instead of wrapping it. */
  .timer-project, .timer-task { flex: 1 1 0; max-width: none; }
  .timer-elapsed { margin-left: auto; }
  .is-manual .timer-manual { flex-wrap: wrap; }
  .entry-row { flex-wrap: wrap; }
  .entry-main { flex-basis: 100%; flex-wrap: wrap; row-gap: 0; }
  .entry-desc { max-width: 100%; }
  .entry-meta { margin-left: auto; }
  .entry-meta .icon-btn, .entry-play { opacity: 1; }
  .day-total { padding-right: 0; }
  .cal-toolbar { padding: 8px 12px; gap: 8px; }
  .cal-title { font-size: 16px; margin-left: 4px; }
  .editor-times { grid-template-columns: 1fr 1fr; }
  .editor-pop { width: calc(100vw - 16px); }
  .kpi-hero .kpi-value { font-size: 34px; }
  .month { padding: 0 6px 8px; }
  .month-ev-time { display: none; }
  .search-input { width: 100%; }
  .bar-cell, .mini-bar { width: 70px; }
  .today-goals { justify-content: flex-start; }
}

@media (max-width: 520px) {
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi-hero { grid-column: 1 / -1; }
  .lang-switch { display: none; }
  .field-row { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
