/* ---------- Tokens ---------- */
:root {
  color-scheme: light;
  --bg: #f9f9f7;
  --surface: #fcfcfb;
  --surface-2: #f2f1ed;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --line: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --accent: #2a78d6;
  --accent-ink: #ffffff;
  --danger: #d03b3b;
  --ok: #006300;
  --now: #d03b3b;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.12);

  /* project colors (categorical, fixed order) */
  --c0: #2a78d6; --c1: #eb6834; --c2: #1baf7a; --c3: #eda100;
  --c4: #e87ba4; --c5: #008300; --c6: #4a3aa7; --c7: #e34948;

  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0d0d0d;
    --surface: #1a1a19;
    --surface-2: #232322;
    --ink: #ffffff;
    --ink-2: #c3c2b7;
    --muted: #898781;
    --line: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.10);
    --accent: #3987e5;
    --ok: #0ca30c;
    --shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
    --c0: #3987e5; --c1: #d95926; --c2: #199e70; --c3: #c98500;
    --c4: #d55181; --c5: #008300; --c6: #9085e9; --c7: #e66767;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d0d0d;
  --surface: #1a1a19;
  --surface-2: #232322;
  --ink: #ffffff;
  --ink-2: #c3c2b7;
  --muted: #898781;
  --line: #2c2c2a;
  --axis: #383835;
  --border: rgba(255, 255, 255, 0.10);
  --accent: #3987e5;
  --ok: #0ca30c;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  --c0: #3987e5; --c1: #d95926; --c2: #199e70; --c3: #c98500;
  --c4: #d55181; --c5: #008300; --c6: #9085e9; --c7: #e66767;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1 { font-size: 22px; margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h2 { font-size: 16px; margin: 0; font-weight: 600; }
h3 { font-size: 14px; margin: 0; font-weight: 600; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.ico { display: inline-flex; width: 18px; height: 18px; flex: none; }
.ico svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

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

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 210px; flex: none;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 18px 12px;
  display: flex; flex-direction: column; gap: 2px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; padding: 4px 10px 18px; }
.brand-mark { width: 22px; height: 22px; border-radius: 7px; background: var(--accent); position: relative; }
.brand-mark::after { content: ""; position: absolute; inset: 6px 6px 6px 8px; border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: skewX(-8deg); }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border: 0; border-radius: 8px;
  background: none; color: var(--ink-2); text-align: left; font-weight: 500;
}
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.active { background: var(--surface-2); color: var(--ink); font-weight: 600; }
.nav-item.active .ico { color: var(--accent); }
.nav-spacer { flex: 1; }

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.view { padding: 24px 28px 60px; max-width: 1180px; width: 100%; }

/* ---------- Timer bar ---------- */
.timerbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.tb-desc {
  flex: 1 1 220px; min-width: 0;
  border: 0; background: transparent; font-size: 16px; padding: 8px 4px;
}
.tb-desc:focus { outline: none; }
.tb-desc::placeholder { color: var(--muted); }
.tb-projwrap {
  display: flex; align-items: center; gap: 8px;
  padding: 0 10px; border-radius: 8px; background: var(--surface-2);
  max-width: 280px; min-width: 0;
}
.tb-projwrap select { border: 0; background: transparent; padding: 8px 0; min-width: 0; max-width: 240px; }
.tb-projwrap select:focus { outline: none; }
.tb-projwrap:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.tb-manual { display: flex; align-items: center; gap: 6px; }
.tb-manual[hidden] { display: none; }
.tb-elapsed { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; min-width: 82px; text-align: right; }
.tb-elapsed[hidden] { display: none; }
.tb-go {
  width: 42px; height: 42px; border-radius: 50%; border: 0;
  background: var(--accent); color: var(--accent-ink);
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,.15);
}
.tb-go.stop { background: var(--danger); }
.tb-go.add { width: auto; border-radius: 21px; padding: 0 18px; font-weight: 600; }
.tb-go:hover { filter: brightness(1.08); }

/* ---------- Generic controls ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--ink);
  font-weight: 500;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); background: var(--accent); }
.btn.danger { color: var(--danger); }
.btn.small { padding: 5px 10px; font-size: 13px; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 8px; border: 0;
  background: none; color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn.sm { width: 28px; height: 28px; }
.icon-btn.sm .ico { width: 15px; height: 15px; }
.input {
  width: 100%; padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface);
}
.input.compact { width: auto; padding: 6px 8px; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 9px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 7px; color: var(--ink-2); font-weight: 500; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.12); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.badge {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  color: var(--ink-2); background: var(--surface-2); padding: 2px 7px; border-radius: 5px;
}

.view-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.head-stats { display: flex; gap: 24px; }
.head-stat .lbl { font-size: 12px; color: var(--muted); }
.head-stat .val { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }

.banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 10px 14px; margin-bottom: 18px; border-radius: var(--radius);
  background: var(--surface-2); color: var(--ink-2);
}

.empty { text-align: center; padding: 48px 20px; color: var(--ink-2); }
.empty h2 { margin-bottom: 6px; color: var(--ink); }

/* ---------- Timer list ---------- */
.day-card { margin-bottom: 14px; overflow: hidden; }
.day-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px; background: var(--surface-2); font-weight: 600;
}
.day-head .num { color: var(--ink-2); }
.entry {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; align-items: center; gap: 16px;
  padding: 10px 8px 10px 16px; border-top: 1px solid var(--line); cursor: pointer;
}
.entry:first-of-type { border-top: 0; }
.entry:hover { background: var(--surface-2); }
.entry-desc { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry-desc.none { color: var(--muted); font-weight: 400; }
.proj-label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); min-width: 0; }
.proj-label .txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry-time { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.entry-dur { font-weight: 600; font-variant-numeric: tabular-nums; min-width: 64px; text-align: right; }
.entry .play { opacity: 0; }
.entry:hover .play, .entry .play:focus-visible { opacity: 1; }
.more-wrap { text-align: center; margin-top: 8px; }

/* ---------- Calendar ---------- */
.cal-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cal-range { font-weight: 600; font-size: 15px; margin-left: 6px; }
.cal-outer { overflow-x: auto; }
.cal { min-width: 680px; overflow: hidden; }
.cal-head, .cal-body {
  display: grid; grid-template-columns: 56px repeat(7, minmax(0, 1fr));
}
.cal-head { border-bottom: 1px solid var(--border); overflow-y: hidden; scrollbar-gutter: stable; }
.cal-dayhead { padding: 8px 8px 6px; border-left: 1px solid var(--line); display: flex; flex-direction: column; align-items: flex-start; }
.cal-dayhead .dow { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.cal-dayhead .dnum { font-size: 20px; font-weight: 600; line-height: 1.2; }
.cal-dayhead .dtot { font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.cal-dayhead.today .dnum { color: var(--accent); }
.cal-scroll { height: calc(100vh - 250px); min-height: 380px; overflow-y: auto; scrollbar-gutter: stable; }
.cal-gutter { position: relative; }
.cal-hour { position: absolute; right: 8px; font-size: 11px; color: var(--muted); transform: translateY(-50%); font-variant-numeric: tabular-nums; }
.cal-col {
  position: relative; border-left: 1px solid var(--line);
  background-image: linear-gradient(to bottom, var(--line) 1px, transparent 1px);
  background-size: 100% 48px;
  cursor: crosshair; touch-action: pan-y;
}
.cal-col.today { background-color: color-mix(in srgb, var(--accent) 4%, transparent); }
.cal-ev {
  position: absolute; overflow: hidden;
  border-radius: 6px; padding: 3px 6px;
  font-size: 12px; line-height: 1.3;
  color: var(--ink);
  border-left: 3px solid var(--ev);
  background: color-mix(in srgb, var(--ev) 20%, var(--surface));
  cursor: pointer;
}
.cal-ev:hover { background: color-mix(in srgb, var(--ev) 30%, var(--surface)); z-index: 2; }
.cal-ev .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-ev .s, .cal-ev .tm { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-ev.running { border-style: dashed; border-left-style: solid; outline: 1px dashed var(--ev); outline-offset: -1px; }
.cal-ghost {
  position: absolute; left: 2px; right: 2px; border-radius: 6px;
  background: color-mix(in srgb, var(--accent) 25%, transparent);
  border: 1px dashed var(--accent); pointer-events: none;
}
.cal-now { position: absolute; left: 0; right: 0; height: 2px; background: var(--now); pointer-events: none; z-index: 3; }
.cal-now::before { content: ""; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--now); }
.cal-hint { color: var(--muted); font-size: 13px; margin: 10px 2px 0; }

/* ---------- Reports ---------- */
.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { padding: 14px 16px; }
.tile .lbl { font-size: 12px; color: var(--muted); }
.tile .val { font-size: 24px; font-weight: 650; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .sub { font-size: 12px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.panel { padding: 16px 18px; margin-bottom: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--ink-2); margin-bottom: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-wrap svg { display: block; overflow: visible; }
.chart-wrap .grid { stroke: var(--line); stroke-width: 1; }
.chart-wrap .base { stroke: var(--axis); stroke-width: 1; }
.chart-wrap .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart-wrap .hit { fill: transparent; }
.chart-wrap .hit:hover { fill: var(--ink); fill-opacity: .04; }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 16px; }
@media (min-width: 1180px) { .two-col { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }

.brk-row {
  display: grid; grid-template-columns: 18px minmax(0, 1.3fr) minmax(40px, 1.6fr) 68px 36px;
  align-items: center; gap: 10px; padding: 7px 4px; width: 100%;
  border: 0; background: none; text-align: left; border-radius: 6px;
}
button.brk-row:hover { background: var(--surface-2); }
.brk-row.sub { padding-left: 22px; grid-template-columns: 0 minmax(0, 1.3fr) minmax(40px, 1.6fr) 68px 36px; font-size: 13px; color: var(--ink-2); }
.brk-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.brk-name .txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brk-track { height: 10px; border-radius: 0 4px 4px 0; position: relative; }
.brk-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 0 4px 4px 0; min-width: 2px; }
.brk-row.sub .brk-fill { opacity: .6; }
.brk-dur { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.brk-row.sub .brk-dur { font-weight: 500; }
.brk-row.flat { grid-template-columns: 0 minmax(0, 1.3fr) minmax(40px, 1.6fr) 68px 36px; }
.brk-pct { text-align: right; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.chev { transition: transform .15s; color: var(--muted); }
.chev.open { transform: rotate(90deg); }

table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th, table.data td { padding: 6px 8px; text-align: right; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data th { color: var(--muted); font-weight: 500; }
.table-scroll { overflow-x: auto; }

.tooltip {
  position: fixed; z-index: 100; pointer-events: none;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow);
  padding: 8px 10px; font-size: 12px; min-width: 160px;
}
.tooltip .tt-head { font-weight: 600; margin-bottom: 4px; }
.tooltip .tt-row { display: flex; align-items: center; gap: 6px; justify-content: space-between; }
.tooltip .tt-row span:first-child { display: inline-flex; align-items: center; gap: 6px; }
.tooltip .tt-total { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 4px; font-weight: 600; }

/* donut */
.donut-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.donut-nav { display: flex; align-items: center; gap: 2px; }
.donut-nav .icon-btn:disabled { opacity: .35; cursor: default; background: none; }
.donut-range { min-width: 120px; text-align: center; font-weight: 600; font-size: 13px; }
.donut-body { display: flex; align-items: center; gap: 32px; flex-wrap: wrap; }
.donut { flex: none; overflow: visible; }
.donut-seg { stroke: var(--surface); stroke-width: 2; stroke-linejoin: round; }
.donut-seg:hover { opacity: .85; }
.donut-empty { stroke: var(--line); }
.donut-total { fill: var(--ink); font-size: 20px; font-weight: 650; }
.donut-sub { fill: var(--muted); font-size: 12px; }
.donut-legend { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 220px; }
.donut-legend li { display: grid; grid-template-columns: 10px minmax(0, 1fr) 44px 68px; align-items: center; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line); }
.donut-legend li:first-child { border-top: 0; }
.donut-legend .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.donut-legend .pct { text-align: right; font-weight: 600; }
.donut-legend .dur { text-align: right; color: var(--ink-2); }

/* ---------- Projects ---------- */
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.proj-card { overflow: hidden; display: flex; flex-direction: column; }
.proj-card .stripe { height: 5px; }
.proj-top { display: flex; align-items: flex-start; gap: 10px; padding: 14px 12px 6px 16px; }
.proj-top .name { font-size: 16px; font-weight: 650; overflow-wrap: anywhere; }
.proj-top .meta { display: flex; gap: 8px; align-items: center; margin-top: 4px; font-size: 12px; color: var(--ink-2); flex-wrap: wrap; }
.proj-top .actions { margin-left: auto; display: flex; }
.act-list { list-style: none; margin: 0; padding: 4px 8px 4px 16px; }
.act-list li { display: flex; align-items: center; gap: 6px; padding: 3px 0; min-height: 32px; border-top: 1px solid var(--line); }
.act-list li:first-child { border-top: 0; }
.act-list .aname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act-list .adur { color: var(--ink-2); font-size: 13px; font-variant-numeric: tabular-nums; }
.act-list li .icon-btn { opacity: 0; }
.act-list li:hover .icon-btn, .act-list li .icon-btn:focus-visible { opacity: 1; }
.act-add { display: flex; gap: 6px; padding: 8px 12px 14px 16px; margin-top: auto; }
.act-add .input { padding: 6px 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px 8px 16px; }
.chip { border: 1px dashed var(--axis); background: none; border-radius: 14px; padding: 2px 10px; font-size: 12px; color: var(--ink-2); }
.chip:hover { border-style: solid; color: var(--ink); }

/* ---------- Modal ---------- */
.modal-back {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0, 0, 0, .35);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 10vh 16px 16px; overflow-y: auto;
}
.modal {
  width: 100%; max-width: 460px;
  background: var(--surface); border-radius: 14px; box-shadow: var(--shadow);
  border: 1px solid var(--border); padding: 20px;
}
.modal h2 { margin-bottom: 14px; }
.field { margin-bottom: 12px; }
.field > label, .field > .lbl { display: block; font-size: 12px; color: var(--ink-2); margin-bottom: 4px; font-weight: 500; }
.row3 { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 8px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }
.modal-actions .left { margin-right: auto; }
.form-err { color: var(--danger); font-size: 13px; margin: 6px 0 0; min-height: 1em; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 0; position: relative; }
.swatch[aria-checked="true"]::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--ink); }
.checks { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.checks label { display: inline-flex; gap: 6px; align-items: center; }

.settings-list { display: grid; gap: 12px; max-width: 640px; }
.setting { padding: 16px 18px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.setting p { margin: 2px 0 0; color: var(--ink-2); font-size: 13px; }

/* ---------- Auth & sync ---------- */
[hidden] { display: none !important; }
.auth { min-height: 100vh; display: flex; align-items: flex-start; justify-content: center; padding: 12vh 16px 24px; }
.auth-card { width: 100%; max-width: 380px; padding: 28px 24px; }
.auth-card .brand { padding: 0 0 18px; }
.auth-card .btn.primary { width: 100%; justify-content: center; padding: 10px; margin-top: 4px; }
.auth-card .btn:disabled { opacity: .6; cursor: default; }
.auth-switch { text-align: center; margin: 16px 0 0; color: var(--ink-2); font-size: 13px; }
.form-ok { color: var(--ok); font-size: 13px; margin: 6px 0 0; min-height: 1em; }
.auth-forgot { margin: -4px 0 6px; text-align: right; font-size: 13px; }
.banner.ok { color: var(--ink); background: color-mix(in srgb, var(--ok) 14%, var(--surface)); }
.linkish { border: 0; background: none; color: var(--accent); font-weight: 600; padding: 0; }
.linkish:hover { text-decoration: underline; }
.sync-status { font-size: 12px; color: var(--muted); }
.sync-status[data-status="error"] { color: var(--danger); }
.sync-status:empty { display: none; }

/* ---------- Calendar subscriptions ---------- */
.cal-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: -6px 0 12px; }
.cal-actions .ico { width: 15px; height: 15px; }
.cal-ev.ext {
  background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--ev) 9%, var(--surface)) 0 6px, var(--surface) 6px 12px);
  border: 1.5px dashed var(--ev); border-left: 3px solid var(--ev);
}
.cal-ev.ext:hover { background: color-mix(in srgb, var(--ev) 18%, var(--surface)); }
.cal-ev .t .ico { width: 11px; height: 11px; margin-right: 3px; vertical-align: -1px; color: var(--ink-2); }
.setting-block { padding: 16px 18px; }
.setting-block > p { margin: 2px 0 12px; color: var(--ink-2); font-size: 13px; }
.feed-list, .rule-list { list-style: none; margin: 0 0 12px; padding: 0; }
.feed-list li, .rule-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.feed-list li:first-child, .rule-list li:first-child { border-top: 0; }
.rule-list li > span { flex: 1; min-width: 0; font-size: 13px; }
.feed-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.feed-main .muted { font-size: 12px; }
.feed-main .form-err { margin: 2px 0 0; }
.feed-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr) auto; gap: 8px; }
.howto { margin-top: 6px; font-size: 13px; color: var(--ink-2); }
.howto summary { cursor: pointer; color: var(--accent); font-weight: 500; }
.howto p { margin: 8px 0; }
.settings-list { max-width: 760px; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .app { flex-direction: column; }
  .sidebar {
    position: fixed; bottom: 0; top: auto; left: 0; right: 0; height: auto; width: auto; z-index: 30;
    flex-direction: row; justify-content: space-around; padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    border-right: 0; border-top: 1px solid var(--border);
  }
  .sidebar .brand, .nav-spacer { display: none; }
  .nav-item { flex-direction: column; gap: 2px; font-size: 11px; padding: 6px 8px; }
  .view { padding: 16px 16px 90px; }
  .timerbar { padding: 10px 16px; }
  .tb-desc { flex-basis: 100%; }
  .tb-projwrap { flex: 1 1 0; max-width: none; }
  .tb-elapsed { min-width: 0; font-size: 16px; }
  .tb-projwrap select { max-width: none; width: 100%; }
  .entry { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; }
  .entry-time { grid-column: 1; grid-row: 2; }
  .entry-dur { grid-column: 2; grid-row: 1; }
  .entry .play { grid-column: 2; grid-row: 2; opacity: 1; justify-self: end; }
  .brk-row { gap: 6px; }
  .row3 { grid-template-columns: 1fr 1fr; }
  .feed-form { grid-template-columns: minmax(0, 1fr); }
  .donut-body { justify-content: center; gap: 16px; }
  .donut-legend { min-width: 100%; }
  .row3 > :first-child { grid-column: 1 / -1; }
  .cal-scroll { height: calc(100vh - 300px); }
}

/* Touch devices have no hover: keep hover-revealed buttons visible */
@media (hover: none) {
  .entry .play, .act-list li .icon-btn { opacity: 1; }
}
