/* Fonts — locali in fonts/ */
@font-face { font-family: 'Geist'; src: url('fonts/Geist-Light.woff2') format('woff2'); font-weight: 300; font-style: normal; font-display: swap; }
@font-face { font-family: 'Geist'; src: url('fonts/Geist-Regular.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Geist'; src: url('fonts/Geist-Medium.woff2') format('woff2'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'Geist Pixel Square'; src: url('fonts/GeistPixel-Square.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Geist Pixel Grid'; src: url('fonts/GeistPixel-Grid.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }

/* WorkLog — styles. Tokens follow DESIGN.md (warm paper canvas, white cards,
   hairline alpha borders, one blue primary action, alpha-based ink hierarchy). */

:root {
  /* Surfaces */
  --canvas: #f9f9f9;       /* main content area */
  --chrome: #f4f4f4;       /* sidebar and top bar */
  --surface: #ffffff;
  --surface-sunk: #fbfaf9;

  /* Ink — one color, hierarchy through alpha */
  --ink: rgba(0, 0, 0, 0.92);
  --ink-2: rgba(0, 0, 0, 0.62);
  --ink-3: rgba(0, 0, 0, 0.55);
  --ink-4: rgba(0, 0, 0, 0.3);

  /* Lines and states */
  --border: rgba(0, 0, 0, 0.08);
  --border-2: rgba(0, 0, 0, 0.14);
  --hover: rgba(0, 0, 0, 0.04);
  --press: rgba(0, 0, 0, 0.07);

  /* Brand */
  --blue: #0075de;
  --blue-hover: color-mix(in oklch, #0075de 86%, black);
  --blue-tint: #e6f3fe;
  --blue-tint-hover: color-mix(in oklch, #e6f3fe 88%, #0075de);
  --midnight: #02093a;

  /* Semantic */
  --pos: #1f7a4d;
  --pos-tint: #e8f4ec;
  --neg: #c9301b;
  --neg-tint: #fdecea;
  --warn: #8a5a00;
  --warn-tint: #fdf1d6;
  --neutral-tint: rgba(0, 0, 0, 0.05);
  --track: #e9e9e9;

  /* Shape */
  --r-sm: 4px;
  --r-btn: 8px;
  --r-card: 12px;

  --font: 'Geist', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-pixel: 'Geist Pixel Square', 'Geist', ui-monospace, monospace;
  --font-pixel-grid: 'Geist Pixel Grid', 'Geist', ui-monospace, monospace;
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --sidebar-w: 232px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.43;
  font-variant-numeric: lining-nums;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, p { margin: 0; }
/* Peso massimo 500: anche gli elementi che il browser mette in grassetto */
b, strong, h1, h2, h3, h4, h5, h6, th, optgroup { font-weight: 500; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--blue-tint); }
.num { font-variant-numeric: tabular-nums; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.muted { color: var(--ink-3); }
[hidden] { display: none !important; }

:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: var(--r-sm); }

.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 50;
  background: var(--surface); padding: 8px 12px; border-radius: var(--r-btn);
  border: 1px solid var(--border-2);
}
.skip-link:focus { top: 12px; }

/* ---------- Layout ---------- */

.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100dvh; }

.sidebar {
  position: sticky; top: 0; height: 100dvh;
  display: flex; flex-direction: column; gap: 8px;
  padding: 16px 12px;
  border-right: 1px solid var(--border);
  background: var(--chrome);
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: 4px; padding-bottom: 8px; }
.brand {
  display: flex; align-items: center; gap: 10px; min-width: 0;
  padding: 6px 10px; border-radius: var(--r-btn);
  font-size: 15px; font-weight: 500; letter-spacing: -0.01em;
}
.brand-mark {
  width: 22px; height: 22px; border-radius: 6px; background: var(--midnight);
  position: relative;
}
.brand-mark::after {
  content: ''; position: absolute; inset: 6px 6px auto auto;
  width: 6px; height: 6px; border-radius: 50%; background: #ffb110;
}

#nav { display: flex; flex-direction: column; gap: 2px; flex: 1; min-height: 0; overflow-y: auto; margin-inline: -4px; padding-inline: 4px; scrollbar-width: thin; }

/* Clients in the sidebar */
.nav-sep { height: 1px; background: var(--border); margin: 10px 4px; flex-shrink: 0; }
.nav-group-head {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  padding: 4px 10px 6px; border: 0; background: transparent; border-radius: var(--r-btn); cursor: pointer;
  font-size: 12px; font-weight: 500; color: var(--ink-3);
}
.nav-group-head:hover { color: var(--ink); }
.nav-group-head svg { transition: transform 150ms var(--ease-out); }
.nav-group-head[aria-expanded='false'] svg { transform: rotate(-90deg); }
.nav-client-list, .nav-projects { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.nav-client-list { margin-bottom: 2px; }
button.nav-item { width: 100%; border: 0; background: transparent; cursor: pointer; text-align: start; font: inherit; }
.nav-item .trunc { flex: 1; }
.client-mark {
  width: 20px; height: 20px; flex-shrink: 0; display: grid; place-items: center; border-radius: 6px;
  font-size: 11px; font-weight: 500; color: var(--tint);
  background: color-mix(in oklch, var(--tint) 16%, white);
}
img.client-mark { object-fit: contain; background: var(--surface); outline: 1px solid rgb(0 0 0 / 0.1); outline-offset: -1px; }
.client-title { display: flex; align-items: center; gap: 12px; }
.logo-field { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.logo-preview { display: inline-flex; }
.label-like { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.nav-projects { padding-left: 18px; margin: 2px 0 4px; }
.nav-project { font-weight: 400; padding-block: 6px; }
.nav-project svg { color: var(--ink-3); }
.nav-project[aria-current='page'] { font-weight: 500; }
.nav-add { color: var(--ink-3); font-weight: 400; font-size: 13px; }
.nav-add svg { margin-inline: 2px; }
.nav-projects .nav-add { padding-block: 5px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: var(--r-btn);
  color: var(--ink-2); font-weight: 500;
  transition: background-color 150ms, color 150ms;
}
.nav-item svg { color: var(--ink-3); flex-shrink: 0; transition: color 150ms; }
.nav-item:hover { background: var(--hover); color: var(--ink); }
.nav-settings { margin-top: auto; }
.l-short { display: none; }
.nav-item[aria-current='page'] { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--border); }
.nav-item[aria-current='page'] svg { color: var(--blue); }
.nav-label {
  font-size: 11px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-3); padding: 16px 10px 6px;
}

.sidebar-foot { display: flex; flex-direction: column; gap: 8px; }
.today-card {
  background: linear-gradient(to top right, var(--midnight), var(--blue)); color: #fff; border-radius: var(--r-card);
  padding: 14px; display: flex; flex-direction: column; gap: 2px;
}
.today-card .label { font-size: 12px; color: rgba(255, 255, 255, 0.75); }
.today-card .value { font-family: var(--font-pixel); font-size: 24px; font-weight: 400; letter-spacing: 0; line-height: 1.2; font-variant-numeric: tabular-nums; }
.today-card .sub { font-size: 12px; color: rgba(255, 255, 255, 0.75); }

.main-col { min-width: 0; display: flex; flex-direction: column; }
main { flex: 1; background: var(--canvas); }
main:focus, main:focus-visible { outline: none; }
.page { padding: 28px 32px 64px; display: flex; flex-direction: column; gap: 32px; }

/* ---------- Timer bar ---------- */

.topbar {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--chrome) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 12px 32px;
}
.timer {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-card); padding: 6px 6px 6px 14px;
  transition: border-color 150ms;
}
.timer:focus-within { border-color: var(--border-2); }
.timer-desc {
  flex: 1; min-width: 0; border: 0; background: transparent; padding: 8px 0;
  font-size: 16px; outline: none;
}
.timer-desc::placeholder { color: var(--ink-3); }
.timer-project {
  max-width: 260px; border: 0; background: var(--hover); border-radius: var(--r-btn);
  padding: 7px 28px 7px 10px; color: var(--ink-2); font-weight: 500; cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-opacity='.5' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
  transition: background-color 150ms;
}
.timer-project:hover { background-color: var(--press); }
.timer-clock {
  font-size: 16px; font-weight: 500; font-variant-numeric: tabular-nums;
  min-width: 82px; text-align: right; color: var(--ink-3); padding: 0 6px;
  display: flex; align-items: center; gap: 8px; justify-content: flex-end;
}
.timer.is-running .timer-clock { color: var(--ink); }
/* Billable toggle: blue when on, muted with a strike when off (Toggl's € switch) */
.timer-billable, .billable-btn { color: var(--ink-4); }
.timer-billable { width: 38px; height: 38px; flex-shrink: 0; }
.timer-billable.on, .billable-btn.on { color: var(--blue); }
.timer-billable:not(.on) svg, .billable-btn:not(.on) svg { opacity: 0.7; }
.timer-billable.on:hover, .billable-btn.on:hover { background: var(--blue-tint); color: var(--blue); }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: #f64932; flex-shrink: 0; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.3; } }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px; border-radius: var(--r-btn); border: 0;
  font-size: 14px; font-weight: 500; white-space: nowrap; cursor: pointer;
  transition: background-color 150ms, color 150ms, transform 100ms var(--ease-out);
  user-select: none;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { cursor: default; transform: none; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-hover); }
.btn-ghost { background: var(--blue-tint); color: var(--blue); }
.btn-ghost:hover { background: var(--blue-tint-hover); }
.btn-text { background: transparent; color: var(--ink); }
.btn-text:hover { background: var(--hover); }
.btn-danger { background: transparent; color: var(--neg); }
.btn-danger:hover { background: var(--neg-tint); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 13px; }
.timer-btn { height: 38px; min-width: 92px; }

.icon-btn {
  position: relative;
  width: 30px; height: 30px; display: inline-grid; place-items: center;
  border: 0; background: transparent; border-radius: var(--r-btn);
  color: var(--ink-3); cursor: pointer;
  transition: background-color 150ms, color 150ms, transform 100ms var(--ease-out);
}
.icon-btn::before { content: ''; position: absolute; inset: -3px; } /* larger hit area */
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.icon-btn:active { transform: scale(0.92); }
.icon-btn.danger:hover { background: var(--neg-tint); color: var(--neg); }
.icon-btn.play:hover { background: var(--blue-tint); color: var(--blue); }

.link { color: var(--blue); font-weight: 500; border-radius: var(--r-sm); }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Page head, sections ---------- */

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head h1 { font-family: var(--font-pixel); font-size: 30px; font-weight: 400; letter-spacing: 0; line-height: 1.15; }
.page-head .sub { color: var(--ink-2); margin-top: 4px; }
.page-head .actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-weight: 500; margin-bottom: 10px; border-radius: var(--r-sm); }
.back:hover { color: var(--ink); }

.section { display: flex; flex-direction: column; gap: 12px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.section-head h2 { font-size: 16px; font-weight: 500; letter-spacing: -0.01em; }

/* Segmented control (tabs for views of the same data) */
.seg { display: inline-flex; background: var(--press); border-radius: var(--r-btn); padding: 2px; gap: 2px; }
.seg button {
  border: 0; background: transparent; padding: 5px 12px; border-radius: 6px;
  font-size: 13px; font-weight: 500; color: var(--ink-2); cursor: pointer;
  transition: background-color 150ms, color 150ms;
}
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed='true'] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 0 0 1px var(--border); }
.seg .count { color: var(--ink-3); margin-left: 4px; font-variant-numeric: tabular-nums; }

/* ---------- Cards ---------- */

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); }
.card-pad { padding: 20px; }

/* Numbers sit in one block, split by hairline dividers (the gap shows the container's line color). */
.stats {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px;
  background: var(--border); background-clip: padding-box; /* else the gap color also paints under the border and doubles it */
  border: 1px solid var(--border); border-radius: var(--r-card); overflow: hidden;
}
.stats > .stat { border: 0; border-radius: 0; background: var(--surface); }
.stats.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat { padding: 18px 20px; display: flex; flex-direction: column; gap: 4px; }
.stat .label { font-size: 13px; color: var(--ink-2); font-weight: 500; display: flex; align-items: center; gap: 8px; margin-bottom: auto; padding-bottom: 12px; }
.stat .label svg { color: var(--ink-3); flex-shrink: 0; }
.stat .value { font-family: var(--font-pixel); font-size: 26px; font-weight: 400; letter-spacing: 0; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat .value small { font-family: var(--font); font-size: 15px; font-weight: 500; color: var(--ink-3); letter-spacing: 0; }
.stat .sub { font-size: 13px; color: var(--ink-3); }
.stat .sub .pos { color: var(--pos); font-weight: 500; }
.stat .sub .neg { color: var(--neg); font-weight: 500; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }

/* Project card (dashboard) — one key number per project */
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.pcard { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 28px; transition: border-color 150ms; }
.pcard:hover { border-color: var(--border-2); }
.pcard-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.pcard-id { min-width: 0; }
.pcard-client { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-3); }
.pcard-title {
  font-size: 15px; font-weight: 500; letter-spacing: -0.01em; margin-top: 6px; text-wrap: balance;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.pcard-title a:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--ink-4); }
.pcard-body { display: flex; flex-direction: column; gap: 10px; margin-top: auto; }
.pcard-figure { display: flex; flex-direction: column; gap: 2px; }
.pcard-num { font-family: var(--font-pixel); font-size: 24px; font-weight: 400; letter-spacing: 0; line-height: 1.2; font-variant-numeric: tabular-nums; }
.pcard-cap { font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.trunc { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live { display: inline-flex; align-items: center; gap: 5px; color: var(--blue); font-weight: 500; white-space: nowrap; }
.live::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.icon-btn.is-running { background: var(--blue-tint); color: var(--blue); }

/* Dashboard tasks */
.section-head .count { font-size: 13px; font-weight: 500; color: var(--ink-3); margin-left: 4px; font-variant-numeric: tabular-nums; }
.btn-soft { background: var(--neutral-tint); color: var(--ink); border-radius: 999px; padding-inline: 14px; }
.btn-soft:hover { background: var(--press); }
.dtable-bar .ui-select--sm { height: 30px; font-size: 13px; padding-block: 0; width: auto; flex: none; max-width: 220px; }

/* Dashboard tables (tasks, recent activity): header bar, grey column header, vertical dividers */
.dtable-card { overflow: hidden; }
.dtable-bar { display: flex; align-items: center; gap: 12px; padding: 12px 16px 12px 20px; }
.dtable-title { display: flex; align-items: center; gap: 10px; white-space: nowrap; flex-shrink: 0; font-size: 17px; font-weight: 500; letter-spacing: -0.01em; }
.dtable-title svg { color: var(--ink-3); }
.dtable-title .count { font-size: 13px; font-weight: 500; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.dtable { width: 100%; border-collapse: collapse; table-layout: fixed; }
.dtable th {
  text-align: start; font-size: 13px; font-weight: 500; color: var(--ink-2);
  background: var(--canvas); padding: 10px 16px; border-block: 1px solid var(--border);
}
.dtable th svg { color: var(--ink-3); vertical-align: -3px; margin-inline-end: 8px; }
.dtable th + th, .dtable td + td { border-inline-start: 1px solid var(--border); }
.dtable td { padding: 8px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.dtable tbody tr { transition: background-color 150ms; }
.dtable tbody tr:hover { background: var(--surface-sunk); }
.dtable tbody tr.is-running { background: var(--blue-tint); }
.dtable tbody tr:last-child td { border-bottom: 0; }
.dtable-tasks th:nth-child(2), .dtable-recent th:nth-child(2) { width: 30%; }
.dtable-tasks th:nth-child(3), .dtable-recent th:nth-child(3) { width: 200px; }
.dtable-recent th:nth-child(4) { width: 150px; }
/* List tables (Progetti, Clienti, Report): same look, own column widths, scroll sideways when narrow */
.dtable-wide { min-width: 860px; }
.dtable-projects th:nth-child(2) { width: 200px; }
.dtable-projects th:nth-child(3) { width: 176px; }
.dtable-projects th:nth-child(4) { width: 120px; }
.dtable-projects th:nth-child(5) { width: 200px; }
.dtable-clients th:nth-child(2) { width: 130px; }
.dtable-clients th:nth-child(3) { width: 110px; }
.dtable-clients th:nth-child(4) { width: 130px; }
.dtable-clients th:nth-child(5) { width: 130px; }
.dtable-clients th:nth-child(6) { width: 180px; }
.dtable-report th:nth-child(2) { width: 180px; }
.dtable-report th:nth-child(3), .dtable-report th:nth-child(4) { width: 120px; }
.dtable-report th:nth-child(5) { width: 110px; }
.dtable-report th:nth-child(6) { width: 140px; }
.dtable-fixed { min-width: 1000px; }
.dtable-fixed th:nth-child(2) { width: 130px; }
.dtable-fixed th:nth-child(3) { width: 110px; }
.dtable-fixed th:nth-child(4) { width: 170px; }
.dtable-fixed th:nth-child(5) { width: 120px; }
.dtable-fixed th:nth-child(6) { width: 170px; }
.dtable-fixed th:nth-child(7) { width: 120px; }
.dtable-wide td { padding-block: 10px; }
.dt-entity { display: flex; align-items: center; gap: 10px; min-width: 0; }
.dt-entity .client-mark { flex-shrink: 0; }
.dt-entity-text { min-width: 0; }
.dt-entity .dt-title { font-weight: 500; }
a.dt-title:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--ink-4); }
.dt-when-inline { display: none; }
.dt-sub:empty { display: none; }
.dt-indent { display: flex; align-items: center; gap: 10px; min-width: 0; padding-inline-start: 6px; }
.dt-indent .dot { margin-inline: 6px 2px; }
.dtable tr.group td { background: var(--canvas); }
.dtable tfoot td { background: var(--canvas); border-top: 1px solid var(--border); border-bottom: 0; font-weight: 500; }
.dt-num { text-align: end !important; font-variant-numeric: tabular-nums; font-weight: 500; white-space: nowrap; }
.dtable th.dt-num svg { display: none; }
.dt-task { display: flex; align-items: center; gap: 8px; min-width: 0; }
.dt-check { flex: 1; display: flex; align-items: center; gap: 12px; min-width: 0; cursor: pointer; }
.dt-check input { width: 18px; height: 18px; accent-color: var(--blue); flex-shrink: 0; cursor: pointer; }
.dt-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.dt-check .dt-title { color: var(--ink-2); }
.dt-sub { font-size: 13px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dt-actions { display: flex; gap: 2px; flex-shrink: 0; }
.dt-proj { font-weight: 500; }
.dt-proj > * { vertical-align: middle; }
.dt-proj .client-mark { display: inline-grid; margin-inline-end: 10px; }
.dt-proj a.trunc { display: inline-block; max-width: calc(100% - 34px); }
.dt-proj a:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--ink-4); }
.dt-when { color: var(--ink-3); font-size: 13px; white-space: nowrap; }
.dtask-edit { opacity: 0; transition: opacity 150ms, background-color 150ms, color 150ms; }
.dtable tr:hover .dtask-edit, .dtask-edit:focus-visible { opacity: 1; }
.dtask-add { border-top: 1px solid var(--border); display: flex; gap: 8px; padding: 10px 12px 10px 20px; }
.dtask-add { flex-wrap: wrap; }
.dtask-add .input { flex: 999 1 220px; min-width: 0; }
.dtask-add .ui-select { width: auto; flex: 1 1 170px; min-width: 0; max-width: 260px; }
.dtask-add .dtask-date { width: 150px; flex: none; }
.dtask-add .dtask-date .ui-select { width: 100%; }

/* Deadline pill */
.due {
  display: inline-flex; align-items: center; gap: 4px; white-space: nowrap;
  font-size: 12px; font-weight: 500; color: var(--ink-3); font-variant-numeric: tabular-nums;
}
.due.today { color: var(--warn); }
.due.late { color: var(--neg); }
.icon-btn.flip svg { transform: scaleX(-1); }

/* ---------- Calendario ---------- */

.cal-month { min-width: 128px; text-align: center; font-weight: 500; text-transform: capitalize; font-variant-numeric: tabular-nums; }
.cal-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; font-size: 13px; color: var(--ink-3); margin-top: -16px; }
.cal-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.cal-legend .cal-hours { margin-right: -10px; }
.cal { overflow: hidden; }
.cal-head, .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-head { border-bottom: 1px solid var(--border); }
.cal-head span { padding: 8px 10px; font-size: 12px; font-weight: 500; color: var(--ink-3); }
.cal-grid { gap: 1px; background: var(--border); }
.cal-day { background: var(--surface); min-height: 112px; padding: 8px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cal-day.out { background: var(--surface-sunk); }
.cal-day.out .cal-num { color: var(--ink-4); }
.cal-day-head { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.cal-num { font-size: 13px; font-weight: 500; color: var(--ink-2); font-variant-numeric: tabular-nums; min-width: 24px; height: 24px; display: inline-grid; place-items: center; border-radius: 999px; }
.cal-wd, .cal-mon { display: none; }
.cal-day.today .cal-num { background: var(--blue); color: #fff; }
.cal-hours { font-size: 11px; color: var(--ink-3); background: var(--neutral-tint); border-radius: 999px; padding: 1px 6px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cal-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.cal-item {
  width: 100%; display: flex; align-items: center; gap: 6px; padding: 3px 6px;
  border: 0; border-radius: var(--r-sm); background: transparent; text-align: start; cursor: pointer;
  font-size: 12px; color: var(--ink); transition: background-color 150ms;
}
.cal-item:hover { background: var(--hover); }
.cal-item.done { color: var(--ink-3); }
.cal-item.late { color: var(--neg); background: var(--neg-tint); }
.cal-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-mark { width: 14px; height: 14px; flex-shrink: 0; display: inline-grid; place-items: center; border-radius: 4px; background: var(--pos-tint); color: var(--pos); }

.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; display: inline-block; }

/* Segmented progress: a white frame, a grey track, and the fill cut into small blocks. */
.progress {
  --seg: 3px; --seg-gap: 2px;
  height: 48px; padding: 4px;
  border: 1px solid var(--border); border-radius: 10px;
  background: linear-gradient(var(--track), var(--track)) content-box, var(--surface);
  overflow: hidden;
}
.progress > span {
  display: block; height: 100%; border-radius: 6px; background: var(--blue);
  -webkit-mask-image: repeating-linear-gradient(90deg, #000 0 var(--seg), transparent var(--seg) calc(var(--seg) + var(--seg-gap)));
  mask-image: repeating-linear-gradient(90deg, #000 0 var(--seg), transparent var(--seg) calc(var(--seg) + var(--seg-gap)));
}
.progress.warn > span { background: #f59e0b; }
.progress.over > span { background: var(--neg); }
.progress-label { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-3); margin-top: 6px; font-variant-numeric: tabular-nums; }

/* Pills */
.pill {
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
  padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 500;
  background: var(--neutral-tint); color: var(--ink-2);
}
.pill.blue { background: var(--blue-tint); color: var(--blue); }
.pill.pos { background: var(--pos-tint); color: var(--pos); }
.pill.warn { background: var(--warn-tint); color: var(--warn); }
.pill.neg { background: var(--neg-tint); color: var(--neg); }

/* ---------- Week chart ---------- */

.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); gap: 12px; align-items: start; }

/* Dashboard overview: numbers in a 2×2 block, the chart of the same period beside them */
.overview { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 12px; align-items: stretch; }
.stats.stats-2x2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.chart { padding: 20px; display: flex; flex-direction: column; gap: 16px; }

/* Dashboard chart: hours per day, one series, details in the tooltip */
.pc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.pc-title { font-size: 15px; font-weight: 500; letter-spacing: -0.01em; }
.pc-sub { font-size: 13px; color: var(--ink-3); margin-top: 2px; font-variant-numeric: tabular-nums; }
.pc-nav { display: flex; align-items: center; gap: 2px; }
.pc-period { min-width: 120px; text-align: center; font-size: 13px; font-weight: 500; text-transform: capitalize; font-variant-numeric: tabular-nums; }
.pc-plot { position: relative; flex: 1; min-height: 180px; margin-left: 30px; }
.pc-grid { position: absolute; inset: 0 0 24px 0; pointer-events: none; }
.pc-grid span { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--border); }
.pc-grid span:first-child { border-top-style: solid; }
.pc-grid em { position: absolute; left: -30px; width: 24px; top: -8px; text-align: end; font-style: normal; font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.pc-cols { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 8px; }
.pc-cols.is-month { gap: 3px; }
.pc-col { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; min-width: 0; border-radius: 4px; outline-offset: 2px; }
.pc-col::before { content: ''; flex: 1; } /* pushes bar + label to the bottom */
.pc-bar {
  display: block; width: 100%; max-width: 40px; border-radius: 4px 4px 0 0; background: var(--blue);
  margin-bottom: 8px; transition: opacity 150ms;
}
.pc-col.future .pc-bar { height: 2px !important; background: var(--neutral-tint); }
.pc-col:not(.future) .pc-bar { min-height: 2px; }
.pc-plot:has(.pc-col:hover, .pc-col:focus-visible) .pc-col:not(:hover):not(:focus-visible) .pc-bar { opacity: 0.35; }
.pc-x { height: 16px; padding: 0 5px; border-radius: 999px; font-size: 11px; line-height: 16px; color: var(--ink-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.pc-x.is-hidden { visibility: hidden; }
.pc-col.today .pc-x { color: var(--ink); font-weight: 500; }
.pc-col:hover .pc-x, .pc-col:focus-visible .pc-x { visibility: visible; background: var(--ink); color: var(--surface); }
.pc-tip {
  position: absolute; left: 0; top: 0; z-index: 5; min-width: 160px; max-width: 260px; pointer-events: none;
  background: var(--surface); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px;
  box-shadow: 0 0 0 1px rgb(0 0 0 / 0.08), 0 4px 12px rgb(0 0 0 / 0.08), 0 12px 32px -8px rgb(0 0 0 / 0.12);
}
.pc-tip-date { font-size: 12px; color: var(--ink-3); }
.pc-tip-total { font-size: 15px; font-weight: 500; font-variant-numeric: tabular-nums; }
.pc-tip-row { display: flex; gap: 12px; font-size: 12px; color: var(--ink-2); }
.pc-tip-total + .pc-tip-row { border-top: 1px solid var(--border); padding-top: 6px; margin-top: 2px; }
.pc-tip-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-tip-v { font-weight: 500; color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---------- Lists & tables ---------- */

.list { list-style: none; margin: 0; padding: 0; }
.list > li + li { border-top: 1px solid var(--border); }

.mini-entry { display: flex; align-items: center; gap: 12px; padding: 11px 20px; }
.mini-entry .main { flex: 1; min-width: 0; }
.mini-entry .t { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-entry .m { font-size: 13px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 6px; }
.mini-entry .d { font-weight: 500; font-variant-numeric: tabular-nums; }

.entry .billed { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.entry .actions { display: flex; justify-content: flex-end; gap: 2px; opacity: 0.55; transition: opacity 150ms; }
.entry:hover .actions, .entry:focus-within .actions { opacity: 1; }
/* Time entries: same table as the dashboard, one per day */
.dtable-tot { font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.dtable-tot b { color: var(--ink); font-weight: 500; }
.dtable-time { min-width: 720px; } /* below this the card scrolls sideways instead of squashing the text columns */
.dtable-time th:nth-child(2) { width: 24%; }
.dtable-time th:nth-child(3) { width: 130px; }
.dtable-time th:nth-child(4) { width: 96px; }
.dtable-time th:nth-child(5) { width: 136px; }
.dtable-time th:nth-child(6) { width: 156px; }
.dtable-time td.dt-row-actions { padding-inline: 8px; }
.dtable-time .dt-sub { display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.dtable-time .dt-sub .trunc { min-width: 0; }
.dtable-time .dt-title { font-weight: 500; }
.na { color: var(--ink-4); text-align: right; display: block; }

.billed-input {
  width: 64px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 500;
  border: 1px solid transparent; background: var(--hover); border-radius: 6px; padding: 4px 8px;
  transition: border-color 150ms, background-color 150ms;
}
.billed-input:hover { border-color: var(--border-2); }
.billed-input:focus { outline: none; border-color: var(--blue); background: var(--surface); box-shadow: 0 0 0 3px var(--blue-tint); }
.billed-input::placeholder { color: var(--ink-3); font-weight: 400; }
.delta { font-size: 12px; font-weight: 500; font-variant-numeric: tabular-nums; }
.delta.pos { color: var(--pos); }
.delta.neg { color: var(--neg); }

.table-wrap { overflow-x: auto; position: relative; } /* keeps sr-only labels inside the scroll box */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 16px; text-align: left; white-space: nowrap; }
th { font-size: 12px; font-weight: 500; color: var(--ink-3); border-bottom: 1px solid var(--border); background: var(--surface-sunk); }
th:first-child, td:first-child { padding-left: 20px; }
th:last-child, td:last-child { padding-right: 20px; }
td { border-bottom: 1px solid var(--border); }
tbody tr:last-child td { border-bottom: 0; }
td.r, th.r { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr.clickable { cursor: pointer; transition: background-color 150ms; }
tbody tr.clickable:hover { background: var(--surface-sunk); }
td .name { font-weight: 500; display: flex; align-items: center; gap: 8px; }
td .name a:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--ink-4); }
td .subline { font-size: 13px; color: var(--ink-3); }
tr.group td { background: var(--surface-sunk); font-weight: 500; }
tfoot td { border-top: 1px solid var(--border-2); border-bottom: 0; font-weight: 500; }
.pos-text { color: var(--pos); }
.neg-text { color: var(--neg); }

/* Tasks */
.task { display: flex; align-items: center; gap: 12px; padding: 9px 12px 9px 20px; transition: background-color 150ms; }
.task:hover { background: var(--surface-sunk); }
.task label { flex: 1; display: flex; align-items: center; gap: 12px; cursor: pointer; min-width: 0; }
.task input[type='checkbox'] { width: 18px; height: 18px; accent-color: var(--blue); flex-shrink: 0; cursor: pointer; }
.task .title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task.done .title { color: var(--ink-3); text-decoration: line-through; text-decoration-color: var(--ink-4); }
.task .due { flex-shrink: 0; }
.task .time { font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.add-row { display: flex; gap: 8px; padding: 10px 12px 10px 20px; border-top: 1px solid var(--border); }
.add-row input { flex: 1; min-width: 0; }
.add-row .add-row-date { flex: none; width: 140px; }
.add-row .add-row-date .ui-select { width: 100%; }

/* Detail layout */
.detail { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 12px; align-items: start; }
.detail > div { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.info { padding: 6px 0; }
.info .row { padding: 8px 20px; }
.info .row .v { font-weight: 400; overflow: hidden; text-overflow: ellipsis; }
.card-title { padding: 16px 20px 0; font-size: 14px; font-weight: 500; }
.card-title-row { display: flex; justify-content: space-between; align-items: center; padding: 14px 12px 14px 20px; border-bottom: 1px solid var(--border); gap: 8px; }
.card-title-row h2 { font-size: 14px; font-weight: 500; }

.note { padding: 12px 20px; display: flex; flex-direction: column; gap: 4px; }
.note .when { font-size: 12px; color: var(--ink-3); display: flex; gap: 6px; align-items: center; }
.note .text { white-space: pre-wrap; max-width: 65ch; }
.note-form { padding: 12px 20px; display: flex; flex-direction: column; gap: 8px; border-bottom: 1px solid var(--border); }
.note-bar { display: flex; gap: 8px; justify-content: space-between; align-items: center; }

/* Empty states */
.empty { padding: 36px 20px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.empty .t { font-weight: 500; }
.empty p { color: var(--ink-2); max-width: 44ch; text-wrap: balance; }
.empty .btn { margin-top: 8px; }

/* ---------- Forms ---------- */

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field > .legend { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.field .help { font-size: 12px; color: var(--ink-3); }
.input, .select, .textarea {
  width: 100%; height: 36px; padding: 0 10px; font-size: 14px;
  background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--r-btn);
  transition: border-color 150ms, box-shadow 150ms;
}
.textarea { height: auto; min-height: 72px; padding: 8px 10px; resize: vertical; line-height: 1.5; }
.input:hover, .select:hover, .textarea:hover { border-color: rgba(0, 0, 0, 0.24); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-tint); }
.input[aria-invalid='true'] { border-color: var(--neg); }
.input[aria-invalid='true']:focus { box-shadow: 0 0 0 3px var(--neg-tint); }
.field-error { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--neg); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 4px 0; }
.check input { width: 18px; height: 18px; accent-color: var(--blue); }

.radio-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.radio-cards label {
  display: flex; flex-direction: column; gap: 2px; padding: 10px 12px;
  border: 1px solid var(--border-2); border-radius: var(--r-btn); cursor: pointer;
  transition: border-color 150ms, background-color 150ms;
}
.radio-cards label:hover { border-color: rgba(0, 0, 0, 0.24); }
.radio-cards label:has(input:checked) { border-color: var(--blue); background: var(--blue-tint); }
.radio-cards label:has(input:focus-visible) { outline: 2px solid var(--blue); outline-offset: 2px; }
.radio-cards input { position: absolute; opacity: 0; pointer-events: none; }
.radio-cards b { font-weight: 500; }
.radio-cards span { font-size: 13px; color: var(--ink-2); }
form:has(input[name='type'][value='hourly']:checked) .only-fixed,
form:has(input[name='type'][value='internal']:checked) .only-fixed,
form:has(input[name='type'][value='internal']:checked) .only-paid { display: none; }

.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatches label { position: relative; cursor: pointer; }
.swatches input { position: absolute; opacity: 0; }
.swatches span { display: block; width: 24px; height: 24px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1); transition: transform 150ms var(--ease-out); }
.swatches label:hover span { transform: scale(1.1); }
.swatches input:checked + span { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ink); }
.swatches input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 4px; }

/* ---------- Dialog ---------- */

dialog {
  width: min(520px, calc(100vw - 32px)); max-height: calc(100dvh - 48px);
  padding: 0; border: 0; border-radius: var(--r-card); background: var(--surface); color: var(--ink);
  box-shadow: 0 0 0 1px var(--border), 0 4px 8px rgba(0, 0, 0, 0.04), 0 16px 32px rgba(0, 0, 0, 0.08), 0 32px 64px rgba(0, 0, 0, 0.08);
}
dialog[open] { animation: dlg-in 200ms var(--ease-out); }
dialog::backdrop { background: rgba(15, 12, 8, 0.28); animation: fade-in 200ms var(--ease-out); }
@keyframes dlg-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
@keyframes fade-in { from { opacity: 0; } }
.dlg-form { display: flex; flex-direction: column; }
.dlg-body { padding: 22px 24px; display: flex; flex-direction: column; gap: 16px; overflow-y: auto; }
.dlg-body h2 { font-size: 18px; font-weight: 500; letter-spacing: -0.015em; }
.dlg-foot {
  display: flex; align-items: center; gap: 8px; padding: 14px 24px;
  border-top: 1px solid var(--border); background: var(--surface-sunk);
  border-radius: 0 0 var(--r-card) var(--r-card);
}
.spacer { flex: 1; }

/* ---------- Toast ---------- */

.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 60;
  transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  display: flex; align-items: center; gap: 12px;
  background: var(--midnight); color: #fff; padding: 10px 10px 10px 16px; border-radius: var(--r-btn);
  font-weight: 500; transition: opacity 200ms var(--ease-out), transform 200ms var(--ease-out);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12), 0 12px 32px rgba(0, 0, 0, 0.12);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast button { background: rgba(255, 255, 255, 0.14); color: #fff; border: 0; border-radius: 6px; padding: 4px 10px; font-weight: 500; cursor: pointer; }
.toast button:hover { background: rgba(255, 255, 255, 0.22); }
.toast:not(:has(button)) { padding-right: 16px; }

/* ---------- Settings ---------- */

.settings { display: flex; flex-direction: column; gap: 12px; max-width: 640px; }
.settings .card-pad { display: flex; flex-direction: column; gap: 16px; }
.settings h2 { font-size: 15px; font-weight: 500; }
.todoist-status { display: flex; align-items: center; gap: 6px; color: var(--pos); font-weight: 500; }
.settings p { color: var(--ink-2); max-width: 65ch; }
.danger-zone { border-color: color-mix(in srgb, var(--neg) 22%, transparent); }

/* ---------- Responsive ---------- */

/* ---------- Collapsed sidebar (icons only) ---------- */

.app { transition: grid-template-columns 200ms var(--ease-out); }
.sidebar { overflow: hidden; }
.nav-item, .brand-name { white-space: nowrap; }
.sidebar-collapsed { --sidebar-w: 64px; }
.sidebar-collapsed .sidebar { padding-inline: 10px; }
.sidebar-collapsed .sidebar-head { flex-direction: column; gap: 6px; }
.sidebar-collapsed .brand { padding: 6px 11px; }
.sidebar-collapsed .brand-name,
.sidebar-collapsed .nav-item .l-long {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.sidebar-collapsed .nav-item { justify-content: center; padding: 8px; }
.sidebar-collapsed .sidebar-foot { display: none; }
.sidebar-collapsed .nav-sep, .sidebar-collapsed .nav-group { display: none; }

@media (max-width: 1040px) {
  .overview { grid-template-columns: minmax(0, 1fr); }
  .dtable-tasks th:nth-child(3), .dtable-recent th:nth-child(3) { width: 150px; }
  .dtable-recent th:nth-child(2) { width: 34%; }
  .dtable-recent th:nth-child(4) { width: 120px; }
  .dtable-recent th:nth-child(3), .dtable-recent td:nth-child(3) { display: none; }
  .dtable-recent .dt-when-inline { display: inline; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split, .detail { grid-template-columns: minmax(0, 1fr); }
  .dtable-time th:nth-child(3), .dtable-time td:nth-child(3) { display: none; }
}

@media (max-width: 780px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: auto; bottom: 0; left: 0; right: 0; height: auto; z-index: 20;
    flex-direction: row; padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--chrome) 92%, transparent);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-right: 0; border-top: 1px solid var(--border);
  }
  .sidebar-head, .sidebar-foot, .nav-label { display: none; }
  .sidebar-collapsed { --sidebar-w: auto; }
  .sidebar-collapsed .sidebar { padding-inline: 8px; }
  .sidebar-collapsed .nav-item .l-long { position: static; }
  .sidebar-collapsed .nav-item { padding: 6px 2px; }
  .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .dtask-add .dtask-date { flex: 1; width: auto; }
  .cal-legend { margin-top: -8px; }
  .cal-head { display: none; }
  .cal-grid { grid-template-columns: minmax(0, 1fr); }
  .cal-day { min-height: 0; padding: 10px 12px; }
  .cal-day.is-empty, .cal-day.out { display: none; }
  .cal-wd, .cal-mon { display: inline; }
  .cal-num { justify-content: start; display: inline-block; height: auto; padding: 2px 8px; margin-left: -8px; }
  .cal-item { font-size: 14px; padding: 6px 8px; }
  /* Tables become stacked rows */
  .dtable-stack thead { display: none; }
  .dtable-stack, .dtable-stack tbody, .dtable-stack tr, .dtable-stack td { display: block; width: 100%; }
  .dtable-stack tr { padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--border); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; }
  .dtable-stack tbody tr:last-child { border-bottom: 0; }
  .dtable-stack td { padding: 0; border: 0 !important; width: auto; }
  .dtable-stack td.dt-main { grid-column: 1 / -1; }
  .dtable-stack td.dt-proj { font-size: 13px; font-weight: 400; color: var(--ink-2); }
  .dtable-stack td.dt-proj .client-mark { margin-inline-end: 6px; }
  .dtable-stack .dt-status, .dtable-stack .dt-num { justify-self: end; }
  .dtable-bar { flex-wrap: wrap; padding: 12px 16px; }
  .dtask-edit { opacity: 1; }
  .dtask-add { flex-wrap: wrap; padding: 10px 12px 12px 16px; }
  .dtask-add .input { flex-basis: 100%; }
  .dtask-add .ui-select { flex: 1; width: auto; min-width: 0; }
  #nav { flex-direction: row; justify-content: space-around; overflow: visible; margin-inline: 0; padding-inline: 0; }
  .nav-sep, .nav-group { display: none; }
  .nav-item { flex: 1; min-width: 0; flex-direction: column; gap: 2px; font-size: 11px; padding: 6px 2px; align-items: center; }
  .nav-settings { margin-top: 0; }
  .l-long { display: none; }
  .l-short { display: inline; }
  .nav-item[aria-current='page'] { box-shadow: none; background: transparent; }
  .main-col { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .topbar { padding: 10px 16px; }
  .timer { flex-wrap: wrap; padding: 6px; }
  .timer-desc { flex-basis: 100%; padding: 6px 8px; }
  .ui-select--timer { flex: 1 1 0; min-width: 0; max-width: none; }
  .timer-clock { min-width: 0; }
  .timer-btn { min-width: 0; }
  .page { padding: 20px 16px 40px; gap: 24px; }
  .page-head h1 { font-size: 24px; }
  .stats, .stats.three, .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat { padding: 14px 16px; }
  .stat .value { font-size: 22px; }
  .dtable-time { min-width: 0; }
  .dtable-time td.dt-main { grid-column: 1; grid-row: 1; }
  .dtable-time td.dt-real { grid-column: 2; grid-row: 1; justify-self: end; }
  .dtable-time td.dt-proj { grid-column: 1; grid-row: 2; }
  .dtable-time td.dt-billed { grid-column: 2; grid-row: 2; }
  .dtable-time td.dt-row-actions { grid-column: 1 / -1; grid-row: 3; }
  .dtable-time .actions { justify-content: flex-start; opacity: 1; margin-inline-start: -8px; }
  .dtable-tot { font-size: 12px; }
  .field-row, .radio-cards { grid-template-columns: 1fr; }
  .input, .select, .textarea, .timer-desc, .billed-input { font-size: 16px; } /* prevent iOS zoom */
  .toast { bottom: calc(80px + env(safe-area-inset-bottom)); }
}

@media (hover: none) {
  .entry .actions, .dtask-edit { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .app { transition: none; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  .pulse { animation: none; }
}

/* GeistPixel — da applicare a elementi scelti */
.font-pixel { font-family: var(--font-pixel); font-weight: 400; }
.font-pixel-grid { font-family: var(--font-pixel-grid); font-weight: 400; }

/* ---------- Select & date picker (BoardUI) — see controls.js ---------- */

.ui-native { display: none !important; }
.ui-select {
  display: inline-flex; align-items: center; justify-content: space-between; gap: 6px;
  width: 100%; min-width: 0; height: 36px; padding: 0 8px 0 10px;
  font: inherit; font-size: 14px; font-weight: 500; line-height: 20px; color: var(--ink); text-align: start;
  background: var(--surface); border: 1px solid #ebebeb; border-radius: 10px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); cursor: pointer;
  transition: background-color 200ms ease, border-color 200ms ease, box-shadow 200ms ease;
}
.ui-select:hover { background: #f8f8f8; border-color: #d6d6d6; }
.ui-select:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.ui-select:disabled { cursor: not-allowed; background: #f4f4f4; color: var(--ink-4); box-shadow: none; }
.ui-select.is-placeholder .ui-select-text, .ui-date-trigger.is-placeholder .ui-select-value { color: var(--ink-3); }
.ui-select-value { display: flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; }
.ui-select-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ui-select .client-mark { flex: none; }
.ui-chevron { flex: none; color: var(--ink-3); transition: transform 200ms ease; }
.ui-select[aria-expanded='true'] .ui-chevron { transform: rotate(180deg); }
.ui-select--sm { height: 30px; font-size: 13px; padding-inline: 8px 6px; border-radius: 8px; width: auto; max-width: 220px; flex: none; }
.ui-select--timer {
  width: auto; max-width: 260px; height: auto; padding: 7px 8px 7px 10px;
  background: var(--hover); border: 0; box-shadow: none; color: var(--ink-2); border-radius: var(--r-btn);
}
.ui-select--timer:hover { background: var(--press); }
.ui-select--timer .ui-select-text { color: var(--ink-2); }

/* Popover shared by select and date picker */
.ui-pop {
  position: fixed; z-index: 1000; transform-origin: top left;
  transition: opacity 150ms ease-out, transform 150ms ease-out, filter 150ms ease-out;
}
.ui-pop[data-placement='top'] { transform-origin: bottom left; }
.ui-pop[data-state='closed'] { opacity: 0; transform: scale(0.95); filter: blur(2px); pointer-events: none; }
@media (prefers-reduced-motion: reduce) {
  .ui-pop { transition: opacity 120ms ease-out; }
  .ui-pop[data-state='closed'] { transform: none; filter: none; }
}

.ui-select-pop {
  padding: 8px; background: var(--surface); border: 1px solid #ebebeb; border-radius: 16px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04), 0 4px 4px rgba(0, 0, 0, 0.02), 0 12px 24px -8px rgba(0, 0, 0, 0.08);
}
.ui-listbox { display: flex; flex-direction: column; gap: 4px; max-height: 240px; overflow-y: auto; outline: none; overscroll-behavior: contain; }
.ui-option {
  display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: 10px;
  font-size: 14px; font-weight: 500; line-height: 20px; color: var(--ink); cursor: pointer;
  transition: background-color 150ms cubic-bezier(0.4, 0, 0.2, 1); user-select: none;
}
.ui-option-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ui-option.is-active { background: #f7f7f7; }
.ui-option[aria-disabled='true'] { color: var(--ink-4); cursor: default; }
.ui-option .client-mark { flex: none; }
.ui-check { flex: none; color: var(--ink-2); }
.ui-group { display: flex; flex-direction: column; gap: 4px; }
.ui-group + .ui-group, .ui-option + .ui-group { margin-top: 4px; padding-top: 8px; border-top: 1px solid #f0f0f0; }
.ui-group-label {
  display: flex; align-items: center; gap: 6px; padding: 2px 8px;
  font-size: 12px; font-weight: 500; color: var(--ink-3);
}
.ui-group-label .client-mark { flex: none; }

/* Date picker */
.ui-date { position: relative; display: inline-flex; min-width: 0; }
.ui-date-trigger { justify-content: flex-start; padding-inline: 10px; }
.ui-date-trigger .ui-select-value { display: block; white-space: nowrap; text-overflow: ellipsis; }
.ui-date.has-value .ui-date-trigger { padding-inline-end: 32px; }
.ui-cal-icon { flex: none; color: var(--ink-2); }
.ui-date-clear {
  position: absolute; inset-inline-end: 6px; top: 50%; transform: translateY(-50%);
  display: none; place-items: center; width: 22px; height: 22px; padding: 0;
  border: 0; border-radius: 6px; background: transparent; color: var(--ink-3); cursor: pointer;
}
.ui-date-clear::before { content: ''; position: absolute; inset: -6px; } /* larger hit area */
.ui-date.has-value .ui-date-clear { display: grid; }
.ui-date-clear:hover { background: var(--hover); color: var(--ink); }
.ui-date-clear:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }

.ui-cal-pop {
  width: 342px; padding: 8px 8px 12px; background: #f7f7f7; border-radius: 24px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.04), 0 1px 1px rgba(0, 0, 0, 0.04), 0 4px 4px rgba(0, 0, 0, 0.02), 0 16px 32px -8px rgba(0, 0, 0, 0.12);
}
.ui-cal-card { background: var(--surface); border-radius: 16px; padding: 15px; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); }
.ui-cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.ui-cal-title { font-size: 14px; font-weight: 500; line-height: 20px; }
.ui-cal-nav {
  position: relative; display: grid; place-items: center; width: 24px; height: 24px; padding: 0;
  border: 0; border-radius: 6px; background: transparent; color: var(--ink-3); cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease;
}
.ui-cal-nav:hover { background: #ebebeb; color: var(--ink); }
.ui-cal-nav:focus-visible, .ui-day:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.ui-cal-grid { width: 100%; border-collapse: separate; border-spacing: 0 6px; margin: -6px 0; table-layout: fixed; }
.ui-cal-grid tr, .ui-cal-grid th, .ui-cal-grid td { border: 0; background: none; }
.ui-cal-grid th { height: 24px; padding: 0; font-size: 14px; font-weight: 500; color: #737373; text-align: center; }
.ui-cal-grid td { padding: 0; text-align: center; height: 32px; }
.ui-day {
  width: 32px; height: 32px; padding: 0; border: 0; border-radius: 8px; background: transparent;
  font: inherit; font-size: 14px; font-weight: 500; line-height: 20px; color: var(--ink);
  font-variant-numeric: tabular-nums; cursor: pointer; transition: background-color 100ms ease-out;
}
.ui-day:hover { background: #ebebeb; }
.ui-day[aria-current='date'] { color: var(--blue); }
.ui-day.is-selected, .ui-day.is-selected:hover { background: #8ec5ff; color: var(--ink); }
.ui-cal-foot { display: flex; align-items: center; gap: 8px; padding: 12px 8px 0; min-height: 50px; }
.ui-cal-spacer { flex: 1; }
.ui-cal-chip {
  width: 104px; height: 38px; padding: 0 8px; font: inherit; font-size: 14px; font-weight: 500; color: var(--ink);
  font-variant-numeric: tabular-nums; background: var(--surface); border: 1px solid #ebebeb; border-radius: 10px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); outline: none; transition: border-color 100ms ease-out;
  animation: ui-chip-in 250ms cubic-bezier(0.34, 1.2, 0.64, 1);
}
.ui-cal-chip:focus-visible { border-color: var(--blue); }
.ui-cal-chip[aria-invalid='true'] { border-color: var(--neg); }
.ui-cal-chip.is-leaving { animation: ui-chip-out 200ms ease-in forwards; }
@keyframes ui-chip-in { from { opacity: 0; transform: translateY(-12px); } }
@keyframes ui-chip-out { to { opacity: 0; transform: translateY(-12px); } }
@media (prefers-reduced-motion: reduce) { .ui-cal-chip, .ui-cal-chip.is-leaving { animation: none; } }
.ui-btn {
  height: 36px; padding: 0 10px; border-radius: 10px; font: inherit; font-size: 14px; font-weight: 500;
  cursor: pointer; transition: background-color 150ms ease, transform 100ms ease;
}
.ui-btn:active:not(:disabled) { transform: scale(0.97); }
.ui-btn:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.ui-btn--secondary { background: var(--surface); color: var(--ink); border: 1px solid #ebebeb; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); }
.ui-btn--secondary:hover { background: #f8f8f8; }
.ui-btn--primary { background: var(--blue); color: #fff; border: 0; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); }
.ui-btn--primary:hover:not(:disabled) { background: var(--blue-hover); }
.ui-btn--primary:disabled { background: #d6e8f9; color: rgba(255, 255, 255, 0.9); box-shadow: none; cursor: not-allowed; }
@media (max-width: 400px) { .ui-cal-pop { width: calc(100vw - 32px); } .ui-cal-card { padding: 12px 8px; } }

/* Status select (projects table) with a colored dot, as in BoardUI's table */
.ui-select--status { width: 100%; max-width: 142px; height: 32px; padding-inline: 10px 8px; }
.ui-dot { flex: none; width: 6px; height: 6px; border-radius: 50%; margin-inline: 2px 2px; }
.ui-dot--pos { background: #22a06b; }
.ui-dot--warn { background: #f5a524; }
.ui-dot--neutral { background: #9a9a9a; }
.dtable td.dt-status { padding-block: 6px; }

/* ---------- Command palette (⌘K), modelled on BoardUI — see palette.js ---------- */

.kbd {
  display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 999px; background: #e2e2e2; color: #5f5f5f;
  font: 600 12px/16px var(--font); white-space: nowrap; font-variant-numeric: tabular-nums;
}
.nav-search { width: 100%; border: 0; background: transparent; cursor: pointer; font: inherit; text-align: start; margin-bottom: 6px; }
.nav-search-label { flex: 1; }
.nav-search .kbd { background: rgba(0, 0, 0, 0.06); color: var(--ink-3); }
.sidebar-collapsed .nav-search { justify-content: center; padding: 8px; }
.sidebar-collapsed .nav-search-label, .sidebar-collapsed .nav-search .kbd { display: none; }
@media (max-width: 780px) { .nav-search { display: none; } }

.cmdk {
  width: min(560px, calc(100vw - 32px)); max-height: min(560px, calc(100dvh - 24vh));
  margin: 12vh auto auto; padding: 0; border: 0; background: transparent; overflow: visible;
}
.cmdk[open] { display: flex; animation: cmdk-in 160ms cubic-bezier(0.2, 0.8, 0.2, 1); }
.cmdk::backdrop { background: rgba(0, 0, 0, 0.18); animation: fade-in 160ms ease-out; }
@keyframes cmdk-in { from { opacity: 0; transform: scale(0.97); filter: blur(2px); } }
@media (prefers-reduced-motion: reduce) { .cmdk[open] { animation: fade-in 120ms ease-out; } }
.cmdk-panel {
  display: flex; flex-direction: column; width: 100%; min-height: 0; overflow: clip;
  background: var(--surface); border: 1px solid #ebebeb; border-radius: 24px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.02), 0 1px 12px rgba(0, 0, 0, 0.06), 0 0 1px rgba(0, 0, 0, 0.32), 0 24px 48px -12px rgba(0, 0, 0, 0.18);
}
.cmdk-input-row { display: flex; align-items: center; gap: 8px; padding: 12px 12px 12px 14px; border-bottom: 1px solid #f0f0f0; flex: none; color: var(--ink-3); }
.cmdk-input {
  flex: 1; min-width: 0; border: 0; outline: none; background: transparent; padding: 0;
  font: 500 14px/20px var(--font); color: var(--ink);
}
.cmdk-input::placeholder { color: #a3a3a3; }
.cmdk-list { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 8px; scrollbar-width: thin; }
.cmdk-group { display: flex; flex-direction: column; gap: 2px; }
.cmdk-group + .cmdk-group { padding-top: 8px; }
.cmdk-group-label { padding: 4px 12px; font-size: 13px; font-weight: 500; line-height: 18px; color: #8a8a8a; }
.cmdk-item {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 12px;
  font-size: 14px; font-weight: 500; line-height: 20px; color: var(--ink); cursor: pointer; user-select: none;
  transition: background-color 100ms ease-out;
}
.cmdk-item[aria-selected='true'] { background: #f7f7f7; }
.cmdk-lead { display: grid; place-items: center; flex: none; width: 18px; height: 18px; color: #737373; }
.cmdk-lead svg { width: 16px; height: 16px; }
.cmdk-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmdk-status { margin-inline-start: 8px; font-weight: 400; color: #8a8a8a; }
.cmdk-hint { flex: none; max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 400; color: #8a8a8a; }
.cmdk-empty { padding: 28px 16px 32px; text-align: center; color: var(--ink-3); }
.cmdk-foot {
  display: flex; align-items: center; justify-content: space-between; flex: none;
  padding: 8px 12px; border-top: 1px solid #f0f0f0; font-size: 13px; color: #8a8a8a;
}
.cmdk-foot .kbd { height: 18px; min-width: 18px; font-size: 11px; }
@media (max-width: 780px) { .cmdk { margin-top: 16px; max-height: calc(100dvh - 32px); } .cmdk-foot { display: none; } }

/* ---------- Phone navigation: dock, bottom sheet, sliding timer bar — see mobile.js ---------- */

.dock, .timer-mini { display: none; }
.sheet {
  width: 100%; max-width: 100%; max-height: calc(100dvh - 48px); margin: auto 0 0;
  padding: 0 16px calc(20px + env(safe-area-inset-bottom)); overflow-y: auto; overscroll-behavior: contain;
  border: 0; border-radius: 24px 24px 0 0; background: var(--surface); box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.12);
  transition: transform 220ms cubic-bezier(0.32, 0.72, 0, 1);
}
.sheet[open] { animation: sheet-in 300ms cubic-bezier(0.32, 0.72, 0, 1); }
.sheet.is-dragging { transition: none; }
.sheet.is-closing { transform: translateY(100%) !important; transition: transform 200ms cubic-bezier(0.4, 0, 1, 1); }
.sheet::backdrop { background: rgba(0, 0, 0, 0.28); animation: fade-in 200ms ease-out; }
@keyframes sheet-in { from { transform: translateY(100%); } }
.sheet-head {
  position: sticky; top: 0; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 10px 0 8px; background: var(--surface); touch-action: none; cursor: grab;
}
.sheet-grip { width: 36px; height: 5px; border-radius: 3px; background: rgba(0, 0, 0, 0.15); }
.sheet-title { align-self: stretch; padding: 0 4px; font-size: 17px; font-weight: 500; outline: none; }
.sheet-nav { display: flex; flex-direction: column; gap: 2px; margin: 4px 0 16px; }
.sheet-link {
  display: flex; align-items: center; gap: 14px; min-height: 48px; padding: 10px 12px; border-radius: 12px;
  font-size: 16px; font-weight: 500; color: var(--ink); text-decoration: none; transition: background-color 150ms;
}
.sheet-link svg { color: var(--ink-3); flex: none; }
.sheet-link:active { background: var(--hover); }
.sheet-link[aria-current='page'] { background: var(--blue-tint); }
.sheet-link[aria-current='page'] svg { color: var(--blue); }
.sheet-link:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
.sheet-today { margin-bottom: 4px; }
.sheet-form { display: flex; flex-direction: column; gap: 16px; padding: 4px 0; }
.sheet-submit { width: 100%; height: 48px; justify-content: center; font-size: 16px; }
@media (prefers-reduced-motion: reduce) {
  .sheet[open] { animation: fade-in 150ms ease-out; }
  .sheet, .sheet.is-closing { transition: none; }
}

@media (max-width: 780px) {
  .sidebar { display: none !important; }
  .seg button { white-space: nowrap; }
  .dtable-bar .seg { flex: 1 1 100%; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .dtable-bar .seg::-webkit-scrollbar { display: none; }
  .dtable-bar .seg button { flex: 1 0 auto; padding-inline: 8px; }
  .overview .pc { display: none; } /* daily-hours chart: not needed on phones, tasks come up sooner */
  .main-col { padding-bottom: calc(96px + env(safe-area-inset-bottom)); transition: padding-top 300ms cubic-bezier(0.32, 0.72, 0, 1); }
  .toast { bottom: calc(92px + env(safe-area-inset-bottom)); }

  /* Floating dock */
  .dock {
    display: flex; gap: 6px; padding: 6px; position: fixed; z-index: 30; left: 50%; transform: translateX(-50%);
    bottom: calc(14px + env(safe-area-inset-bottom));
    border-radius: 999px; background: rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(16px) saturate(1.4); -webkit-backdrop-filter: blur(16px) saturate(1.4);
  }
  .dock-btn {
    display: grid; place-items: center; width: 52px; height: 52px; padding: 0; border: 0; border-radius: 50%;
    background: rgba(255, 255, 255, 0.3); color: rgb(0 0 0 / 80%); cursor: pointer;
    transition: background-color 150ms, color 150ms, transform 120ms ease-out;
    -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  }
  .dock-btn:active { transform: scale(0.92); }
  .dock-btn[aria-current] { background: #fff; color: var(--ink); }
  .dock-btn:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
  .dock-main, .dock-main[aria-current] { background: var(--blue); color: #fff; }
  .dock-main.is-stop { background: #f64932; }

  /* Timer bar: hidden until a timer runs, then it slides down and stays at the top */
  .topbar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 25;
    padding: calc(8px + env(safe-area-inset-top)) 12px 8px;
    transform: translateY(-100%); visibility: hidden;
    transition: transform 300ms cubic-bezier(0.32, 0.72, 0, 1), visibility 0s linear 300ms;
  }
  .has-timer .topbar { transform: none; visibility: visible; transition: transform 300ms cubic-bezier(0.32, 0.72, 0, 1), visibility 0s; }
  .has-timer .main-col { padding-top: calc(70px + env(safe-area-inset-top)); }
  .topbar .timer { display: none; }
  .timer-mini {
    display: flex; align-items: center; gap: 10px; padding: 7px 7px 7px 14px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  }
  .timer-mini-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
  .timer-mini-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
  .timer-mini-sub { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 12px; color: var(--ink-3); }
  .timer-mini-clock { font-family: var(--font-pixel); font-size: 18px; line-height: 1; font-variant-numeric: tabular-nums; }
  .timer-mini-stop {
    display: grid; place-items: center; flex: none; width: 40px; height: 40px; padding: 0;
    border: 0; border-radius: 50%; background: #f64932; color: #fff; cursor: pointer;
  }
  .timer-mini-stop:active { transform: scale(0.94); }
  .timer-mini-stop:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
}
@media (max-width: 780px) and (prefers-reduced-motion: reduce) {
  .topbar, .has-timer .topbar, .main-col { transition: none; }
}

/* Internal projects: keep the action icons aligned where the billable toggle would be */
.icon-btn-spacer { display: inline-block; width: 30px; height: 30px; flex: none; }

/* ---------- Login and cloud sync — see sync.js ---------- */

.auth {
  position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; overflow-y: auto;
  padding: max(24px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
  background: var(--canvas);
}
.auth[hidden] { display: none; }
.auth-open body { overflow: hidden; }
.auth-card {
  width: min(400px, 100%); display: flex; flex-direction: column; gap: 10px;
  padding: 28px 24px 24px; background: var(--surface); border-radius: 20px;
  box-shadow: 0 0 0 1px var(--border), 0 1px 2px rgba(0, 0, 0, 0.04), 0 16px 40px -16px rgba(0, 0, 0, 0.12);
  animation: auth-in 240ms var(--ease-out);
}
@keyframes auth-in { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) { .auth-card { animation: none; } }
.auth-brand { display: flex; align-items: center; gap: 10px; font-weight: 500; margin-bottom: 14px; }
.auth-card h1 { font-family: var(--font-pixel); font-size: 28px; font-weight: 400; line-height: 1.15; }
.auth-sub { color: var(--ink-2); text-wrap: pretty; }
.auth-form { display: flex; flex-direction: column; gap: 14px; margin-top: 10px; }
.auth-form .input { height: 44px; font-size: 16px; }
.auth-error { min-height: 20px; margin: -4px 0 -6px; font-size: 13px; color: var(--neg); }
.auth-error:empty { min-height: 0; margin: 0; }
.auth-submit { height: 46px; justify-content: center; font-size: 15px; }
.auth-link { align-self: center; }

.cloud-status { display: flex; align-items: center; gap: 8px; margin: 4px 0 12px; font-size: 13px; color: var(--ink-2); }
.cloud-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-4); flex: none; }
.cloud-status.is-ok .cloud-dot { background: #22a06b; }
.cloud-status.is-syncing .cloud-dot { background: var(--blue); }
.cloud-status.is-offline .cloud-dot { background: #f5a524; }
.cloud-status.is-error .cloud-dot { background: var(--neg); }
.todoist-project-row { align-items: end; }
.todoist-project-save { padding-bottom: 22px; }
