/* Design tokens: light by default, dark via prefers-color-scheme */
:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --text: #1d1d1f;
  --muted: #6b6b70;
  --border: #e2e2e0;
  --accent: #5b5fc7;
  --rail: #ebebeb;
  --accent-text: #ffffff;
  --work: #2f6fde;
  --personal: #1f9d6b;
  --warn-bg: #fff4d6;
  --warn-text: #7a5300;
  --danger: #c43d3d;
  --radius: 10px;
  color-scheme: light dark; /* native date/time pickers follow the theme */
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141416;
    --surface: #1e1e21;
    --text: #ececef;
    --muted: #9a9aa2;
    --border: #2e2e33;
    --accent: #7f85f5;
    --rail: #0f0f11;
    --work: #6d9cf2;
    --personal: #45c08f;
    --warn-bg: #3a2f12;
    --warn-text: #f3cf6e;
    --danger: #e06666;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
button, input, textarea, select { font: inherit; color: inherit; }

/* Layout */
.shell { max-width: 1400px; margin: 0 auto; padding: 0 16px 96px; }
header.top {
  position: sticky; top: 0; z-index: 10;
  background: var(--bg);
  padding: 12px 0 8px;
  border-bottom: 1px solid var(--border);
}
.capture { display: flex; gap: 8px; }
.capture input { flex: 1; }
.flash { color: var(--personal); font-size: 13px; min-height: 18px; margin-top: 4px; }

nav.tabs {
  display: flex; gap: 4px; overflow-x: auto; padding-top: 6px;
  scrollbar-width: none;
}
nav.tabs a {
  white-space: nowrap; text-decoration: none; color: var(--muted);
  padding: 6px 10px; border-radius: 999px; font-size: 14px;
}
nav.tabs a.active { background: var(--accent); color: var(--accent-text); }
nav.tabs a.soon { opacity: .5; }
.count {
  display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px;
  border-radius: 999px; background: var(--border); color: var(--text);
  font-size: 12px; text-align: center;
}
nav.tabs a.active .count { background: rgba(255,255,255,.25); color: inherit; }

main { padding-top: 16px; }
h1 { font-size: 20px; margin: 0 0 12px; }
h2 { font-size: 16px; margin: 20px 0 8px; }
.muted { color: var(--muted); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* Controls */
input[type=text], input[type=search], input[type=date], input[type=time], textarea, select {
  width: 100%; padding: 9px 11px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
textarea { min-height: 70px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
button {
  padding: 8px 14px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface); cursor: pointer;
}
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
button.ghost { border-color: transparent; background: transparent; color: var(--muted); padding: 4px 8px; }
button.danger { color: var(--danger); }
button:disabled { opacity: .5; cursor: default; }
label.field { display: block; margin: 12px 0 4px; font-size: 13px; color: var(--muted); }

/* Cards and lists */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px; margin-bottom: 10px;
}
ul.list { list-style: none; margin: 0; padding: 0; }
ul.list li {
  display: flex; gap: 10px; align-items: center;
  padding: 9px 4px; border-bottom: 1px solid var(--border);
}
ul.list li:last-child { border-bottom: 0; }
.title { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.done .title { text-decoration: line-through; color: var(--muted); }

.chip {
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--muted); white-space: nowrap;
}
.chip.work { color: var(--work); border-color: var(--work); }
.chip.personal { color: var(--personal); border-color: var(--personal); }

.seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.seg button { border: 0; border-radius: 0; }
.seg button.on { background: var(--accent); color: var(--accent-text); }

.warn {
  background: var(--warn-bg); color: var(--warn-text);
  border-radius: var(--radius); padding: 8px 10px; margin: 6px 0 0; font-size: 13px;
}
.big-question { font-size: 18px; margin: 4px 0 14px; }
.inbox-title { font-size: 20px; font-weight: 600; margin: 0 0 6px; }
.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
progress { width: 80px; }
.nowrap { white-space: nowrap; }
.seg.small button { padding: 4px 8px; font-size: 12px; }
select.compact { width: auto; padding: 6px 6px; font-size: 13px; }
.chip.size { font-weight: 600; }

/* Capture: on phones the text field takes its own row */
.capture { flex-wrap: wrap; }
.capture input { min-width: 220px; }

/* Classify layout: board of boxes + sticky side panel */
.classify-layout { display: grid; gap: 16px; }
.classify-layout.with-panel { grid-template-columns: minmax(0, 1fr) 420px; align-items: start; }
.panel { position: sticky; top: 130px; max-height: calc(100vh - 150px); overflow-y: auto; }
.board-help { font-size: 13px; }
@media (max-width: 900px) {
  .classify-layout.with-panel { grid-template-columns: 1fr; }
  .classify-layout.with-panel .panel { order: -1; position: static; max-height: none; }
}

.task-row { display: flex; gap: 6px; align-items: center; width: 100%; }
.task-row input[type=text] { flex: 1; min-width: 0; }
.task-rows li { display: block; padding: 6px 0; }
@media (max-width: 520px) {
  .task-row { flex-wrap: wrap; }
  .task-row input[type=text] { flex-basis: 100%; order: -1; }
}
input[type=range] { width: 100%; accent-color: var(--accent); }

/* Board: box area grows with the expected size */
.board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  grid-auto-rows: 56px;
  grid-auto-flow: dense;
  gap: 10px;
}
.box {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 4px;
  text-align: left; padding: 10px; border-radius: 12px;
  background: var(--surface); border: 2px solid var(--border);
  transition: transform .15s, box-shadow .15s;
}
.box:hover { transform: translateY(-2px); box-shadow: 0 4px 14px rgba(0,0,0,.12); }
.box.selected { outline: 3px solid var(--accent); outline-offset: 1px; }
.box-top { display: flex; justify-content: space-between; gap: 6px; font-size: 11px; color: var(--muted); }
.box-age { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.box-size { font-weight: 700; color: var(--text); }
.box-title { flex: 1; font-weight: 600; overflow: hidden; overflow-wrap: anywhere; }
.box-foot { font-size: 11px; color: var(--muted); }
.box-pct { position: absolute; left: 0; bottom: 0; height: 4px; background: var(--accent); }

/* Area grows roughly with size: 2 → 4 → 6 → 9 → 12 cells */
.box.size-none, .box.size-xs { grid-column: span 1; grid-row: span 2; }
.box.size-s  { grid-column: span 2; grid-row: span 2; }
.box.size-m  { grid-column: span 2; grid-row: span 3; }
.box.size-l  { grid-column: span 3; grid-row: span 3; }
.box.size-xl { grid-column: span 3; grid-row: span 4; }
.box.size-none .box-size { color: var(--muted); }
.box.size-m .box-title, .box.size-l .box-title { font-size: 17px; }
.box.size-xl .box-title { font-size: 20px; }
@media (max-width: 520px) {
  .box.size-l, .box.size-xl { grid-column: span 2; }
}

/* Aging: fresh and green → wilting → cobwebs → fossil */
.box.age-fresh { border-color: var(--personal); }
.box.age-young { border-color: color-mix(in srgb, var(--personal) 45%, var(--border)); }
.box.age-wilting {
  border-color: #c98a3a;
  background: color-mix(in srgb, #c98a3a 10%, var(--surface));
  transform: rotate(-.6deg);
}
.box.age-cobweb {
  border: 2px dashed #9a8a73;
  background: color-mix(in srgb, #9a8a73 16%, var(--surface));
  filter: sepia(.35);
  transform: rotate(.8deg);
}
.box.age-cobweb::after {
  content: "🕸️"; position: absolute; right: -4px; bottom: -6px;
  font-size: 34px; opacity: .45; pointer-events: none;
}
.box.age-fossil {
  border: 2px dashed #8a8a8a;
  background: repeating-linear-gradient(135deg,
    color-mix(in srgb, #8a8a8a 14%, var(--surface)) 0 8px,
    color-mix(in srgb, #8a8a8a 22%, var(--surface)) 8px 16px);
  filter: grayscale(.8);
  transform: rotate(-1.2deg);
}
.box.age-fossil .box-title { opacity: .75; }
.box.age-wilting:hover, .box.age-cobweb:hover, .box.age-fossil:hover { transform: rotate(0) translateY(-2px); }

/* Sprint and calendar */
.pill {
  text-decoration: none; color: var(--text); font-size: 13px;
  padding: 5px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
}
.pill.on { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.sprint-picker { margin-bottom: 12px; }
.button-link, .button-like {
  display: inline-block; padding: 8px 14px; border-radius: var(--radius); cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); text-decoration: none;
}
.button-link.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.two-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
@media (max-width: 760px) { .two-cols { grid-template-columns: 1fr; } }
.drop.over { outline: 2px dashed var(--accent); outline-offset: -2px; }
.plan-task { cursor: grab; }
.project-name { font-size: 12px; }
.hint ol { margin: 8px 0; padding-left: 20px; }
.hint summary { cursor: pointer; }
.cal-toolbar { margin-bottom: 10px; }
.day-tabs { margin-bottom: 10px; width: 100%; }
.day-tabs button { flex: 1; padding: 6px 0; font-size: 13px; }

.cal-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 12px; align-items: start; }
.cal-side { position: sticky; top: 130px; max-height: calc(100vh - 150px); overflow-y: auto; }
@media (max-width: 900px) {
  .cal-layout { grid-template-columns: 1fr; }
  .cal-side { position: static; max-height: none; order: -1; }
}

.cal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.cal-head, .cal-body { display: grid; grid-template-columns: 48px repeat(var(--cols), minmax(0, 1fr)); }
.cal-head { border-bottom: 1px solid var(--border); }
.cal-day { padding: 8px 6px; font-size: 13px; font-weight: 600; text-align: center; }
.cal-day::first-letter { text-transform: uppercase; }
.cal-day.today { color: var(--accent); }
.cal-body { position: relative; }
.cal-gutter { position: relative; }
.cal-gutter span { position: absolute; right: 6px; transform: translateY(-50%); font-size: 11px; color: var(--muted); }
.cal-gutter span:first-child { transform: none; }
.cal-col {
  position: relative; border-left: 1px solid var(--border);
  background-image: repeating-linear-gradient(to bottom, var(--border) 0 1px, transparent 1px 48px);
}

.ev {
  position: absolute; left: 3px; right: 3px; overflow: hidden;
  border-radius: 6px; padding: 3px 6px; font-size: 12px; line-height: 1.3; text-align: left;
}
.ev.busy {
  background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--muted) 22%, var(--surface)) 0 6px,
    color-mix(in srgb, var(--muted) 30%, var(--surface)) 6px 12px);
  color: var(--text); pointer-events: auto;
}
.ev.slot {
  border: 1px dashed var(--personal); background: color-mix(in srgb, var(--personal) 8%, transparent);
  color: var(--personal); cursor: pointer; opacity: .8;
  display: flex; align-items: flex-start; flex-wrap: wrap; gap: 0 4px;
}
.ev.slot:hover { opacity: 1; background: color-mix(in srgb, var(--personal) 16%, transparent); }
.ev.block {
  background: color-mix(in srgb, var(--accent) 22%, var(--surface));
  border-left: 4px solid var(--accent); cursor: pointer; display: flex; flex-direction: column; gap: 1px;
}
.ev.block.personal { background: color-mix(in srgb, var(--personal) 22%, var(--surface)); border-left-color: var(--personal); }
.ev.block.selected { outline: 2px solid var(--accent); }
.ev.block.over { outline: 2px dashed var(--accent); }
.ev.block.overload { border-left-color: var(--danger); }
.ev-time { color: var(--muted); font-size: 11px; }
.ev-task { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-task.done { text-decoration: line-through; color: var(--muted); }

.meter { height: 6px; border-radius: 3px; background: var(--border); overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--accent); }
.meter.overload span { background: var(--danger); }

/* Face boxes (design/aging-styles): the box is also the face of the waiting item */
.c-green  { --c: #7cc48c; }
.c-blue   { --c: #79a8e8; }
.c-amber  { --c: #e0b46a; }
.c-red    { --c: #e88370; }
.c-pink   { --c: #d98cb8; }
.c-violet { --c: #a990e0; }

.face-box {
  --face-line: color-mix(in srgb, var(--text) 62%, transparent);
  --face-eye: #eceef2;
  --face-pupil: #121316;
  --glow: var(--accent);
  border: 1.5px solid color-mix(in srgb, var(--text) 38%, transparent);
  background: transparent;
  border-radius: 16px;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease, border-radius .2s ease;
}
.face-box .box-age { color: var(--accent); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
/* The face fills the lower part of the box whatever its size; the title sits on top, max 2 lines */
.face-box .box-top, .face-box .box-title { position: relative; z-index: 1; }
.face-box .box-title {
  flex: 0 0 auto; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  text-shadow: 0 1px 3px var(--bg);
}
.face-wrap { position: absolute; left: 6px; right: 6px; bottom: 6px; top: max(50px, 32%); display: flex; }
.face { width: 100%; height: 100%; overflow: visible; }

/* Priority colors (settings.box_color = priority); unspecified is the standard blue */
.p-none   { --c: #5b9be8; }
.p-low    { --c: #5bb878; }
.p-medium { --c: #d6c27e; }
.p-high   { --c: #ff3b3b; }
.prio-dot { display: inline-block; flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.prio-seg button { display: inline-flex; align-items: center; gap: 5px; }
.prio-seg button.on { background: color-mix(in srgb, var(--c) 30%, var(--surface)); color: var(--text); }
.prio-select { border-left: 4px solid var(--c); }
/* Classic boxes keep their aging look; priority shows as a top band */
.box.colored:not(.face-box) { border-top: 5px solid var(--c); }

.face-box.colored {
  --face-line: var(--c);
  --glow: var(--c);
  border-color: var(--c);
  background: color-mix(in srgb, var(--c) 14%, var(--surface));
}
.face-box.colored .box-age { color: var(--c); }
@media (prefers-color-scheme: light) {
  .face-box { --face-eye: #ffffff; }
  .face-box.colored { --face-line: color-mix(in srgb, var(--c) 70%, var(--text)); }
}

.face path { fill: none; stroke: var(--face-line); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.face .wrinkles path { stroke-width: 1.3; opacity: .55; }
.face .brows path { stroke-width: 3.6; }
.face .mustache { stroke-width: 4; }
.face .lid { stroke-width: 3; }
.face .eye-white { fill: var(--face-eye); stroke: var(--face-line); stroke-width: 1.6; }
.face .pupil-dot { fill: var(--face-pupil); }
.face .pupil-shine { fill: #fff; }
.face .pupil { transform: translate(calc(var(--px, 0) * 8px), calc(var(--py, 0) * 5px)); transition: transform .12s ease-out; }
.face .brows, .face .eye, .face .mouth { transform-box: fill-box; transform-origin: center; transition: transform .2s ease; }

/* Age deforms the box (color never encodes age) */
.face-box.face-suspicious   { transform: rotate(-.4deg); border-radius: 16px 19px 14px 18px; }
.face-box.face-angry        { transform: rotate(.6deg); border-radius: 14px 20px 16px 22px; }
.face-box.face-disappointed { transform: rotate(-.8deg); border-radius: 18px 14px 26px 22px / 16px 18px 30px 26px; }
.face-box.face-ancient      { transform: rotate(1deg); border-radius: 22px 16px 34px 28px / 18px 22px 40px 34px; border-style: solid; border-width: 1.5px 1.5px 3px; }

/* Hover: straightens, comes 2 px closer, border lights up and the face reacts to its age */
.face-box:hover, .face-box.selected {
  transform: translateY(-2px);
  border-color: var(--glow);
  box-shadow: 0 0 0 1px var(--glow), 0 0 18px color-mix(in srgb, var(--glow) 45%, transparent);
}
.face-box.selected { outline: none; }
.face-box:hover .brows { transform: translateY(-3px); }                       /* attention */
.face-box.face-angry:hover .brows { transform: translateY(2px) scaleX(.94); } /* reproach */
.face-box.face-angry:hover .mouth { transform: scaleX(.8); }
.face-box.face-disappointed:hover .eye,
.face-box.face-ancient:hover .eye { transform: scaleY(1.6); }                 /* resigned surprise */
.face-box.face-disappointed:hover .brows,
.face-box.face-ancient:hover .brows { transform: translateY(-5px); }
.face-box.face-eager:hover .mouth { transform: scale(1.12); }

@media (prefers-reduced-motion: reduce) {
  .face-box, .face .pupil, .face .brows, .face .eye, .face .mouth { transition: none; }
}

/* Settings: shape and age-color pickers */
.style-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.style-option { padding: 10px; border-radius: var(--radius); border: 1px solid var(--border); }
.style-option.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.style-preview { display: grid; grid-template-rows: repeat(4, 56px); margin-bottom: 8px; }
.style-preview .box { grid-row: span 4; }
.design-sub { font-size: 15px; margin: 18px 0 8px; }
.design-note { font-weight: 400; font-size: 13px; }
.style-options.dimmed { opacity: .55; }
.age-scale { display: flex; gap: 3px; height: 8px; margin-bottom: 8px; }
.age-scale span { flex: 1; height: 8px; border-radius: 2px; }

/* Centered dialog (classify, review) */
body.modal-open { overflow: hidden; }
.backdrop {
  position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, .55);
  display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px; overflow-y: auto;
}
.modal {
  width: 100%; max-width: 640px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 18px 20px; box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
}
.modal.wide { max-width: 940px; }
@media (max-width: 600px) {
  .backdrop { padding: 0; }
  .modal, .modal.wide { min-height: 100vh; border-radius: 0; }
}
.dialog-head { display: flex; align-items: center; gap: 8px; }
.dialog-title { font-size: 20px; font-weight: 600; margin-top: 6px; }
.dialog-section { font-size: 15px; margin: 18px 0 6px; }
.small-label { font-size: 12px; }

/* Task rows inside the classify dialog */
.task-grid {
  display: grid; grid-template-columns: 140px minmax(0, 1fr) 130px 120px auto 32px;
  gap: 8px; align-items: start; padding: 8px 0; border-bottom: 1px solid var(--border);
}
.task-grid-head { font-size: 12px; padding: 0 0 4px; }
.task-grid select.compact { width: 100%; }
.task-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.task-desc { font-size: 13px; padding: 6px 10px !important; }
.add-row { margin-top: 10px; border-style: dashed; width: 100%; }
@media (max-width: 760px) {
  .task-grid { grid-template-columns: 1fr 1fr; }
  .task-grid .task-text { grid-column: 1 / -1; order: -1; }
  .task-grid-head { display: none; }
}
.task-notes { display: block; font-size: 12px; }

/* Volume: 30-min cells, a divider every 2 h focus session */
.volume { margin: 6px 0; }
.volume-cells { display: flex; flex-wrap: wrap; gap: 3px; align-items: center; min-height: 20px; }
.cell { width: 16px; height: 16px; border-radius: 3px; }
.cell.half { width: 8px; }
.cell.empty { border: 1px dashed var(--border); background: transparent; }
.cell.over { outline: 2px solid var(--danger); outline-offset: -1px; }
.cell-divider { width: 1px; height: 22px; background: var(--muted); margin: 0 4px; opacity: .6; }
.volume-text { font-size: 12px; margin: 6px 0 0; }
.volume-legend { opacity: .7; }

/* Unsized boxes: dashed border, tape measure, sizes on hover */
.box { cursor: pointer; }
.box.unsized { border-style: dashed; }
.quick-size {
  position: absolute; left: 6px; right: 6px; bottom: 6px; z-index: 2;
  display: flex; justify-content: center; opacity: 0; transition: opacity .15s;
}
.quick-size .seg { background: var(--surface); }
.box:hover .quick-size, .box:focus-within .quick-size { opacity: 1; }
@media (hover: none) { .quick-size { opacity: 1; } }
.face .tape rect { fill: color-mix(in srgb, var(--face-line) 15%, transparent); stroke: var(--face-line); stroke-width: 2; }
.face .tape path { stroke-width: 1.4; }

/* Calendar week */
.cal-nav { margin-bottom: 10px; }
.cal-nav .title { font-size: 20px; }
.cal-day.past, .cal-col.past { opacity: .55; }
.ev.block.complete { border-left-color: var(--personal); opacity: .8; }
@media (max-width: 1000px) {
  .cal-layout { grid-template-columns: 1fr; }
  .cal-side { position: static; max-height: none; order: -1; }
}

button.big { font-size: 18px; padding: 12px 28px; }

/* Review */
.review-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 12px 0; }
.review-stats div { background: var(--bg); border-radius: var(--radius); padding: 10px; display: flex; flex-direction: column; }
.review-stats b { font-size: 24px; }
.history-row .title { min-width: 0; }

/* Narrow sidebar lists: title on its own line, chips and the block picker below */
.cal-side .plan-task, .review-block li { flex-wrap: wrap; row-gap: 4px; }
.cal-side .plan-task .title { flex: 1 1 100%; order: -1; }
.cal-side select.compact, .review-block select.compact { max-width: 170px; }

/* ---- Teams-like frame: icon rail on the left, capture bar on top ---- */
body { overflow: hidden; }
.app { display: grid; grid-template-columns: 72px minmax(0, 1fr); height: 100vh; }
.rail {
  background: var(--rail); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; align-items: stretch; gap: 2px; padding-top: 8px;
}
.rail-item {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 10px 0 8px; color: var(--muted); text-decoration: none; font-size: 11px;
}
.rail-item:hover { color: var(--text); }
.rail-item.active { color: var(--accent); }
.rail-item.active::before {
  content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent);
}
.rail-icon { position: relative; display: inline-flex; }
.rail-badge {
  position: absolute; top: -6px; right: -12px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; line-height: 18px; text-align: center;
}
.main-area { display: flex; flex-direction: column; min-width: 0; height: 100vh; }
.topbar { position: relative; padding: 10px 16px 6px; border-bottom: 1px solid var(--border); background: var(--bg); }
.topbar .capture { max-width: 760px; margin: 0 auto; }
.topbar .flash { position: absolute; left: 0; right: 0; bottom: -18px; text-align: center; font-size: 12px; min-height: 0; z-index: 5; }
.content { flex: 1; min-height: 0; overflow-y: auto; }
.page { max-width: 1180px; margin: 0 auto; padding: 16px 16px 48px; }
.content-calendario { overflow: hidden; }
.clickable { cursor: pointer; }
.clickable:hover { text-decoration: underline; text-decoration-color: var(--border); }
.editor-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 0 12px; }
.editor-grid select.compact { width: 100%; }

@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .rail {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; flex-direction: row; justify-content: space-around;
    padding: 0; border-right: 0; border-top: 1px solid var(--border);
  }
  .rail-item { flex: 1; padding: 8px 0 6px; }
  .rail-item.active::before { left: 25%; right: 25%; top: 0; bottom: auto; width: auto; height: 3px; border-radius: 0 0 3px 3px; }
  .main-area { height: calc(100vh - 58px); }
}

/* ---- Calendar like Teams ---- */
.cal-page { display: grid; grid-template-columns: minmax(0, 1fr); height: 100%; }
.cal-page.with-panel { grid-template-columns: 290px minmax(0, 1fr); }
.cal-left { border-right: 1px solid var(--border); overflow-y: auto; padding: 14px 14px 24px; }
.cal-left h1 { font-size: 20px; margin: 4px 0 14px; }
.cal-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.cal-header {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 10px 16px; border-bottom: 1px solid var(--border);
}
.cal-title { font-size: 16px; margin-left: 6px; }
.cal-msg { margin: 6px 16px 0; }
.view-select { width: auto; }
details.menu { position: relative; }
details.menu > summary { list-style: none; }
details.menu > summary::-webkit-details-marker { display: none; }
.menu-pop {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; width: 310px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px; display: flex; flex-direction: column; gap: 10px; box-shadow: 0 12px 30px rgba(0, 0, 0, .25);
}

/* Mini month with ISO week numbers */
.mini-head { margin-bottom: 4px; }
.mini-head .title { font-size: 14px; }
.mini-month table { width: 100%; border-collapse: collapse; font-size: 12px; text-align: center; }
.mini-month th { color: var(--muted); font-weight: 500; padding: 4px 0; }
.mini-month .wk { color: var(--muted); font-size: 11px; width: 34px; }
.mini-month tr.in-view td:not(.wk) { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.mini-month tr.in-view td:nth-child(2) { border-radius: 6px 0 0 6px; }
.mini-month tr.in-view td:last-child { border-radius: 0 6px 6px 0; }
.mini-day { width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%; background: transparent; font-size: 12px; }
.mini-day:hover { background: var(--border); }
.mini-day.other { color: var(--muted); }
.mini-day.today { background: var(--accent); color: #fff; font-weight: 600; }

/* Time grid: sticky day headers, the full day scrolls */
.tgrid { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.tgrid-head, .tgrid-body { display: grid; grid-template-columns: 56px repeat(var(--cols), minmax(0, 1fr)); }
.tgrid-head { border-bottom: 1px solid var(--border); overflow-y: hidden; scrollbar-gutter: stable; }
.tgrid-scroll { flex: 1; overflow-y: scroll; scrollbar-gutter: stable; }
.tgrid-body { position: relative; }
.day-head {
  display: flex; flex-direction: column; align-items: flex-start; gap: 0; text-align: left;
  padding: 8px 10px 6px; border: 0; border-left: 1px solid var(--border); border-top: 3px solid transparent;
  border-radius: 0; background: transparent; color: var(--text);
}
.day-head:hover { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.day-head.today { border-top-color: var(--accent); color: var(--accent); }
.day-head.past { color: var(--muted); }
.day-num { font-size: 22px; line-height: 1.15; }
.day-dow { font-size: 12px; }
.now-line { position: absolute; left: 0; right: 0; height: 2px; background: var(--accent); z-index: 3; pointer-events: none; }
.now-line::before {
  content: ""; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent);
}
.ev.block {
  background: color-mix(in srgb, var(--accent) 20%, var(--surface));
  border-left: 4px solid var(--accent); border-radius: 4px;
}

/* Month grid */
.mgrid { flex: 1; display: flex; flex-direction: column; overflow: auto; }
.mgrid-row { display: grid; grid-template-columns: 40px repeat(7, minmax(0, 1fr)); flex: 1; min-height: 96px; border-bottom: 1px solid var(--border); }
.mgrid-head { flex: 0 0 auto; min-height: 0; font-size: 12px; color: var(--muted); }
.mgrid-head span { padding: 6px 8px; }
.mgrid .wk { color: var(--muted); font-size: 11px; text-align: center; padding-top: 8px; }
.mcell { border-left: 1px solid var(--border); padding: 4px 6px; display: flex; flex-direction: column; gap: 2px; cursor: pointer; overflow: hidden; min-width: 0; }
.mcell:hover { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.mcell.other { opacity: .45; }
.mcell.past .mfree { display: none; }
.mnum { font-size: 13px; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; }
.mcell.today .mnum { background: var(--accent); color: #fff; border-radius: 50%; font-weight: 600; }
.mev {
  font-size: 11px; padding: 1px 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: color-mix(in srgb, var(--accent) 20%, var(--surface)); border-left: 3px solid var(--accent); border-radius: 0;
}
.mev.personal { border-left-color: var(--personal); background: color-mix(in srgb, var(--personal) 18%, var(--surface)); }
.mmore { font-size: 11px; }
.mfree { font-size: 11px; color: var(--personal); margin-top: auto; }

@media (max-width: 760px) {
  .cal-page.with-panel { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .cal-left { max-height: 45vh; border-right: 0; border-bottom: 1px solid var(--border); }
  .cal-title { font-size: 14px; flex-basis: 100%; order: 10; margin: 4px 0 0; }
  .mgrid-row { min-height: 70px; }
  .mev { font-size: 10px; }
}

/* ---- Focus editor: details + tasks on the left, filtered backlog on the right ---- */
.focus-editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; margin-top: 6px; }
.fe-right { border-left: 1px solid var(--border); padding-left: 20px; min-width: 0; }
@media (max-width: 820px) {
  .focus-editor { grid-template-columns: 1fr; }
  .fe-right { border-left: 0; padding-left: 0; border-top: 1px solid var(--border); padding-top: 12px; }
}
.focus-load { border-radius: var(--radius); padding: 8px 10px; background: color-mix(in srgb, var(--muted) 8%, transparent); }
.focus-load.ok { background: color-mix(in srgb, var(--personal) 10%, transparent); }
.focus-load.over { background: color-mix(in srgb, var(--danger) 12%, transparent); }
.load-verdict { margin: 6px 0 0; font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.focus-load.ok .load-verdict { color: var(--personal); }
.focus-load.over .load-verdict { color: var(--danger); }
.focus-load .volume { margin: 0; }
.focus-load .volume-text { display: none; }

.picker input[type=search] {
  width: 100%; padding: 8px 11px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.picker-filters { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.picker-filters select.compact { max-width: 180px; }
.picker-fits { font-size: 13px; }
.picker-count { font-size: 12px; margin: 8px 0 0; }
.picker-list { max-height: 46vh; overflow-y: auto; }
.picker.compact .picker-list { max-height: none; }
.picker .plan-task { flex-wrap: wrap; row-gap: 4px; }
.picker .plan-task .title { flex: 1 1 100%; order: -1; }
.picker.compact .picker-filters select.compact { max-width: 100%; flex: 1 1 120px; }
.add-btn { padding: 4px 10px; font-size: 13px; margin-left: auto; }
.linklike { border: 0; padding: 0; background: none; color: var(--accent); cursor: pointer; font-size: inherit; }
.cal-col { cursor: copy; }
.cal-col.past { cursor: default; }

/* ---- Review: week load chart ---- */
.week-chart { margin: 8px 0 4px; }
.wk-summary { display: flex; gap: 18px; flex-wrap: wrap; margin: 0 0 12px; }
.wk-summary b { font-size: 20px; }
.wk-plot {
  position: relative; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px;
  padding-left: 34px;
}
.wk-axis { position: absolute; left: 0; top: 22px; height: 200px; width: 100%; pointer-events: none; }
.wk-axis span {
  position: absolute; left: 0; right: 0; transform: translateY(50%); font-size: 11px; color: var(--muted);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent); line-height: 0; padding-bottom: 0;
}
.wk-day { display: flex; flex-direction: column; align-items: stretch; min-width: 0; }
.wk-total { height: 22px; font-size: 12px; font-weight: 600; text-align: center; }
.wk-bars {
  height: 200px; display: flex; align-items: flex-end; justify-content: center; gap: 3px;
  border-bottom: 1px solid var(--border); position: relative; z-index: 1;
}
.wk-day.today .wk-bars { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.wk-bar { position: relative; flex: 0 1 22px; min-width: 6px; }
.wk-cap, .wk-fill, .wk-excess { position: absolute; left: 0; right: 0; bottom: 0; border-radius: 3px 3px 0 0; }
.wk-cap { border: 1.5px solid var(--accent); border-bottom: 0; background: color-mix(in srgb, var(--accent) 8%, transparent); }
.wk-fill { background: var(--accent); opacity: .85; }
.wk-excess { background: var(--danger); }
.wk-bar.over .wk-cap { border-color: var(--text); background: none; }
.wk-label { text-align: center; font-size: 12px; margin-top: 4px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wk-day.today .wk-label { color: var(--accent); font-weight: 600; }
.wk-legend { font-size: 12px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 10px 0 0; }
.wk-key { display: inline-block; width: 12px; height: 12px; border-radius: 2px; }
.wk-key.cap { border: 1.5px solid var(--accent); }
.wk-key.fill { background: var(--accent); }
.wk-key.over { background: var(--danger); }
.review-more { margin-top: 14px; }
.review-more summary { cursor: pointer; color: var(--accent); }

/* Backlog: one table, filters on top, values in cells act as filters */
.backlog-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 12px; }
.backlog-filters input[type=search] { flex: 1 1 220px; width: auto; }
.backlog-filters select.compact { width: auto; max-width: 190px; }
.backlog-table-wrap { padding: 0; overflow-x: auto; }
.backlog-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.backlog-table th { text-align: left; font-weight: 500; font-size: 12px; color: var(--muted);
  border-bottom: 1px solid var(--border); padding: 0; white-space: nowrap; }
.backlog-table td { padding: 7px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.backlog-table tbody tr { cursor: pointer; }
.backlog-table tbody tr:hover { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.backlog-table tbody tr:last-child td { border-bottom: 0; }
/* Completing: a line draws across the title, then the row fades out */
.backlog-table .title { position: relative; transition: color .35s .3s; }
.backlog-table .title::after { content: ""; position: absolute; left: -2px; top: 55%; height: 2px; width: 0;
  border-radius: 2px; background: currentColor; transition: width .45s cubic-bezier(.6, 0, .3, 1); }
.backlog-table tr.done .title { color: var(--muted); }
.backlog-table tr.done .title::after { width: calc(100% + 4px); }
.backlog-table tr.leaving { animation: row-out .45s .55s ease-in forwards; pointer-events: none; }
@keyframes row-out { to { opacity: 0; transform: translateX(28px); } }
.backlog-table .col-done, .backlog-table .col-edit { width: 38px; text-align: center; }
.done-btn { position: relative; width: 24px; height: 24px; padding: 0; border-radius: 50%;
  border: 2px solid var(--c); background: transparent; display: inline-grid; place-items: center;
  transition: background .2s, transform .2s; }
.done-btn svg { width: 16px; height: 16px; fill: none; stroke: var(--c); stroke-width: 2.6;
  stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 20; stroke-dashoffset: 20; opacity: .5;
  transition: stroke-dashoffset .3s .1s, opacity .2s; }
.done-btn:hover svg { stroke-dashoffset: 0; }
.done-btn.on { background: var(--c); animation: done-pop .35s cubic-bezier(.3, 1.6, .5, 1); }
.done-btn.on svg { stroke: #fff; stroke-dashoffset: 0; opacity: 1; }
.done-btn::after { content: ""; position: absolute; inset: -2px; border-radius: 50%; border: 2px solid var(--c);
  opacity: 0; pointer-events: none; }
.done-btn.on::after { animation: done-ring .55s ease-out; }
@keyframes done-pop { 0% { transform: scale(.7); } 100% { transform: scale(1); } }
@keyframes done-ring { 0% { opacity: .9; transform: scale(1); } 100% { opacity: 0; transform: scale(2.1); } }
.backlog-table .col-progress { width: 104px; }
.prog { display: inline-flex; align-items: center; gap: 6px; padding: 4px; border: 0; background: transparent; }
.prog-bar { display: inline-flex; gap: 2px; }
.prog-bar i { width: 13px; height: 8px; background: color-mix(in srgb, var(--muted) 22%, transparent); transition: background .25s; }
.prog-bar i:first-child { border-radius: 4px 0 0 4px; }
.prog-bar i:last-child { border-radius: 0 4px 4px 0; }
.prog-bar i.on { background: var(--c); }
.prog:hover .prog-bar i:not(.on) { background: color-mix(in srgb, var(--c) 30%, transparent); }
.prog-pct { font-size: 11px; color: var(--muted); min-width: 28px; text-align: left; }
tr.done .prog-bar i.on { background: color-mix(in srgb, var(--c) 45%, var(--surface)); }
.undo-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 30;
  display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 16px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); box-shadow: 0 6px 24px rgb(0 0 0 / .25);
  animation: toast-in .25s ease-out; max-width: calc(100vw - 32px); }
.undo-toast span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 10px); } }
.backlog-table .col-prio { width: 52px; }
.backlog-table .col-title { min-width: 220px; }
.backlog-table .col-created, .backlog-table .col-status { white-space: nowrap; font-size: 12px; }
.th-sort { border: 0; background: transparent; color: inherit; font: inherit; padding: 8px; width: 100%; text-align: left; }
.th-sort.on { color: var(--text); font-weight: 600; }
.link-chip { border: 1px solid transparent; background: transparent; color: inherit; font: inherit;
  padding: 2px 6px; border-radius: 6px; display: inline-flex; align-items: center; gap: 4px; text-align: left; }
.link-chip:hover { border-color: var(--border); }
.link-chip.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
@media (max-width: 720px) {
  .backlog-table .col-action, .backlog-table .col-status, .backlog-table .col-created { display: none; }
}

/* --- Focus tab and focus house (design/focus-house) --- */
.page-focus { max-width: 1240px; }
.focus-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.focus-setup .field { margin-top: 14px; }
.focus-minutes { width: 80px; }
.focus-preview { margin: 8px 0; font-size: 14px; }
.focus-preview li { display: flex; gap: 8px; align-items: center; }
.focus-preview li.done .title { text-decoration: line-through; color: var(--muted); }
.focus-preview .title { flex: 1; }
.focus-start { width: 100%; margin-top: 16px; }
.focus-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.focus-head h1 { margin-bottom: 2px; }
.focus-current { text-align: right; min-width: 0; }
.focus-current small { display: block; color: var(--muted); font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; }
.focus-current b { font-size: 17px; }
.focus-side { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.focus-side p { margin: 0; }
.focus-status { font-weight: 600; }
.rail-dot { position: absolute; top: -2px; right: -4px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 2px var(--surface); animation: fh-blink 2s ease-in-out infinite; }
@keyframes fh-blink { 50% { opacity: .35; } }
.ev-play { position: absolute; top: 2px; right: 3px; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
  font-size: 10px; text-decoration: none; color: var(--accent-text); background: var(--accent); opacity: 0; transition: opacity .15s; }
.ev.block:hover .ev-play, .ev-play:focus-visible { opacity: 1; }

/* Focus scene (design/focus-house/focus-scene.html): timer in the middle, house on the left */
.fh { --c: var(--accent); --ink: var(--text); --line: 2.2px; --sand: #e4aa43; --ground: 69%;
  border: 1px solid var(--border); border-radius: 22px; overflow: hidden; background: var(--surface);
  box-shadow: 0 18px 50px color-mix(in srgb, var(--c) 10%, transparent); }
.fh.p-neutral { --c: var(--muted); }
.fh.classic { --line: 3.2px; }
.fh-stage { position: relative; display: grid; grid-template-columns: 30% 70%; height: clamp(440px, 64vh, 640px); overflow: hidden;
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 4%, var(--surface)) 0 var(--ground),
    color-mix(in srgb, var(--c) 9%, var(--bg)) var(--ground)); }
.fh-stage::after { content: ""; position: absolute; left: 0; right: 0; top: var(--ground); height: 1px;
  background: color-mix(in srgb, var(--ink) 14%, transparent); }

.fh-home { position: relative; border-right: 1px dashed color-mix(in srgb, var(--c) 22%, transparent); }
.fh-house { position: absolute; left: 10%; bottom: 14%; width: min(78%, 240px); height: auto; overflow: visible;
  filter: drop-shadow(12px 14px 0 color-mix(in srgb, var(--c) 12%, transparent)); transform-origin: 50% 100%; }
.fh-house * { vector-effect: non-scaling-stroke; stroke: var(--ink); stroke-width: calc(var(--line) + 1px); stroke-linejoin: round; }
.fh-roof { fill: color-mix(in srgb, var(--c) 78%, var(--surface)); }
.fh-chimney { fill: color-mix(in srgb, var(--c) 45%, var(--surface)); }
.fh-wall { fill: color-mix(in srgb, var(--c) 9%, var(--surface)); }
.fh-window { fill: color-mix(in srgb, #8fd3ff 40%, var(--surface)); }
.fh-frame { fill: none; }
.fh-door { fill: color-mix(in srgb, #f3d9a0 40%, var(--surface)); }
.fh-knob { fill: var(--ink); }
.fh-doorway { fill: color-mix(in srgb, var(--ink) 82%, #241c3f); }
.fh-door-leaf { transform-box: fill-box; transform-origin: 100% 50%; }
.fh-step { fill: color-mix(in srgb, var(--c) 18%, transparent); stroke: none !important; }
.fh-house.opening .fh-door-leaf { animation: fh-door-open 1.45s cubic-bezier(.45, 0, .25, 1) both; }
@keyframes fh-door-open {
  0%, 12%, 100% { transform: scaleX(1) skewY(0); }
  34%, 68% { transform: scaleX(.16) skewY(-5deg); }
}
.fh.classic .fh-house { filter: drop-shadow(0 0 0 var(--surface)) drop-shadow(10px 12px 0 color-mix(in srgb, var(--c) 30%, transparent)); }
.fh.classic .fh-wall { fill: color-mix(in srgb, var(--c) 22%, var(--surface)); }
.fh-home-label { position: absolute; left: 0; right: 0; bottom: 4%; margin: 0; text-align: center; color: var(--muted);
  font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }

/* Chimney smoke: the focus tasks float in it, faint until hovered or focused */
.fh-smoke { position: absolute; z-index: 8; left: calc(10% + min(78%, 240px) * .62); bottom: calc(14% + min(78%, 240px) * .86);
  width: 66px; height: 66px; cursor: pointer; outline: none; }
.fh-smoke > i { position: absolute; border: 2px solid color-mix(in srgb, var(--c) 36%, transparent); border-radius: 50%;
  background: color-mix(in srgb, var(--surface) 60%, transparent); animation: fh-smoke 2.8s ease-in-out infinite; }
.fh-smoke > i:nth-child(1) { width: 22px; height: 22px; left: 4px; bottom: 0; }
.fh-smoke > i:nth-child(2) { width: 32px; height: 32px; left: 14px; bottom: 14px; animation-delay: -.8s; }
.fh-smoke > i:nth-child(3) { width: 42px; height: 42px; left: 26px; bottom: 34px; animation-delay: -1.6s; }
.fh-smoke-icon { position: absolute; z-index: 2; left: 33px; bottom: 44px; width: 38px; height: 38px; display: grid; place-items: center;
  border-radius: 50%; background: var(--surface); color: var(--c); border: 2px solid var(--c); font-size: 19px;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--c) 25%, transparent); }
.fh-smoke:focus-visible .fh-smoke-icon { outline: 2px solid var(--c); outline-offset: 3px; }
@keyframes fh-smoke { 0%, 100% { transform: translate(0, 4px) scale(.88); opacity: .3; } 50% { transform: translate(8px, -8px) scale(1.08); opacity: .75; } }
.fh-tasks { position: absolute; left: 62px; bottom: 30px; width: min(300px, 70vw); max-height: 260px; overflow-y: auto;
  padding: 10px 12px; border-radius: 12px; cursor: default; background: color-mix(in srgb, var(--surface) 92%, transparent);
  border: 1px solid color-mix(in srgb, var(--c) 20%, transparent); box-shadow: 0 8px 25px rgb(0 0 0 / .08);
  opacity: .14; transform: translateX(-10px); pointer-events: none; transition: opacity .25s, transform .25s, box-shadow .25s; }
.fh-smoke:hover .fh-tasks, .fh-smoke:focus-within .fh-tasks, .fh-smoke.open .fh-tasks {
  opacity: 1; transform: none; pointer-events: auto; box-shadow: 0 12px 32px rgb(0 0 0 / .2); }
.fh-tasks-head { margin: 0 0 6px; font-size: 12px; color: var(--muted); }
.fh-task { display: flex; align-items: center; gap: 10px; padding: 5px 0; font-size: 14px; }
.fh-task .title { position: relative; transition: color .35s .3s; }
.fh-task .title::after { content: ""; position: absolute; left: -2px; top: 55%; height: 2px; width: 0; border-radius: 2px;
  background: currentColor; transition: width .45s cubic-bezier(.6, 0, .3, 1); }
.fh-task.done .title { color: var(--muted); }
.fh-task.done .title::after { width: calc(100% + 4px); }

/* The timer: ring, digits and a small hourglass */
.fh-timer { position: relative; display: grid; place-items: center; }
.fh-ring { position: absolute; inset: 4% 3%; width: 94%; height: 92%; overflow: visible;
  filter: drop-shadow(0 18px 28px color-mix(in srgb, var(--c) 18%, transparent)); }
.fh-ring circle { fill: none; stroke-width: 6; }
.fh-ring-track { stroke: color-mix(in srgb, var(--c) 14%, var(--surface)); fill: var(--surface) !important; }
.fh-ring-fill { stroke: var(--c); stroke-linecap: round; transition: stroke-dasharray 1s linear; }
.fh-readout { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; text-align: center; }
.fh-label { color: var(--c); font-size: 12px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.fh-digits { margin: 6px 0 2px; font-size: clamp(56px, min(9vw, 15vh), 132px); line-height: .9; font-weight: 780;
  letter-spacing: -.06em; font-variant-numeric: tabular-nums; }
.fh-sub { color: var(--muted); font-size: 14px; }
.fh-hourglass { width: 44px; height: auto; margin-top: 18px; overflow: visible; }
.fh-hourglass * { vector-effect: non-scaling-stroke; }
.fh-bar { fill: var(--c); stroke: var(--ink); stroke-width: var(--line); }
.fh-glass { fill: none; stroke: var(--ink); stroke-width: var(--line); stroke-linejoin: round; }
.fh-sand { fill: var(--sand); transition: y 1s linear, height 1s linear; }
.fh-stream { stroke: var(--sand); stroke-width: 2.5; stroke-dasharray: 3 4; animation: fh-pour .5s linear infinite; }
@keyframes fh-pour { to { stroke-dashoffset: -7; } }

/* The cast: inbox faces on box bodies, hopping along the ground */
.fh-cast { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
.fh-person { position: absolute; width: clamp(64px, 7.5vw, 98px); transform-origin: 50% 100%;
  animation: fh-arrive .6s cubic-bezier(.3, 1.6, .5, 1) both; }
.fh-person.slot-0 { left: 26%; bottom: 13%; }
.fh-person.slot-0 { --exit-x: -1vw; --exit-y: 25px; }
.fh-person.slot-1 { left: 37%; bottom: 6%; --exit-x: -12vw; --exit-y: 48px; }
.fh-person.slot-2 { left: 88%; bottom: 10%; --exit-x: -62vw; --exit-y: 40px; }
.fh-person.slot-3 { left: 71%; bottom: 17%; --exit-x: -45vw; --exit-y: 8px; }
.fh-person.slot-4 { left: 49%; bottom: 2%; --exit-x: -24vw; --exit-y: 68px; }
.fh-person.slot-5 { left: 63%; bottom: 8%; --exit-x: -37vw; --exit-y: 45px; }
.fhc { display: block; width: 100%; height: auto; overflow: visible;
  filter: drop-shadow(5px 8px 5px color-mix(in srgb, var(--ink) 18%, transparent)); }
.fhc * { vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; }
.fhc-pose { transform-box: fill-box; transform-origin: 50% 100%; }
.fhc-limb { transform-box: fill-box; transform-origin: 50% 8%; }
.fhc-torso-rig { transform-box: fill-box; transform-origin: 50% 100%; }
.fhc-head-rig { transform-box: fill-box; transform-origin: 50% 75%; }
.fhc-eye-rig { transform-box: fill-box; transform-origin: center; }
.fhc-line, .fhc-brow, .fhc-mouth { fill: none; stroke: var(--ink); }
.fhc-line { stroke-width: var(--line); }
.fhc-brow { stroke-width: calc(var(--line) + 1px); }
.fhc-mouth { stroke-width: var(--line); }
.fhc-wrinkles path { fill: none; stroke: var(--ink); stroke-width: 1.2px; opacity: .5; }
.fhc-head { fill: var(--surface); stroke: var(--ink); stroke-width: var(--line); }
.fhc-body { fill: color-mix(in srgb, var(--c) 20%, var(--surface)); stroke: var(--ink); stroke-width: var(--line); }
.fhc-side { fill: color-mix(in srgb, var(--c) 40%, var(--surface)); stroke: var(--ink); stroke-width: 1.8px; }
.fhc-top { fill: color-mix(in srgb, var(--c) 16%, var(--surface)); stroke: var(--ink); stroke-width: 1.8px; }
.fhc-button { fill: var(--c); stroke: var(--ink); stroke-width: 1.8px; }
.fhc-shadow { fill: color-mix(in srgb, var(--c) 14%, transparent); }
.fhc-eye { fill: var(--surface); stroke: var(--ink); stroke-width: 1.5px; }
.fhc-pupil { fill: #171720; transform: translate(calc(var(--px) * 5px), calc(var(--py) * 3px)); transition: transform .3s; }
.fhc-shine { fill: #fff; }
.fhc-cheek { fill: color-mix(in srgb, var(--c) 28%, #ff9aaa); stroke: none; opacity: .18; transition: opacity .2s; }
.fhc-emote { fill: none; stroke: var(--c); stroke-width: 3px; opacity: 0; transition: opacity .18s; }
.fhc-emote.effort { fill: color-mix(in srgb, #64b5f6 72%, var(--surface)); stroke: var(--ink); stroke-width: 1.5px; }
.fh.classic .fhc-head { fill: color-mix(in srgb, var(--c) 10%, var(--surface)); }
.fh.classic .fhc-body { fill: var(--c); }
.fh.classic .fhc { filter: drop-shadow(0 0 0 var(--surface)) drop-shadow(3px 4px 0 color-mix(in srgb, var(--ink) 35%, transparent)); }
.fhc-mood { transition: opacity .2s; }
.fhc-mood.joy, .fhc-mood.anger { opacity: 0; }

/* Running: each one hops its own way across the scene */
.fh.s-running .fh-person.slot-0 { animation: fh-exit .95s cubic-bezier(.2, .8, .25, 1) .22s both, fh-hop-a 3.2s ease-in-out 1.2s infinite; }
.fh.s-running .fh-person.slot-1 { animation: fh-exit .95s cubic-bezier(.2, .8, .25, 1) .22s both, fh-hop-b 4.1s ease-in-out 1.2s infinite; }
.fh.s-running .fh-person.slot-2 { animation: fh-exit .95s cubic-bezier(.2, .8, .25, 1) .22s both, fh-hop-c 3.6s ease-in-out 1.2s infinite; }
.fh.s-running .fh-person.slot-3 { animation: fh-exit .95s cubic-bezier(.2, .8, .25, 1) .22s both, fh-hop-b 3.8s ease-in-out 1.45s infinite reverse; }
.fh.s-running .fh-person.slot-4 { animation: fh-exit .95s cubic-bezier(.2, .8, .25, 1) .22s both, fh-hop-a 4.4s ease-in-out 1.2s infinite; }
.fh.s-running .fh-person.slot-5 { animation: fh-exit .95s cubic-bezier(.2, .8, .25, 1) .22s both, fh-hop-c 3.4s ease-in-out 1.7s infinite reverse; }
@keyframes fh-arrive { from { opacity: 0; transform: translateY(18px) scale(.7); } }
@keyframes fh-exit {
  0%, 18% { opacity: 0; transform: translate(var(--exit-x), var(--exit-y)) scale(.18, .25); }
  34% { opacity: 1; transform: translate(var(--exit-x), var(--exit-y)) scale(.42, .7); }
  72% { transform: translate(0, -18px) scale(.9, 1.08); }
  100% { opacity: 1; transform: none; }
}
@keyframes fh-hop-a { 0%, 100% { translate: 0 0; rotate: -4deg; } 45% { translate: 38px -28px; rotate: 5deg; } 55% { translate: 45px 0; rotate: 2deg; } }
@keyframes fh-hop-b { 0%, 100% { translate: 0 0; rotate: 4deg; } 35% { translate: 40px -18px; rotate: -7deg; } 70% { translate: 80px 2px; rotate: 4deg; } }
@keyframes fh-hop-c { 0%, 100% { translate: 0 0; rotate: -2deg; } 50% { translate: -48px -35px; rotate: 7deg; } }

/* Classic 2D walk cycle: contact, down, passing and up, with head overlap. */
.fh.s-running:not(.cats) .fhc-torso-rig { animation: fh-torso-cycle .72s ease-in-out infinite; }
.fh.s-running:not(.cats) .fhc-head-rig { animation: fh-head-overlap .72s ease-in-out infinite; }
.fh.s-running:not(.cats) .fhc-eye-rig { animation: fh-blink 5.2s ease-in-out infinite; }
.fh.s-running:not(.cats) .fhc-limb.arm-0,
.fh.s-running:not(.cats) .fhc-limb.leg-1 { animation: fh-limb-forward .72s ease-in-out infinite; }
.fh.s-running:not(.cats) .fhc-limb.arm-1,
.fh.s-running:not(.cats) .fhc-limb.leg-0 { animation: fh-limb-back .72s ease-in-out infinite; }
@keyframes fh-torso-cycle {
  0%, 100% { transform: translateY(0) scale(1); }
  24% { transform: translateY(3px) scale(1.025, .965) rotate(-1deg); }
  50% { transform: translateY(-2px) scale(.99, 1.025); }
  74% { transform: translateY(2px) scale(1.02, .98) rotate(1deg); }
}
@keyframes fh-head-overlap {
  0%, 100% { transform: translate(0, 0) rotate(1.8deg); }
  24% { transform: translate(-1px, 1px) rotate(-1deg); }
  50% { transform: translate(1px, -2px) rotate(-2deg); }
  74% { transform: translate(0, 1px) rotate(1deg); }
}
@keyframes fh-limb-forward {
  0%, 100% { transform: rotate(-22deg) translateY(0); }
  25% { transform: rotate(-8deg) translateY(2px); }
  50% { transform: rotate(24deg) translateY(-1px); }
  75% { transform: rotate(8deg) translateY(-2px); }
}
@keyframes fh-limb-back {
  0%, 100% { transform: rotate(24deg) translateY(-1px); }
  25% { transform: rotate(8deg) translateY(-2px); }
  50% { transform: rotate(-22deg) translateY(0); }
  75% { transform: rotate(-8deg) translateY(2px); }
}
@keyframes fh-blink { 0%, 43%, 47%, 88%, 92%, 100% { transform: scaleY(1); } 45%, 90% { transform: scaleY(.08); } }

/* Event reactions: a task completion gets a short cheer; the final 10% shows effort. */
.fh.react-cheer .fhc-emote.cheer, .fh.react-cheer .fh-cat-emote.cheer { opacity: 1; }
.fh.react-cheer .fhc-cheek { opacity: .75; }
.fh.react-cheer .fhc-pose { animation: fh-reaction-cheer .42s cubic-bezier(.2, 1.5, .45, 1) 3 !important; }
.fh.react-cheer .fhc-limb.arm-0 { animation: fh-wave .28s ease-in-out 5 alternate !important; }
.fh.phase-final .fhc-emote.effort, .fh.phase-final .fh-cat-emote.effort { opacity: .9; }
@keyframes fh-reaction-cheer { 50% { transform: translateY(-12px) scale(1.04, .96); } }
@keyframes fh-wave { to { transform: rotate(-38deg) translateY(-4px); } }

/* Cancel hold: 1 stop hopping · 2 look at you · 3 frown · 4 the house trembles */
.fh.hold .fh-person, .fh.hold .fhc-pose, .fh.hold .fhc-limb,
.fh.hold .fh-cat, .fh.hold .fh-cat::before, .fh.hold .fh-cat::after,
.fh.hold .fh-cat img { animation: none !important; }
.fh.hold .fhc-emote, .fh.hold .fh-cat-emote { opacity: 0 !important; }
.fh.hold-2 .fhc, .fh.hold-3 .fhc, .fh.hold-4 .fhc { --px: 0 !important; --py: 0 !important; }
.fh.hold-3 .fhc-mood.own, .fh.hold-4 .fhc-mood.own { opacity: 0; }
.fh.hold-3 .fhc-mood.anger, .fh.hold-4 .fhc-mood.anger { opacity: 1; }
.fh.hold-4 .fh-house, .fh.hold-4 .fh-person { animation: fh-shake .12s linear infinite alternate !important; }
@keyframes fh-shake { from { transform: translateX(-2px) rotate(-.6deg); } to { transform: translateX(2px) rotate(.6deg); } }

/* Completed: everybody jumps with joy */
.fh.s-completed .fh-person { animation: fh-jump .7s ease-in-out infinite; animation-delay: calc(var(--i) * .12s); }
.fh.s-completed .fhc-mood.own { opacity: 0; }
.fh.s-completed .fhc-mood.joy { opacity: 1; }
@keyframes fh-jump { 50% { transform: translateY(-16px); } }
/* Cancelled: the scene stops where it was */
.fh.s-cancelled .fh-sand, .fh.s-cancelled .fh-ring-fill { transition: none; }

.fh-cancel { position: absolute; z-index: 9; right: 22px; bottom: 18px; display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 14px; user-select: none; -webkit-user-select: none; touch-action: none; background: var(--surface);
  color: var(--muted); font-weight: 700; border-radius: 10px; }
.fh-cancel-ring { width: 22px; height: 22px; transform: rotate(-90deg); }
.fh-cancel-ring circle { fill: none; stroke: var(--border); stroke-width: 2.5; }
.fh-cancel-ring circle.fill { stroke: var(--danger); stroke-dasharray: 0 100; }
.fh.hold .fh-cancel { color: var(--danger); border-color: var(--danger); }

.fh-foot { display: flex; align-items: center; gap: 16px; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface); }
.fh-foot strong { color: var(--c); white-space: nowrap; font-variant-numeric: tabular-nums; }
.fh-bar-track { flex: 1; height: 8px; border-radius: 99px; overflow: hidden; background: color-mix(in srgb, var(--c) 12%, var(--bg)); }
.fh-bar-track i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--c), color-mix(in srgb, var(--c) 60%, #fff));
  transition: width 1s linear; }
.fh-foot small { font-size: 12px; text-align: right; }

/* Small screens: the timer takes the stage; house bottom-left, 4 characters on the ground */
@media (max-width: 760px) {
  .fh { --ground: 64%; }
  .fh-stage { grid-template-columns: 1fr; height: 560px; }
  .fh-home { position: absolute; inset: 0; border: 0; z-index: 6; pointer-events: none; }
  .fh-home > * { pointer-events: auto; }
  .fh-house { width: 92px; left: 10px; bottom: 14px; }
  .fh-home-label { display: none; }
  .fh-smoke { left: 52px; bottom: 92px; transform: scale(.8); transform-origin: 0 100%; }
  .fh-tasks { width: min(250px, 70vw); }
  .fh-ring { inset: 12px 0 auto; height: 300px; width: 100%; }
  .fh-timer { align-items: start; padding-top: 74px; }
  .fh-digits { font-size: 64px; }
  .fh-hourglass { width: 34px; margin-top: 12px; }
  .fh-person { width: 56px; }
  .fh-person.slot-4, .fh-person.slot-5 { display: none; }
  .fh-person.slot-0 { left: 34%; bottom: 25%; }
  .fh-person.slot-1 { left: 52%; bottom: 18%; }
  .fh-person.slot-2 { left: 80%; bottom: 24%; }
  .fh-person.slot-3 { left: 66%; bottom: 29%; }
  .fh-cancel { right: 10px; bottom: 12px; padding: 8px 12px; font-size: 14px; }
  .fh-foot { flex-wrap: wrap; padding: 12px 16px; }
  .fh-foot small { width: 100%; text-align: left; }
  .focus-current { text-align: left; }
}

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

/* Action types: icon picker and settings list */
.action-types ul.list li { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.action-icon { width: 28px; text-align: center; font-size: 18px; }
.action-row .title { flex: 1; }
.action-edit { display: block !important; }
.action-add { margin-top: 10px; }
.icon-picker { margin-top: 10px; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius); max-height: 320px; overflow-y: auto; }
.icon-group { font-size: 12px; margin: 6px 0 4px; }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(36px, 1fr)); gap: 4px; }
.icon-btn { width: 36px; height: 36px; padding: 0; font-size: 19px; line-height: 1; display: grid; place-items: center; }
.icon-btn.on { outline: 2px solid var(--accent); }
.icon-btn-lg { width: 44px; height: 40px; font-size: 22px; flex: none; }
kbd { font: inherit; font-size: 11px; padding: 1px 5px; border: 1px solid var(--border); border-radius: 4px; }

/* Backlog undo: steps back one task change at a time (Ctrl+Z too). */
.undo-btn { display: inline-flex; align-items: center; gap: 6px; }
.undo-btn .muted { font-size: 12px; font-variant-numeric: tabular-nums; }
.undo-btn:disabled { opacity: .45; cursor: default; }

/* Cloud sync card */
.sync-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; background: var(--muted); }
.sync-dot.ok { background: var(--personal); }
.sync-dot.busy { background: #e0a800; }
.sync-dot.err { background: var(--danger); }
.sync-choice { display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; align-items: center; margin: 12px 0; }
.sync-choice p { margin: 0; font-size: 13px; }
.sync-login input { flex: 1; min-width: 180px; }
@media (max-width: 600px) { .sync-choice { grid-template-columns: 1fr; } }

/* Google Calendar events: read only, a calmer tint than Outlook busy time */
.ev.busy.google { background: color-mix(in srgb, #1a73e8 14%, var(--surface)); border-left: 3px solid #1a73e8; }

/* Classify dialog footer: save leads, send is outlined and set apart */
.classify-actions { margin-top: 14px; gap: 10px; }
.classify-sep { width: 1px; align-self: stretch; background: var(--border); margin: 0 4px; }
.send-btn { background: transparent; color: var(--accent); border: 1.5px solid var(--accent); font-weight: 600; }
.send-btn:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 12%, transparent); }
@media (max-width: 600px) { .classify-sep { display: none; } .classify-actions .spacer { flex-basis: 100%; height: 0; } }

/* Kitten theme: same box as the faces, the kitten picture instead of the drawn face.
   Priority colours the halo and shadow, never the kitten (its red eyes mean tiredness). */
.cat-box .face-wrap { align-items: flex-end; justify-content: center; }
.cat-img { display: block; max-width: 100%; max-height: 100%; margin: 0 auto; object-fit: contain;
  user-select: none; -webkit-user-drag: none;
  filter: drop-shadow(0 4px 6px color-mix(in srgb, var(--text) 18%, transparent)); transition: transform .2s; }
.cat-box.colored .cat-img { filter: drop-shadow(0 0 10px color-mix(in srgb, var(--c) 55%, transparent))
  drop-shadow(0 4px 6px color-mix(in srgb, var(--text) 15%, transparent)); }
.cat-box:hover .cat-img { transform: translateY(-3px) rotate(-1.5deg); }

.fh-cat { position: relative; display: block; width: 100%; aspect-ratio: 285 / 360; }
.fh-cat img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; transition: opacity .2s;
  filter: drop-shadow(0 0 9px color-mix(in srgb, var(--c) 45%, transparent)) drop-shadow(4px 7px 5px color-mix(in srgb, var(--ink) 20%, transparent)); }
.fh.p-neutral .fh-cat img { filter: drop-shadow(4px 7px 5px color-mix(in srgb, var(--ink) 20%, transparent)); }

/* Cats keep their raster identity, while two soft paws and squash/stretch make the gait readable. */
.fh-cat::before, .fh-cat::after { content: ""; position: absolute; z-index: 3; bottom: 4%; width: 20%; aspect-ratio: 1.25;
  border: 1px solid color-mix(in srgb, #6f5345 65%, var(--ink)); border-radius: 55% 55% 45% 45%;
  background: linear-gradient(145deg, #fff4df, #d8b592); box-shadow: inset 0 -2px 3px #8d67452a;
  transform-origin: 50% 20%; opacity: .94; }
.fh-cat::before { left: 29%; }
.fh-cat::after { right: 29%; }
.fh.s-running.cats .fh-cat { animation: fh-cat-body .72s ease-in-out infinite alternate; }
.fh.s-running.cats .fh-cat::before { animation: fh-cat-paw-a .72s ease-in-out infinite alternate; }
.fh.s-running.cats .fh-cat::after { animation: fh-cat-paw-b .72s ease-in-out infinite alternate; }
.fh.s-running.cats .fh-cat img { animation: fh-cat-face 2.8s ease-in-out infinite; }
.fh.s-running.cats .fh-person:nth-child(even) .fh-cat,
.fh.s-running.cats .fh-person:nth-child(even) .fh-cat::before,
.fh.s-running.cats .fh-person:nth-child(even) .fh-cat::after { animation-direction: alternate-reverse; }
@keyframes fh-cat-body { to { transform: translateY(-4px) scale(1.035, .965) rotate(1.5deg); } }
@keyframes fh-cat-paw-a { to { transform: translate(-3px, -7px) rotate(-17deg); } }
@keyframes fh-cat-paw-b { to { transform: translate(3px, 2px) rotate(12deg); } }
@keyframes fh-cat-face { 0%, 44%, 48%, 100% { scale: 1 1; } 46% { scale: 1 .96; } }

/* Individual feline actions keep the cast from moving like duplicated stickers. */
.fh.s-running.cats .fh-person.slot-0 .fh-cat { animation: fh-cat-trot .72s ease-in-out infinite; }
.fh.s-running.cats .fh-person.slot-1 .fh-cat { animation: fh-cat-pounce 2.4s cubic-bezier(.3, 0, .25, 1) infinite; }
.fh.s-running.cats .fh-person.slot-2 .fh-cat { animation: fh-cat-look 3.4s ease-in-out infinite; }
.fh.s-running.cats .fh-person.slot-3 .fh-cat { animation: fh-cat-stretch 3.8s ease-in-out infinite; }
.fh.s-running.cats .fh-person.slot-4 .fh-cat { animation: fh-cat-chase 2.8s ease-in-out infinite; }
.fh.s-running.cats .fh-person.slot-5 .fh-cat { animation: fh-cat-groom 3.2s ease-in-out infinite; }
.fh-cat-emote { position: absolute; z-index: 5; right: 4%; top: 2%; display: grid; place-items: center; width: 24px; height: 24px;
  color: var(--c); font-style: normal; font-weight: 900; opacity: 0; pointer-events: none; }
.fh-cat-emote.effort { color: #64b5f6; top: 12%; right: 0; font-size: 12px; transform: rotate(12deg); }
.fh.react-cheer .fh-cat { animation: fh-cat-cheer .38s cubic-bezier(.2, 1.6, .4, 1) 4 alternate !important; }
.fh.react-cheer .fh-cat-emote.cheer { animation: fh-cat-sparkle .7s ease-out 2; }
@keyframes fh-cat-trot { 0%, 100% { transform: translateY(0) rotate(-1deg) scale(1); } 50% { transform: translateY(-5px) rotate(2deg) scale(1.035, .965); } }
@keyframes fh-cat-pounce { 0%, 18%, 100% { transform: translateY(0) scale(1); } 28% { transform: translateY(4px) scale(1.08, .9); } 48% { transform: translate(9px, -14px) scale(.94, 1.08) rotate(4deg); } 63% { transform: translate(13px, 0) scale(1.08, .92); } }
@keyframes fh-cat-look { 0%, 35%, 100% { transform: rotate(-2deg); } 48%, 68% { transform: rotate(6deg) translateX(2px); } }
@keyframes fh-cat-stretch { 0%, 28%, 100% { transform: scale(1); } 42%, 65% { transform: translateY(4px) scale(1.12, .88); } 75% { transform: translateY(-3px) scale(.98, 1.04); } }
@keyframes fh-cat-chase { 0%, 100% { transform: rotate(-7deg) translateX(-2px); } 50% { transform: rotate(8deg) translateX(5px) scale(.97, 1.03); } }
@keyframes fh-cat-groom { 0%, 30%, 100% { transform: rotate(0); } 42%, 58% { transform: rotate(-8deg) translate(-2px, 3px); } 50% { transform: rotate(-11deg) translate(-3px, 4px) scale(1.02, .98); } }
@keyframes fh-cat-cheer { to { transform: translateY(-11px) scale(1.06, .94) rotate(3deg); } }
@keyframes fh-cat-sparkle { from { transform: scale(.3) rotate(-25deg); } 60% { transform: scale(1.35) rotate(12deg); } to { transform: scale(1); } }

/* Before starting, the first character waits with a calm breath instead of hopping */
.fh.s-idle .fh-person { animation: fh-arrive .6s cubic-bezier(.3, 1.6, .5, 1) both, fh-breathe 3.2s ease-in-out .6s infinite; }
@keyframes fh-breathe { 50% { transform: scale(1.03, .97); } }

/* Floating capture window (Document Picture-in-Picture) */
.float-btn { padding-inline: 10px; }
body.floating-capture { margin: 0; padding: 12px; background: var(--bg); overflow: hidden; }
body.floating-capture .capture { flex-wrap: wrap; }
body.floating-capture .capture input { min-width: 0; flex-basis: 100%; }
body.floating-capture .flash { margin-top: 6px; font-size: 12px; }

/* Floating capture: a small round icon that unfolds into the capture bar */
body.floating-capture:not(.open) { padding: 0; display: grid; place-items: center; height: 100vh; }
.float-icon { position: relative; width: 56px; height: 56px; padding: 0; border-radius: 50%; border: 0;
  background: var(--accent); color: var(--accent-text); font-size: 30px; line-height: 1; cursor: pointer;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 45%, transparent); transition: transform .15s; }
.float-icon:hover { transform: scale(1.06); }
.float-count { position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 10px; background: var(--danger); color: #fff; font-size: 11px; line-height: 20px; }
.float-open { position: relative; padding-right: 26px; }
.float-fold { position: absolute; top: -6px; right: -6px; padding: 2px 8px; font-size: 18px; }

/* Inbox as a list: same width for every row, height by size, character on the left */
.inbox-list { display: flex; flex-direction: column; gap: 8px; }
.inbox-row {
  --h: 64px;
  --face-line: color-mix(in srgb, var(--text) 62%, transparent); --face-eye: #eceef2; --face-pupil: #121316;
  position: relative; display: flex; align-items: center; gap: 14px; min-height: var(--h);
  padding: 8px 16px 8px 8px; border-radius: 14px; cursor: pointer; overflow: hidden;
  background: var(--surface); border: 1.5px solid color-mix(in srgb, var(--text) 22%, transparent);
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.inbox-row.size-xs { --h: 52px; }
.inbox-row.size-s  { --h: 68px; }
.inbox-row.size-m  { --h: 92px; }
.inbox-row.size-l  { --h: 124px; }
.inbox-row.size-xl { --h: 164px; }
.inbox-row.unsized { border-style: dashed; }
.inbox-row.colored { --face-line: var(--c); border-color: var(--c); background: color-mix(in srgb, var(--c) 12%, var(--surface)); }
.inbox-row:hover, .inbox-row.selected { transform: translateX(3px); box-shadow: 0 4px 16px color-mix(in srgb, var(--c, var(--accent)) 25%, transparent); }
/* Fixed column so every title starts at the same x; the character grows with the row inside it */
.row-avatar { flex: 0 0 112px; display: grid; place-items: center; height: calc(var(--h) - 16px); }
.row-avatar .face { width: 100%; height: 100%; }
.row-avatar .cat-img { height: calc(var(--h) - 16px); max-height: none; width: auto; max-width: 112px; }
.row-emoji { font-size: min(calc(var(--h) * .5), 56px); line-height: 1; }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row-title { font-weight: 650; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.row-meta { font-size: 12px; color: var(--muted); }
.inbox-row.colored .row-meta { color: color-mix(in srgb, var(--c) 55%, var(--text)); }
.row-notes { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inbox-row.size-xs .row-notes, .inbox-row.size-s .row-notes { display: none; }
.row-size { flex: 0 0 auto; font-weight: 800; font-size: 13px; color: var(--c, var(--muted)); }
.inbox-row .quick-size { left: auto; right: 48px; top: 50%; bottom: auto; transform: translateY(-50%); }
.inbox-row:hover .quick-size, .inbox-row:focus-within .quick-size { opacity: 1; }
@media (max-width: 600px) {
  .row-avatar { flex-basis: 64px; }
  .row-avatar .cat-img { max-width: 64px; }
  .inbox-row { gap: 10px; padding-right: 12px; }
}

/* Inbox header: title, sort, view and undo wrap onto several lines when they do not fit */
.inbox-head { flex-wrap: wrap; row-gap: 8px; }
.inbox-head h1 { min-width: 0; }
@media (max-width: 600px) { .inbox-head h1 { flex-basis: 100%; } .inbox-head .spacer { display: none; } }
/* Touch screens show the sizing buttons all the time: under the text instead of over it */
@media (hover: none) {
  .inbox-row.unsized { flex-wrap: wrap; }
  .inbox-row .quick-size { position: static; transform: none; flex-basis: 100%; justify-content: flex-start; padding-left: 122px; }
}
@media (hover: none) and (max-width: 600px) { .inbox-row .quick-size { padding-left: 74px; } }
