:root {
  color-scheme: light;
  --bg: #f7f4ff; --bg2: #fff6ec; --panel: #ffffff; --panel2: #f0ecfb; --line: #e4def3;
  --text: #221c3a; --muted: #6d6786; --accent: #6c4ef2; --accent2: #9a5cf5; --accent-ink: #fff;
  --coral: #ff6b5e; --sun: #ffb930; --mint: #22b98f;
  --good: #1f9e7a; --late: #b4610a; --p1: #e2483b; --p2: #e08a00; --p3: #3d82d6;
  --radius: 18px; --shadow: 0 8px 24px rgb(66 42 150 / .10);
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #15122a; --bg2: #1c1433; --panel: #211c3d; --panel2: #2d2650; --line: #383058;
    --text: #f5f2ff; --muted: #aca6c8; --accent: #8f76ff; --accent2: #b98cff; --accent-ink: #120c2b;
    --coral: #ff8a7e; --sun: #ffc95c; --mint: #4fd9b1;
    --good: #4fd9b1; --late: #ffbd6b; --p1: #ff8a7e; --p2: #ffc95c; --p3: #7fb6f5;
    --shadow: 0 8px 26px rgb(0 0 0 / .35);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: linear-gradient(160deg, var(--bg), var(--bg2)) fixed; color: var(--text);
  font: 16px/1.45 ui-rounded, "SF Pro Rounded", "Segoe UI Variable Text", "Segoe UI", Roboto, system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 20px; height: 20px; flex: none; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
a { color: inherit; }
h1 { font-size: 1.75rem; margin: 0; letter-spacing: -.02em; font-weight: 800; }
h2 { font-size: .78rem; margin: 22px 0 6px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-weight: 750; }
h2.plain { font-size: 1.35rem; text-transform: none; letter-spacing: -.01em; color: var(--text); margin: 8px 0 4px; }
.muted { color: var(--muted); } .small { font-size: .86rem; } .grow { flex: 1; min-width: 0; }
.trunc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { color: var(--muted); padding: 22px 4px; }

.shell { display: grid; grid-template-columns: 228px minmax(0, 1fr); min-height: 100dvh; }
nav.side { padding: 18px 12px; position: sticky; top: 0; height: 100dvh; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; background: color-mix(in srgb, var(--panel) 62%, transparent); border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 1.1rem; padding: 2px 10px 14px; text-decoration: none; }
.navlink { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 11px; border-radius: 12px; text-decoration: none; color: var(--muted); min-height: 40px; font-weight: 600; transition: background .12s, color .12s; }
.navlink .row { gap: 10px; min-width: 0; }
.navlink:hover { background: var(--panel2); color: var(--text); }
.navlink.on { background: linear-gradient(120deg, var(--accent), var(--accent2)); color: var(--accent-ink); }
.navlink.on .count { color: inherit; opacity: .85; }
.navhead { font-size: .75rem; font-weight: 750; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 16px 11px 6px; text-decoration: none; }
.navproject { font-size: .94rem; font-weight: 550; min-height: 36px; }
.sidefoot { margin-top: auto; padding-top: 14px; }
.sync { padding: 4px 11px; min-height: 1.2em; }
.count { font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 700; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; display: inline-block; }
.dot.big { width: 16px; height: 16px; }
main { padding: 28px 30px 120px; max-width: 760px; width: 100%; margin: 0 auto; }
main.enter { animation: rise .22s ease-out; }
/* Movement only, no fade: a stalled animation must never leave the page dim or blank. */
@keyframes rise { from { transform: translateY(6px); } }
.bottom { display: none; }
.head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.nowrap { flex-wrap: nowrap; } .row.center { justify-content: center; } .row.end { justify-content: flex-end; } .row.between { justify-content: space-between; } .row.top { align-items: flex-start; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; background: var(--panel); border: 1.5px solid var(--line); border-radius: 13px; padding: 8px 14px; min-height: 42px; font-weight: 650; white-space: nowrap; transition: transform .1s, border-color .12s, box-shadow .12s; }
.btn:hover { border-color: var(--accent); }
.btn:active { transform: scale(.97); }
.btn.primary { background: linear-gradient(120deg, var(--accent), var(--accent2)); border-color: transparent; color: var(--accent-ink); box-shadow: 0 5px 14px color-mix(in srgb, var(--accent) 35%, transparent); }
.btn.danger { color: var(--p1); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.big { padding: 13px 22px; font-size: 1.05rem; min-height: 52px; border-radius: 16px; }
.btn:disabled { opacity: .5; cursor: default; }
.tiny { background: none; border: 0; color: var(--accent); font-weight: 700; font-size: .82rem; padding: 6px 8px; border-radius: 8px; text-transform: none; letter-spacing: 0; }
.tiny:hover { background: var(--panel2); }

.task { display: flex; align-items: flex-start; gap: 11px; padding: 11px 6px; border-bottom: 1px solid var(--line); border-radius: 10px; transition: background .12s; }
.task:hover { background: color-mix(in srgb, var(--panel) 75%, transparent); }
.check { flex: none; width: 26px; height: 26px; border-radius: 50%; border: 2.5px solid var(--muted); background: transparent; padding: 0; position: relative; transition: transform .12s, background .12s; }
.check::after { content: ""; position: absolute; inset: -10px; }
.check.p1 { border-color: var(--p1); } .check.p2 { border-color: var(--p2); } .check.p3 { border-color: var(--p3); }
.check:hover { transform: scale(1.12); background: color-mix(in srgb, var(--mint) 25%, transparent); }
.check.done { background: var(--mint); border-color: var(--mint); display: inline-block; }
.tbody { flex: 1; min-width: 0; background: none; border: 0; text-align: left; padding: 0; overflow-wrap: anywhere; color: inherit; }
.ttl { font-weight: 550; }
.meta { font-size: .8rem; color: var(--muted); display: flex; gap: 9px; flex-wrap: wrap; margin-top: 2px; align-items: center; }
.meta .late { color: var(--late); font-weight: 650; }
.meta .tag { display: inline-flex; gap: 5px; align-items: center; }
.meta .ic svg { width: 13px; height: 13px; display: block; }
.pin { flex: none; background: none; border: 0; color: var(--muted); width: 38px; height: 38px; margin: -6px -4px; border-radius: 50%; display: grid; place-items: center; opacity: .55; transition: opacity .12s, background .12s, transform .12s; }
.pin:hover { background: var(--panel2); opacity: 1; transform: scale(1.1); }
.pin.on { color: var(--sun); opacity: 1; }
.pin.on svg { fill: currentColor; }
.sub { margin-left: 32px; }
.grip { flex: none; width: 18px; height: 28px; margin-right: -5px; border: 0; padding: 0; background: radial-gradient(var(--muted) 1.4px, transparent 1.7px) center / 7px 7px; opacity: .3; cursor: grab; touch-action: none; border-radius: 5px; transition: opacity .12s; }
.task:hover .grip, .nowcard:hover .grip, .grip:focus-visible { opacity: .9; }
@media (hover: none) { .grip { opacity: .55; } }
.dragging { opacity: .75; background: var(--panel2) !important; box-shadow: var(--shadow); border-radius: 12px; }
[data-drop] { min-height: 14px; }
.nowcard .grip { margin-right: 2px; }
.nudge { background: color-mix(in srgb, var(--accent) 13%, var(--panel)); border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line)); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; }
.nudge .ic { color: var(--accent); display: grid; }
.nudge .row + .row { margin-top: 10px; }
.memory .chip { display: inline-block; margin-left: 4px; }

.hero { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.hello { font-size: 1.85rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.score { flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; width: 78px; height: 78px; border-radius: 50%; background: linear-gradient(140deg, var(--sun), var(--coral)); color: #2a1404; box-shadow: var(--shadow); }
.score b { font-size: 1.6rem; line-height: 1; font-weight: 850; }
.score span { font-size: .66rem; font-weight: 750; }
.week { display: flex; gap: 6px; margin: 14px 0 20px; }
.wk { flex: 1; max-width: 46px; height: 34px; border-radius: 11px; background: var(--panel2); display: grid; place-items: center; font-style: normal; color: var(--muted); }
.wk b { font-size: .72rem; }
.wk.hit { background: var(--mint); color: #05291f; }
.wk.nowday { outline: 2px solid var(--accent); outline-offset: 1px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow); }
.welcome .row { margin-top: 10px; }
.nowcard { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow); }
.nowcard.first { border: 2px solid var(--accent); padding: 20px; }
.nowcard .title { font-size: 1.12rem; font-weight: 700; overflow-wrap: anywhere; background: none; border: 0; padding: 0; text-align: left; flex: 1; min-width: 0; }
.nowcard.first .title { font-size: 1.45rem; font-weight: 800; letter-spacing: -.01em; }
.nowcard .step { margin: 6px 0 14px; color: var(--muted); }
.resume { display: flex; width: 100%; justify-content: space-between; align-items: center; gap: 12px; text-align: left; background: color-mix(in srgb, var(--sun) 24%, var(--panel)); border: 0; border-radius: var(--radius); padding: 13px 16px; margin-bottom: 12px; }
.resume .link { font-weight: 750; color: var(--accent); white-space: nowrap; }
.banner { background: color-mix(in srgb, var(--sun) 18%, var(--panel)); border-radius: var(--radius); padding: 13px 15px; margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.softlink { display: inline-block; color: var(--accent); font-weight: 700; font-size: .92rem; margin-top: 6px; text-decoration: none; }
.emptystate { text-align: center; padding: 34px 16px; background: color-mix(in srgb, var(--panel) 70%, transparent); border-radius: var(--radius); margin: 10px 0; }
.emptystate .emoji { font-size: 2.6rem; line-height: 1.2; }
.emptystate b { display: block; font-size: 1.15rem; margin: 4px 0 2px; }
.emptystate .row { margin-top: 14px; }

.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.projectcard { display: block; text-decoration: none; color: inherit; background: var(--panel); border: 1px solid var(--line); border-top: 5px solid var(--pc, var(--accent)); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); transition: transform .12s; }
.projectcard:hover { transform: translateY(-2px); }
.nextup { margin-top: 6px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.bar { height: 7px; border-radius: 4px; background: var(--panel2); overflow: hidden; margin-top: 10px; }
.bar > i { display: block; height: 100%; background: var(--pc, var(--mint)); border-radius: 4px; }
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(260px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.column { background: color-mix(in srgb, var(--panel) 75%, transparent); border-radius: var(--radius); padding: 12px; }
.column h2 { margin-top: 2px; }
.moregrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.moretile { display: flex; align-items: center; gap: 10px; padding: 18px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; font-weight: 650; box-shadow: var(--shadow); }
.moretile svg { color: var(--accent); }

.fab { position: fixed; right: 26px; bottom: 28px; width: 62px; height: 62px; border-radius: 50%; border: 0; background: linear-gradient(135deg, var(--accent), var(--accent2)); color: var(--accent-ink); font-size: 34px; line-height: 1; box-shadow: 0 10px 24px color-mix(in srgb, var(--accent) 45%, transparent); z-index: 5; transition: transform .12s; }
.fab:hover { transform: scale(1.07) rotate(90deg); }

dialog { background: var(--panel); color: var(--text); border: 0; border-radius: 22px; padding: 20px; width: min(560px, calc(100vw - 24px)); max-height: 90dvh; overflow-y: auto; box-shadow: 0 24px 60px rgb(0 0 0 / .35); }
dialog[open] { animation: rise .18s ease-out; }
dialog::backdrop { background: rgb(20 12 50 / .55); backdrop-filter: blur(3px); }
label { display: block; font-size: .83rem; font-weight: 650; color: var(--muted); margin: 13px 0 5px; }
label.inline { display: flex; gap: 8px; align-items: center; color: var(--text); margin-top: 12px; }
input[type=text], input[type=password], input[type=date], input[type=time], input[type=number], input[type=search], select, textarea {
  width: 100%; background: var(--bg); border: 1.5px solid var(--line); border-radius: 12px; padding: 9px 12px; min-height: 44px; font-size: 16px; min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
.bigfield { font-size: 1.2rem !important; font-weight: 650; border: 0 !important; background: transparent !important; padding: 4px 0 !important; border-radius: 0 !important; border-bottom: 2px solid var(--line) !important; }
.bigfield:focus { border-bottom-color: var(--accent) !important; }
textarea { min-height: 72px; resize: vertical; }
details { margin-top: 14px; }
summary { cursor: pointer; font-weight: 650; color: var(--accent); padding: 4px 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
#e-chips + .grid2 { margin-top: 8px; }
.preview { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; min-height: 24px; }
.chip { font-size: .8rem; font-weight: 650; background: var(--panel2); border-radius: 20px; padding: 3px 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip-btn { background: var(--panel); border: 1.5px solid var(--line); border-radius: 20px; padding: 6px 13px; min-height: 36px; font-size: .9rem; font-weight: 600; transition: border-color .12s, transform .1s; }
.chip-btn:hover { border-color: var(--accent); }
.chip-btn:active { transform: scale(.96); }
.chip-btn.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.err { color: var(--p1); font-size: .9rem; margin-top: 8px; font-weight: 600; }
.err:empty { display: none; }

main.chatmain { display: flex; flex-direction: column; min-height: 100dvh; padding-bottom: 150px; }
#chat { display: flex; flex-direction: column; gap: 9px; flex: 1; }
.intro { text-align: center; padding: 26px 10px 18px; max-width: 460px; margin: 0 auto; }
.orb { width: 72px; height: 72px; border-radius: 50%; margin: 0 auto; display: grid; place-items: center; color: #fff; background: linear-gradient(140deg, var(--accent), var(--coral)); box-shadow: var(--shadow); }
.orb svg { width: 34px; height: 34px; }
.bubble { padding: 11px 15px; border-radius: 19px; white-space: pre-wrap; overflow-wrap: anywhere; max-width: 88%; animation: rise .16s ease-out; }
.bubble.user { background: linear-gradient(120deg, var(--accent), var(--accent2)); color: var(--accent-ink); align-self: flex-end; border-bottom-right-radius: 6px; }
.bubble.assistant { background: var(--panel); border: 1px solid var(--line); align-self: flex-start; border-bottom-left-radius: 6px; box-shadow: var(--shadow); }
.status { display: block; color: var(--muted); font-size: .88rem; font-style: italic; }
.dots { display: none; gap: 4px; }
.typing .dots { display: inline-flex; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: bob 1s infinite; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes bob { 40% { transform: translateY(-5px); } }
.action { display: flex; align-items: center; gap: 8px; font-size: .86rem; color: var(--muted); padding: 2px 4px; }
.action .ic { color: var(--mint); display: grid; }
.action svg { width: 16px; height: 16px; }
.composer { position: fixed; bottom: 0; left: 228px; right: 0; padding: 10px 16px 16px; background: linear-gradient(transparent, var(--bg) 26%); z-index: 4; }
.composer > * { max-width: 700px; margin-inline: auto; }
.composer .chips { margin-bottom: 9px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.composer .chip-btn { white-space: nowrap; flex: none; box-shadow: var(--shadow); }
.composer input { border-radius: 24px; min-height: 50px; padding-inline: 18px; background: var(--panel); box-shadow: var(--shadow); }
.iconbtn { flex: none; width: 50px; height: 50px; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid var(--line); background: var(--panel); }
.iconbtn.send { background: linear-gradient(120deg, var(--accent), var(--accent2)); border: 0; color: var(--accent-ink); }
.iconbtn:disabled { opacity: .5; }
.iconbtn.listening { background: var(--coral); color: #fff; border-color: var(--coral); animation: bob 1s infinite; }
.memory { display: flex; align-items: center; gap: 10px; padding: 12px 14px; margin-bottom: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }

#focus { position: fixed; inset: 0; background: linear-gradient(160deg, var(--bg), var(--bg2)); z-index: 20; display: flex; flex-direction: column; align-items: center; justify-content: safe center; padding: 24px; text-align: center; overflow-y: auto; animation: rise .2s ease-out; }
#focus[hidden] { display: none; }
.f-eyebrow { color: var(--accent); font-weight: 750; margin-bottom: 6px; }
.f-title { font-size: clamp(1.5rem, 5vw, 2.3rem); font-weight: 800; letter-spacing: -.02em; max-width: 700px; overflow-wrap: anywhere; }
.f-step { color: var(--muted); font-size: 1.1rem; margin-top: 8px; max-width: 600px; }
.ring { position: relative; width: min(58vw, 250px); aspect-ratio: 1; margin: 20px 0; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 14; }
.ring .track { stroke: var(--panel2); }
.ring .prog { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset 1s linear; }
.f-clock { position: absolute; inset: 0; display: grid; place-items: center; font-size: clamp(2.6rem, 11vw, 3.8rem); font-variant-numeric: tabular-nums; font-weight: 700; }
.f-clock.over { color: var(--good); }
.f-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.f-panel { width: min(500px, 100%); margin-top: 16px; text-align: left; }
.party { font-size: 4.5rem; animation: pop .5s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes pop { from { transform: scale(.2); } }
.spark { position: fixed; width: 9px; height: 9px; border-radius: 3px; z-index: 40; pointer-events: none; animation: spark .75s ease-out forwards; }
@keyframes spark { to { transform: translate(var(--dx), var(--dy)) rotate(280deg); opacity: 0; } }

#toast { position: fixed; left: 50%; bottom: 100px; transform: translate(-50%, 8px); z-index: 30; display: flex; gap: 12px; align-items: center; background: var(--text); color: var(--bg); padding: 11px 18px; border-radius: 16px; font-weight: 650; max-width: calc(100vw - 24px); opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s; }
#toast.show { opacity: 1; pointer-events: auto; transform: translate(-50%, 0); }
#toast button { background: none; border: 0; color: inherit; font-weight: 800; text-decoration: underline; padding: 4px; }
.auth { max-width: 400px; margin: 10vh auto; padding: 0 16px; text-align: center; }
.auth label { text-align: left; }
.auth h1 { margin-top: 8px; }

@media (max-width: 760px) {
  .shell { display: block; }
  nav.side { display: none; }
  main { padding: 20px 16px 130px; }
  main.chatmain { padding-bottom: 210px; min-height: auto; }
  .hello { font-size: 1.55rem; }
  .bottom { display: flex; position: fixed; left: 0; right: 0; bottom: 0; background: var(--panel); border-top: 1px solid var(--line); z-index: 6; padding-bottom: env(safe-area-inset-bottom); }
  .bottom a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px 7px; font-size: .72rem; font-weight: 650; text-decoration: none; color: var(--muted); }
  .bottom a.on { color: var(--accent); }
  .bottom a.on svg { transform: scale(1.12); }
  .fab { bottom: calc(76px + env(safe-area-inset-bottom)); right: 16px; }
  .composer { left: 0; bottom: calc(58px + env(safe-area-inset-bottom)); padding: 8px 12px 10px; }
  #toast { bottom: calc(146px + env(safe-area-inset-bottom)); }
  .grid2 { grid-template-columns: 1fr; }
  .chat-head h1 { font-size: 1.4rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
