:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --border: #e3e8f0;
  --text: #1b2230;
  --muted: #6b7686;
  --primary: #22c55e;
  --primary-dark: #16a34a;
  --todo: #8a93a6;
  --doing: #e0a020;
  --done: #2faa6a;
  --high: #e8533b;
  --med: #e0a020;
  --low: #5b9bd5;
  --ai: #8b5cf6;
  --shadow: 0 1px 3px rgba(20,30,60,.08), 0 4px 14px rgba(20,30,60,.06);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased;
}

/* Top bar */
.topbar { display: flex; align-items: center; gap: 22px; padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.brand { display: flex; align-items: center; gap: 9px; }
.brand-mark { display: inline-flex; align-items: center; }
.brand h1 { font-size: 19px; margin: 0; letter-spacing: -.02em; }
.topbar-spacer { flex: 1; }
.tabs { display: flex; gap: 2px; }
.tab { background: none; border: none; padding: 8px 13px; border-radius: 8px; font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer; }
.tab:hover { background: var(--bg); }
.tab.active { color: var(--primary); background: #eef2ff; }
.tab-count { display: inline-block; background: var(--doing); color: #fff; font-size: 11px; font-weight: 700; border-radius: 10px; padding: 0 6px; margin-left: 3px; vertical-align: middle; }
.gap-up { color: var(--done); }
.gap-down { color: var(--high); }
.chat-toggle { font-weight: 600; }
.icon-gear { background: none; border: none; font-size: 19px; cursor: pointer; padding: 6px 8px; border-radius: 8px; line-height: 1; }
.icon-gear:hover { background: var(--bg); }
.icon-gear.active { background: #eef2ff; }
.more-wrap { position: relative; }
.more-menu { position: absolute; top: 100%; left: 0; margin-top: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); padding: 6px; min-width: 180px; z-index: 30; display: flex; flex-direction: column; }
.more-menu button { background: none; border: none; text-align: left; padding: 9px 12px; border-radius: 7px; font-size: 14px; font-weight: 600; color: var(--text); cursor: pointer; }
.more-menu button:hover { background: var(--bg); }

/* Ticker strip (always-on, under the nav) */
.ticker { position: sticky; top: 53px; z-index: 9; background: var(--surface); border-bottom: 1px solid var(--border); }
.ticker-inner { max-width: 1080px; margin: 0 auto; padding: 8px 24px; display: flex; align-items: center; gap: 14px; overflow-x: auto; }
.tick-now { background: #eef2ff; border: 1px solid #d8e0ff; color: var(--text); border-radius: 20px; padding: 5px 13px; font-size: 13px; cursor: pointer; white-space: nowrap; }
.tick-now b { font-weight: 700; }
.tick-mut { color: var(--muted); font-weight: 500; }
.tick-spacer { flex: 1; min-width: 12px; }
.tick-habit { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; white-space: nowrap; cursor: grab; }
.tick-habit.tick-dragging { opacity: 0.4; }
.tick-habit.tick-over { outline: 2px solid var(--primary, #22c55e); border-radius: 8px; }
.tick-ic { font-size: 14px; }
.tick-bar { width: 54px; height: 6px; background: var(--bg); border-radius: 4px; overflow: hidden; }
.tick-bar > i { display: block; height: 100%; background: var(--done); }

/* Account chip + login gate (Phase 2 multi-user) */
.build-tag { position: fixed; bottom: 6px; right: 9px; font-size: 10px; color: var(--muted); opacity: .55; z-index: 9999; pointer-events: none; }
.save-status { font-size: 12px; color: var(--muted); }
.save-status.saved { color: var(--done); }
.save-status.error { color: var(--high); }
.account-chip { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.account-chip #accountEmail { font-weight: 600; color: var(--text); max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.auth-gate { position: fixed; inset: 0; z-index: 100; background: linear-gradient(135deg, #eef2ff, #f4f6fb); display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: 0 20px 60px rgba(20,30,60,.18); padding: 40px 36px; max-width: 400px; width: 100%; text-align: center; }
.auth-logo { display: inline-flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.auth-logo span { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.auth-card h2 { margin: 0 0 6px; font-size: 22px; }
.auth-sub { color: var(--muted); margin: 0 0 26px; }
.auth-google { width: 100%; padding: 13px; border-radius: 12px; font-size: 15px; }
.auth-denied { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; border-radius: 12px; padding: 12px 14px; font-size: 14px; line-height: 1.5; margin: 0 0 18px; }
.auth-note { font-size: 12px; color: var(--muted); margin: 16px 0 0; line-height: 1.5; }

main { max-width: 1080px; margin: 0 auto; padding: 22px; }
.view { display: none; }
.view.active { display: block; }
.hidden { display: none !important; }
.hint { background: #eef2ff; border: 1px solid #d8e0ff; color: #38477a; padding: 12px 14px; border-radius: 10px; font-size: 13px; margin: 0 0 18px; }
.hint code { background: #fff; padding: 1px 5px; border-radius: 4px; }
.re-intro { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; box-shadow: var(--shadow); margin: 0 0 18px; }
.re-intro h3 { margin: 0 0 8px; font-size: 15px; }
.re-intro .re-sub { font-weight: 500; color: var(--muted); }
.re-intro p { margin: 0 0 9px; font-size: 13.5px; line-height: 1.55; color: var(--text); }
.re-intro .re-rule { background: #eef2ff; border: 1px solid #d8e0ff; color: #38477a; padding: 10px 12px; border-radius: 9px; }
.re-intro code { background: #fff; border: 1px solid #d8e0ff; padding: 1px 6px; border-radius: 4px; font-weight: 600; color: var(--primary); }
.re-intro .re-notes { margin: 0 0 9px; padding-left: 18px; font-size: 13px; color: var(--muted); line-height: 1.6; }
.re-intro .re-disc { font-size: 12px; color: var(--muted); margin: 0; }
.re-tags { margin: 0 0 10px; }
.re-tags label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 5px; }
.re-tags-edit { display: flex; gap: 8px; max-width: 360px; }
.re-tags-edit input { flex: 1; padding: 8px 11px; border: 1px solid var(--border); border-radius: 8px; font-size: 13.5px; font-family: inherit; background: #fafbfd; }
.re-tags-hint { display: block; font-size: 12px; color: var(--muted); margin-top: 5px; }
.re-tags-hint code { background: #fff; border: 1px solid #d8e0ff; padding: 1px 5px; border-radius: 4px; color: var(--primary); font-weight: 600; }

/* Reports sub-nav */
.report-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 20px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.rnav { background: none; border: 1px solid var(--border); color: var(--muted); font-family: inherit; font-size: 13px; font-weight: 600; padding: 7px 14px; border-radius: 20px; cursor: pointer; }
.rnav:hover { background: var(--surface); color: var(--text); }
.rnav.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.rnav-manage { margin-left: auto; }
.rnav-manage.on { background: var(--text); border-color: var(--text); }
.rnav-empty { font-size: 13px; color: var(--muted); }
.cal-synced { font-size: 12px; color: var(--muted); align-self: center; }
/* Reports hub */
.reports-title { font-size: 18px; margin: 0 0 4px; }
.reports-intro { font-size: 13.5px; color: var(--muted); margin: 0 0 16px; }
.report-toggles { display: grid; gap: 12px; margin-bottom: 26px; }
.report-toggle { display: flex; gap: 16px; align-items: center; justify-content: space-between; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; box-shadow: var(--shadow); }
.report-toggle.on { border-color: var(--primary); }
.rt-name { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.rt-desc { font-size: 13px; color: var(--muted); line-height: 1.5; margin-bottom: 6px; }
.rt-who { font-size: 12px; color: var(--muted); }
.rt-who b { color: var(--text); }
.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; inset: 0; background: var(--border); border-radius: 24px; transition: .2s; cursor: pointer; }
.slider::before { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider::before { transform: translateX(18px); }
.report-block { margin-top: 10px; }
.report-head { margin-bottom: 14px; }
.report-head h3 { margin: 0 0 4px; font-size: 16px; }
.report-sub { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.5; }
.report-head-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.report-head-row select { padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); font-family: inherit; font-size: 13.5px; }
/* Life balance */
.balance-bars { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; box-shadow: var(--shadow); }
.bal-row { display: flex; align-items: center; gap: 12px; padding: 7px 0; }
.bal-label { width: 150px; flex-shrink: 0; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bal-track { flex: 1; height: 10px; background: var(--bg); border-radius: 6px; overflow: hidden; }
.bal-fill { display: block; height: 100%; background: var(--primary); border-radius: 6px; }
.bal-row-muted .bal-fill { background: var(--muted); }
.bal-val { width: 70px; text-align: right; font-size: 13px; font-weight: 600; }
.bal-pct { color: var(--muted); font-weight: 400; }
.balance-note { font-size: 13px; color: var(--muted); margin: 12px 2px 0; line-height: 1.5; }
.balance-note b { color: var(--text); }
/* Category deep-dive */
.cat-outcomes { display: grid; gap: 12px; }
.cat-out { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; box-shadow: var(--shadow); }
.cat-out-top { display: flex; justify-content: space-between; font-size: 14px; font-weight: 600; margin-bottom: 7px; }
.cat-pct { color: var(--primary); }
.cat-track { display: block; height: 8px; background: var(--bg); border-radius: 5px; overflow: hidden; margin-bottom: 6px; }
.cat-fill { display: block; height: 100%; background: var(--primary); border-radius: 5px; }
.cat-meta { font-size: 12px; color: var(--muted); }
.cat-habits { margin-top: 16px; }
.cat-habits h4 { margin: 0 0 8px; font-size: 13px; }
.cat-habit { display: inline-block; font-size: 12px; font-weight: 600; padding: 4px 10px; border: 1px dashed var(--primary); color: var(--primary); border-radius: 20px; margin: 0 6px 6px 0; }
.section-h { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 0 12px; }

/* Toolbar / buttons */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.toolbar-spacer { flex: 1; }
.search { padding: 8px 11px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; background: var(--surface); }
.view-switch { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg { background: var(--surface); border: none; padding: 7px 14px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg.active { background: var(--primary); color: #fff; }
.btn { border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 8px 14px; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; }
.btn:hover { background: var(--bg); }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: none; border-color: transparent; }
.btn-danger { color: var(--high); border-color: #f3c6bd; background: #fff; }
.btn-danger:hover { background: #fde7e2; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-ai { background: #f3eeff; color: var(--ai); border-color: #e2d6ff; }
.btn-ai:hover { background: #e9e0ff; }

/* ---- Today / focus ---- */
.now-card { background: linear-gradient(135deg, #22c55e, #5b8def); color: #fff; border-radius: 16px; padding: 22px 24px; margin-bottom: 22px; box-shadow: 0 8px 24px rgba(59,103,246,.28); }
.now-label { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; opacity: .85; font-weight: 700; margin-bottom: 8px; }
.now-title { font-size: 22px; font-weight: 700; letter-spacing: -.01em; margin-bottom: 6px; }
.now-meta { font-size: 13px; opacity: .9; margin-bottom: 4px; }
.now-next { font-size: 14px; background: rgba(255,255,255,.18); display: inline-block; padding: 5px 12px; border-radius: 20px; margin-top: 10px; }
.now-actions { margin-top: 16px; display: flex; gap: 8px; }
.now-actions .btn { background: rgba(255,255,255,.16); color: #fff; border-color: rgba(255,255,255,.3); }
.now-actions .btn:hover { background: rgba(255,255,255,.28); }
.now-empty { font-size: 16px; }
.focus-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.mini-list { display: flex; flex-direction: column; gap: 8px; }
.mini { background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--med); border-radius: 9px; padding: 10px 12px; box-shadow: var(--shadow); cursor: pointer; }
.mini[data-priority="high"] { border-left-color: var(--high); }
.mini[data-priority="low"] { border-left-color: var(--low); }
.mini-title { font-weight: 600; font-size: 14px; }
.mini-sub { font-size: 12px; color: var(--muted); margin-top: 3px; display: flex; gap: 8px; flex-wrap: wrap; }
.mini-empty { color: var(--muted); font-size: 13px; padding: 10px 2px; }

/* ---- Board ---- */
.board { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; align-items: start; }
.column { min-width: 0; position: relative; grid-column: span 1; }
.col-resize { position: absolute; top: 0; right: -9px; width: 18px; height: 100%; cursor: col-resize; z-index: 4; }
.col-resize::after { content: ''; position: absolute; top: 50%; left: 8px; transform: translateY(-50%); width: 3px; height: 38px; background: var(--border); border-radius: 2px; opacity: 0; transition: opacity .12s; }
.column:hover .col-resize::after { opacity: 1; }
.col-collapse { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 13px; padding: 0 4px; border-radius: 5px; line-height: 1; }
.col-collapse:hover { background: var(--bg); color: var(--text); }
.column-head { cursor: grab; }
.col-dragging { opacity: .55; outline: 2px dashed var(--primary); border-radius: 12px; }
.column.collapsed { cursor: grab; padding: 14px 0; min-height: 150px; display: flex; justify-content: center; align-items: flex-start; background: #f3f5fb; }
.column.collapsed:hover { background: #e9edf8; }
.column.collapsed .cards, .column.collapsed .col-collapse { display: none; }
.column.collapsed .column-head { writing-mode: vertical-rl; transform: rotate(180deg); margin: 0; padding: 0; height: auto; align-items: center; gap: 8px; white-space: nowrap; justify-content: flex-start; }
.column.collapsed .column-head h2 { white-space: nowrap; color: var(--text); }
.column.collapsed .count { background: #fff; }

/* Smart "do this next" suggestion in To Do */
.suggest-card { background: linear-gradient(135deg, #eef2ff, #ffffff); border: 1px solid #c9d6ff; border-left: 3px solid var(--primary); border-radius: 10px; padding: 11px 12px; margin-bottom: 12px; box-shadow: var(--shadow); }
.suggest-label { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--primary); margin-bottom: 5px; }
.suggest-title { font-weight: 700; font-size: 14.5px; margin-bottom: 3px; }
.suggest-sub { font-size: 11.5px; color: var(--muted); margin-bottom: 6px; }
.suggest-step { font-size: 12px; background: rgba(59,103,246,.1); color: var(--primary-dark); display: inline-block; padding: 3px 9px; border-radius: 20px; margin-bottom: 9px; }
.suggest-actions { display: flex; gap: 6px; }
.column { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px; min-height: 200px; }
.column-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; padding: 0 4px; }
.column-head h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0; }
.count { font-size: 12px; font-weight: 700; color: var(--muted); background: var(--bg); border-radius: 10px; padding: 1px 8px; }
.cards { display: flex; flex-direction: column; gap: 10px; min-height: 60px; }
.cards.dragover { outline: 2px dashed var(--primary); outline-offset: 2px; border-radius: 8px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 13px; box-shadow: var(--shadow); cursor: grab; }
.card.dragging { opacity: .5; }
.card.starred { box-shadow: 0 0 0 1.5px #ecc878, var(--shadow); }
.icon-btn.star.on { color: #e0a83a; }
.card-title { font-weight: 600; font-size: 14px; margin-bottom: 6px; letter-spacing: -.01em; }
.card.done .card-title { text-decoration: line-through; color: var(--muted); }
.card-meta { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-bottom: 7px; }
.proj-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.meta-txt { font-size: 12px; color: var(--muted); }
.meta-txt.overdue { color: var(--high); }
/* Delegation: owner chip + approval badges on a tadoo card */
.owner-chip { font-size: 11px; font-weight: 600; color: var(--primary-dark); background: #e7f9ef; border: 1px solid #c2eccf; border-radius: 10px; padding: 1px 7px; }
.appr-badge { font-size: 11px; font-weight: 700; border-radius: 10px; padding: 1px 7px; }
.appr-badge.submitted { color: #92600a; background: #fff3d6; border: 1px solid #ffe1a3; }
.appr-badge.rejected { color: #b42318; background: #fee4e2; border: 1px solid #fecdc9; }
.icon-btn.appr-ok { color: var(--done); }
.icon-btn.appr-back { color: var(--high); }
.progress.thin { height: 4px; margin: 6px 0; }
.card .progress.thin > i { background: #aab4c5; }
.chip { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 20px; background: var(--bg); color: var(--muted); }
.chip.due { background: #fff3e0; color: #b06d00; }
.chip.due.overdue { background: #fde7e2; color: var(--high); }
.chip.proj { color: #fff; }
.progress { height: 5px; background: var(--bg); border-radius: 4px; overflow: hidden; margin: 7px 0; }
.progress > i { display: block; height: 100%; background: var(--done); }
.card-actions { display: flex; gap: 2px; margin-top: 9px; flex-wrap: wrap; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; background: none; border: none; color: var(--muted); cursor: pointer; font-size: 13px; padding: 5px; border-radius: 7px; }
.icon-btn:hover { background: var(--bg); color: var(--text); }
.icon-btn svg { display: block; }

/* ---- List / table ---- */
.list { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 14px; font-size: 13.5px; border-bottom: 1px solid var(--border); }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: #fafbfd; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafbff; }
.status-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.status-dot.todo { background: var(--todo); } .status-dot.doing { background: var(--doing); } .status-dot.done { background: var(--done); }
.empty { text-align: center; color: var(--muted); padding: 40px; font-size: 14px; }

/* ---- Projects ---- */
.project-list { display: flex; flex-direction: column; gap: 16px; }
.project { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
.project-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; cursor: pointer; }
.project-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.project-name { font-size: 16px; font-weight: 700; }
.project-prog { flex: 1; max-width: 240px; }
.project-pct { font-size: 12px; color: var(--muted); font-weight: 600; }
.project-body { padding: 4px 18px 16px; border-top: 1px solid var(--border); }
.step-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.step-row:last-child { border-bottom: none; }
.step-row input[type="checkbox"] { width: 17px; height: 17px; }
.step-title { flex: 1; font-size: 14px; }
.step-title.done { text-decoration: line-through; color: var(--muted); }
.step-meta { font-size: 11px; color: var(--muted); }
.project-actions { display: flex; gap: 8px; margin-top: 12px; }

/* ---- Goals ---- */
.area-section { margin-bottom: 26px; }
.area-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.area-emoji { font-size: 18px; }
.area-head h2 { font-size: 16px; margin: 0; letter-spacing: -.01em; }
.area-spacer { flex: 1; }
.goal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.goal { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px; }
.goal-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; cursor: pointer; }
.goal-name { font-size: 15px; font-weight: 700; }
.goal-detail { display: flex; flex-direction: column; gap: 12px; margin-top: 4px; }
.g-project { border: 1px solid var(--border); border-radius: 9px; padding: 10px 12px; background: #fafbff; }
.g-project-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.g-project-name { font-weight: 700; font-size: 13.5px; flex: 1; }
.goal-pct { font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.goal-why { font-size: 12.5px; color: var(--muted); font-style: italic; }
.goal-projects { display: flex; flex-wrap: wrap; gap: 6px; }
.goal-projects-list { display: flex; flex-direction: column; gap: 6px; margin: 2px 0; }
.g-proj-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; background: #fafbff; border: 1px solid var(--border); border-radius: 8px; }
.g-proj-name { flex: 1; font-size: 13.5px; font-weight: 600; cursor: pointer; }
.g-proj-name:hover { color: var(--primary); text-decoration: underline; }
.g-proj-pct { font-size: 11px; color: var(--muted); font-weight: 600; }
.goal-actions { display: flex; align-items: center; gap: 6px; margin-top: 2px; flex-wrap: wrap; }
.habit-input { display: inline-flex; gap: 6px; align-items: center; }
.habit-input input { width: 90px; margin-top: 0; padding: 5px 8px; }

/* Today habit strip */
.habit-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 22px; }
.hchip { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 11px 13px; box-shadow: var(--shadow); }
.hchip-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 7px; }
.hchip-top b { font-size: 13.5px; }
.hchip-top span { font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.habit-strip .progress { height: 6px; margin: 0; }

/* ---- Goal meta chips ---- */
.goal-meta { display: flex; gap: 6px; margin: 4px 0 6px; }
.chip.pri-high { background: #fde7e2; color: var(--high); }
.chip.pri-med { background: #fff3e0; color: #b06d00; }
.chip.pri-low { background: #eef4fb; color: var(--low); }

/* ---- Life Goals mind map ---- */
.mindmap { position: relative; border: 1px solid var(--border); border-radius: 12px; background: #fafbff; min-height: 560px; height: calc(100vh - 230px); overflow: auto; }
.mm-lines { position: absolute; top: 0; left: 0; pointer-events: none; z-index: 0; }
.mm-nodes { position: relative; min-height: 560px; min-width: 100%; z-index: 1; }
.mm-node { position: absolute; z-index: 1; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 9px 12px; box-shadow: var(--shadow); cursor: grab; user-select: none; touch-action: none; max-width: 210px; font-size: 13.5px; transition: box-shadow .12s ease, transform .12s ease; }
.mm-node:hover { box-shadow: 0 6px 18px rgba(20,30,60,.16); transform: translateY(-1px); }
.mm-node:active { cursor: grabbing; }
.mm-root { background: linear-gradient(135deg, #eef2ff, #fff); border: 2px solid var(--primary); font-weight: 700; }
.mm-area { background: #fff; border-width: 2px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.mm-emoji { font-size: 15px; }
.mm-mark { vertical-align: -2px; }
.mm-empty { position: absolute; left: 50%; top: 56%; transform: translateX(-50%); text-align: center; max-width: 340px; }
.mm-empty p { font-size: 13.5px; color: var(--muted); margin: 0 0 12px; line-height: 1.5; }
.mm-add { margin-left: auto; border: none; background: var(--bg); color: var(--muted); border-radius: 6px; cursor: pointer; font-size: 14px; line-height: 1; padding: 2px 7px; }
.mm-add:hover { background: #e3e8f0; color: var(--text); }
.mm-refresh { position: absolute; top: 6px; right: 6px; border: none; background: rgba(59,103,246,.12); color: var(--primary); border-radius: 6px; cursor: pointer; font-size: 13px; line-height: 1; padding: 3px 6px; }
.mm-refresh:hover { background: rgba(59,103,246,.22); }
.mm-cal { padding-right: 30px; }
.mm-goal { border-left: 4px solid var(--med); }
.mm-goal.pri-high { border-left-color: var(--high); }
.mm-goal.pri-low { border-left-color: var(--low); }
.mm-goal b { display: block; }
/* Habits read as recurring: dashed teal pill, not a one-time outcome box */
.mm-habit { border: 2px dashed #0fb5ba; border-left: 2px dashed #0fb5ba; background: #f0fbfb; border-radius: 22px; }
.mm-habit .mm-prog > i { background: #0fb5ba; }
.mm-warn { color: var(--high); font-size: 10.5px; }
.mm-cal { border: 2px solid var(--primary); border-left: 2px solid var(--primary); background: #eef2ff; }
.mm-prog-2 { position: relative; }
.mm-prog-2 > i { position: absolute; left: 0; top: 0; height: 100%; }
.mm-cal .mm-prog-2 > i.booked { background: #b5c5f5; }
.mm-cal .mm-prog-2 > i:not(.booked) { background: var(--primary); z-index: 1; }
.modal-hint { font-size: 12px; color: var(--muted); line-height: 1.5; margin: 4px 0 0; }
.modal-hint code { background: var(--bg); padding: 1px 5px; border-radius: 4px; color: var(--primary); font-weight: 600; }
.mm-sub { font-size: 11px; color: var(--muted); }
.mm-proj { border-left: 3px solid var(--primary); padding: 7px 11px; max-width: 190px; font-size: 12.5px; background: #fbfcfe; }
.mm-proj b { display: block; font-weight: 600; }
.mm-prog { display: block; height: 5px; background: var(--bg); border-radius: 4px; overflow: hidden; margin-top: 6px; }
.mm-prog > i { display: block; height: 100%; background: var(--done); }
.mm-reset { position: absolute; top: 10px; right: 10px; z-index: 3; }
.mm-hint { position: sticky; bottom: 8px; left: 12px; display: inline-block; margin: 8px 0 0 12px; font-size: 11px; color: var(--muted); pointer-events: none; }
@media (max-width: 680px) {
  .mm-node { max-width: 210px; font-size: 13px; padding: 8px 11px; }
  .mindmap { min-height: 460px; }
  .mm-reset { top: 8px; right: 8px; }
}

/* ---- Goal detail panel ---- */
.detail-card { max-width: 540px; }
.detail-head { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.detail-head .goal-meta { margin: 0; }
.detail-title { font-size: 21px; margin: 0 0 8px; letter-spacing: -.01em; }
.detail-why { color: var(--muted); font-style: italic; margin: 0 0 6px; line-height: 1.5; }
.detail-h { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 16px 0 8px; }
.detail-sub { font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.detail-projects { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.detail-proj { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: #fafbff; }
.detail-proj-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.detail-proj-name { flex: 1; font-weight: 700; font-size: 13.5px; cursor: pointer; }
.detail-proj-name:hover { color: var(--primary); text-decoration: underline; }
.detail-task { display: flex; align-items: center; gap: 10px; padding: 5px 0; border-top: 1px solid var(--border); }
.detail-task input[type="checkbox"] { width: 16px; height: 16px; flex-shrink: 0; }
.detail-task-title { font-size: 13.5px; cursor: pointer; flex: 1; }
.detail-task-title:hover { color: var(--primary); }
.detail-task.done .detail-task-title { text-decoration: line-through; color: var(--muted); }

/* ---- Reports ---- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px; text-align: center; box-shadow: var(--shadow); }
.stat-num { display: block; font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
.stat-label { font-size: 12.5px; color: var(--muted); }
.report-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 18px; }
.report-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; box-shadow: var(--shadow); }
.report-card h3 { margin: 0 0 12px; font-size: 14px; }
.bars { display: flex; flex-direction: column; gap: 9px; }
.bar-row { display: grid; grid-template-columns: 120px 1fr 42px; align-items: center; gap: 8px; font-size: 12.5px; }
.bar-track { background: var(--bg); border-radius: 5px; height: 14px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--primary); border-radius: 5px; }
.bar-val { text-align: right; color: var(--muted); font-weight: 600; }
.bars-empty { color: var(--muted); font-size: 13px; }

/* ---- Settings ---- */
.settings-h { font-size: 22px; margin: 0 0 18px; letter-spacing: -.02em; }
.settings-section { margin-bottom: 26px; }
.integration-list { display: flex; flex-direction: column; gap: 14px; }
.integration { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; box-shadow: var(--shadow); }
.integration.planned { opacity: .72; }
.profile-card { padding: 18px; }
.profile-head { display: flex; align-items: center; gap: 13px; }
.profile-avatar { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.profile-avatar-fallback { display: flex; align-items: center; justify-content: center; background: var(--primary); color: #fff; font-weight: 700; font-size: 18px; }
.profile-id { flex: 1; min-width: 0; }
.profile-name { font-weight: 700; font-size: 15px; }
.profile-email { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin: 16px 0 5px; }
.profile-hint { font-weight: 500; color: var(--muted); opacity: .8; }
.profile-edit { display: flex; gap: 8px; max-width: 420px; }
.profile-edit input { flex: 1; padding: 8px 11px; border: 1px solid var(--border); border-radius: 8px; font-size: 13.5px; font-family: inherit; background: #fafbfd; }
.profile-tz-select { flex: 1; padding: 8px 11px; border: 1px solid var(--border); border-radius: 8px; font-size: 13.5px; font-family: inherit; background: #fafbfd; }
.profile-danger { display: flex; align-items: center; gap: 10px; margin-top: 16px; padding-top: 14px; border-top: 0.5px solid var(--border); }
.btn-danger-link { background: none; border: 1px solid var(--high); color: var(--high); font-size: 13px; font-weight: 600; cursor: pointer; padding: 6px 12px; border-radius: 8px; }
.btn-danger-link:hover { background: var(--high); color: #fff; }
.btn-danger-link:disabled { opacity: .6; cursor: default; }
.intg-title { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.intg-badge { font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 20px; background: var(--bg); color: var(--muted); }
.intg-badge.on { background: #e3f6ec; color: var(--done); }
.intg-desc { font-size: 13px; color: var(--muted); line-height: 1.5; margin-bottom: 12px; }
.intg-url-label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin: 12px 0 5px; }
.intg-url { display: flex; gap: 8px; }
.intg-url input { flex: 1; padding: 8px 11px; border: 1px solid var(--border); border-radius: 8px; font-size: 13.5px; font-family: inherit; background: #fafbfd; }
.intg-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.intg-help { font-size: 13px; color: var(--text); line-height: 1.6; margin: 10px 0 0; padding-left: 20px; }
.intg-help code { background: var(--bg); padding: 1px 5px; border-radius: 4px; font-size: 12px; word-break: break-all; }
.intg-warn { color: #b06d00; }
.intg-desc code { background: var(--bg); padding: 1px 5px; border-radius: 4px; font-size: 12px; }

/* ---- Modal ---- */
.modal { position: fixed; inset: 0; background: rgba(20,30,60,.45); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px; }
.modal-card { background: var(--surface); border-radius: 14px; padding: 24px; width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal-card h3 { margin: 0 0 16px; font-size: 18px; }
form label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 14px; }
form input, form textarea, form select { width: 100%; margin-top: 5px; padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; font-family: inherit; color: var(--text); background: var(--surface); }
form input:focus, form textarea:focus, form select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px #eef2ff; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.subtasks-head { display: flex; align-items: center; justify-content: space-between; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.subtask-edit { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.subtask-edit .st { display: flex; align-items: center; gap: 8px; }
.subtask-edit .st input[type="text"] { margin-top: 0; }
.subtask-edit .st input[type="checkbox"] { width: 17px; height: 17px; flex-shrink: 0; }
.subtask-edit .st .icon-btn { flex-shrink: 0; }

/* ---- Chat drawer ---- */
.chat-drawer { position: fixed; top: 0; right: 0; bottom: 0; width: 360px; max-width: 90vw; background: var(--surface); border-left: 1px solid var(--border); box-shadow: -8px 0 30px rgba(0,0,0,.12); display: flex; flex-direction: column; z-index: 60; }
.chat-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--border); font-weight: 700; }
.chat-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.chat-msg { padding: 10px 13px; border-radius: 12px; font-size: 13.5px; line-height: 1.45; max-width: 88%; }
.chat-msg.bot { background: var(--bg); align-self: flex-start; border-bottom-left-radius: 3px; }
.chat-msg.user { background: var(--primary); color: #fff; align-self: flex-end; border-bottom-right-radius: 3px; }
.chat-msg.sys { background: #fff7e6; color: #8a6d1a; align-self: center; font-size: 12px; text-align: center; }
.chat-input { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); }
.chat-input input { flex: 1; margin-top: 0; padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; }

@media (max-width: 760px) {
  .board, .stats, .focus-cols, .report-grid { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; gap: 10px; }
  .tabs { order: 3; width: 100%; overflow-x: auto; }
}
