/* Clyde · Work. Tokens first: light, then dark (OS setting or Telegram's theme). */
:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --wash: #f1f0ec;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --track: #ecebe6;
  --accent: #2a78d6;
  /* Area colours: categorical slots, in fixed order */
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
  --s5: #e87ba4; --s6: #008300; --s7: #6250d6; --s8: #e34948;
  /* Status: only where colour means good/bad, always with an icon and words */
  --good: #0ca30c; --good-text: #006300; --serious: #ec835a; --critical: #d03b3b;
  --critical-text: #b42323; --critical-wash: rgba(208, 59, 59, 0.16);
  --shadow: 0 1px 2px rgba(11, 11, 11, 0.06), 0 8px 24px rgba(11, 11, 11, 0.06);
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0d0d0d; --surface: #1a1a19; --wash: #232321;
    --ink: #f0efec; --ink-2: #c3c2b7; --muted: #898781;
    --grid: #2c2c2a; --axis: #383835; --border: rgba(255, 255, 255, 0.10); --track: #2a2a28;
    --accent: #3987e5;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
    --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
    --good-text: #0ca30c; --critical-text: #f08080; --critical-wash: rgba(208, 59, 59, 0.24);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.3);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d; --surface: #1a1a19; --wash: #232321;
  --ink: #f0efec; --ink-2: #c3c2b7; --muted: #898781;
  --grid: #2c2c2a; --axis: #383835; --border: rgba(255, 255, 255, 0.10); --track: #2a2a28;
  --accent: #3987e5;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
  --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
  --good-text: #0ca30c; --critical-text: #f08080; --critical-wash: rgba(208, 59, 59, 0.24);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.3);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--page); color: var(--ink);
  font: 15px/1.45 var(--font); -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.loading { color: var(--muted); padding: 40px 16px; text-align: center; }
.muted { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* --- top bar ----------------------------------------------------------------------------- */
.top {
  position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--page) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--border); padding-top: env(safe-area-inset-top);
}
.top-in { max-width: 1120px; margin: 0 auto; display: flex; align-items: center; gap: 12px; padding: 10px 16px; }
.top h1 { font-size: 17px; font-weight: 650; margin: 0; letter-spacing: -0.01em; }
.chip-term { font-size: 13px; color: var(--ink-2); background: var(--wash); border-radius: 99px; padding: 3px 10px; white-space: nowrap; }
.top .grow { flex: 1; }
.btn {
  border: 1px solid var(--border); background: var(--surface); border-radius: 10px;
  padding: 7px 12px; font-size: 14px; font-weight: 550; display: inline-flex; align-items: center; gap: 6px;
  min-height: 36px;
}
.btn:hover { background: var(--wash); }
.btn.primary { background: var(--ink); color: var(--page); border-color: transparent; }
.btn.primary:hover { opacity: 0.88; }
.btn.danger { color: var(--critical-text); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--wash); }
.btn[disabled] { opacity: 0.5; cursor: default; }
.icon-btn { width: 36px; padding: 0; justify-content: center; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 16px 16px 96px; }
section.block { margin-top: 22px; }
.block-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; margin: 0 0 10px; }
.block-head h2 { font-size: 13px; font-weight: 650; margin: 0; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.05em; }
.block-head .note { font-size: 13px; color: var(--muted); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }

/* --- headline ------------------------------------------------------------------------------ */
.headline { display: grid; grid-template-columns: minmax(220px, 1.2fr) repeat(3, minmax(0, 1fr)); gap: 12px; }
.tile { padding: 14px 16px; }
.tile .label { font-size: 13px; color: var(--ink-2); }
.tile .value { font-size: 24px; font-weight: 650; letter-spacing: -0.02em; margin-top: 2px; }
.tile .sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.hero .value { font-size: 44px; line-height: 1.05; }
.hero .status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; margin-top: 6px; }
.status.bad { color: var(--critical-text); }
.status.good { color: var(--good-text); }
.status .ico { width: 16px; height: 16px; flex: none; }
@media (max-width: 760px) {
  .headline { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .hero { grid-column: 1 / -1; }
  .tile.hero .value { font-size: 38px; }
  .tile { padding: 10px 12px; }
  .tile .value { font-size: 20px; }
  .tile .label, .tile .sub { font-size: 12px; }
}

/* --- area filter row ---------------------------------------------------------------------- */
.filters { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; margin: 18px -2px 0; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.fchip {
  flex: none; display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--border);
  background: var(--surface); border-radius: 99px; padding: 6px 12px 6px 10px; font-size: 14px; min-height: 34px;
}
.fchip[aria-pressed="true"] { background: var(--ink); color: var(--page); border-color: transparent; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c, var(--muted)); flex: none; }
.fchip[aria-pressed="true"] .dot { box-shadow: 0 0 0 2px var(--page); }

/* --- area cards ------------------------------------------------------------------------- */
.areas { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.area { padding: 14px 16px 12px; text-align: left; width: 100%; color: inherit; display: flex; flex-direction: column; justify-content: flex-start; }
.area:hover { border-color: var(--axis); }
.area[aria-pressed="true"] { outline: 2px solid var(--c); outline-offset: -1px; }
.area .name { display: flex; align-items: center; gap: 8px; font-weight: 650; }
.area .full { font-size: 12.5px; color: var(--muted); margin: 1px 0 10px 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meter { position: relative; height: 8px; border-radius: 4px; background: color-mix(in oklab, var(--c) 18%, var(--surface)); }
.meter .fill { position: absolute; inset: 0 auto 0 0; border-radius: 4px; background: var(--c); }
.meter .expected { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; background: var(--ink); border-radius: 1px; }
.area .nums { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-2); margin-top: 8px; font-variant-numeric: tabular-nums; }
.area .state { font-size: 13px; margin-top: 6px; display: flex; align-items: center; gap: 6px; min-height: 20px; }
.area .next { font-size: 13px; color: var(--ink-2); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 600px) {
  .areas { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .area { padding: 10px 12px; }
  .area .full, .area .next { display: none; }
  .area .meter { margin-top: 8px; }
  .area .nums, .area .state { font-size: 12px; }
}

/* --- timeline ---------------------------------------------------------------------------- */
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--ink-2); margin: 0 0 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend svg { flex: none; }
.timeline { display: flex; overflow: hidden; }
.tl-labels { flex: none; border-right: 1px solid var(--grid); background: var(--surface); z-index: 1; }
.tl-labels .head { height: 40px; }
.tl-row-label { display: flex; flex-direction: column; justify-content: center; padding: 0 12px; border-top: 1px solid var(--grid); }
.tl-row-label .n { display: flex; align-items: center; gap: 7px; font-size: 14px; font-weight: 600; min-width: 0; }
.tl-row-label .n .t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-row-label .s { font-size: 12px; color: var(--muted); margin-left: 17px; white-space: nowrap; }
.tl-row-label .s.bad { color: var(--critical-text); }
.tl-scroll { flex: 1; overflow-x: auto; overscroll-behavior-x: contain; }
.tl-scroll svg { display: block; }
.tl-scroll svg text { font-family: var(--font); }
.hit { fill: transparent; cursor: pointer; }
.sheet .items { max-height: 50vh; overflow-y: auto; }
.hit:hover + .mark, .hit:focus + .mark { filter: brightness(1.12); }
@media (max-width: 600px) { .tl-row-label { padding: 0 8px; } .tl-row-label .n { font-size: 13px; } }

#tooltip {
  position: fixed; z-index: 50; pointer-events: none; max-width: 280px; background: var(--surface);
  color: var(--ink); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow);
  padding: 8px 10px; font-size: 13px; line-height: 1.35;
}
#tooltip .v { font-weight: 650; }
#tooltip .k { display: flex; align-items: center; gap: 6px; color: var(--ink-2); }
#tooltip .k i { width: 12px; height: 2px; border-radius: 1px; background: var(--c); }

/* --- the list --------------------------------------------------------------------------- */
.group { margin-top: 18px; }
.group-head { display: flex; align-items: center; gap: 10px; margin: 0 4px 6px; }
.group-head h3 { font-size: 14px; font-weight: 650; margin: 0; }
.group-head .note { font-size: 13px; color: var(--muted); }
.group-head .grow { flex: 1; }
.group-head .btn { min-height: 30px; padding: 4px 10px; font-size: 13px; }
.items { list-style: none; margin: 0; padding: 4px 0; }
.item { display: flex; align-items: flex-start; gap: 12px; padding: 9px 14px; border-top: 1px solid var(--grid); }
.item:first-child { border-top: 0; }
.item.done .what { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--axis); }
.check {
  flex: none; width: 24px; height: 24px; margin-top: 1px; border-radius: 7px; border: 2px solid var(--axis);
  background: var(--surface); display: grid; place-items: center; padding: 0;
}
.check:hover { border-color: var(--c, var(--accent)); }
.check[aria-checked="true"] { background: var(--c, var(--accent)); border-color: var(--c, var(--accent)); }
.check svg { width: 14px; height: 14px; opacity: 0; }
.check[aria-checked="true"] svg { opacity: 1; }
.check-slot { flex: none; width: 24px; height: 24px; display: grid; place-items: center; color: var(--muted); margin-top: 1px; }
.item .body { flex: 1; min-width: 0; cursor: pointer; }
.item .what { font-weight: 550; overflow-wrap: anywhere; }
.item .what .detail { font-weight: 400; color: var(--ink-2); }
.item .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 13px; color: var(--ink-2); margin-top: 2px; }
.item .meta .area-tag { display: inline-flex; align-items: center; gap: 6px; }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 650; border-radius: 6px; padding: 1px 7px; }
.badge.bad { color: var(--critical-text); background: var(--critical-wash); }
.badge.soon { color: var(--ink); background: var(--wash); }
.badge .ico { width: 12px; height: 12px; }
.more { display: block; width: 100%; text-align: center; padding: 10px; border: 0; background: transparent; color: var(--ink-2); font-size: 14px; border-top: 1px solid var(--grid); }
.more:hover { background: var(--wash); }
.empty { padding: 18px 16px; color: var(--muted); text-align: center; }

/* --- sheets (add, edit, areas, sign in) ------------------------------------------------------- */
dialog.sheet {
  border: 1px solid var(--border); border-radius: 18px; padding: 0; width: min(520px, calc(100vw - 24px));
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow); max-height: calc(100dvh - 32px);
}
dialog.sheet::backdrop { background: rgba(0, 0, 0, 0.32); }
@media (max-width: 600px) {
  dialog.sheet { margin: auto 0 0; width: 100vw; max-width: 100vw; border-radius: 18px 18px 0 0; padding-bottom: env(safe-area-inset-bottom); }
}
.sheet form { padding: 18px; display: grid; gap: 14px; }
.sheet h2 { font-size: 18px; margin: 0; }
.sheet .from { font-size: 13px; color: var(--muted); margin-top: -8px; }
.field { display: grid; gap: 5px; }
.field > span { font-size: 13px; color: var(--ink-2); font-weight: 550; }
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--border); background: var(--page); border-radius: 10px; padding: 9px 11px; min-height: 40px;
}
.field textarea { min-height: 72px; resize: vertical; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg { display: flex; background: var(--wash); border-radius: 10px; padding: 3px; gap: 3px; }
.seg button { flex: 1; border: 0; background: transparent; border-radius: 8px; padding: 6px 8px; font-size: 14px; min-height: 32px; }
.seg button[aria-pressed="true"] { background: var(--surface); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12); font-weight: 600; }
.actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.actions .grow { flex: 1; }
.error { color: var(--critical-text); font-size: 14px; min-height: 1em; }
.area-edit { border-top: 1px solid var(--grid); padding-top: 12px; display: grid; gap: 8px; }
.area-edit:first-of-type { border-top: 0; padding-top: 0; }
.area-edit .row { display: flex; align-items: center; gap: 8px; }
.area-edit .row input[type="text"] { flex: 1; }
.toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); white-space: nowrap; }

/* --- sign in ------------------------------------------------------------------------------ */
.signin { max-width: 380px; margin: 12vh auto 0; padding: 28px 22px; text-align: center; }
.signin h1 { font-size: 22px; margin: 6px 0 6px; }
.signin p { color: var(--ink-2); margin: 0 0 18px; }
.signin form { display: grid; gap: 12px; }
.signin input { text-align: center; font-size: 26px; letter-spacing: 0.3em; font-variant-numeric: tabular-nums; }
.logo { width: 52px; height: 52px; }

/* --- toast and the add button ------------------------------------------------------------- */
#toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60;
  background: var(--ink); color: var(--page); border-radius: 12px; padding: 10px 14px; font-size: 14px;
  display: flex; align-items: center; gap: 14px; box-shadow: var(--shadow); max-width: calc(100vw - 32px);
}
#toast button { border: 0; background: transparent; color: inherit; font-weight: 700; text-decoration: underline; padding: 4px; }
.fab {
  position: fixed; right: 18px; bottom: calc(22px + env(safe-area-inset-bottom)); z-index: 30; width: 56px; height: 56px;
  border-radius: 18px; border: 0; background: var(--ink); color: var(--page); box-shadow: var(--shadow);
  display: none; place-items: center;
}
.fab svg { width: 24px; height: 24px; }
@media (max-width: 760px) { .fab { display: grid; } .top .add-btn { display: none; } }
.stale { opacity: 0.6; transition: opacity 0.2s; }

/* --- chat with Clyde: beside the tracker on a wide screen, over it on a narrow one, the whole screen on a phone */
.chat-btn { position: relative; }
.chat-btn[aria-expanded="true"] { background: var(--ink); color: var(--page); border-color: transparent; }
.chat-btn.unread::after {
  content: ""; position: absolute; top: -3px; right: -3px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 2px var(--page);
}
.chat {
  position: fixed; z-index: 40; top: 0; right: 0; bottom: 0; width: min(420px, 100vw);  /* CHAT_WIDTH in app.js */
  display: flex; flex-direction: column; background: var(--surface); color: var(--ink);
  border-left: 1px solid var(--border); box-shadow: var(--shadow);
}
.chat:focus { outline: none; }
@media (min-width: 1100px) { body.chat-open .wrap, body.chat-open .top-in { margin-right: 420px; } }
.chat-head {
  display: flex; align-items: center; gap: 10px; flex: none;
  padding: calc(10px + env(safe-area-inset-top)) 10px 10px 16px; border-bottom: 1px solid var(--grid);
}
.chat-head .logo { width: 30px; height: 30px; }
.chat-head h2 { font-size: 16px; font-weight: 650; margin: 0; line-height: 1.25; }
.chat-head .sub { font-size: 12.5px; color: var(--muted); }
.chat-head .grow { flex: 1; }
.chat-log {
  flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 16px;
  display: flex; flex-direction: column; gap: 8px;
}
.chat-log > * { flex: none; }  /* scroll, never squash */
.chat-log:focus-visible { outline-offset: -2px; border-radius: 0; }
.msg { max-width: 86%; padding: 8px 12px; border-radius: 16px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.4; }
.msg.me { align-self: flex-end; background: var(--ink); color: var(--page); border-bottom-right-radius: 5px; }
.msg.clyde { align-self: flex-start; background: var(--wash); border-bottom-left-radius: 5px; }
.msg.bad { background: var(--critical-wash); color: var(--critical-text); }  /* not .error: the sheets' .error sets a min-height */
.msg a { color: inherit; text-underline-offset: 2px; }
.msg .ico { width: 14px; height: 14px; vertical-align: -2px; margin-right: 6px; }
.chat-when { align-self: center; font-size: 12px; color: var(--muted); margin-top: 6px; }
.msg.thinking { display: inline-flex; align-items: center; gap: 10px; color: var(--ink-2); }
.dots { display: inline-flex; gap: 4px; flex: none; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.4; }
.chat-intro { margin: auto 0; padding: 8px; text-align: center; color: var(--ink-2); }
.chat-intro p { margin: 0 0 14px; }
.chat-suggest { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.chat-error { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 0; color: var(--critical-text); font-size: 14px; }
.chat-error .ico { width: 16px; height: 16px; flex: none; }
.chat-form {
  display: flex; align-items: flex-end; gap: 8px; flex: none;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--grid);
}
.chat-form textarea {
  flex: 1; min-width: 0; resize: none; border: 1px solid var(--border); background: var(--page); border-radius: 12px;
  padding: 9px 12px; min-height: 40px; max-height: 160px; line-height: 1.4; overflow-y: hidden;
}
.chat-form textarea:disabled { opacity: 0.6; }
.chat-form .send { width: 40px; height: 40px; border-radius: 12px; flex: none; }
@media (max-width: 600px) {
  .chat-btn { width: 36px; padding: 0; justify-content: center; }
  .chat-btn .lbl { display: none; }
  .chat { width: 100vw; border-left: 0; }
  body.chat-open { overflow: hidden; }
  .chat-form textarea { font-size: 16px; }  /* smaller text makes iOS zoom in */
}
@media (prefers-reduced-motion: no-preference) {
  .chat:not([hidden]) { animation: chat-in 0.2s ease-out; }
  .dots i { animation: dot 1.2s ease-in-out infinite; }
  .dots i:nth-child(2) { animation-delay: 0.15s; }
  .dots i:nth-child(3) { animation-delay: 0.3s; }
}
@media (max-width: 600px) and (prefers-reduced-motion: no-preference) { .chat:not([hidden]) { animation-name: chat-up; } }
@keyframes chat-in { from { transform: translateX(32px); opacity: 0; } }
@keyframes chat-up { from { transform: translateY(32px); opacity: 0; } }
@keyframes dot { 0%, 60%, 100% { opacity: 0.4; transform: none; } 30% { opacity: 1; transform: translateY(-2px); } }
@media (prefers-reduced-motion: no-preference) { .check, .fchip, .btn { transition: background-color 0.15s, border-color 0.15s; } }

/* --- Work / Calendar ------------------------------------------------------------------------------ */
.tabs { display: inline-flex; background: var(--wash); border-radius: 10px; padding: 3px; gap: 2px; flex: none; }
.tabs button {
  border: 0; background: transparent; border-radius: 8px; padding: 5px 12px; min-height: 32px;
  font-size: 15px; font-weight: 600; color: var(--ink-2);
}
.tabs button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12); }
@media (max-width: 600px) { .top .chip-term { display: none; } .tabs button { padding: 5px 10px; } }

/* --- the calendar: a week (three days on a phone), Clyde's events beside mine ------------------------ */
.cal-wrap { padding-top: 10px; }
.cal-block { margin-top: 0; }
.cal-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 10px; }
.cal-nav { display: inline-flex; gap: 4px; }
.cal-range { font-size: 17px; font-weight: 650; margin: 0 0 0 4px; letter-spacing: -0.01em; }
.cal-warn { display: flex; align-items: center; gap: 6px; margin: -2px 0 10px; font-size: 13px; color: var(--critical-text); }
.cal-warn.muted { color: var(--muted); }
.cal-warn .ico { width: 15px; height: 15px; flex: none; }
.cal { overflow: hidden; }
.cal-scroll { height: calc(100dvh - 200px); min-height: 380px; overflow-y: auto; overscroll-behavior: contain; }
.cal-row { display: grid; grid-template-columns: var(--gut) repeat(var(--days), minmax(0, 1fr)); --gut: 52px; }
.cal-top { position: sticky; top: 0; z-index: 3; background: var(--surface); border-bottom: 1px solid var(--grid); }
.dh { display: grid; justify-items: center; gap: 1px; padding: 6px 2px 4px; font-size: 12px; color: var(--ink-2); }
.dh .dn { font-size: 19px; font-weight: 600; color: var(--ink); width: 32px; height: 32px; line-height: 32px; text-align: center; border-radius: 50%; }
.dh.today .dw { color: var(--accent); font-weight: 650; }
.dh.today .dn { background: var(--accent); color: #fff; }
.cal-allday { border-top: 1px solid var(--grid); }
.gut { font-size: 11px; color: var(--muted); }
.cal-allday .gut { text-align: right; padding: 7px 8px 0 0; }
.ad { display: flex; flex-direction: column; gap: 2px; min-width: 0; min-height: 28px; padding: 3px 2px; border-left: 1px solid var(--grid); }
.chip {
  display: block; width: 100%; border: 0; border-radius: 5px; padding: 2px 6px; text-align: left;
  font-size: 12px; line-height: 1.35; background: var(--c); color: var(--on, #fff);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal-body { position: relative; }
.hours { position: relative; }
.hours span { position: absolute; right: 8px; transform: translateY(-50%); }
.day {
  position: relative; min-width: 0; border-left: 1px solid var(--grid); cursor: cell;
  background-image: linear-gradient(to bottom, var(--grid) 1px, transparent 1px); background-size: 100% var(--hour);
}
.day.today { background-color: color-mix(in srgb, var(--accent) 5%, transparent); }
.ev {
  position: absolute; display: flex; flex-direction: column; overflow: hidden; border: 0; border-radius: 6px;
  padding: 2px 6px; text-align: left; font-size: 12px; line-height: 1.25; background: var(--c); color: var(--on, #fff);
  box-shadow: 0 0 0 1px var(--surface);
}
.ev .t { font-weight: 600; overflow: hidden; overflow-wrap: anywhere; }
.ev .m { opacity: 0.85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev:hover, .chip:hover { filter: brightness(1.06); }
.ev.pending, .chip.pending {
  background: color-mix(in srgb, var(--c) 14%, var(--surface)); color: var(--ink);
  outline: 1.5px dashed var(--c); outline-offset: -1.5px;
}
.ev.maybe, .chip.maybe { background: color-mix(in srgb, var(--c) 55%, var(--surface)); color: var(--ink); }
.ev.ro, .chip.ro {
  background: color-mix(in srgb, var(--c) 30%, var(--surface)); color: var(--ink);
  box-shadow: inset 3px 0 0 var(--c), 0 0 0 1px var(--surface);
}
.now { position: absolute; left: -1px; right: 0; height: 2px; margin-top: -1px; background: var(--critical); z-index: 2; pointer-events: none; }
.now::before { content: ""; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--critical); }
.cal-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; font-size: 12.5px; color: var(--ink-2); }
.cal-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.ev-meta { display: grid; gap: 6px; margin-top: -6px; font-size: 14px; color: var(--ink-2); }
.ev-cal { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ev-notes { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; background: var(--wash); border-radius: 10px; padding: 10px 12px; }
.ev-notes a { color: inherit; }
.ev-origin { font-size: 13px; }
a.btn { text-decoration: none; color: inherit; }
@media (max-width: 600px) {
  .cal-row { --gut: 40px; }
  .cal-scroll { height: calc(100dvh - 180px); }
  .cal-allday .gut { padding-right: 4px; font-size: 10px; }
  .hours span { right: 4px; font-size: 10px; }
  .ev { padding: 2px 4px; font-size: 11.5px; }
  .cal-range { font-size: 15px; }
}

/* --- how cooked I am ---------------------------------------------------------------------------- */
.cook { display: flex; align-items: center; gap: 16px; padding: 14px 18px 12px 14px; margin-bottom: 12px; }
.cook-steak { flex: none; display: grid; place-items: center; width: 76px; height: 76px; border-radius: 12px; background: var(--wash); }
.steak { width: 64px; height: 64px; image-rendering: pixelated; }
.cook-body { flex: 1; min-width: 0; }
.cook-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.cook-name { font-size: 21px; font-weight: 700; letter-spacing: -0.01em; }
.cook-pct { font-size: 15px; font-weight: 650; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cook-means { font-size: 13px; color: var(--ink-2); margin: 1px 0 9px; }
.cookometer { position: relative; }
.segs { display: flex; gap: 2px; height: 12px; }
.seg { background: var(--m); opacity: 0.22; }
.seg.on { opacity: 1; }
.needle { position: absolute; top: -4px; bottom: -4px; width: 4px; margin-left: -2px; background: var(--ink); box-shadow: 0 0 0 2px var(--surface); }
.cook-scale { position: relative; height: 15px; margin-top: 5px; font-size: 11px; color: var(--muted); }
.cook-scale span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.cook-scale span:first-child { transform: none; }
.cook-scale span:last-child { transform: translateX(-100%); }
@media (max-width: 600px) {
  .cook { gap: 12px; padding: 12px 14px 10px 12px; }
  .cook-steak { width: 64px; height: 64px; }
  .steak { width: 56px; height: 56px; }
  .cook-name { font-size: 18px; }
}

/* Each task carries its module's colour, so the list sorts itself by eye on a phone too. */
.item { box-shadow: inset 4px 0 0 var(--c, transparent); }
.check { border-color: color-mix(in srgb, var(--c, var(--axis)) 65%, var(--axis)); }
.item .meta .area-tag { color: var(--ink); font-weight: 600; }
