/* Emit — daily work OS: violet accent, soft panels, compact 12px type,
   1px borders. */

:root {
  --bg: #f7f4ff;
  --panel: #fffefe;
  --panel-alt: #f3edff;
  --panel-hover: #ede5ff;
  --text: #2b2540;
  --muted: #6b6280;
  --faint: #9b93ab;
  --border: #e7def7;
  --border-strong: #d7c9ee;
  --accent: #8b5cf6;
  --accent-dark: #6d28d9;
  --accent-soft: #f1e9ff;
  --positive: #16a34a;
  --positive-soft: #dcfce7;
  --negative: #e74c3c;
  --negative-soft: #fee2e2;
  --warning: #d97706;
  --warning-soft: #fef3c7;
  --selected: #ece2ff;
  --track: #ece2ff;
  --shadow: 0 10px 30px rgba(56, 33, 104, 0.14);
  --radius: 10px;
  --radius-sm: 7px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "JetBrains Mono", "SF Mono", Consolas, monospace;
  --scroll-track: rgba(76, 29, 149, 0.05);
  --scroll-thumb: rgba(109, 40, 217, 0.28);
  --scroll-thumb-hover: rgba(109, 40, 217, 0.48);
}

body.dark {
  --bg: #131722;
  --panel: #1e222d;
  --panel-alt: #242836;
  --panel-hover: #2a2e3c;
  --text: #d1d4dc;
  --muted: #9aa4b2;
  --faint: #787f8c;
  --border: #2a2e39;
  --border-strong: #363b48;
  --accent: #a78bfa;
  --accent-dark: #c4b5fd;
  --accent-soft: #2c2344;
  --positive: #34d399;
  --positive-soft: #12352a;
  --negative: #f87171;
  --negative-soft: #3a1b1b;
  --warning: #fbbf24;
  --warning-soft: #3a2c10;
  --selected: #352a56;
  --track: #2a2e39;
  --shadow: 0 10px 34px rgba(0, 0, 0, 0.42);
  --scroll-track: rgba(255, 255, 255, 0.045);
  --scroll-thumb: rgba(167, 139, 250, 0.32);
  --scroll-thumb-hover: rgba(167, 139, 250, 0.54);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--scroll-track); border-radius: 999px; }
::-webkit-scrollbar-thumb {
  min-height: 30px; border: 2px solid transparent; border-radius: 999px;
  background: var(--scroll-thumb); background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--scroll-thumb-hover); background-clip: padding-box; }
::-webkit-scrollbar-corner { background: transparent; }

html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 12px;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: 0.2px; }
a { color: var(--accent); }
.ico { flex: none; display: inline-block; vertical-align: -2px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.right { text-align: right; }
.grow { flex: 1 1 auto; min-width: 0; }
.row { display: flex; align-items: center; gap: 8px; }
.wrap { flex-wrap: wrap; }
.nowrap { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------- app frame */
.app {
  display: grid;
  grid-template-columns: 208px minmax(0, 1fr);
  height: 100vh;
  background: var(--bg);
}
.app.side-collapsed { grid-template-columns: 58px minmax(0, 1fr); }

/* --------------------------------------------------------------- sidebar */
.side {
  display: flex; flex-direction: column;
  border-right: 1px solid var(--border);
  background: var(--panel);
  min-height: 0;
}
.brand {
  display: flex; align-items: center; gap: 9px;
  height: 58px; padding: 0 14px;
  border-bottom: 1px solid var(--border);
}
.brand-mark {
  width: 27px; height: 27px; border-radius: 8px;
  display: grid; place-items: center;
  background: linear-gradient(150deg, var(--accent), var(--accent-dark));
  color: #fff; font-size: 14px;
  box-shadow: 0 4px 12px rgba(109, 40, 217, 0.3);
}
.brand-mark svg { width: 16px; height: 16px; display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text b { font-size: 12.5px; letter-spacing: 1.4px; }
.brand-text small { color: var(--faint); font-size: 9.5px; letter-spacing: 0.4px; text-transform: uppercase; }

.nav { padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  height: 33px; padding: 0 9px;
  border: 0; border-radius: 7px;
  background: transparent; color: var(--muted);
  font-size: 12px; font-weight: 600; text-align: left;
  position: relative;
}
.nav-item:hover { background: var(--panel-hover); color: var(--text); }
.nav-item.on { background: var(--accent-soft); color: var(--accent-dark); }
body.dark .nav-item.on { color: var(--text); }
.nav-item.on::before {
  content: ""; position: absolute; left: -8px; top: 7px; bottom: 7px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--accent);
}
.ni-ico { display: grid; place-items: center; width: 17px; }
.ni-label { flex: 1 1 auto; }
.nav-item kbd {
  font-family: var(--mono); font-size: 9px; color: var(--faint);
  border: 1px solid var(--border); border-radius: 4px; padding: 1px 4px;
  opacity: 0; transition: opacity 0.12s;
}
.nav-item:hover kbd, .nav-item.on kbd { opacity: 1; }
.side-collapsed .nav-item { justify-content: center; padding: 0; }
.side-collapsed .ni-label, .side-collapsed .nav-item kbd, .side-collapsed .brand-text { display: none; }
.side-collapsed .brand { justify-content: center; padding: 0; }
.side-collapsed .streak-card { display: none; }

.side-foot { margin-top: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.streak-card {
  border: 1px solid var(--border); border-radius: 9px;
  background: var(--panel-alt);
  padding: 9px 10px;
}
.streak-card .sc-top { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; }
.streak-card .sc-top .ico { color: var(--warning); }
.streak-card .sc-num { font-size: 19px; font-weight: 800; line-height: 1.15; margin-top: 2px; }
.streak-card .sc-sub { color: var(--faint); font-size: 10px; }
.side-meta { display: flex; align-items: center; justify-content: space-between; padding: 0 2px; }
.save-state { display: flex; align-items: center; gap: 5px; font-size: 10px; color: var(--faint); }
.save-state .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--positive); }
.save-state.saving .dot { background: var(--warning); }

/* ---------------------------------------------------------------- topbar */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar {
  display: flex; align-items: center; gap: 14px;
  flex: 0 0 58px; height: 58px; padding: 0 16px 0 18px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}
.tb-left { display: flex; align-items: baseline; gap: 9px; min-width: 148px; }
.tb-left h1 { font-size: 15px; }
.tb-date { color: var(--faint); font-size: 10.5px; }

.quickadd {
  position: relative;
  display: flex; align-items: center; gap: 8px;
  flex: 1 1 auto; max-width: 720px;
  height: 34px; padding: 0 6px 0 10px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg);
  transition: border-color 0.14s, box-shadow 0.14s;
}
.quickadd:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.qa-ico { color: var(--faint); display: grid; place-items: center; }
.quickadd input {
  flex: 1 1 auto; min-width: 0; border: 0; outline: 0; background: transparent;
  font-size: 12px; height: 100%;
}
.quickadd input::placeholder { color: var(--faint); }
.tiny-btn { height: 24px; padding: 0 10px; font-size: 11px; }
.qa-preview {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px);
  display: none; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--panel); box-shadow: var(--shadow); z-index: 30;
}
.qa-preview.show { display: flex; }
.qa-preview .qa-hint-lab { color: var(--faint); font-size: 10px; text-transform: uppercase; letter-spacing: 0.6px; }

.tb-right { display: flex; align-items: center; gap: 7px; margin-left: auto; }

/* desktop window chrome — only shown when the Electron shell exposes the bridge */
.win-controls { display: flex; align-items: center; gap: 2px; margin-left: 5px; padding-left: 5px; border-left: 1px solid var(--border); }
.win-controls[hidden] { display: none; }
.win-btn { width: 26px; height: 26px; border: 0; border-radius: 5px; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; padding: 0; }
.win-btn:hover { background: var(--panel-alt); color: var(--text); }
.win-btn.win-close:hover { background: #dc2626; color: #fff; }
body.frameless .topbar { -webkit-app-region: drag; }
body.frameless .topbar .quickadd,
body.frameless .topbar button,
body.frameless .topbar input,
body.frameless .topbar select { -webkit-app-region: no-drag; }
.timer-chip {
  display: flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 11px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--panel-alt);
  color: var(--muted); font-size: 11px; font-weight: 700;
}
.timer-chip:hover { border-color: var(--accent); color: var(--text); }
.timer-chip.running { border-color: var(--accent); color: var(--accent-dark); background: var(--accent-soft); }
body.dark .timer-chip.running { color: var(--text); }

/* --------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 30px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 7px;
  background: var(--panel); color: var(--text);
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
  transition: background-color 0.12s, border-color 0.12s, transform 0.08s;
}
.btn:hover { background: var(--panel-hover); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
body.dark .btn.primary { color: #1a1626; }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--panel-hover); }
.btn.danger { background: var(--negative); border-color: var(--negative); color: #fff; }
.btn.small { height: 26px; font-size: 11px; padding: 0 9px; }
.btn.icon-only { width: 30px; padding: 0; }

.icon-btn {
  display: grid; place-items: center;
  width: 30px; height: 30px;
  border: 1px solid transparent; border-radius: 7px;
  background: transparent; color: var(--muted);
}
.icon-btn:hover { background: var(--panel-hover); color: var(--text); }
.icon-btn.tiny { width: 23px; height: 23px; }
.icon-btn.on { background: var(--accent-soft); color: var(--accent-dark); }

/* ---------------------------------------------------------------- inputs */
.input, .select, textarea.input {
  width: 100%; height: 32px; padding: 0 9px;
  border: 1px solid var(--border); border-radius: 7px;
  background: var(--bg); color: var(--text);
  font-size: 12px; outline: 0;
  transition: border-color 0.12s, box-shadow 0.12s;
}
textarea.input { height: auto; min-height: 74px; padding: 8px 9px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, textarea.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.select { appearance: none; padding-right: 26px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 14px) 14px, calc(100% - 9px) 14px; background-size: 5px 5px; background-repeat: no-repeat; }
.searchbox { position: relative; display: flex; align-items: center; }
.searchbox .ico { position: absolute; left: 9px; color: var(--faint); pointer-events: none; }
.searchbox .input { padding-left: 30px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > label { font-size: 10px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; color: var(--faint); }
.checkline { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--muted); cursor: pointer; }
.checkline input { accent-color: var(--accent); width: 14px; height: 14px; }

/* ----------------------------------------------------------------- chips */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  height: 19px; padding: 0 7px;
  border-radius: 999px; border: 1px solid var(--border);
  background: var(--panel-alt); color: var(--muted);
  font-size: 10px; font-weight: 600; white-space: nowrap;
}
.chip.bare { border-color: transparent; background: transparent; padding: 0 3px; color: var(--faint); }
.chip.project { background: color-mix(in srgb, var(--pc) 14%, transparent); border-color: color-mix(in srgb, var(--pc) 34%, transparent); color: var(--pc); }
.chip .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.chip.due { background: var(--panel-alt); }
.chip.due.today { color: var(--accent-dark); border-color: var(--accent); background: var(--accent-soft); }
body.dark .chip.due.today { color: var(--text); }
.chip.due.over { color: var(--negative); border-color: color-mix(in srgb, var(--negative) 40%, transparent); background: var(--negative-soft); }
.chip.tag { background: transparent; border-color: var(--border); color: var(--faint); }
/* Tag picker in the task editor: every tag used before, one click away. */
.tag-menu { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; max-height: 86px; overflow-y: auto; padding: 2px 1px; }
.tag-menu-lab { font-size: 10px; color: var(--faint); margin-right: 2px; }
.tag-menu .chip { cursor: pointer; font-family: inherit; height: 22px; padding: 0 9px; font-size: 10.5px; }
.tag-menu .chip:hover { border-color: var(--accent); color: var(--text); }
.tag-menu .chip.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-dark); }
body.dark .tag-menu .chip.on { color: var(--text); }
.chip.mit { color: var(--warning); border-color: color-mix(in srgb, var(--warning) 45%, transparent); background: var(--warning-soft); }
.chip.doing { color: var(--accent-dark); background: var(--accent-soft); border-color: var(--accent); }
.chip.time-chip.under { color: var(--positive); }
.chip.time-chip.over { color: var(--negative); }
.chip.time-chip.even { color: var(--muted); }
/* Logged focus time against the task's pre-allotted estimate. */
.time-compare { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; padding: 9px 11px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel-alt); }
.time-compare .tc-item { display: flex; flex-direction: column; gap: 1px; }
.time-compare .tc-lab { font-size: 9px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; color: var(--faint); }
.time-compare .tc-item b { font-size: 15px; font-variant-numeric: tabular-nums; color: var(--text); }
.time-compare .tc-verdict { margin-left: auto; font-size: 10px; font-weight: 700; color: var(--muted); }
.time-compare.under .tc-item:first-child b, .time-compare.under .tc-verdict { color: var(--positive); }
.time-compare.over .tc-item:first-child b, .time-compare.over .tc-verdict { color: var(--negative); }
body.dark .chip.doing { color: var(--text); }
.chip.prio-high { color: var(--negative); border-color: color-mix(in srgb, var(--negative) 38%, transparent); background: var(--negative-soft); }
.chip.prio-med { color: var(--warning); border-color: color-mix(in srgb, var(--warning) 38%, transparent); background: var(--warning-soft); }
.chip.prio-low { color: var(--muted); }
.mini-project { display: inline-flex; align-items: center; gap: 5px; font-size: 10px; color: var(--faint); }
.mini-project .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--pc); }

/* ----------------------------------------------------------------- views */
.view {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden;
  padding: 18px 20px 40px;
  outline: 0;
  scroll-behavior: smooth;
}
.page { max-width: 1560px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.page-head { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.page-head .ph-left { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.page-title { font-size: 20px; letter-spacing: -0.2px; }
.page-sub { color: var(--muted); font-size: 11.5px; }
.page-actions { display: flex; align-items: center; gap: 7px; margin-left: auto; flex-wrap: wrap; }

.card {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--panel);
  display: flex; flex-direction: column; min-width: 0;
  overflow: hidden;
}
.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; border-bottom: 1px solid var(--border);
  min-height: 42px;
}
.card-title { font-size: 12px; font-weight: 700; display: flex; align-items: center; gap: 7px; }
.card-title .ico { color: var(--faint); }
.card-sub { color: var(--faint); font-size: 10.5px; }
.card-head .right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.card-body { padding: 12px 14px; min-width: 0; }
.card-body.flush { padding: 0; }
.card-foot { padding: 9px 14px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 8px; }

.grid { display: grid; gap: 14px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.side { grid-template-columns: minmax(0, 1.65fr) minmax(300px, 1fr); align-items: start; }
.grid.kpis { grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); gap: 10px; }

.section-head { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.section-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.7px; color: var(--faint); display: flex; align-items: center; gap: 6px; }
.section-head .right { margin-left: auto; display: flex; gap: 6px; align-items: center; }

.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px;
  padding: 34px 16px; color: var(--faint); text-align: center;
}
.empty .ico { opacity: 0.55; }
.empty b { color: var(--muted); font-size: 12px; }
.empty p { margin: 0; font-size: 11px; max-width: 320px; line-height: 1.5; }

/* ------------------------------------------------------------------ kpis */
.kpi {
  border: 1px solid var(--border); border-radius: 9px;
  background: var(--panel); padding: 10px 12px;
  display: flex; flex-direction: column; gap: 2px;
}
.kpi .k-lab { font-size: 9.5px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase; color: var(--faint); }
.kpi .k-val { font-size: 19px; font-weight: 800; letter-spacing: -0.3px; font-variant-numeric: tabular-nums; }
.kpi .k-sub { font-size: 10.5px; color: var(--muted); }
.kpi.accent { border-color: color-mix(in srgb, var(--accent) 42%, var(--border)); background: var(--accent-soft); }
.kpi.good .k-val { color: var(--positive); }
.kpi.bad .k-val { color: var(--negative); }

/* -------------------------------------------------------------- task rows */
.task-list { display: flex; flex-direction: column; }
.task-row {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 9px 10px; border-radius: 8px;
  border: 1px solid transparent;
  transition: background-color 0.12s, border-color 0.12s;
  position: relative;
}
.task-row + .task-row { border-top-color: transparent; }
.task-row:hover { background: var(--panel-alt); border-color: var(--border); }
.task-row.done { opacity: 0.58; }
.task-row.done .task-title { text-decoration: line-through; }
.task-row.draggable { cursor: grab; }
.task-row.dragging { opacity: 0.4; }

.tcheck {
  width: 17px; height: 17px; margin-top: 1px;
  border: 1.6px solid var(--border-strong); border-radius: 5px;
  background: transparent; color: #fff;
  display: grid; place-items: center; flex: none;
  transition: background-color 0.12s, border-color 0.12s;
}
.tcheck:hover { border-color: var(--accent); background: var(--accent-soft); }
.tcheck.on { background: var(--positive); border-color: var(--positive); }
.task-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; cursor: pointer; }
.task-title-line { display: flex; align-items: center; gap: 7px; min-width: 0; }
.task-title { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--faint); font-size: 10px; }
.task-tags { display: inline-flex; gap: 4px; }
.task-note-flag { color: var(--faint); display: inline-flex; }
.task-side { display: flex; align-items: center; gap: 5px; margin-left: auto; padding-top: 1px; }

/* -------------------------------------------------------------- progress */
.progress { height: 6px; border-radius: 999px; background: var(--track); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 999px; background: var(--accent); transition: width 0.3s ease; }
.progress.good > span { background: var(--positive); }

/* --------------------------------------------------------------- banners */
.banner {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 13px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--panel-alt);
  font-size: 11.5px;
}
.banner .ico { color: var(--warning); }
.banner.warn { border-color: color-mix(in srgb, var(--warning) 45%, var(--border)); background: var(--warning-soft); color: var(--text); }
.banner .right { margin-left: auto; display: flex; gap: 6px; }

/* ------------------------------------------------------------------ hero */
.hero {
  display: flex; align-items: center; gap: 20px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background:
    radial-gradient(1200px 240px at -10% -60%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 60%),
    var(--panel);
  padding: 16px 18px;
}
.hero-left { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.hero-greet { font-size: 11px; font-weight: 700; letter-spacing: 0.7px; text-transform: uppercase; color: var(--accent); }
.hero-date { font-size: 22px; font-weight: 800; letter-spacing: -0.4px; }
.hero-sub { color: var(--muted); font-size: 11.5px; }
.hero-stats { display: flex; gap: 18px; margin-left: auto; flex-wrap: wrap; }
.hero-stat { display: flex; flex-direction: column; gap: 1px; }
.hero-stat b { font-size: 16px; font-variant-numeric: tabular-nums; }
.hero-stat span { font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--faint); }
.hero-ring { --ring-color: var(--accent); }
.ring-text { font-size: 15px; font-weight: 800; fill: var(--text); }

/* ------------------------------------------------------------------- MITs */
.mit-list { display: flex; flex-direction: column; gap: 8px; }
.mit-card {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--panel-alt);
}
.mit-index {
  width: 21px; height: 21px; border-radius: 6px; flex: none;
  display: grid; place-items: center;
  font-size: 10px; font-weight: 800;
  background: var(--accent-soft); color: var(--accent-dark);
}
body.dark .mit-index { color: var(--text); }
.mit-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 auto; }
.mit-title { font-size: 12.5px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mit-meta { font-size: 10px; color: var(--faint); display: flex; gap: 7px; }
.mit-card.done .mit-title { text-decoration: line-through; opacity: 0.6; }
.mit-actions { display: flex; gap: 4px; }
.mit-pick {
  width: 100%; border: 1px dashed var(--border-strong); border-radius: 9px;
  background: transparent; color: var(--faint);
  padding: 9px; font-size: 11.5px; display: flex; align-items: center; justify-content: center; gap: 6px;
}
.mit-pick:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* --------------------------------------------------------------- timeline */
.timeline { position: relative; display: flex; flex-direction: column; }
.tl-row { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 8px; min-height: 40px; }
.tl-hour { font-family: var(--mono); font-size: 9.5px; color: var(--faint); padding-top: 2px; text-align: right; }
.tl-slot { border-top: 1px dashed var(--border); position: relative; padding: 3px 0; display: flex; flex-direction: column; gap: 4px; min-height: 40px; }
.tl-empty { min-height: 34px; }
.tl-item {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 8px; border-radius: 6px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft); font-size: 11px; cursor: pointer;
}
.tl-item b { font-weight: 700; }
.tl-item .tl-when { margin-left: auto; font-family: var(--mono); font-size: 9.5px; color: var(--muted); }
.tl-item.task { border-left-color: var(--positive); background: var(--positive-soft); }
.tl-item.meeting { border-left-color: var(--warning); background: var(--warning-soft); }
.tl-item.personal { border-left-color: #06b6d4; background: color-mix(in srgb, #06b6d4 14%, transparent); }
.tl-item.break { border-left-color: var(--faint); background: var(--panel-alt); }
.tl-now {
  position: relative; height: 0; border-top: 2px solid var(--negative);
  margin: 2px 0 2px 52px;
}
.tl-now::before {
  content: ""; position: absolute; left: -5px; top: -5px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--negative);
}

/* ------------------------------------------------------------------ notes */
/* Today: wake / sleep times plus a running list of meals. */
.rhythm-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.rhythm-grid .input { padding: 0 7px; }
.meal-field { margin-top: 12px; }
.meal-list { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; min-height: 23px; }
.meal-empty { font-size: 10.5px; color: var(--faint); }
.meal-chip { display: inline-flex; align-items: center; gap: 2px; height: 23px; padding: 0 3px 0 8px; border: 1px solid var(--border); border-radius: 999px; background: var(--panel-alt); color: var(--muted); font-size: 10.5px; font-weight: 600; }
.meal-chip .icon-btn.tiny { width: 18px; height: 18px; }
.meal-add { display: flex; gap: 6px; margin-top: 6px; }
.meal-add .input { height: 30px; min-width: 0; }

/* Today: reminders */
.reminder-add { display: flex; gap: 6px; margin-top: 6px; }
.reminder-add .input { height: 30px; min-width: 0; }
.reminder-list { display: flex; flex-direction: column; gap: 5px; margin-top: 8px; }
.reminder-row { display: flex; align-items: center; gap: 7px; padding: 6px 7px; border: 1px solid var(--border); border-radius: 7px; background: var(--bg); }
.reminder-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex: 0 0 auto; }
.reminder-row.late .reminder-dot { background: var(--negative); }
.reminder-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1 1 auto; }
.reminder-text b { font-size: 11.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reminder-text span { font-size: 10px; color: var(--faint); }
.reminder-row.late .reminder-text span { color: var(--negative); }
.note-area { width: 100%; min-height: 120px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); padding: 9px 10px; font-size: 11.5px; line-height: 1.55; resize: vertical; outline: 0; }
.note-area:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ----------------------------------------------------------------- board */
.board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: start; }
.board-col { border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); display: flex; flex-direction: column; min-height: 180px; }
.board-head { display: flex; align-items: center; gap: 7px; padding: 9px 11px; border-bottom: 1px solid var(--border); }
.board-head .bd-name { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.6px; color: var(--muted); }
.board-head .bd-count { margin-left: auto; font-size: 10px; color: var(--faint); background: var(--panel-alt); border-radius: 999px; padding: 1px 7px; }
.board-body { padding: 8px; display: flex; flex-direction: column; gap: 7px; min-height: 120px; flex: 1 1 auto; }
.board-col.drag-over { border-color: var(--accent); background: var(--accent-soft); }

/* -------------------------------------------------------------- dragging */
.mit-card.draggable, .evt.draggable, .task-row.draggable { cursor: grab; }
.mit-card.draggable:active, .evt.draggable:active, .task-row.draggable:active { cursor: grabbing; }
.mit-card.dragging, .evt.dragging { opacity: 0.4; }
.mit-list.drag-over { outline: 1.5px dashed var(--accent); outline-offset: 2px; border-radius: 10px; }
.task-list.drag-over { box-shadow: inset 0 0 0 1.5px var(--accent); border-radius: 8px; }
.week-col.drag-over { background: var(--accent-soft); box-shadow: inset 0 0 0 1.5px var(--accent); }

/* the insertion line that previews exactly where a dragged card will land */
.drag-line {
  position: fixed; z-index: 200; height: 2px; border-radius: 2px;
  background: var(--accent); pointer-events: none;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent), 0 0 10px var(--accent);
}
.drag-line[hidden] { display: none; }
.drag-line::before, .drag-line::after {
  content: ""; position: absolute; top: -3px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--accent);
}
.drag-line::before { left: -3px; }
.drag-line::after { right: -3px; }
.board-body .task-row { border: 1px solid var(--border); background: var(--bg); padding: 8px 9px; }
.board-body .task-row:hover { background: var(--panel-hover); }
.board-add { border: 1px dashed var(--border-strong); background: transparent; color: var(--faint); border-radius: 7px; padding: 7px; font-size: 11px; display: flex; align-items: center; justify-content: center; gap: 5px; }
.board-add:hover { border-color: var(--accent); color: var(--accent); }

/* --------------------------------------------------------------- toolbar */
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 9px 11px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); }
.toolbar .searchbox { flex: 1 1 210px; min-width: 160px; }
.filter-chip {
  height: 25px; padding: 0 10px; border-radius: 999px;
  border: 1px solid var(--border); background: transparent; color: var(--muted);
  font-size: 11px; font-weight: 600;
}
.filter-chip:hover { background: var(--panel-hover); color: var(--text); }
.filter-chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
body.dark .filter-chip.on { color: #1a1626; }
.filter-chip .n { opacity: 0.75; margin-left: 4px; font-variant-numeric: tabular-nums; }
.toolbar .select { width: auto; min-width: 120px; height: 27px; font-size: 11px; padding-right: 24px; background-position: calc(100% - 12px) 12px, calc(100% - 7px) 12px; }
.seg { display: inline-flex; padding: 2px; border-radius: 7px; background: var(--panel-alt); border: 1px solid var(--border); }
.seg button { border: 0; background: transparent; color: var(--muted); height: 22px; padding: 0 9px; border-radius: 5px; font-size: 11px; font-weight: 700; display: flex; align-items: center; gap: 5px; }
.seg button.on { background: var(--panel); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.14); }

/* ------------------------------------------------------------------ week */
.week { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); overflow: hidden; }
.week-head { display: grid; grid-template-columns: 46px repeat(7, minmax(0, 1fr)); border-bottom: 1px solid var(--border); background: var(--panel-alt); }
.week-head .wh-lab { height: 44px; }
.day-head { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; padding: 6px 4px; border-left: 1px solid var(--border); }
.day-head .dh-name { font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.7px; color: var(--faint); font-weight: 700; }
.day-head .dh-num { font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; }
.day-head.today { background: var(--accent-soft); }
.day-head.today .dh-num { color: var(--accent-dark); }
body.dark .day-head.today .dh-num { color: var(--text); }
.week-body { display: grid; grid-template-columns: 46px repeat(7, minmax(0, 1fr)); max-height: 640px; overflow-y: auto; }
.hour-col { display: flex; flex-direction: column; }
.hour-col .hr { height: 44px; font-family: var(--mono); font-size: 9px; color: var(--faint); text-align: right; padding-right: 5px; transform: translateY(-6px); }
.week-col { border-left: 1px solid var(--border); position: relative; }
.week-col .slot { height: 44px; border-top: 1px dashed var(--border); position: relative; }
.week-col .slot:hover { background: var(--panel-alt); }
.week-col.today { background: color-mix(in srgb, var(--accent) 5%, transparent); }
.evt {
  position: absolute; left: 2px; right: 2px;
  border-radius: 5px; padding: 2px 5px;
  font-size: 9.5px; font-weight: 650; line-height: 1.25;
  border-left: 3px solid var(--accent); background: var(--accent-soft); color: var(--text);
  overflow: hidden; cursor: pointer; z-index: 2;
}
.evt .evt-time { display: block; font-family: var(--mono); font-size: 8.5px; color: var(--muted); }
.evt.meeting { border-left-color: var(--warning); background: var(--warning-soft); }
.evt.personal { border-left-color: #06b6d4; background: color-mix(in srgb, #06b6d4 16%, transparent); }
.evt.break { border-left-color: var(--faint); background: var(--panel-alt); }
.evt.task { border-left-color: var(--positive); background: var(--positive-soft); }
.evt:hover { z-index: 4; box-shadow: 0 3px 12px rgba(0, 0, 0, 0.18); }
.evt.done { opacity: 0.55; text-decoration: line-through; }
.tl-item.done { opacity: 0.6; text-decoration: line-through; }
.week-col .now-line { position: absolute; left: 0; right: 0; border-top: 2px solid var(--negative); z-index: 3; pointer-events: none; }
.week-col .now-line::before { content: ""; position: absolute; left: -4px; top: -4px; width: 6px; height: 6px; border-radius: 50%; background: var(--negative); }

/* ------------------------------------------------------------- mini month */
.mini-month { display: flex; flex-direction: column; gap: 6px; }
.mm-head { display: flex; align-items: center; justify-content: space-between; }
.mm-head b { font-size: 11.5px; }
.mm-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.mm-dow { font-size: 8.5px; text-align: center; color: var(--faint); text-transform: uppercase; padding-bottom: 2px; }
.mm-day {
  position: relative; height: 26px; border: 0; background: transparent; border-radius: 6px;
  font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums;
}
.mm-day:hover { background: var(--panel-hover); color: var(--text); }
.mm-day.outside { color: var(--faint); opacity: 0.45; }
.mm-day.today { background: var(--accent); color: #fff; font-weight: 800; }
body.dark .mm-day.today { color: #1a1626; }
.mm-day.has::after { content: ""; position: absolute; bottom: 3px; left: 50%; transform: translateX(-50%); width: 3px; height: 3px; border-radius: 50%; background: var(--accent); }
.mm-day.today.has::after { background: #fff; }

/* ----------------------------------------------------------------- focus */
.timer-wrap { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 18px 10px 20px; }
.mode-pills { display: inline-flex; gap: 3px; padding: 3px; border-radius: 999px; border: 1px solid var(--border); background: var(--panel-alt); }
.mode-pill { border: 0; background: transparent; color: var(--muted); font-size: 10.5px; font-weight: 700; padding: 5px 12px; border-radius: 999px; display: flex; align-items: center; gap: 5px; }
.mode-pill.on { background: var(--accent); color: #fff; }
body.dark .mode-pill.on { color: #1a1626; }
.pomo-ring { position: relative; display: grid; place-items: center; }
.pomo-ring svg { transform: rotate(-90deg); }
.pomo-ring .pr-track { stroke: var(--track); }
.pomo-ring .pr-fill { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset 0.6s linear; }
.timer-inner { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.timer-time { font-size: 42px; font-weight: 800; letter-spacing: -1.5px; font-variant-numeric: tabular-nums; line-height: 1; }
.timer-mode-lab { font-size: 9.5px; text-transform: uppercase; letter-spacing: 1.1px; color: var(--faint); font-weight: 700; }
.timer-task { font-size: 11px; color: var(--muted); max-width: 190px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timer-controls { display: flex; align-items: center; gap: 8px; }
.timer-big { width: 52px; height: 52px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; display: grid; place-items: center; box-shadow: 0 6px 18px rgba(109, 40, 217, 0.35); }
.timer-big:hover { background: var(--accent-dark); }
body.dark .timer-big { color: #1a1626; }
.timer-rounds { display: flex; align-items: center; gap: 5px; }
.round-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--track); border: 1px solid var(--border-strong); }
.round-dot.on { background: var(--accent); border-color: var(--accent); }
.session-list { display: flex; flex-direction: column; }
.session-row { display: flex; align-items: center; gap: 9px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 11.5px; }
.session-row:last-child { border-bottom: 0; }
.session-row .s-time { font-family: var(--mono); font-size: 10px; color: var(--faint); width: 40px; }
.session-row .s-dur { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }

/* -------------------------------------------------------------- projects */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.project-card {
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel);
  display: flex; flex-direction: column; overflow: hidden; cursor: pointer;
  transition: border-color 0.14s, transform 0.1s;
}
.project-card:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.project-card.sel { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.pc-top { height: 4px; background: var(--pc, var(--accent)); }
.pc-body { padding: 12px 13px; display: flex; flex-direction: column; gap: 8px; }
.pc-head { display: flex; align-items: center; gap: 8px; }
.pc-name { font-size: 13px; font-weight: 750; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-counts { display: flex; gap: 10px; font-size: 10px; color: var(--faint); }
.pc-counts b { color: var(--muted); font-variant-numeric: tabular-nums; }
.pc-next { font-size: 10.5px; color: var(--muted); display: flex; align-items: center; gap: 5px; min-width: 0; }
.pc-next span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-foot { display: flex; align-items: center; gap: 8px; padding: 8px 13px; border-top: 1px solid var(--border); font-size: 10px; color: var(--faint); }
.new-project { border: 1px dashed var(--border-strong); background: transparent; border-radius: var(--radius); min-height: 132px; color: var(--faint); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; font-size: 11.5px; }
.new-project:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* ---------------------------------------------------------------- habits */
.habit-list { display: flex; flex-direction: column; }
.habit-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.habit-row:last-child { border-bottom: 0; }
.habit-main { display: flex; flex-direction: column; gap: 2px; min-width: 160px; flex: 1 1 220px; }
.habit-name { font-size: 12.5px; font-weight: 650; display: flex; align-items: center; gap: 7px; }
.habit-name .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--hc, var(--accent)); }
.habit-meta { font-size: 10px; color: var(--faint); display: flex; gap: 8px; }
.habit-days { display: flex; gap: 4px; }
.habit-day { width: 28px; height: 28px; border-radius: 7px; border: 1px solid var(--border); background: transparent; color: var(--faint); font-size: 9px; font-weight: 700; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; }
.habit-day:hover { border-color: var(--accent); color: var(--text); }
.habit-day.on { background: var(--positive); border-color: var(--positive); color: #fff; }
.habit-day.today { border-color: var(--accent); }
.habit-day.future { opacity: 0.4; pointer-events: none; }
.habit-streak { display: flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; color: var(--warning); min-width: 58px; justify-content: flex-end; }

/* ---------------------------------------------------------------- review */
.chart-card { padding: 10px 12px 4px; }
.bar-chart { width: 100%; height: auto; display: block; }
.chart-lab { font-size: 9px; fill: var(--faint); font-family: var(--mono); }
.chart-val { font-size: 9px; fill: var(--muted); font-weight: 700; }
.spark { display: block; }
.legend { display: flex; gap: 14px; font-size: 10px; color: var(--faint); padding: 2px 12px 8px; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }
.table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.table th { text-align: left; font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--faint); padding: 7px 10px; border-bottom: 1px solid var(--border); font-weight: 700; }
.table td { padding: 7px 10px; border-bottom: 1px solid var(--border); }
.table tr:last-child td { border-bottom: 0; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.review-wins { display: flex; flex-direction: column; gap: 6px; }
.review-win { display: flex; align-items: center; gap: 7px; font-size: 11.5px; padding: 6px 8px; border-radius: 6px; background: var(--positive-soft); }
.review-win .ico { color: var(--positive); }

/* -------------------------------------------------------------- settings */
.settings-grid { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 16px; align-items: start; }
.settings-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; }
.settings-nav button { border: 0; background: transparent; text-align: left; padding: 8px 10px; border-radius: 7px; font-size: 11.5px; font-weight: 600; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.settings-nav button:hover { background: var(--panel-hover); color: var(--text); }
.settings-nav button.on { background: var(--accent-soft); color: var(--accent-dark); }
body.dark .settings-nav button.on { color: var(--text); }
.settings-panel { display: flex; flex-direction: column; gap: 14px; }
.setting-row { display: flex; align-items: center; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.setting-row:last-child { border-bottom: 0; }
.setting-row .s-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.setting-row .s-name { font-size: 12px; font-weight: 650; }
.setting-row .s-help { font-size: 10.5px; color: var(--faint); }
.setting-row .s-ctl { flex: none; display: flex; align-items: center; gap: 6px; }
.setting-row .s-ctl .input, .setting-row .s-ctl .select { width: auto; min-width: 84px; }
.switch { position: relative; width: 34px; height: 19px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--track); border: 1px solid var(--border-strong); transition: background-color 0.16s; pointer-events: none; }
.switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 13px; height: 13px; border-radius: 50%; background: var(--panel); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); transition: transform 0.16s; }
.switch input:checked + span { background: var(--accent); border-color: var(--accent); }
.switch input:checked + span::after { transform: translateX(15px); background: #fff; }
.switch input:focus-visible + span { box-shadow: 0 0 0 3px var(--accent-soft); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.two-wide { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.hint { font-size: 10.5px; color: var(--faint); line-height: 1.5; }

/* ---------------------------------------------------------------- modals */
#modalRoot { position: fixed; inset: 0; z-index: 90; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(10, 12, 20, 0.55); display: flex; align-items: flex-start; justify-content: center; padding: 70px 20px 30px; overflow-y: auto; }
.modal {
  width: min(520px, 100%); border-radius: 12px; background: var(--panel);
  border: 1px solid var(--border-strong); box-shadow: var(--shadow);
  display: flex; flex-direction: column; max-height: calc(100vh - 100px);
  animation: modal-in 0.16s ease;
}
@keyframes modal-in { from { opacity: 0; transform: translateY(-6px) scale(0.99); } to { opacity: 1; transform: none; } }
.modal.wide { width: min(760px, 100%); }
.modal-head { display: flex; align-items: flex-start; gap: 10px; padding: 14px 16px 12px; border-bottom: 1px solid var(--border); }
.modal-head h2 { font-size: 14px; }
.modal-sub { margin: 3px 0 0; font-size: 10.5px; color: var(--faint); }
.modal-head .icon-btn { margin-left: auto; }
.modal-body { padding: 14px 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.modal-foot { padding: 11px 16px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.confirm-text { margin: 0; font-size: 12px; line-height: 1.6; color: var(--muted); }

/* modal internals */
.subtask-list { display: flex; flex-direction: column; gap: 4px; }
.subtask { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 6px; }
.subtask:hover { background: var(--panel-alt); }
.subtask input[type=checkbox] { accent-color: var(--accent); width: 14px; height: 14px; }
.subtask span { flex: 1 1 auto; font-size: 11.5px; }
.subtask.done span { text-decoration: line-through; color: var(--faint); }
.subtask-add { display: flex; gap: 6px; }

/* Attachments: pictures and PDFs copied into the app's data folder. */
.attach-zone {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 8px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--panel-alt) 55%, transparent);
  transition: border-color 0.15s, background 0.15s;
}
.attach-zone.drag-over { border-color: var(--accent); background: var(--accent-soft); }
.attach-list { display: flex; flex-direction: column; gap: 4px; max-height: 186px; overflow-y: auto; }
.attach-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 5px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
}
.attach-item:hover { border-color: var(--border-strong); }
.attach-thumb {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--panel-alt);
  color: var(--faint);
}
.attach-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.attach-info { flex: 1 1 auto; min-width: 0; }
.attach-name { font-size: 11.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attach-meta { margin-top: 1px; font-size: 10px; color: var(--faint); }
.attach-btns { display: flex; gap: 2px; flex: 0 0 auto; }
.attach-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.attach-actions .hint { margin-left: auto; }
.attach-empty { margin: 0; padding: 3px 2px; font-size: 10.5px; color: var(--faint); }
.color-swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatch { width: 22px; height: 22px; border-radius: 6px; border: 2px solid transparent; background: var(--sw); }
.swatch.on { border-color: var(--text); }

/* -------------------------------------------------------------- pop menu */
.popmenu {
  position: fixed; z-index: 100; width: 184px;
  background: var(--panel); border: 1px solid var(--border-strong);
  border-radius: 9px; box-shadow: var(--shadow); padding: 5px;
  display: flex; flex-direction: column;
  animation: modal-in 0.12s ease;
}
.popmenu button { border: 0; background: transparent; text-align: left; padding: 7px 8px; border-radius: 6px; font-size: 11.5px; color: var(--text); display: flex; align-items: center; gap: 8px; }
.popmenu button:hover { background: var(--panel-hover); }
.popmenu button.danger { color: var(--negative); }
.popmenu button.danger:hover { background: var(--negative-soft); }
.popmenu hr { border: 0; border-top: 1px solid var(--border); margin: 4px 2px; }

/* ---------------------------------------------------------------- toasts */
.toast-stack { position: fixed; right: 16px; bottom: 16px; z-index: 120; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 13px; border-radius: 8px;
  background: var(--panel); border: 1px solid var(--border-strong);
  box-shadow: var(--shadow); font-size: 11.5px; font-weight: 600;
  opacity: 0; transform: translateY(6px); transition: opacity 0.2s, transform 0.2s;
}
.toast.in { opacity: 1; transform: none; }
.toast .ico { color: var(--positive); }
.toast.warn .ico { color: var(--warning); }
.toast.timer .ico { color: var(--accent); }

/* --------------------------------------------------------------- palette */
.palette-backdrop { position: fixed; inset: 0; z-index: 110; background: rgba(10, 12, 20, 0.5); display: flex; justify-content: center; padding-top: 12vh; }
.palette { width: min(600px, 92vw); height: max-content; max-height: 66vh; background: var(--panel); border: 1px solid var(--border-strong); border-radius: 12px; box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; }
.palette-top { display: flex; align-items: center; gap: 9px; padding: 12px 14px; border-bottom: 1px solid var(--border); color: var(--faint); }
.palette-top input { flex: 1 1 auto; border: 0; outline: 0; background: transparent; font-size: 13px; color: var(--text); }
.palette-top kbd { font-family: var(--mono); font-size: 9px; border: 1px solid var(--border); border-radius: 4px; padding: 2px 5px; color: var(--faint); }
.palette-list { overflow-y: auto; padding: 6px; }
.palette-item { display: flex; align-items: center; gap: 9px; width: 100%; border: 0; background: transparent; text-align: left; padding: 8px 9px; border-radius: 7px; color: var(--text); font-size: 12px; }
.palette-item .pi-kind { margin-left: auto; font-size: 9px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--faint); }
.palette-item.on, .palette-item:hover { background: var(--accent-soft); }
.palette-item .ico { color: var(--muted); }
.palette-foot { display: flex; gap: 16px; padding: 7px 14px; border-top: 1px solid var(--border); font-size: 9.5px; color: var(--faint); }

/* ------------------------------------------------------------ responsive */
@media (max-width: 1200px) {
  .grid.side { grid-template-columns: minmax(0, 1fr); }
  .grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-stats { gap: 12px; }
}
@media (max-width: 960px) {
  .app { grid-template-columns: 58px minmax(0, 1fr); }
  .brand-text, .ni-label, .nav-item kbd, .streak-card { display: none; }
  .brand, .nav-item { justify-content: center; }
  .quickadd input::placeholder { color: transparent; }
  .grid.two, .grid.three, .board { grid-template-columns: minmax(0, 1fr); }
  .settings-grid { grid-template-columns: minmax(0, 1fr); }
  .settings-nav { flex-direction: row; flex-wrap: wrap; position: static; }
  .hero { flex-wrap: wrap; }
  .hero-stats { margin-left: 0; }
  .week-body { max-height: none; }
}

/* ============================================ goals · notes · assistant */
.seg-wrap { display: flex; align-items: center; gap: 10px; margin: 2px 0 12px; }
.seg-wrap .hint { margin-left: auto; }

/* ----------------------------------------------------------------- goals */
.goal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(236px, 1fr)); gap: 12px; }
.goal-card {
  position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 8px;
  padding: 13px 12px 10px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--panel); cursor: pointer; transition: border-color .14s, background .14s;
}
.goal-card::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--gc); opacity: .85; }
.goal-card:hover { border-color: var(--border-strong); background: var(--panel-hover); }
.goal-card.sel { border-color: var(--gc); box-shadow: 0 0 0 1px var(--gc) inset; }
.gc-head { display: flex; align-items: center; gap: 6px; }
.gc-area { font-size: 9px; font-weight: 800; letter-spacing: .45px; text-transform: uppercase; color: var(--gc); }
.gc-frame { margin-left: auto; font-size: 9.5px; color: var(--faint); }
.gc-name { font-size: 12.5px; line-height: 1.35; margin: 0; }
.gc-bar { display: flex; align-items: center; gap: 8px; }
.gc-bar .progress { flex: 1 1 auto; }
.gc-bar b { font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.gc-meta { display: flex; justify-content: space-between; gap: 8px; font-size: 10px; color: var(--faint); }
.gc-meta .neg { color: var(--negative); font-weight: 700; }
.gc-foot {
  display: flex; align-items: center; gap: 6px; margin-top: auto; padding-top: 7px;
  border-top: 1px solid var(--border); font-size: 10px;
}
.gc-open { margin-left: auto; color: var(--faint); }

.goal-detail .card-body { display: flex; flex-direction: column; gap: 14px; }
.goal-detail-top { display: flex; align-items: flex-start; gap: 14px; }
.goal-ring { flex: none; }
.goal-detail-actions { display: flex; flex-direction: column; gap: 6px; margin-left: auto; }
.goal-target { display: flex; align-items: center; gap: 8px; font-size: 11px; }
.goal-target label {
  font-size: 9px; text-transform: uppercase; letter-spacing: .4px; color: var(--faint); font-weight: 700;
}
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 980px) { .two-col { grid-template-columns: 1fr; } }
.milestone-list { display: flex; flex-direction: column; gap: 3px; margin-top: 6px; }
.milestone {
  display: flex; align-items: center; gap: 8px; padding: 5px 6px;
  border-radius: var(--radius-sm); border: 1px solid transparent;
}
.milestone:hover { background: var(--panel-alt); }
.milestone span { flex: 1 1 auto; font-size: 11.5px; }
.milestone.done span { color: var(--faint); text-decoration: line-through; }
.milestone-check {
  width: 16px; height: 16px; flex: none; display: grid; place-items: center;
  border-radius: 5px; border: 1.5px solid var(--border-strong); background: transparent; color: #fff;
}
.milestone-check.on { background: var(--accent); border-color: var(--accent); }
.inline-add { display: flex; gap: 6px; margin-top: 8px; }
.goal-tasks { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; max-height: 240px; overflow: auto; }
.goal-remind { display: flex; align-items: center; gap: 8px; padding-top: 10px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.goal-remind .input { max-width: 190px; }

/* ----------------------------------------------------------------- notes */
.notes-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.notes-toolbar .searchbox { flex: 1 1 240px; }
.memo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(238px, 1fr)); gap: 12px; }
.memo-card {
  display: flex; flex-direction: column; gap: 7px; padding: 11px 12px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel);
  cursor: pointer; transition: border-color .14s, background .14s;
}
.memo-card:hover { border-color: var(--border-strong); background: var(--panel-hover); }
.memo-card.pinned { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.memo-head { display: flex; align-items: center; gap: 6px; }
.memo-kind {
  font-size: 8.5px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase;
  padding: 2px 6px; border-radius: 999px; background: var(--accent-soft); color: var(--accent);
}
.memo-kind.k-journal { background: var(--positive-soft); color: var(--positive); }
.memo-kind.k-idea { background: var(--warning-soft); color: var(--warning); }
.memo-kind.k-meeting { background: var(--negative-soft); color: var(--negative); }
.memo-kind.k-list { background: var(--panel-alt); color: var(--muted); }
.memo-date { margin-left: auto; font-size: 9.5px; color: var(--faint); }
.icon-btn.tiny.on { color: var(--accent); }
.memo-title { font-size: 12.5px; margin: 0; line-height: 1.35; }
.memo-body { margin: 0; font-size: 11px; color: var(--muted); line-height: 1.5; }
.memo-foot {
  display: flex; align-items: center; gap: 6px; padding-top: 6px; margin-top: auto;
  border-top: 1px solid var(--border);
}
.journal-list { display: flex; flex-direction: column; }
.journal-row {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 10px 14px;
  background: transparent; border: 0; border-bottom: 1px solid var(--border); color: inherit;
}
.journal-row:last-child { border-bottom: 0; }
.journal-row:hover { background: var(--panel-alt); }
.journal-date { flex: none; width: 42px; display: flex; flex-direction: column; align-items: center; line-height: 1.1; }
.journal-date b { font-size: 15px; }
.journal-date i {
  font-size: 9px; color: var(--faint); font-style: normal;
  text-transform: uppercase; letter-spacing: .4px;
}
.journal-text { flex: 1 1 auto; font-size: 11.5px; color: var(--muted); }

/* --------------------------------------------------- today's mini widgets */
.habit-mini-list, .goal-mini-list { display: flex; flex-direction: column; gap: 4px; }
.habit-mini {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--panel-alt); color: inherit; font-size: 11.5px;
}
.habit-mini:hover { border-color: var(--border-strong); }
.habit-mini.on {
  border-color: color-mix(in srgb, var(--hc) 55%, var(--border));
  background: color-mix(in srgb, var(--hc) 14%, var(--panel));
}
.hm-check {
  width: 15px; height: 15px; flex: none; display: grid; place-items: center;
  border-radius: 4px; border: 1.5px solid var(--border-strong); color: #fff;
}
.habit-mini.on .hm-check { background: var(--hc); border-color: var(--hc); }
.hm-streak { font-size: 9.5px; color: var(--faint); font-variant-numeric: tabular-nums; }
.goal-mini {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--panel-alt); color: inherit; font-size: 11.5px;
}
.goal-mini:hover { border-color: var(--border-strong); }
.gm-bar { flex: none; width: 52px; height: 5px; border-radius: 999px; background: var(--track); overflow: hidden; }
.gm-bar i { display: block; height: 100%; background: var(--gc); border-radius: 999px; }
.gm-pct { font-size: 9.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------- assistant */
.assist-text { min-height: 86px; resize: vertical; line-height: 1.55; }
.assist-result { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); }
.assist-rows { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.assist-row {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px; font-size: 11.5px;
  border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--panel-alt);
}
.assist-row.warn {
  border-color: color-mix(in srgb, var(--warning) 40%, var(--border));
  background: var(--warning-soft);
}
.assist-idx {
  flex: none; width: 16px; height: 16px; border-radius: 4px; background: var(--track);
  display: grid; place-items: center; font-size: 9px; font-weight: 700; color: var(--muted);
}
.assist-summary {
  margin: 0; padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--panel-alt); border: 1px solid var(--border);
  font-family: var(--mono); font-size: 10.5px; line-height: 1.7;
  white-space: pre-wrap; color: var(--muted);
}
.chip.done { background: var(--positive-soft); color: var(--positive); }
.chip.over { background: var(--negative-soft); color: var(--negative); }

/* ------------------------------------------------------- event details */
/* Any place a block is named can be clicked to read its details. */
.linklike {
  border: 0; background: transparent; padding: 0; color: inherit;
  font: inherit; font-weight: inherit; text-align: left;
  border-bottom: 1px dashed color-mix(in srgb, currentColor 45%, transparent);
}
.linklike:hover { color: var(--accent); border-bottom-color: var(--accent); }
.event-info { display: flex; flex-direction: column; gap: 14px; }
.event-info-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.event-info-desc {
  padding: 11px 13px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--panel-alt); font-size: 12.5px; line-height: 1.6; min-height: 58px;
}

/* ------------------------------------------------------- plan tomorrow */
.tomorrow-card .card-head .right { flex-wrap: wrap; justify-content: flex-end; }
.tomorrow-card .tm-date {
  text-transform: none; letter-spacing: 0; font-weight: 500;
  padding-left: 2px; color: var(--faint);
}
.tomorrow-grid { grid-template-columns: minmax(0, 1.5fr) minmax(260px, 1fr); }
.tm-list { display: flex; flex-direction: column; gap: 4px; margin-top: 7px; }
.tm-item {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px;
  text-align: left; border: 1px solid transparent; border-left: 3px solid var(--accent);
  border-radius: 6px; background: var(--accent-soft); font-size: 11.5px;
  color: var(--text);
}
.tm-item:hover { border-color: var(--border-strong); }
.tm-item.meeting { border-left-color: var(--warning); background: var(--warning-soft); }
.tm-item.personal { border-left-color: #06b6d4; background: color-mix(in srgb, #06b6d4 14%, transparent); }
.tm-item.break { border-left-color: var(--faint); background: var(--panel-alt); }
.tm-item.task { border-left-color: var(--positive); background: var(--positive-soft); }
.tm-when { flex: none; width: 34px; font-family: var(--mono); font-size: 9.5px; color: var(--muted); }
.tm-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 650; }
.tm-kind { flex: none; font-size: 9px; color: var(--faint); text-transform: capitalize; }
.tm-empty {
  display: flex; align-items: center; gap: 8px; margin-top: 1px; padding: 13px 10px;
  border: 1px dashed var(--border); border-radius: 7px; color: var(--faint); font-size: 11.5px;
}
.tm-side { border-left: 1px solid var(--border); padding-left: 16px; min-width: 0; }
.tm-add { display: flex; gap: 6px; margin-top: 7px; }
.tm-add .input { height: 30px; min-width: 0; }
.tm-mits { display: flex; flex-direction: column; gap: 4px; margin-top: 7px; }
.tm-mit {
  display: flex; align-items: center; gap: 7px; padding: 5px 7px;
  border-radius: 6px; background: var(--panel-alt); font-size: 11.5px;
}
.tm-mit-idx {
  flex: none; width: 16px; height: 16px; display: grid; place-items: center;
  border-radius: 4px; background: var(--accent-soft); color: var(--accent);
  font-size: 9px; font-weight: 800;
}
.tm-mit-pick {
  display: flex; align-items: center; gap: 6px; padding: 5px 7px; text-align: left;
  border: 1px dashed var(--border); border-radius: 6px; background: transparent;
  color: var(--muted); font-size: 11px;
}
.tm-mit-pick:hover { border-color: var(--accent); color: var(--accent); }
@media (max-width: 960px) {
  .tomorrow-grid { grid-template-columns: minmax(0, 1fr); }
  .tm-side { border-left: 0; padding-left: 0; }
}

/* ============================================================ priority UI */
.rank-chip { gap: 3px; font-variant-numeric: tabular-nums; cursor: pointer; }
.rank-chip:hover { border-color: var(--accent); color: var(--accent-dark); }
body.dark .rank-chip:hover { color: var(--text); }
.chip.blocked { color: var(--warning); border-color: color-mix(in srgb, var(--warning) 40%, transparent); background: var(--warning-soft); }
.chip.stuck { color: var(--negative); border-color: color-mix(in srgb, var(--negative) 35%, transparent); background: var(--negative-soft); cursor: pointer; }
.chip.conflict { color: var(--negative); border-color: transparent; background: transparent; }

.task-row.selected { background: var(--selected); box-shadow: inset 3px 0 0 var(--accent); }
.task-row.selected:hover { background: var(--selected); }

.hero-actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }

/* --------------------------------------------------------- context menu */
.ctx-menu {
  position: fixed; z-index: 620; min-width: 216px; max-width: 330px;
  background: var(--panel); border: 1px solid var(--border-strong);
  border-radius: 9px; box-shadow: var(--shadow); padding: 5px;
  animation: ctxIn 110ms ease-out;
}
@keyframes ctxIn { from { opacity: 0; transform: translateY(-3px) scale(0.99); } to { opacity: 1; transform: none; } }
.ctx-sub { z-index: 630; }
.ctx-item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  background: transparent; border: 0; border-radius: 6px; padding: 6px 7px;
  color: var(--text); text-align: left; font-size: 11.5px; line-height: 1.25;
}
.ctx-item:hover, .ctx-item.focus { background: var(--panel-hover); outline: none; }
.ctx-item[aria-disabled="true"] { opacity: 0.42; cursor: not-allowed; }
.ctx-item.danger { color: var(--negative); }
.ctx-item.on { background: var(--accent-soft); }
.ctx-ico { width: 15px; display: inline-flex; justify-content: center; color: var(--muted); }
.ctx-item.danger .ctx-ico { color: var(--negative); }
.ctx-label { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctx-key { font-family: var(--mono); font-size: 9.5px; color: var(--faint); border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; }
.ctx-more { color: var(--faint); font-size: 14px; }
.ctx-sep { height: 1px; background: var(--border); margin: 5px 4px; }
.ctx-custom { padding: 3px 4px 5px; }
.ctx-head { font-weight: 700; font-size: 11.5px; padding: 5px 4px 7px; border-bottom: 1px solid var(--border); margin-bottom: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctx-sub, .ctx-subhead { display: block; font-weight: 500; color: var(--faint); font-size: 10px; margin-top: 2px; }
.ctx-subhead { text-transform: uppercase; letter-spacing: 0.6px; padding: 3px 4px 2px; }
.ctx-empty { color: var(--faint); font-size: 10.5px; padding: 4px; }
.ctx-levels { display: flex; gap: 3px; padding: 2px 2px 4px; }
.lvl { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--border); background: var(--panel); border-radius: 999px; padding: 4px 7px; font-size: 10px; color: var(--muted); }
.lvl i { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }
.lvl-high i { background: var(--negative); }
.lvl-med i { background: var(--warning); }
.lvl-low i { background: var(--muted); }
.lvl-none i { background: transparent; border: 1px solid var(--faint); }
.lvl:hover { border-color: var(--accent); color: var(--text); }
.lvl.on { border-color: var(--accent); background: var(--accent-soft); color: var(--text); font-weight: 700; }

.toast-undo { margin-left: 8px; background: transparent; border: 1px solid currentColor; color: inherit; border-radius: 5px; padding: 2px 6px; font-size: 10px; font-weight: 700; }

/* ------------------------------------------------------------- bulk bar */
.bulk-bar {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px; z-index: 410;
  background: var(--panel); border: 1px solid var(--border-strong);
  box-shadow: var(--shadow); border-radius: 999px; padding: 6px 9px 6px 14px;
  animation: bulkIn 140ms ease-out;
}
@keyframes bulkIn { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
.bulk-count { font-weight: 700; font-size: 11px; color: var(--accent-dark); white-space: nowrap; }
body.dark .bulk-count { color: var(--text); }
.bulk-actions { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.bulk-del { color: var(--negative); }

/* ---------------------------------------------------------- line tool */
.link-overlay { position: fixed; inset: 0; z-index: 460; pointer-events: none; overflow: hidden; }
.link-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.link-path { fill: none; stroke-width: 2; stroke-linecap: round; }
.link-path.rank { stroke: var(--accent); }
.link-path.dep { stroke: var(--warning); stroke-dasharray: 7 5; }
.link-path.equal { stroke: var(--accent); stroke-dasharray: 4 6; }
.link-path.remove { stroke: var(--negative); stroke-dasharray: 4 5; }
.link-path.bad { stroke: var(--negative); }
.link-path.live { opacity: 0.85; stroke-dasharray: 5 6; animation: linkFlow 0.9s linear infinite; }
.link-path.hover { opacity: 0.42; stroke-width: 1.6; }
@keyframes linkFlow { to { stroke-dashoffset: -22; } }
.link-overlay.link-error .link-path.live { stroke: var(--negative); }
.link-overlay.link-pulse .link-path.solid { filter: drop-shadow(0 0 6px var(--accent)); }
.link-overlay.hover-mode { z-index: 120; }

.link-hud {
  position: fixed; top: 12px; left: 50%; transform: translateX(-50%);
  pointer-events: auto; z-index: 470; min-width: 420px; max-width: min(760px, 92vw);
  background: var(--panel); border: 1px solid var(--border-strong);
  box-shadow: var(--shadow); border-radius: 11px; padding: 8px 10px;
}
.lh-top { display: flex; align-items: center; gap: 7px; font-size: 11.5px; }
.lh-mode { display: inline-flex; align-items: center; gap: 4px; color: var(--accent-dark); background: var(--accent-soft); border-radius: 5px; padding: 2px 6px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; }
body.dark .lh-mode { color: var(--text); }
.lh-title { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lh-count { color: var(--muted); }
.lh-off { margin-left: auto; color: var(--faint); font-size: 10px; }
.lh-note { display: flex; align-items: center; gap: 5px; margin-top: 5px; color: var(--negative); font-size: 10.5px; }
.lh-actions { display: flex; align-items: center; gap: 5px; margin-top: 7px; flex-wrap: wrap; }
.lh-align { display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; color: var(--muted); margin-left: 3px; }
.btn.on { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }

.link-tags { position: absolute; inset: 0; }
.link-badge {
  position: absolute; width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
.link-source { position: relative; box-shadow: 0 0 0 2px var(--accent), 0 0 0 5px color-mix(in srgb, var(--accent) 18%, transparent); border-radius: var(--radius-sm); }
.link-source::after {
  content: "HIGHER"; position: absolute; top: -9px; right: 8px; z-index: 5;
  background: var(--accent); color: #fff; border-radius: 4px; font-size: 8px; font-weight: 800;
  letter-spacing: 0.8px; padding: 1px 5px; pointer-events: none;
}
.link-focus { outline: 2px dashed var(--accent); outline-offset: 2px; }
body.linking { cursor: crosshair; }
body.linking .link-hud, body.linking .link-hud * { cursor: default; }
@media (prefers-reduced-motion: reduce) {
  .link-path.live { animation: none; }
  .link-overlay.link-pulse .link-path.solid { filter: none; }
  .ctx-menu, .bulk-bar { animation: none; }
}

/* --------------------------------------------------------- priority page */

/* --------------------------------------------------------- priority page */
.prio-toolbar { gap: 6px; }
.prio-tabs button { display: inline-flex; align-items: center; gap: 4px; }
.rank-list { display: flex; flex-direction: column; }
.rank-row { align-items: center; gap: 9px; }
.rank-row .rank-num { width: 34px; text-align: right; color: var(--faint); font-family: var(--mono); font-size: 10.5px; flex: none; }
.rank-row.compact .rank-num { width: 28px; }
.score-btn { background: transparent; border: 0; padding: 0; flex: none; line-height: 0; border-radius: 50%; }
.score-btn:hover { filter: brightness(1.08); }
.score-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.rank-row .task-meta { row-gap: 3px; }
.why { width: 330px; max-width: 80vw; }
.why-head { display: flex; flex-direction: column; gap: 2px; padding: 3px 4px 8px; border-bottom: 1px solid var(--border); margin-bottom: 7px; }
.why-total { color: var(--faint); font-size: 10px; }
.why-row { display: grid; grid-template-columns: 92px 1fr 30px; gap: 6px; align-items: center; padding: 3px 4px; font-size: 10.5px; }
.why-name { color: var(--muted); }
.why-bar { height: 6px; background: var(--track); border-radius: 999px; overflow: hidden; }
.why-bar i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.why-pts { text-align: right; font-family: var(--mono); font-size: 10px; color: var(--muted); }
.why-note { grid-column: 1 / -1; color: var(--faint); font-size: 9.5px; margin-top: -1px; }
.why-conflict { margin-top: 6px; border-top: 1px solid var(--border); padding-top: 6px; color: var(--negative); font-size: 10px; display: flex; flex-direction: column; gap: 3px; }
.why-foot { margin-top: 7px; color: var(--faint); font-size: 9.5px; }

.tier-groups { display: flex; flex-direction: column; gap: 12px; }
.tier-card .card-title { text-transform: none; }

.matrix { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 12px; min-height: 520px; }
.matrix-cell { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; display: flex; flex-direction: column; min-height: 240px; }
.matrix-cell.q1 { border-top: 3px solid var(--negative); }
.matrix-cell.q2 { border-top: 3px solid var(--accent); }
.matrix-cell.q3 { border-top: 3px solid var(--warning); }
.matrix-cell.q4 { border-top: 3px solid var(--border-strong); }
.matrix-cell header { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
.matrix-cell header b { font-size: 11.5px; }
.matrix-cell header span { color: var(--faint); font-size: 10px; }
.matrix-cell.drag-over { background: var(--accent-soft); border-color: var(--accent); }
.quadrant-body { display: flex; flex-direction: column; gap: 4px; flex: 1 1 auto; overflow: auto; }
.matrix-card { background: var(--panel-alt); border: 1px solid var(--border); border-radius: 6px; padding: 5px 7px; font-size: 10.5px; cursor: grab; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.matrix-card.dragging { opacity: 0.45; }

.graph-wrap { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px; }
.graph-tools { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 2px 4px 8px; }
.rank-graph { width: 100%; height: 58vh; min-height: 340px; background: var(--panel-alt); border-radius: 8px; cursor: grab; touch-action: none; }
.graph-node rect { fill: var(--panel); stroke: var(--border-strong); stroke-width: 1.2; }
.graph-node text { fill: var(--text); font-size: 10.5px; font-family: var(--font); pointer-events: none; }
.graph-node { cursor: pointer; }
.graph-node.chain rect { stroke: var(--accent); stroke-width: 2; }
.graph-node.blocked rect { stroke-dasharray: 4 3; stroke: var(--warning); }
.graph-node:hover rect { fill: var(--panel-hover); }
.graph-handle { fill: var(--accent); opacity: 0; cursor: crosshair; }
.graph-node:hover .graph-handle { opacity: 1; }
.graph-edge path { fill: none; stroke: var(--accent); stroke-width: 1.8; }
.graph-edge path.hit { stroke: transparent; stroke-width: 14; pointer-events: stroke; cursor: pointer; }
.graph-edge:hover path { stroke: var(--negative); }
.graph-edge.equal path { stroke-dasharray: 4 5; }

/* -------------------------------------------------------- planner UI */
.plan-scopes { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.plan-stats { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.plan-days { display: flex; flex-direction: column; gap: 9px; max-height: 46vh; overflow: auto; padding-right: 4px; }
.plan-day { border: 1px solid var(--border); border-radius: 8px; padding: 7px 9px; }
.pd-head { display: flex; justify-content: space-between; font-size: 10.5px; margin-bottom: 4px; }
.pd-head span { color: var(--faint); }
.pd-items { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
.plan-item { display: grid; grid-template-columns: 16px 46px 1fr auto; gap: 6px; align-items: center; font-size: 10.5px; padding: 2px 3px; border-radius: 4px; }
.plan-item.moved { background: var(--accent-soft); }
.pi-time { font-family: var(--mono); color: var(--accent-dark); }
body.dark .pi-time { color: var(--text); }
.pi-why { color: var(--faint); font-size: 9.5px; max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plan-unplaced { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 9px; display: flex; flex-direction: column; gap: 7px; }
.unplaced-row { border: 1px solid color-mix(in srgb, var(--negative) 30%, var(--border)); border-radius: 7px; padding: 7px 9px; }
.up-top { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; }
.up-why { color: var(--faint); font-size: 10px; margin: 3px 0 5px; }
.up-options { display: flex; gap: 4px; flex-wrap: wrap; }
.plan-warn { margin-top: 9px; display: flex; flex-direction: column; gap: 3px; color: var(--warning); font-size: 10.5px; }
.plan-warn div { display: flex; gap: 5px; align-items: center; }
.plan-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 10px; }
.pk { background: var(--panel-alt); border-radius: 7px; padding: 7px 9px; display: flex; flex-direction: column; }
.pk b { font-size: 15px; }
.pk span { color: var(--faint); font-size: 9.5px; }
.pk.bad b { color: var(--negative); }
.plan-tab { display: flex; flex-direction: column; gap: 12px; }
.burnup { width: 100%; height: 180px; }
.wi-result { margin-top: 9px; }
.wi-box { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; display: flex; flex-direction: column; gap: 5px; align-items: flex-start; }
.wi-box.good { border-color: color-mix(in srgb, var(--positive) 35%, var(--border)); background: var(--positive-soft); }
.wi-box.bad { border-color: color-mix(in srgb, var(--warning) 40%, var(--border)); background: var(--warning-soft); }
.calib-notes { display: flex; flex-direction: column; gap: 5px; }
.calib-note { display: flex; gap: 6px; align-items: flex-start; font-size: 10.5px; }
.calib-hint { display: flex; align-items: center; gap: 5px; margin: -2px 0 8px; color: var(--warning); }
.calib-hint .ico { flex: none; }
.insert-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.insert-good { color: var(--positive); display: flex; gap: 6px; align-items: center; }
.insert-bad { color: var(--warning); display: flex; gap: 6px; align-items: center; }
.insert-bumps { display: flex; flex-direction: column; gap: 4px; margin-top: 5px; }
.insert-bump { display: flex; justify-content: space-between; gap: 8px; border: 1px solid var(--border); border-radius: 6px; padding: 5px 7px; font-size: 10.5px; }

/* --------------------------------------------------------- smart extras */
.what-now .card-body { padding-top: 8px; }
.wn-list { display: flex; flex-direction: column; gap: 5px; }
.wn-row { display: flex; align-items: center; gap: 7px; border: 1px solid var(--border); border-radius: 7px; padding: 6px 8px; }
.wn-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.wn-main b { font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wn-main span { color: var(--faint); font-size: 9.8px; }
.wn-doing { display: flex; align-items: center; gap: 6px; background: var(--accent-soft); border-radius: 7px; padding: 6px 8px; margin-bottom: 7px; font-size: 10.5px; }

.gap-block { position: absolute; left: 3px; right: 3px; z-index: 0; border: 1px dashed color-mix(in srgb, var(--accent) 30%, transparent); background: color-mix(in srgb, var(--accent) 6%, transparent); border-radius: 5px; color: transparent; font-size: 9px; padding: 1px 4px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.gap-block:hover { color: var(--accent-dark); background: var(--accent-soft); border-color: var(--accent); z-index: 3; }
body.dark .gap-block:hover { color: var(--text); }

.heat-strip { display: grid; grid-template-columns: repeat(24, 1fr); gap: 2px; align-items: end; height: 70px; margin-bottom: 14px; }
.heat-cell { position: relative; height: 100%; border-radius: 2px; background: color-mix(in srgb, var(--accent) calc(var(--v) * 78%), var(--track)); display: flex; align-items: flex-end; justify-content: center; }
.heat-cell.now { outline: 1px solid var(--accent); outline-offset: 1px; }
.heat-cell span { font-size: 7.5px; color: var(--faint); margin-bottom: -13px; }

.workload .ico { color: var(--warning); }
.shutdown-list { display: flex; flex-direction: column; gap: 3px; max-height: 180px; overflow: auto; margin-top: 4px; }
.shutdown-row { display: flex; gap: 6px; align-items: center; font-size: 10.5px; border-bottom: 1px dashed var(--border); padding: 3px 0; }

.weight-grid { display: flex; flex-direction: column; }
.weight-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 5px 0; border-bottom: 1px solid var(--border); }
.weight-row:last-child { border-bottom: 0; }
.preview-rank { margin-top: 10px; border-top: 1px solid var(--border); padding-top: 9px; }
.preview-rank-row { display: flex; align-items: center; gap: 7px; font-size: 10.5px; padding: 3px 0; }
.pr-rank { font-family: var(--mono); color: var(--faint); width: 28px; text-align: right; }
.workdays { display: flex; gap: 4px; }
.wd { display: inline-flex; align-items: center; gap: 3px; border: 1px solid var(--border); border-radius: 5px; padding: 3px 5px; font-size: 9.5px; color: var(--faint); cursor: pointer; }
.wd input { margin: 0; }
.wd.on { border-color: var(--accent); color: var(--text); background: var(--accent-soft); }

.score-ring { display: block; }
.score-ring text { fill: var(--text); font-size: 10px; font-weight: 700; }

/* Priority duel shown after a new task is created. */
.rank-duel { display: flex; flex-direction: column; gap: 10px; }
.rank-duel-progress { display: flex; align-items: center; gap: 10px; }
.rank-duel-progress .progress { flex: 1 1 auto; }
.rank-duel-count { font-family: var(--mono); font-size: 10px; color: var(--faint); white-space: nowrap; }
.rank-duel-card { border: 1px solid var(--border); background: var(--panel-alt); border-radius: 10px; padding: 12px; }
.rank-duel-card.new { border-color: color-mix(in srgb, var(--accent) 42%, var(--border)); background: color-mix(in srgb, var(--accent) 7%, var(--panel-alt)); }
.rank-duel-label { font-size: 9px; letter-spacing: 0.7px; text-transform: uppercase; color: var(--faint); font-weight: 700; }
.rank-duel-title { font-size: 15px; font-weight: 700; line-height: 1.35; margin-top: 2px; }
.rank-duel-meta { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.rank-duel-vs { text-align: center; font-size: 10px; color: var(--faint); text-transform: uppercase; letter-spacing: 0.6px; }
.rank-duel-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rank-duel-actions .btn { justify-content: center; padding: 13px 8px; font-size: 12.5px; }
@media (max-width: 520px) { .rank-duel-actions { grid-template-columns: 1fr; } }

/* QR pairing card in Settings → Phone sync. */
.sync-qr-card { display: flex; align-items: center; gap: 14px; padding: 10px 0 14px; margin-bottom: 10px; border-bottom: 1px solid var(--border); }
.sync-qr-card[hidden] { display: none; }
.sync-qr-card img { width: 152px; height: 152px; flex: none; border-radius: 10px; background: #fff; padding: 7px; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22); }
.sync-qr-text { display: flex; flex-direction: column; gap: 5px; min-width: 0; font-size: 11px; color: var(--muted); line-height: 1.45; }
.sync-qr-text b { color: var(--text); font-size: 12.5px; }
.sync-qr-text span:last-child { color: var(--faint); font-size: 10px; }
@media (max-width: 560px) { .sync-qr-card { align-items: flex-start; } .sync-qr-card img { width: 118px; height: 118px; } }

/* ------------------------------------------------------------ login gate */
/* Login is the only way in; the app shell is hidden until the session is
   verified with the account server. */
body.login-locked .app { display: none; }
.login-gate {
  position: fixed; inset: 0; z-index: 500;
  display: flex; align-items: center; justify-content: center;
  padding: 24px; overflow-y: auto;
  background:
    radial-gradient(1100px 420px at 50% -10%, color-mix(in srgb, var(--accent) 20%, transparent), transparent 65%),
    var(--bg);
}
.login-card {
  width: min(400px, 100%); margin: auto; padding: 26px 26px 20px;
  border: 1px solid var(--border); border-radius: 14px;
  background: var(--panel); box-shadow: var(--shadow);
}
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.login-mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(150deg, var(--accent), var(--accent-dark)); color: #fff;
  box-shadow: 0 6px 16px rgba(109, 40, 217, 0.32);
}
.login-mark svg { width: 20px; height: 20px; display: block; }
.login-brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.login-brand-text b { font-size: 14px; letter-spacing: 1.8px; }
.login-brand-text small { color: var(--faint); font-size: 9.5px; letter-spacing: 0.5px; text-transform: uppercase; }
.login-card h2 { font-size: 19px; letter-spacing: -0.2px; }
.login-sub { margin: 7px 0 18px; color: var(--muted); font-size: 11.5px; line-height: 1.55; }
.login-field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 11px; }
.login-field > span { font-size: 9.5px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase; color: var(--faint); }
.login-field .input { height: 35px; font-size: 12.5px; }
.login-error {
  margin: 2px 0 10px; padding: 8px 10px;
  border: 1px solid color-mix(in srgb, var(--negative) 40%, var(--border));
  border-radius: 7px; background: var(--negative-soft); color: var(--negative);
  font-size: 10.5px; line-height: 1.45;
}
.login-error.info { border-color: var(--border); background: var(--panel-alt); color: var(--muted); }
.login-submit, .login-create { width: 100%; height: 36px; font-size: 12px; }
.login-submit { margin-top: 4px; }
.login-create { margin-top: 8px; }
.login-note { margin: 14px 0 0; color: var(--faint); font-size: 9.5px; line-height: 1.55; text-align: center; }
body.dark .login-error { color: #fca5a5; }
