/* Tasks — design tokens from the Figma "Redesign v1" page. Change colours here only. */
@font-face {
  font-family: 'Geist'; src: url('/fonts/Geist-Variable.woff2') format('woff2');
  font-weight: 100 900; font-display: swap;
}
@font-face {
  font-family: 'Geist Mono'; src: url('/fonts/GeistMono-Variable.woff2') format('woff2');
  font-weight: 100 900; font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #0E0F12;
  --surface: #15171C;
  --surface-2: #1B1E25;
  --surface-3: #232733;
  --border: #2A2F3A;
  --text: #ECEEF2;
  --text-muted: #9198A6;
  --text-subtle: #5E6573;
  --accent: #8B8FFF;
  --accent-soft: #25274A;
  --on-accent: #0E0F12;
  --success: #4ADE80;
  --warning: #F5B547;
  --danger: #F2706C;

  --muted: var(--text-muted);          /* older views use this name */
  --radius: 12px;
  --radius-sm: 8px;
  --font: 'Geist', system-ui, sans-serif;
  --mono: 'Geist Mono', ui-monospace, monospace;
  --sidebar: 240px;
  --tabbar-h: 64px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.hidden { display: none !important; }
.i { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: currentColor;
     stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.i.sm { width: 14px; height: 14px; }
.i.xs { width: 13px; height: 13px; }

/* ---------- type ---------- */
.display { font-size: 28px; line-height: 1.2; font-weight: 600; letter-spacing: -.02em; margin: 0; }
.overline { font-size: 11px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase;
            color: var(--text-subtle); margin: 0; }
.caption { font-size: 12px; color: var(--text-muted); }
.subtle { color: var(--text-subtle); }
.muted { color: var(--text-muted); }

/* ---------- app shell ---------- */
.app { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100dvh; }

.sidebar {
  position: sticky; top: 0; height: 100dvh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 2px; padding: 20px 12px;
  background: var(--surface); border-right: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 20px;
         font-size: 17px; font-weight: 600; }
.logo { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: var(--on-accent);
        display: grid; place-items: center; }
.logo .i { width: 16px; height: 16px; stroke-width: 2.5; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px;
  color: var(--text-muted); font-weight: 500;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--surface-3); color: var(--text); }
.nav-item.active .i { color: var(--accent); }

.side-goals { padding: 24px 10px 0; display: flex; flex-direction: column; gap: 10px; }
.side-goal-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.side-goal-list li { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13px;
                     color: var(--text-muted); background: none; border: 0; padding: 0; margin: 0; }
.side-goal-list li:hover { color: var(--text); }
.side-goal-list .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-goal-list .count { font-size: 12px; color: var(--text-subtle); }
.side-goal-list .empty { padding: 0; text-align: left; font-size: 12px; color: var(--text-subtle); cursor: default; }
.gdot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.gdot.warning { background: var(--warning); }
.gdot.danger { background: var(--danger); }

.user-card {
  margin-top: auto; display: flex; align-items: center; gap: 10px;
  padding: 10px; border-radius: 10px; background: var(--surface-2);
}
.user-card .who { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.user-card small { font-size: 12px; color: var(--text-subtle); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  background: var(--accent-soft); color: var(--accent); font-weight: 600;
  display: grid; place-items: center;
}
.topbar-avatar { width: 36px; height: 36px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 10px; padding: 14px clamp(16px, 2.5vw, 48px);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-left { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
.page-title { font-size: 17px; font-weight: 600; margin: 0; }
/* Content fills the window; only very wide screens get a cap so lines stay readable. */
#view { padding: 28px clamp(16px, 2.5vw, 48px) 56px; width: 100%; max-width: 1760px; margin-inline: auto; }
#view.narrow { max-width: 1000px; }

.date-nav { display: flex; align-items: center; gap: 10px; min-width: 0; }
.date-label { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.date-label strong { font-weight: 600; white-space: nowrap; }
.date-label small { font-size: 12px; color: var(--text-muted); white-space: nowrap; }

.planner-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px;
  border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border);
  font-size: 13px; color: var(--text-muted); white-space: nowrap;
}
.planner-pill .i { width: 14px; height: 14px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-subtle); flex-shrink: 0; }
.planner-pill.online .dot { background: var(--success); }
.planner-pill.offline .dot { background: var(--danger); }

/* ---------- buttons & controls ---------- */
.icon-btn {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
  display: inline-grid; place-items: center; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-muted);
}
.icon-btn:hover { color: var(--text); border-color: var(--text-subtle); }
.icon-btn.plain { background: none; border-color: transparent; }
.icon-btn.sm { width: 30px; height: 30px; border-radius: 8px; }

.btn, button.add, .ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 8px 14px; border-radius: 10px; cursor: pointer; white-space: nowrap;
  font-weight: 500; font-size: 14px; line-height: 20px;
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
}
.btn:hover, .ghost:hover { border-color: var(--text-subtle); }
.btn.primary, button.add { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn.primary:hover, button.add:hover { filter: brightness(1.08); }
.btn .i { width: 16px; height: 16px; }
.btn:disabled, .ghost:disabled, button.add:disabled { opacity: .5; cursor: default; filter: none; }
.ghost { padding: 6px 10px; font-size: 13px; color: var(--text-muted); }
.ghost:hover { color: var(--text); }
.ghost.danger:hover { border-color: var(--danger); color: var(--danger); }
.btn.block { width: 100%; padding: 12px 14px; }

input[type=text], input[type=url], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=datetime-local], select, textarea {
  padding: 9px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
input::placeholder, textarea::placeholder { color: var(--text-subtle); }
select { cursor: pointer; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; flex-shrink: 0; }
::-webkit-calendar-picker-indicator { filter: invert(.7); }

.chip-select {
  position: relative; display: inline-flex; align-items: center; gap: 6px;
  padding: 0 10px; height: 34px; border-radius: 8px; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-muted);
  font-size: 13px; max-width: 190px;
}
.chip-select:hover { color: var(--text); }
.chip-select:focus-within { border-color: var(--accent); }
.chip-select .i { width: 14px; height: 14px; }
.chip-select select {
  appearance: none; -webkit-appearance: none; border: 0; background: none; padding: 0;
  color: inherit; font: inherit; font-size: 13px; min-width: 0; max-width: 150px;
  text-overflow: ellipsis;
}
.chip-select select option { background: var(--surface); color: var(--text); }

/* ---------- cards ---------- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
         padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.panel-head h3 { font-size: 14px; font-weight: 500; margin: 0; }
.panel-head .i { color: var(--accent); }
.panel p { margin: 0; }
.link { color: var(--accent); font-size: 12px; cursor: pointer; background: none; border: 0; padding: 0; }
.link:hover { text-decoration: underline; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
/* Stats follow the width of the column they sit in, not the window. */
@container (max-width: 640px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
             padding: 16px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.stat-card .value { font: 500 26px/1.1 var(--mono); letter-spacing: -.02em; white-space: nowrap; }
.stat-card .sub { font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-card.warn .value { color: var(--warning); }
.stat-card.bad .value { color: var(--danger); }
.cap-bar { height: 4px; border-radius: 2px; background: var(--surface-3); overflow: hidden; margin-top: 2px; }
.cap-fill { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 2px; transition: width .3s; }
.cap-fill.busy { background: var(--warning); }
.cap-fill.full { background: var(--danger); }

/* ---------- today ---------- */
.today { display: grid; grid-template-columns: minmax(0, 1fr) clamp(280px, 24%, 400px); gap: clamp(16px, 2vw, 32px); align-items: start; }
.day-col { display: flex; flex-direction: column; gap: 20px; min-width: 0; container-type: inline-size; }
.side-col { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 92px; }
.greet { display: flex; flex-direction: column; gap: 6px; }
.greet p { margin: 0; color: var(--text-muted); }

.quick-add {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0;
  padding: 8px 8px 8px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border);
}
.quick-add:focus-within { border-color: color-mix(in srgb, var(--accent) 60%, var(--border)); }
.qa-main { flex: 1 1 240px; display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--text-subtle); }
.qa-main input { flex: 1; border: 0; background: none; padding: 8px 0; font-size: 14px; }
.qa-opts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.gen-results:empty { display: none; }
.day-body { display: flex; flex-direction: column; gap: 20px; }
.panel .planner-pill { align-self: flex-start; }
.gen-results { margin-top: -8px; }

.section { display: flex; flex-direction: column; gap: 8px; }
.section-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.section-top .caption { color: var(--text-subtle); }

ul.list, ul { list-style: none; margin: 0; padding: 0; }
ul.list { display: flex; flex-direction: column; gap: 8px; }

/* generic rows (All tasks, Goals, Settings still use these) */
li {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
}
:where(ul:not(.list)) > li { margin-bottom: 8px; }
li .body { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.title { flex: 1; word-break: break-word; font-weight: 500; }
.due { font-size: 12px; color: var(--text-muted); }
li.done .title { text-decoration: line-through; color: var(--text-subtle); }
li.overdue { border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); }
li.overdue .due { color: var(--danger); }
li.done .due { color: var(--text-subtle); }
li.p1 { box-shadow: inset 3px 0 0 var(--danger); }
li.p2 { box-shadow: inset 3px 0 0 var(--warning); }
li.done { box-shadow: none; }
li.clash { border-color: color-mix(in srgb, var(--warning) 45%, var(--border)); }

/* today's task row */
.task-row { padding: 12px 10px 12px 14px; gap: 14px; }
.check {
  width: 20px; height: 20px; border-radius: 6px; flex-shrink: 0; cursor: pointer; padding: 0;
  display: grid; place-items: center; background: none; border: 1.5px solid var(--text-subtle); color: transparent;
}
.check:hover { border-color: var(--accent); }
.check .i { width: 13px; height: 13px; stroke-width: 3; }
.task-row.done .check { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 12px; color: var(--text-muted); }
.meta .bit { display: inline-flex; align-items: center; gap: 4px; }
.meta .i { width: 13px; height: 13px; color: var(--text-subtle); }
.meta .warn { color: var(--danger); }
.goal-chip { padding: 1px 8px; border-radius: 6px; background: var(--accent-soft); color: var(--accent);
             max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-row.done .goal-chip { opacity: .6; }
.note-text { font-size: 12px; color: var(--text-muted); font-style: italic; white-space: pre-wrap; word-break: break-word; }
.title.editable { cursor: text; }
.title.editable:hover { text-decoration: underline dotted var(--text-subtle); }
.title-edit { width: 100%; padding: 4px 8px; border-color: var(--accent); background: var(--bg); }

.event-row { gap: 14px; }
.event-bar { width: 3px; align-self: stretch; min-height: 32px; border-radius: 2px; background: var(--accent); flex-shrink: 0; }
.event-time { display: flex; flex-direction: column; font: 500 12px/1.4 var(--mono); flex-shrink: 0; }
.event-time span + span { color: var(--text-subtle); }

/* menus */
.menu {
  position: fixed; z-index: 60; min-width: 190px; padding: 6px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .45); display: flex; flex-direction: column;
}
.menu button {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px;
  background: none; border: 0; text-align: left; cursor: pointer; color: var(--text);
}
.menu button:hover, .menu button:focus-visible { background: var(--surface-3); outline: none; }
.menu button .i { width: 16px; height: 16px; color: var(--text-muted); }
.menu button.danger, .menu button.danger .i { color: var(--danger); }

/* deadlines card */
.deadline { display: flex; flex-direction: column; gap: 8px; cursor: pointer; }
.deadline-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; }
.deadline-top span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.days {
  flex-shrink: 0; padding: 2px 8px; border-radius: 6px; font-size: 12px;
  color: var(--text-muted); background: color-mix(in srgb, var(--text-muted) 15%, transparent);
}
.days.warning { color: var(--warning); background: color-mix(in srgb, var(--warning) 15%, transparent); }
.days.danger { color: var(--danger); background: color-mix(in srgb, var(--danger) 15%, transparent); }
.track { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.track span { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.track span.complete { background: var(--success); }
.fit-warn { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--danger); }
.fit-warn .i { width: 13px; height: 13px; }

/* left over */
.leftover-list li { padding: 6px 0; background: none; border: 0; border-radius: 0; font-size: 13px;
                    justify-content: space-between; margin: 0; }
.leftover-list .tag { font-size: 11px; color: var(--text-subtle); text-transform: uppercase; letter-spacing: .04em; }
.leftover-list li.stranded { color: var(--text-muted); }
.rollover-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* AI suggestions */
.gen-panel { gap: 10px; }
.gen-list { display: flex; flex-direction: column; gap: 2px; }
.gen-list li { background: none; border: 0; border-radius: 8px; padding: 6px 4px; margin: 0; gap: 10px; font-size: 13px; }
.gen-list li.off { opacity: .4; }
.gen-list .tag { font-size: 12px; color: var(--text-muted); flex-shrink: 0; font-family: var(--mono); }
.hint { font-size: 12px; color: var(--text-muted); line-height: 1.6; margin: 0; }

.empty { color: var(--text-muted); text-align: center; padding: 28px 0; }
.empty-card { padding: 28px; text-align: center; color: var(--text-muted); border: 1px dashed var(--border); border-radius: 12px; }
.error { color: var(--danger); font-size: 13px; }
.error:empty { display: none; }

/* ---------- notifications ---------- */
.bell-wrap { position: relative; }
.bell { position: relative; }
.badge {
  position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--danger); color: var(--text);
  font: 600 11px/18px var(--font); text-align: center;
}
.notif-panel {
  position: absolute; right: 0; top: calc(100% + 10px); width: 380px; max-height: min(560px, 75dvh);
  display: flex; flex-direction: column; overflow: hidden; z-index: 50;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .45);
}
.notif-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px;
              border-bottom: 1px solid var(--border); font-weight: 500; }
.notif-list { overflow-y: auto; }
.notif {
  display: flex; gap: 12px; padding: 14px 18px; cursor: pointer; align-items: flex-start;
  background: none; border: 0; border-radius: 0; margin: 0; border-bottom: 1px solid var(--border);
}
.notif:last-child { border-bottom: 0; }
.notif.unread { background: var(--surface-2); }
.notif:hover { background: var(--surface-3); }
.notif-icon { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
              color: var(--accent); background: color-mix(in srgb, currentColor 15%, transparent); }
.notif-icon .i { width: 16px; height: 16px; }
.notif-icon.danger { color: var(--danger); }
.notif-icon.warning { color: var(--warning); }
.notif-icon.muted { color: var(--text-muted); }
.notif-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.notif-text strong { font-weight: 500; }
.notif-text .body { font-size: 13px; color: var(--text-muted); white-space: pre-line; word-break: break-word; }
.notif-text time { font-size: 12px; color: var(--text-subtle); }
.notif .unread-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-top: 6px; flex-shrink: 0; }
.notif-empty { padding: 32px 18px; text-align: center; color: var(--text-muted); }

/* ---------- mobile tab bar ---------- */
.tabbar { display: none; }
.fab {
  width: 52px; height: 52px; border-radius: 50%; border: 0; cursor: pointer; margin-top: -18px;
  display: grid; place-items: center; background: var(--accent); color: var(--on-accent);
  box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 35%, transparent);
}
.fab .i { width: 24px; height: 24px; }

/* =================================================================
   Older views (Goals, All tasks, Calendar, Settings) — same classes,
   new colours.
   ================================================================= */
.section-head { font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .08em;
                color: var(--text-subtle); margin: 0 0 10px; }
.day-section { margin-bottom: 20px; }
form { margin: 0; }
details > summary { cursor: pointer; color: var(--text-muted); font-weight: 500; padding: 4px 0; }
details > summary:hover { color: var(--text); }
.add-form { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.add-row { display: flex; flex-wrap: wrap; gap: 8px; }
.add-row > input[type=text], .f-title { flex: 1; width: 100%; }

.del, .carry {
  border: 0; background: none; color: var(--text-subtle); cursor: pointer;
  font-size: 1.1rem; line-height: 1; padding: 4px 7px; border-radius: 6px;
}
.del:hover { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }
.carry:hover { color: var(--accent); background: var(--accent-soft); }
.row-actions { display: flex; gap: 2px; flex-shrink: 0; }

.tabs { display: flex; gap: 4px; background: var(--surface); padding: 4px; border-radius: 10px; border: 1px solid var(--border); }
.tab { border: 0; background: none; color: var(--text-muted); font-size: 13px; padding: 6px 12px; border-radius: 8px; cursor: pointer; }
.tab.active { background: var(--surface-3); color: var(--text); }

.filters { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.filter { border: 1px solid var(--border); background: var(--surface); color: var(--text-muted);
          font-size: 13px; padding: 6px 12px; border-radius: 8px; cursor: pointer; }
.filter:hover { color: var(--text); }
.filter.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

/* calendar */
.cal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.cal-month { font-size: 17px; font-weight: 600; flex: 1; }
.cal-nav, .cal-today {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 6px 12px; border-radius: 10px; cursor: pointer;
}
.cal-nav { font-size: 1.1rem; line-height: 1; }
.cal-nav:hover, .cal-today:hover { border-color: var(--text-subtle); }
.cal-weekdays, .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-weekdays { margin-bottom: 4px; }
.cal-weekdays span { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-subtle); text-align: center; padding: 4px 0; }
.cal-cell {
  min-height: 92px; padding: 6px; border-radius: 10px; min-width: 0;
  background: var(--surface); border: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 2px; cursor: pointer; overflow: hidden;
}
.cal-cell:hover { border-color: var(--text-subtle); }
.cal-cell.outside { opacity: .35; }
.cal-cell.today .cal-num { background: var(--accent); color: var(--on-accent); }
.cal-cell.selected { border-color: var(--accent); }
.cal-cell.has-clash { border-color: color-mix(in srgb, var(--warning) 50%, var(--border)); }
.cal-num { font-size: 12px; color: var(--text-muted); align-self: flex-start; min-width: 22px; height: 22px;
           line-height: 22px; text-align: center; border-radius: 50%; margin-bottom: 2px; }
.cal-cell > * { max-width: 100%; }
.chip { display: block; font-size: 11px; padding: 2px 6px; border-radius: 5px; background: var(--accent-soft); color: var(--accent);
        white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip.overdue { background: color-mix(in srgb, var(--danger) 18%, transparent); color: var(--danger); }
.chip.done { background: var(--surface-2); color: var(--text-subtle); text-decoration: line-through; }
.chip.more { background: none; color: var(--text-subtle); padding-left: 2px; }
.chip.event { background: var(--surface-2); color: var(--text-muted); border-left: 3px solid var(--accent); border-radius: 4px; }
.chip.clash { outline: 1px solid var(--warning); }
.chip.urgent { border-left: 2px solid var(--danger); }
.cal-detail { margin-top: 24px; }
.cal-detail h2 { font-size: 11px; font-weight: 500; margin: 0 0 10px; color: var(--text-subtle); text-transform: uppercase; letter-spacing: .08em; }
.cal-detail .empty { text-align: left; padding: 8px 0; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); }
.legend-item i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.legend-error { color: var(--danger); }
.legend-error::after { content: ' \26a0'; }
.clash-banner { background: color-mix(in srgb, var(--warning) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--warning) 40%, var(--border));
                color: var(--warning); padding: 10px 14px; border-radius: 10px; font-size: 13px; margin-bottom: 12px; }
li.is-event .dot { width: 10px; height: 10px; }

/* settings */
.cal-manage { margin-bottom: 32px; }
.cal-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 8px;
            background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.cal-card.off { opacity: .5; }
.cal-card .body { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cal-card .due.is-error, .due.is-error { color: var(--danger); }
.name-edit { background: none; border: 1px solid transparent; color: inherit; font: inherit; font-weight: 500;
             padding: 2px 6px; border-radius: 6px; width: 100%; }
.name-edit:hover { border-color: var(--border); }
.name-edit:focus { outline: none; border-color: var(--accent); background: var(--bg); }
.cal-actions { display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }
.cal-form { display: flex; flex-direction: column; gap: 8px; }
.cal-form input[type=text] { width: 100%; }
.cal-form button.add { align-self: flex-start; }
.swatches { display: flex; gap: 6px; margin: 4px 0; }
.swatch input { position: absolute; opacity: 0; }
.swatch span { display: block; width: 24px; height: 24px; border-radius: 6px; cursor: pointer; border: 2px solid transparent; }
.swatch input:checked + span { border-color: var(--text); }

/* rollover box (All tasks still uses the old one) */
.rollover-box { background: color-mix(in srgb, var(--warning) 7%, var(--surface)); border: 1px solid color-mix(in srgb, var(--warning) 35%, var(--border));
                border-radius: 12px; padding: 14px; margin-bottom: 20px; }
.rollover-head { font-size: 13px; color: var(--warning); margin-bottom: 10px; font-weight: 500; }
.rollover-list { margin: 0 0 12px; }
.rollover-list li { justify-content: space-between; gap: 8px; background: none; border: 0; border-radius: 0; padding: 4px 0; margin: 0; font-size: 13px; }
.rollover-list .tag { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-subtle); }

/* goals */
.archive-toggle { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-muted); margin-bottom: 12px; cursor: pointer; }
.goal-list { margin-top: 8px; }
.goal-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px; margin-bottom: 12px; }
.goal-card.archived { opacity: .5; }
.goal-card.p1 { box-shadow: inset 3px 0 0 var(--danger); }
.goal-card.p2 { box-shadow: inset 3px 0 0 var(--warning); }
.goal-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.goal-head .body { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.goal-title { font-weight: 600; font-size: 15px; }
.goal-progress { display: flex; align-items: center; gap: 10px; }
.goal-track { flex: 1; height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.goal-fill { display: block; height: 100%; width: 0; min-width: 2px; background: var(--accent); transition: width .3s ease; }
.goal-fill.complete, .cap-fill.complete { background: var(--success); }
.goal-pct { font-size: 12px; color: var(--text-muted); flex-shrink: 0; min-width: 64px; text-align: right; }
.goal-tasks { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.goal-tasks .list li, .goal-tasks li { background: var(--surface-2); }
.goal-scroll { max-height: 360px; overflow-y: auto; padding-right: 6px; }
.goal-scroll .list li { margin-bottom: 0; }
.goal-form { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.goal-form textarea { resize: vertical; }
.goal-form .add-row { display: flex; gap: 8px; }
.goal-form .add { align-self: flex-start; }

/* planner (inside goal cards) */
.plan-box { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.plan-form .add-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.fieldlet { display: flex; flex-direction: column; gap: 4px; flex: 1 1 120px; min-width: 0;
            font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-subtle); }
.fieldlet input { width: 100%; padding: 8px 10px; background: var(--bg); font-size: 13px; text-transform: none; letter-spacing: 0; }
.plan-opts { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.plan-opts label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); cursor: pointer; }
.plan-summary { font-size: 14px; font-weight: 500; margin: 16px 0 6px; }
.plan-summary.is-warn { color: var(--warning); }
.plan-scroll { max-height: 340px; overflow-y: auto; border: 1px solid var(--border); border-radius: 10px;
               padding: 6px 10px; margin: 10px 0 12px; background: var(--bg); }
.plan-list li { display: flex; align-items: center; gap: 8px; background: none; border: 0; border-radius: 0; padding: 6px 0; margin: 0; }
.plan-list li.off { opacity: .35; }
.plan-list li.titled { flex-wrap: wrap; }
.plan-num { font-size: 12px; color: var(--text-subtle); min-width: 22px; font-family: var(--mono); }
.plan-date, .plan-mins, .plan-title { padding: 6px 8px; border-radius: 8px; font-size: 13px; }
.plan-date { flex: 1; }
.plan-mins { width: 72px; }
.plan-title { flex: 1 1 100%; order: -1; margin-bottom: 4px; }
.plan-list li.titled .plan-date { flex: 1 1 auto; }
.plan-list .del { flex-shrink: 0; font-size: 1rem; }
.plan-bump { font-size: 11px; color: var(--warning); cursor: help; border: 1px solid color-mix(in srgb, var(--warning) 40%, transparent); border-radius: 5px; padding: 1px 5px; }
.plan-count { font-size: 13px; color: var(--text-muted); align-self: center; }

.feas-box { border-radius: 12px; padding: 14px; margin: 14px 0; font-size: 13px; }
.feas-box.ok { background: color-mix(in srgb, var(--success) 8%, var(--surface)); border: 1px solid color-mix(in srgb, var(--success) 35%, var(--border)); color: var(--success); }
.feas-box.warn { background: color-mix(in srgb, var(--warning) 7%, var(--surface)); border: 1px solid color-mix(in srgb, var(--warning) 35%, var(--border)); }
.feas-box.est { background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border)); }
.feas-head { color: var(--warning); font-weight: 500; margin-bottom: 6px; }
.feas-box.est .feas-head { color: var(--accent); }
.feas-detail { color: var(--text-muted); margin: 0 0 10px; line-height: 1.55; font-size: 13px; }
.feas-box .rollover-actions { margin: 0; }

/* old capacity strip / summary, kept for any view that still renders them */
.capacity { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.capacity .cap-bar { flex: 1; height: 6px; }
.cap-text { font-size: 12px; color: var(--text-muted); }

/* ---------- tablet & phone ---------- */
@media (max-width: 1180px) {
  .today { grid-template-columns: minmax(0, 1fr); }
  .side-col { position: static; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
}

@media (max-width: 1180px) and (min-width: 900px) {
  :root { --sidebar: 208px; }
}

@media (max-width: 899px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .topbar { padding: calc(10px + env(safe-area-inset-top)) 16px 10px; }
  .page-title { font-size: 22px; }
  .topbar .planner-pill { padding: 6px; }
  .topbar .planner-pill .pill-text { display: none; }
  .goal-head { flex-wrap: wrap; }
  .goal-head .body { flex: 1 1 100%; }
  .goal-head .cal-actions { justify-content: flex-start; }
  #view { padding: 16px 16px calc(var(--tabbar-h) + 40px + env(safe-area-inset-bottom)); }
  .display { font-size: 22px; }
  .stats { gap: 8px; }
  .stat-card { padding: 12px; }
  .stat-card .value { font-size: 22px; }
  .qa-opts { width: 100%; }
  .qa-opts .chip-select { flex: 1 1 auto; max-width: none; }
  .qa-opts .btn { flex: 1 1 auto; }
  .goal-chip { max-width: 160px; }
  .notif-panel { position: fixed; left: 8px; right: 8px; top: calc(60px + env(safe-area-inset-top)); width: auto; }

  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    justify-content: space-around; align-items: flex-start;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding: 8px 8px env(safe-area-inset-bottom);
    background: var(--surface); border-top: 1px solid var(--border);
  }
  .tab-item { width: 64px; display: flex; flex-direction: column; align-items: center; gap: 3px;
              font-size: 11px; color: var(--text-subtle); }
  .tab-item .i { width: 22px; height: 22px; }
  .tab-item.active { color: var(--accent); }

  .cal-cell { min-height: 56px; padding: 3px; border-radius: 8px; }
  .cal-cell .chip { font-size: 9px; padding: 1px 3px; }
  .cal-weekdays span { font-size: 10px; letter-spacing: 0; }
}

@media (max-width: 420px) {
  .date-label small { display: none; }
}

.hint.is-warn { color: var(--warning); }

/* ---------- sign-in ---------- */
.sprite { display: none; }
.user-card small { display: inline-flex; align-items: center; gap: 4px; }
.user-card small .i { color: var(--success); }
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card {
  width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 32px 28px;
}
.auth-logo { width: 52px; height: 52px; border-radius: 14px; align-self: center; }
.auth-logo .i { width: 28px; height: 28px; }
.auth-title { font-size: 22px; font-weight: 600; text-align: center; margin: 4px 0 0; }
.auth-sub { text-align: center; color: var(--text-muted); margin: 0; }
.auth-form { display: flex; flex-direction: column; gap: 14px; margin-top: 8px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-muted); }
.field input { padding: 12px 14px; font-size: 15px; }
.auth-foot { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 12px;
             color: var(--text-muted); margin: 6px 0 0; text-align: center; }
.auth-foot .i { width: 14px; height: 14px; color: var(--success); }
.auth-foot.subtle { color: var(--text-subtle); }
.auth-links { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.link.subtle-link { color: var(--text-muted); }
.auth-step { margin: 0; color: var(--text-muted); font-size: 13px; }
.digits { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.digit { height: 56px; text-align: center; font: 600 22px var(--mono); padding: 0 !important; }
.recovery-input { padding: 12px 14px; font: 500 16px var(--mono); text-align: center; letter-spacing: .05em; }
.qr { align-self: center; padding: 10px; background: #fff; border-radius: 12px; line-height: 0; }
.qr img { display: block; }
.manual-key { font-size: 13px; }
.manual-key[open] { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.secret { display: block; width: 100%; font: 500 14px/1.6 var(--mono); background: var(--bg); border: 1px solid var(--border);
          border-radius: 8px; padding: 8px 10px; word-break: break-all; user-select: all; }
.codes { list-style: none; margin: 0; padding: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px;
         background: var(--bg); border: 1px solid var(--border); border-radius: 12px; }
.codes li { background: none; border: 0; padding: 0; margin: 0; font: 500 15px var(--mono); justify-content: center; }
.check-line { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }
@media (max-width: 480px) {
  .auth { place-items: start center; padding-top: calc(48px + env(safe-area-inset-top)); }
  .auth-card { border: 0; background: none; padding: 0 4px; }
}

/* ---------- settings: account ---------- */
.account { margin-bottom: 32px; }
.acct { gap: 0; padding: 4px 18px; }
.acct-row { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
.acct > .acct-row:first-child { border-top: 0; }
.acct-row .body { flex: 1 1 220px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.acct-icon { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
             background: var(--surface-3); color: var(--text-muted); flex-shrink: 0; }
.acct-icon.ok { color: var(--success); background: color-mix(in srgb, var(--success) 15%, transparent); }
.acct-icon .i { width: 16px; height: 16px; }
.row-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.acct > div:not(.acct-row):not(:empty) { padding: 0 0 16px; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding-top: 4px; }
.inline-form input { flex: 1 1 200px; }
.stack-form { display: flex; flex-direction: column; gap: 10px; max-width: 420px; padding-top: 4px; }
.acct-head { margin-top: 24px; }
.acct-head .section-head { margin: 0; }
.device-list, .event-list { margin-top: 10px; }
.account .section-head { margin-top: 24px; }
.account > .section-head:first-child { margin-top: 0; }
.account .acct-head .section-head { margin-top: 0; }
.this-device { font-size: 12px; color: var(--success); flex-shrink: 0; }
.event-list li { padding: 8px 14px; margin-bottom: 4px; flex-direction: column; align-items: flex-start; gap: 0; }
.event-list li .title { font-weight: 400; font-size: 13px; }
.event-list li.bad .title { color: var(--danger); }
.warn-text { color: var(--warning) !important; }
.ok-text { color: var(--success); }
