:root {
  --bg: #0f1419;
  --surface: #161d24;
  --surface-2: #1e2731;
  --line: #2a3541;
  --text: #e8edf2;
  --muted: #8b98a6;
  --accent: #f2a541;
  --accent-ink: #1a1206;
  --ok: #4cc38a;
  --danger: #ef5b5b;
  --warn: #f2c94c;
  --radius: 16px;
}
:root[data-theme="light"] {
  --bg: #f4f1ea;
  --surface: #ffffff;
  --surface-2: #f0ece3;
  --line: #e2dccf;
  --text: #1c2228;
  --muted: #6b7480;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f4f1ea;
    --surface: #ffffff;
    --surface-2: #f0ece3;
    --line: #e2dccf;
    --text: #1c2228;
    --muted: #6b7480;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  padding: 0 16px 48px;
  max-width: 920px;
  margin: 0 auto;
}
.mono { font-family: "JetBrains Mono", ui-monospace, monospace; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

.top {
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 0 16px;
}
.date { color: var(--muted); font-size: 0.9rem; }
.clock { font-size: 1.6rem; font-weight: 700; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.badge {
  font-size: 0.75rem; padding: 4px 10px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--line);
}
.badge.live { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.label { font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }

.now h1 { font-size: clamp(1.5rem, 5vw, 2.2rem); margin: 6px 0 2px; line-height: 1.15; }
.now .range { color: var(--muted); }
.countdown { font-size: clamp(2.6rem, 11vw, 4.2rem); font-weight: 700; margin: 10px 0 8px; color: var(--accent); }
.now.warn .countdown { color: var(--warn); }
.now.over { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger) inset; }
.now.over .countdown { color: var(--danger); }
.now.over { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { background: color-mix(in srgb, var(--danger) 10%, var(--surface)); } }
.bar { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; width: 0; background: var(--accent); transition: width 0.6s linear; }
.now.warn .bar-fill { background: var(--warn); }
.now.over .bar-fill { background: var(--danger); }
.next { margin-top: 12px; color: var(--muted); font-size: 0.95rem; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid .card { margin-bottom: 16px; }
@media (max-width: 640px) { .grid { grid-template-columns: 1fr; gap: 0; } }

.big { font-size: 2.6rem; font-weight: 700; margin: 6px 0 2px; }
.chip {
  font-size: 0.75rem; padding: 3px 10px; border-radius: 99px;
  background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); font-weight: 600;
}
.chip.break { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }

.row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; align-items: center; }
.row.end { justify-content: flex-end; }
.presets { margin-top: 10px; }

.btn {
  font: inherit; font-weight: 600; font-size: 0.92rem;
  border-radius: 10px; padding: 9px 16px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
}
.btn:hover { filter: brightness(1.08); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.danger { background: var(--danger); color: #fff; border-color: transparent; }
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 10px; font-size: 0.8rem; }
.btn.chipbtn { padding: 5px 12px; font-size: 0.8rem; border-radius: 99px; }
.icon-btn {
  background: transparent; border: 1px solid var(--line); color: var(--muted);
  border-radius: 10px; width: 40px; height: 40px; display: grid; place-items: center; cursor: pointer;
}

input[type="number"], input[type="password"] {
  font: inherit; background: var(--surface-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; width: 90px;
}
input[type="password"] { width: 100%; }

.timeline { list-style: none; margin: 4px 0 0; padding: 0; }
.timeline li {
  display: grid; grid-template-columns: 110px 1fr; gap: 12px; align-items: center;
  padding: 10px 12px; border-radius: 10px; border-left: 3px solid transparent;
}
.timeline li + li { margin-top: 2px; }
.timeline .t { color: var(--muted); font-size: 0.88rem; }
.timeline li.done { opacity: 0.45; }
.timeline li.done .title { text-decoration: line-through; }
.timeline li.current { background: var(--surface-2); border-left-color: var(--accent); }
.timeline li.current .title { font-weight: 700; }
.timeline li.free .title { color: var(--muted); font-style: italic; }

.unlock {
  position: sticky; top: 0; z-index: 5;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  background: var(--accent); color: var(--accent-ink);
  padding: 12px 16px; margin: 0 -16px;
}
.unlock span { display: block; font-size: 0.85rem; opacity: 0.85; }
.unlock .btn.primary { background: var(--accent-ink); color: var(--accent); }

dialog {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--text); padding: 0;
  width: min(460px, calc(100vw - 32px));
}
dialog::backdrop { background: rgb(0 0 0 / 0.55); }
.settings { padding: 22px; }
.settings h2 { margin: 0 0 14px; font-size: 1.2rem; }
.settings label { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 10px 0; font-size: 0.92rem; }
.settings label:first-of-type { flex-direction: column; align-items: stretch; }
.settings label.check { justify-content: flex-start; }
fieldset { border: 1px solid var(--line); border-radius: 12px; margin: 14px 0; padding: 6px 14px 8px; }
legend { color: var(--muted); font-size: 0.8rem; padding: 0 6px; }

/* ---------- Categorias (cor por tipo de bloco) ---------- */
:root {
  /* Paleta validada (daltonismo e contraste) na ordem: clientes, estudo, saúde, emprego, vida, outros; conteúdo (roxo) veio depois */
  --c-work: #d95926;
  --c-study: #3987e5;
  --c-health: #199e70;
  --c-career: #c98500;
  --c-life: #d55181;
  --c-other: #008300;
  --c-content: #a274f0;
}
:root[data-theme="light"] {
  --c-work: #eb6834; --c-study: #2a78d6; --c-health: #1baf7a;
  --c-career: #eda100; --c-life: #e87ba4; --c-other: #008300; --c-content: #7d4fd8;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --c-work: #eb6834; --c-study: #2a78d6; --c-health: #1baf7a;
    --c-career: #eda100; --c-life: #e87ba4; --c-other: #008300; --c-content: #7d4fd8;
  }
}
.cat-work   { --cat: var(--c-work); }
.cat-study  { --cat: var(--c-study); }
.cat-health { --cat: var(--c-health); }
.cat-career { --cat: var(--c-career); }
.cat-life   { --cat: var(--c-life); }
.cat-other  { --cat: var(--c-other); --cat-ink: #fff; }
.cat-content { --cat: var(--c-content); --cat-ink: #fff; }

/* ---------- Abas e navegação ---------- */
.tabs { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.tab {
  font: inherit; font-size: 0.85rem; font-weight: 600; color: var(--muted);
  background: transparent; border: 0; border-radius: 7px; padding: 6px 14px; cursor: pointer;
}
.tab.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 0 var(--line); }
.nav-row { display: flex; align-items: center; gap: 8px; margin: 8px 0 12px; }
.view-label { font-weight: 600; flex: 1; text-align: center; }
.icon-btn.sm { width: 34px; height: 34px; font-size: 1.3rem; line-height: 1; color: var(--text); }
.agenda .card-head { gap: 10px; flex-wrap: wrap; }

/* Dia: borda colorida por categoria */
.timeline li[class*="cat-"] { border-left-color: color-mix(in srgb, var(--cat) 55%, transparent); }
.timeline li.current { border-left-color: var(--cat, var(--accent)); }

/* ---------- Semana ---------- */
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.wk-day { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 8px; min-height: 140px; display: flex; flex-direction: column; gap: 6px; }
.wk-day.today { border-color: var(--accent); }
.wk-day.past { opacity: 0.6; }
.wk-head {
  display: flex; align-items: baseline; gap: 6px; background: transparent; border: 0; padding: 2px 2px 4px;
  color: var(--muted); font: inherit; cursor: pointer; text-align: left;
}
.wk-head:hover .wk-num { color: var(--accent); }
.wk-dow { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.wk-num { font-size: 1.15rem; font-weight: 700; color: var(--text); }
.wk-day.today .wk-num { color: var(--accent); }
.wk-item {
  display: flex; flex-direction: column; gap: 1px; padding: 6px 7px; border-radius: 8px;
  background: color-mix(in srgb, var(--cat) 14%, var(--surface)); border-left: 3px solid var(--cat);
  font-size: 0.8rem; line-height: 1.25;
}
.wk-item.done { opacity: 0.5; }
.wk-item.current { box-shadow: 0 0 0 1px var(--cat) inset; }
.wk-time { color: var(--muted); font-size: 0.72rem; }
.wk-title { font-weight: 500; overflow-wrap: anywhere; }
.wk-empty { color: var(--muted); font-size: 0.8rem; font-style: italic; padding: 4px 2px; }

/* ---------- Mês ---------- */
.mo-head, .mo-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.mo-head span { text-align: center; color: var(--muted); font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; padding-bottom: 6px; }
.mo-cell {
  font: inherit; color: var(--text); text-align: left; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px;
  min-height: 96px; padding: 6px; display: flex; flex-direction: column; gap: 4px; overflow: hidden;
}
.mo-cell:hover { border-color: var(--muted); }
.mo-cell.out { opacity: 0.4; }
.mo-cell.past:not(.out) .mo-items { opacity: 0.6; }
.mo-cell.today { border-color: var(--accent); }
.mo-num { font-weight: 700; font-size: 0.9rem; }
.mo-cell.today .mo-num { color: var(--accent-ink); background: var(--accent); border-radius: 99px; padding: 0 7px; align-self: flex-start; }
.mo-items { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mo-chip {
  display: flex; gap: 4px; align-items: baseline; font-size: 0.7rem; line-height: 1.3;
  padding: 1px 4px; border-radius: 4px; background: color-mix(in srgb, var(--cat) 16%, transparent);
  white-space: nowrap; overflow: hidden; min-width: 0;
}
.mo-chip-time { color: var(--muted); flex: none; }
.mo-chip-title { overflow: hidden; text-overflow: ellipsis; }
.mo-more { font-size: 0.7rem; color: var(--muted); padding-left: 4px; }
.mo-dots { display: none; gap: 3px; flex-wrap: wrap; }
.mo-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--cat); }

@media (max-width: 760px) {
  .week { grid-template-columns: 1fr; }
  .wk-day { min-height: 0; }
  .wk-head { padding-bottom: 2px; }
  .mo-cell { min-height: 58px; padding: 5px; }
  .mo-items { display: none; }
  .mo-dots { display: flex; }
}

/* ---------- Semana em grade de horários ---------- */
.agenda.wide { position: relative; left: 50%; transform: translateX(-50%); width: min(1280px, calc(100vw - 32px)); }
.week.wk-grid { display: block; }
.wg-head, .wg-body { display: grid; grid-template-columns: 48px repeat(7, minmax(0, 1fr)); }
.wg-head { position: sticky; top: 0; z-index: 2; background: var(--surface); border-bottom: 1px solid var(--line); }
.wg-day-head {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0 8px;
  background: transparent; border: 0; color: var(--muted); font: inherit; cursor: pointer;
}
.wg-day-head .wk-num { font-size: 1.5rem; font-weight: 500; line-height: 1.2; width: 2.2em; height: 2.2em; display: grid; place-items: center; border-radius: 50%; }
.wg-day-head:hover .wk-num { background: var(--surface-2); }
.wg-day-head.today .wk-dow { color: var(--accent); }
.wg-day-head.today .wk-num { background: var(--accent); color: var(--accent-ink); }
.wg-hours { position: relative; }
.wg-hour { position: absolute; right: 8px; transform: translateY(-50%); font-size: 0.7rem; color: var(--muted); }
.wg-hour:first-child { transform: none; }
.wg-col {
  position: relative; border-left: 1px solid var(--line);
  background-image: linear-gradient(to bottom, var(--line) 1px, transparent 1px);
}
.wg-col.today { background-color: color-mix(in srgb, var(--accent) 5%, transparent); }
.wg-item {
  position: absolute; display: flex; flex-direction: column; gap: 1px; overflow: hidden;
  text-align: left; font: inherit; cursor: pointer; padding: 4px 6px; border-radius: 6px;
  border: 0; border-left: 3px solid color-mix(in srgb, var(--cat) 60%, black);
  background: var(--cat); color: var(--cat-ink, #14181c); line-height: 1.2;
}
.wg-item:hover { filter: brightness(1.08); z-index: 1; }
.wg-item.past { opacity: 0.55; }
.wg-item.done { opacity: 0.45; }
.wg-item.skipped { opacity: 0.5; background: color-mix(in srgb, var(--cat) 30%, var(--surface)); color: var(--text); }
.wg-item.skipped .wg-title { text-decoration: line-through; }
.wg-item.current { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--cat); }
.wg-title { font-size: 0.78rem; font-weight: 600; overflow-wrap: anywhere; }
.wg-title .mark { margin-right: 3px; }
.wg-time { font-size: 0.7rem; opacity: 0.9; }
.wg-item.short { flex-direction: row; gap: 6px; align-items: baseline; padding-top: 2px; }
.wg-item.short .wg-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; }
.wg-item.short .wg-time { flex: none; }
.wg-now { position: absolute; left: -1px; right: 0; height: 2px; background: var(--danger); z-index: 1; pointer-events: none; }
.wg-now::before { content: ""; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--danger); }

[hidden] { display: none !important; }
.timeline li { grid-template-columns: 128px 1fr; }
.timeline .t { white-space: nowrap; }
@media (max-width: 420px) { .timeline li { grid-template-columns: 1fr; gap: 2px; } }

/* ---------- Status: passado, feito, não feito ---------- */
.timeline li.blk { grid-template-columns: 128px 1fr 22px; cursor: pointer; }
.timeline li.blk:hover { background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
.timeline li.blk:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.mark { font-weight: 700; text-align: center; }
.timeline li.done, .timeline li.past, .timeline li.skipped { opacity: 1; }
.past .title, .past .t { opacity: 0.55; }
.done .title, .done .wk-title, .mo-chip.done .mo-chip-title { text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--text) 45%, transparent); opacity: 0.7; }
.done .mark { color: var(--ok); }
.skipped .title, .skipped .wk-title { opacity: 0.6; }
.skipped .mark { color: var(--danger); }
.timeline li.skipped { border-left-color: color-mix(in srgb, var(--danger) 60%, transparent); }
.tag { margin-left: 8px; font-size: 0.7rem; font-weight: 600; color: var(--danger); background: color-mix(in srgb, var(--danger) 14%, transparent); padding: 1px 7px; border-radius: 99px; vertical-align: middle; }
.hint { color: var(--muted); font-size: 0.8rem; margin: 10px 0 0; }

.wk-item { font: inherit; font-size: 0.8rem; color: var(--text); text-align: left; cursor: pointer; border-top: 0; border-right: 0; border-bottom: 0; }
.wk-item.done, .wk-item.past { opacity: 1; }
.wk-item.past .wk-title, .wk-item.past .wk-time { opacity: 0.55; }
.wk-item.skipped { border-left-color: var(--danger); }
.wk-time { display: flex; justify-content: space-between; gap: 4px; }
.mo-chip.skipped { opacity: 0.5; }
.mo-chip.done { opacity: 0.75; }
@media (max-width: 420px) { .timeline li.blk { grid-template-columns: 1fr 22px; } .timeline li.blk .t { grid-column: 1; } .timeline li.blk .mark { grid-row: 1 / span 2; grid-column: 2; align-self: center; } }

/* ---------- Edição (banco) ---------- */
body:not(.db) .db-only { display: none !important; }
.head-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.timeline li.blk { grid-template-columns: 128px 1fr auto; }
.side { display: flex; align-items: center; gap: 4px; }
.mark { min-width: 16px; }
.edit-btn {
  background: transparent; border: 1px solid transparent; color: var(--muted); border-radius: 8px;
  width: 30px; height: 30px; cursor: pointer; font-size: 0.95rem; opacity: 0.5;
}
.timeline li.blk:hover .edit-btn, .edit-btn:focus-visible { opacity: 1; border-color: var(--line); }
@media (hover: none) { .edit-btn { opacity: 0.8; } }
.note { display: block; font-size: 0.78rem; color: var(--muted); font-style: italic; margin-top: 2px; text-decoration: none; }
input[type="text"], input[type="date"], input[type="time"], select, textarea {
  font: inherit; font-size: 0.92rem; background: var(--surface-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; min-width: 0;
}
textarea { resize: vertical; width: 100%; }
.settings label.stack { flex-direction: column; align-items: stretch; gap: 6px; }
.settings label.stack input { width: 100%; }
.settings .two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.settings .two label { flex-direction: column; align-items: stretch; gap: 6px; margin: 6px 0; }
.settings select { min-width: 160px; }
.days { display: flex; flex-wrap: wrap; gap: 6px; }
.days label { margin: 4px 0 !important; gap: 4px !important; justify-content: flex-start !important; }
.err { color: var(--danger); font-size: 0.85rem; min-height: 1em; margin: 6px 0 0; }
.spacer { flex: 1; }
.danger-text { color: var(--danger); }
dialog.wide { width: min(560px, calc(100vw - 32px)); }
.tpl-list { list-style: none; padding: 0; margin: 10px 0; display: flex; flex-direction: column; gap: 6px; max-height: 55vh; overflow: auto; }
.tpl { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border-left: 3px solid var(--cat, var(--line)); }
.tpl.off { opacity: 0.5; }
.tpl-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.settings .card-head h2 { margin: 0; }
@media (max-width: 420px) { .timeline li.blk { grid-template-columns: 1fr auto; } .timeline li.blk .side { grid-row: 1 / span 2; grid-column: 2; } }

/* ---------- Resumo da semana ---------- */
.summary { display: flex; flex-direction: column; gap: 16px; }
.sum-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.sum-tile { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.sum-label { color: var(--muted); font-size: 0.8rem; }
.sum-value { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.sum-sub { color: var(--muted); font-size: 0.75rem; }
.sum-chart { display: flex; flex-direction: column; gap: 4px; }
.sum-legend { display: flex; gap: 14px; color: var(--muted); font-size: 0.78rem; margin-bottom: 4px; }
.sum-legend span { display: inline-flex; align-items: center; gap: 6px; }
.sum-legend i { width: 18px; height: 8px; border-radius: 4px; display: inline-block; }
.lg-plan i { background: color-mix(in srgb, var(--muted) 30%, transparent); }
.lg-done i { background: var(--muted); }
.sum-row { display: grid; grid-template-columns: 150px 1fr auto; align-items: center; gap: 10px; padding: 5px 4px; border-radius: 8px; outline: none; }
.sum-row:hover, .sum-row:focus-visible { background: var(--surface-2); }
.sum-name { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sum-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--cat); flex: none; display: inline-block; }
.sum-track { height: 14px; position: relative; }
.sum-plan { display: block; height: 100%; min-width: 4px; border-radius: 0 4px 4px 0; background: color-mix(in srgb, var(--cat) 28%, transparent); overflow: hidden; }
.sum-done { display: block; height: 100%; background: var(--cat); border-right: 2px solid var(--surface); }
.sum-done[style*="width: 100%"], .sum-done[style*="width: 0"] { border-right: 0; }
.sum-val { font-size: 0.85rem; color: var(--muted); white-space: nowrap; }
.sum-val b { color: var(--text); font-weight: 600; }
.sum-table summary { cursor: pointer; color: var(--muted); font-size: 0.88rem; }
.sum-table table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 0.86rem; }
.sum-table th { text-align: left; color: var(--muted); font-weight: 500; font-size: 0.78rem; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.sum-table td { padding: 6px 8px; border-bottom: 1px solid var(--line); }
.sum-table td .sum-dot { margin-right: 8px; vertical-align: 1px; }
.sum-table td:first-child { padding-left: 4px; }
.sum-table th:not(:first-child), .sum-table td:not(:first-child) { text-align: right; }
.sum-total td { font-weight: 700; border-bottom: 0; }
.sum-tip {
  position: fixed; z-index: 50; pointer-events: none; white-space: pre-line;
  background: var(--surface); color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 10px; font-size: 0.82rem; box-shadow: 0 6px 20px rgb(0 0 0 / 0.3);
}
@media (max-width: 560px) {
  .sum-tiles { grid-template-columns: 1fr 1fr 1fr; }
  .sum-value { font-size: 1.2rem; }
  .sum-row { grid-template-columns: 1fr auto; }
  .sum-track { grid-column: 1 / -1; grid-row: 2; }
  .sum-table th:nth-child(2), .sum-table td:nth-child(2) { display: none; }
}

/* Botão de tema: mostra o sol no escuro (vai pro claro) e a lua no claro */
#themeBtn .ico-moon { display: none; }
:root[data-theme="light"] #themeBtn .ico-sun { display: none; }
:root[data-theme="light"] #themeBtn .ico-moon { display: block; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) #themeBtn .ico-sun { display: none; }
  :root:not([data-theme="dark"]) #themeBtn .ico-moon { display: block; }
}
.wg-item .mark { color: inherit !important; }

/* Cartão de detalhes do bloco (Semana) */
.peek {
  position: fixed; z-index: 40; width: min(300px, calc(100vw - 16px));
  background: var(--surface); color: var(--text); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 14px; box-shadow: 0 10px 30px rgb(0 0 0 / 0.35);
  display: flex; flex-direction: column; gap: 6px;
}
.peek-head { display: flex; align-items: center; gap: 8px; }
.peek-head strong { flex: 1; font-size: 0.98rem; }
.peek-x { background: transparent; border: 0; color: var(--muted); font-size: 1.3rem; line-height: 1; cursor: pointer; padding: 0 2px; }
.peek-when { color: var(--muted); font-size: 0.85rem; }
.peek-note { font-size: 0.85rem; white-space: pre-line; }
.peek-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.peek-actions .btn.on.ok { background: var(--ok); color: #0b1a12; border-color: var(--ok); }
.peek-actions .btn.on.no { background: var(--danger); color: #fff; border-color: var(--danger); }

/* ---------- Modo foco (pomodoro em tela cheia) ---------- */
.focus-mode {
  position: fixed; inset: 0; z-index: 100; background: var(--bg); color: var(--text);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  --fm: var(--accent);
}
.focus-mode.break { --fm: var(--ok); }
body.focus-open { overflow: hidden; }
.fm-center { display: flex; flex-direction: column; align-items: center; gap: 18px; width: min(1100px, 92vw); }
.fm-phase {
  font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; font-size: clamp(0.9rem, 1.6vw, 1.2rem);
  color: var(--fm); border: 1px solid color-mix(in srgb, var(--fm) 50%, transparent); border-radius: 99px; padding: 6px 16px;
}
.fm-time { font-size: clamp(5rem, 24vw, 22rem); font-weight: 700; line-height: 1; color: var(--fm); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.fm-bar { width: min(720px, 80vw); height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; }
.fm-bar > div { height: 100%; width: 0; background: var(--fm); border-radius: 99px; transition: width 1s linear; }
.fm-sub { color: var(--muted); font-size: 1rem; }
.fm-block { color: var(--muted); font-size: clamp(1rem, 2vw, 1.3rem); text-align: center; min-height: 1.4em; }
.fm-actions { display: flex; gap: 12px; margin-top: 8px; }
.fm-actions .btn { font-size: 1.05rem; padding: 12px 28px; }
.focus-mode .btn.primary { background: var(--fm); border-color: var(--fm); }
.fm-exit {
  position: absolute; top: 18px; right: 18px; width: 44px; height: 44px; border-radius: 50%;
  background: transparent; border: 1px solid var(--line); color: var(--muted); font-size: 1.2rem; cursor: pointer;
}
.fm-exit:hover { color: var(--text); border-color: var(--muted); }
.fm-hint { position: absolute; bottom: 18px; color: var(--muted); font-size: 0.8rem; opacity: 0.7; }
.focus-mode:fullscreen { background: var(--bg); }
.focus-mode::backdrop { background: var(--bg); }
.focus-mode.finished { --fm: var(--danger); }
.head-icons { display: flex; align-items: center; gap: 8px; }
.full-btn {
  width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; cursor: pointer;
  background: transparent; border: 1px solid var(--line); color: var(--muted); font-size: 1rem; line-height: 1;
}
.full-btn:hover { color: var(--text); border-color: var(--muted); }
@media (max-width: 420px) { #timerMin { width: 60px; } }
.focus-mode.warn { --fm: var(--warn); }
.fm-title { font-size: clamp(1.6rem, 4.5vw, 3.4rem); font-weight: 700; text-align: center; line-height: 1.15; max-width: 92vw; }
.now .card-head { margin-bottom: 0; }
.fm-time.long { font-size: clamp(4rem, 16vw, 15rem); }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); } 50% { box-shadow: 0 0 0 8px transparent; } }
.btn.pulse { animation: pulse 1.2s ease-in-out infinite; }

a.icon-btn { text-decoration: none; color: inherit; display: inline-flex; align-items: center; justify-content: center; }
.app-link { width: auto; padding: 0 12px; gap: 6px; font-weight: 600; font-size: 0.88rem; display: inline-flex; align-items: center; font-family: inherit; }
@media (max-width: 520px) { .app-link { width: 40px; padding: 0; } .app-link-txt { display: none; } }

/* ---------- Janelinha flutuante (Picture-in-Picture) ---------- */
#pipBtn.on { border-color: var(--accent); color: var(--accent); }
.pip-body { margin: 0; background: var(--bg); color: var(--text); overflow: hidden; }
.pip { padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; min-height: 100vh; box-sizing: border-box; border: 2px solid transparent; }
.pip.over { border-color: var(--danger); animation: pulse 1.6s ease-in-out infinite; }
.pip-head { display: flex; justify-content: space-between; align-items: center; font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.pip.over .pip-label { color: var(--danger); }
.pip-title { font-weight: 700; font-size: 1.02rem; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pip-main { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.pip-count { font-size: 2rem; font-weight: 700; color: var(--accent); line-height: 1.1; }
.pip.warn .pip-count { color: var(--warn); }
.pip.over .pip-count { color: var(--danger); }
.pip-range { font-size: 0.78rem; color: var(--muted); }
.pip .bar { margin: 2px 0; }
.pip.warn .bar-fill { background: var(--warn); }
.pip.over .bar-fill { background: var(--danger); }
.pip-next { font-size: 0.78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pip-row { display: flex; gap: 8px; margin-top: 4px; }
.pip-row .btn { flex: 1; padding: 6px 8px; }
.pip-tool { display: flex; align-items: center; gap: 8px; margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); font-size: 0.95rem; }
.pip-tool .mono { font-weight: 700; flex: 1; }
.pip-tool .btn.sm { padding: 4px 10px; font-size: 0.8rem; }
