/* fonts served from the app itself, so nothing waits on another server */
@font-face { font-family: "Fraunces"; font-style: normal; font-weight: 500 700; font-display: swap; src: url(fonts/fraunces-latin.woff2) format("woff2"); }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 400 800; font-display: swap; src: url(fonts/manrope-latin.woff2) format("woff2"); }
/* Proper: one phone-width column (a little wider on the tablet), tabs on top, sheets from the bottom. */
:root {
  --bg: #f4f2ec;
  --surface: #ffffff;
  --raised: #f7f5f0;
  --ink: #14171f;
  --muted: #646a78;
  --line: #e3dfd4;
  --accent: #d98e1f;
  --accent-ink: #1a1203;
  --accent-soft: #fbefd9;
  --work: #2f64d6;
  --personal: #128a66;
  --danger: #c93b3b;
  --t0: #c93b3b; --t1: #d9781f; --t2: #2f64d6; --t3: #128a66;
  --shadow: 0 1px 2px rgba(20, 23, 31, .05), 0 10px 26px rgba(20, 23, 31, .08);
  --display: "Fraunces", Georgia, serif;
  --ui: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1117; --surface: #161b24; --raised: #1d2330; --ink: #eef1f6; --muted: #9aa2b2; --line: #272e3c;
    --accent: #f5b544; --accent-ink: #1a1203; --accent-soft: rgba(245, 181, 68, .13);
    --work: #6d97ff; --personal: #3ccf9b; --danger: #ff6b6b;
    --t0: #ff6b6b; --t1: #f5a142; --t2: #6d97ff; --t3: #3ccf9b;
    --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 12px 30px rgba(0, 0, 0, .35); color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--ink); font: 500 15px/1.5 var(--ui); padding-inline: 16px; -webkit-tap-highlight-color: transparent; }
.app { max-width: 560px; margin: 0 auto; padding-block: calc(14px + env(safe-area-inset-top, 0px)) calc(48px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 14px; }
.tab { display: flex; flex-direction: column; gap: 14px; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { margin: 0; font-family: var(--display); font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 30px; line-height: 1; }
h1 .dot { color: var(--accent); }
h2 { font-size: 22px; line-height: 1.15; }
h3 { font-size: 17px; }
.sub { margin: 4px 0 0; color: var(--muted); font-size: 13px; font-weight: 600; }
.top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.icon-btn { width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; padding: 0; color: var(--muted); }
.icon-btn svg { width: 20px; height: 20px; }
.demo-tag { align-self: flex-start; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 3px 10px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 14px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow); min-width: 0; }
.label { font-size: 11px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; color: var(--muted); }
.note { margin: 0; color: var(--muted); font-size: 13px; }
.error { margin: 0; color: var(--danger); font-size: 13px; font-weight: 600; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.empty { margin: 0; color: var(--muted); font-size: 13.5px; }

input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"], input[type="time"], textarea, select {
  width: 100%; min-width: 0; font: inherit; color: var(--ink); background: var(--raised); border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px; min-height: 44px; resize: none;
}
.btn { border: 0; border-radius: 999px; padding: 10px 18px; min-height: 44px; font-weight: 800; background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn.small { min-height: 36px; padding: 6px 14px; font-size: 13px; }
.btn.danger { background: transparent; color: var(--danger); border: 1.5px solid color-mix(in srgb, var(--danger) 40%, transparent); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.block { width: 100%; }
.link { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 800; text-decoration: underline; }
.auth form { display: flex; flex-direction: column; gap: 8px; }

/* tabs */
nav.tabs { position: sticky; top: calc(8px + env(safe-area-inset-top, 0px)); z-index: 20; background: color-mix(in srgb, var(--surface) 92%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border: 1px solid var(--line); border-radius: 18px; padding: 4px; box-shadow: var(--shadow); }
nav.tabs .inner { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; }
nav.tabs button { border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 0 6px; font-size: 11.5px; font-weight: 800; color: var(--muted); border-radius: 14px; }
nav.tabs button svg { width: 21px; height: 21px; }
nav.tabs button[aria-selected="true"] { background: var(--ink); color: var(--bg); }
.card, .ritual { scroll-margin-top: calc(90px + env(safe-area-inset-top, 0px)); }

/* chips and segmented controls */
.seg { display: flex; gap: 4px; padding: 3px; border-radius: 999px; background: var(--raised); border: 1px solid var(--line); }
.seg button { flex: 1; border: 0; background: none; border-radius: 999px; padding: 6px 10px; font-size: 13px; font-weight: 800; color: var(--muted); white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 4px rgba(0, 0, 0, .12); }
.seg button[data-v="work"][aria-pressed="true"] { color: var(--work); }
.seg button[data-v="personal"][aria-pressed="true"] { color: var(--personal); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1.5px solid var(--line); background: var(--raised); border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 700; min-height: 36px; }
.chip[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }

/* hero: today's progress */
.hero { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center; }
.ring { --p: 0; --c: var(--accent); width: 84px; height: 84px; border-radius: 50%; background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--line) 0); display: grid; place-items: center; }
.ring > div { width: 66px; height: 66px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; text-align: center; }
.ring b { font: 700 24px/1 var(--display); }
.ring small { display: block; font-size: 10px; font-weight: 800; color: var(--muted); letter-spacing: .06em; }
.ring.big { width: 132px; height: 132px; } .ring.big > div { width: 106px; height: 106px; } .ring.big b { font-size: 38px; }
.hero h2 { font-size: 21px; }
.flags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.flag { border: 1.5px solid var(--line); background: var(--raised); border-radius: 999px; padding: 4px 10px; font-size: 12.5px; font-weight: 800; color: var(--muted); }
.flag[aria-pressed="true"] { border-color: var(--accent); color: var(--ink); background: var(--accent-soft); }
.flag.done { border-color: var(--personal); color: var(--personal); background: color-mix(in srgb, var(--personal) 12%, transparent); }

/* rituals */
.ritual { border: 1.5px solid var(--accent); background: linear-gradient(135deg, var(--accent-soft), var(--surface)); }
.ritual h2 { font-size: 20px; }

/* quick add */
.quick { display: flex; gap: 8px; }
.quick input { flex: 1; }
.quick .btn { flex: 0 0 auto; }

/* tasks */
.list { display: flex; flex-direction: column; gap: 6px; }
.task { --c: var(--work); display: grid; grid-template-columns: 30px 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 14px; background: var(--raised); border: 1px solid transparent; }
.task.personal { --c: var(--personal); }
.task.p1 { border-color: color-mix(in srgb, var(--t0) 45%, transparent); }
.check { width: 28px; height: 28px; border-radius: 9px; border: 2px solid var(--c); background: transparent; display: grid; place-items: center; padding: 0; color: #fff; }
.task.done .check { background: var(--c); }
.check svg { width: 16px; height: 16px; opacity: 0; }
.task.done .check svg { opacity: 1; }
.task-body { min-width: 0; border: 0; background: none; text-align: left; padding: 2px 0; }
.task-body b { display: block; font-weight: 700; font-size: 15px; line-height: 1.3; overflow-wrap: anywhere; }
.task.done .task-body b { text-decoration: line-through; color: var(--muted); }
.task-meta { display: flex; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--muted); font-weight: 700; margin-top: 1px; }
.task-meta .carried { color: var(--t1); }
.task-meta .area { color: var(--c); }
.star { border: 0; background: none; color: var(--line); font-size: 20px; padding: 4px; line-height: 1; }
.task.top .star { color: var(--accent); }
.group-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.group-head .count { font-size: 12px; font-weight: 800; color: var(--muted); }
.calm { padding: 12px 14px; border-radius: 14px; background: color-mix(in srgb, var(--personal) 12%, transparent); color: var(--ink); font-weight: 700; font-size: 14px; }
.timeline { display: flex; flex-direction: column; gap: 4px; }
.slot { display: grid; grid-template-columns: 48px 1fr; gap: 8px; align-items: baseline; font-size: 14px; }
.slot time { font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 13px; }
.slot.now time { color: var(--accent); }

/* week */
.weekbar { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; text-align: center; gap: 8px; }
.round { width: 44px; height: 44px; border-radius: 50%; border: 1.5px solid var(--line); background: var(--surface); padding: 0; display: grid; place-items: center; }
.days { display: flex; flex-direction: column; gap: 8px; }
.day { display: grid; grid-template-columns: 54px 1fr auto; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 16px; background: var(--raised); border: 1.5px solid transparent; text-align: left; width: 100%; }
.day.today { border-color: var(--accent); }
.day .dn { text-align: center; }
.day .dn b { display: block; font: 700 22px/1 var(--display); }
.day .dn small { font-size: 11px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.day .dinfo { min-width: 0; font-size: 13px; color: var(--muted); font-weight: 600; }
.day .dinfo .bars { display: flex; gap: 4px; margin-top: 5px; }
.bar { height: 6px; border-radius: 6px; background: var(--line); overflow: hidden; flex: 1; }
.bar i { display: block; height: 100%; }
.badge { min-width: 38px; text-align: center; font-weight: 800; font-size: 13px; padding: 4px 8px; border-radius: 999px; background: var(--line); color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.stat { background: var(--raised); border-radius: 14px; padding: 10px 12px; }
.stat b { display: block; font: 700 24px/1.1 var(--display); }
.stat span { font-size: 12px; font-weight: 700; color: var(--muted); }

/* body */
.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.photos button { aspect-ratio: 1; border: 0; padding: 0; border-radius: 12px; overflow: hidden; background: var(--raised); position: relative; }
.photos img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photos .tag { position: absolute; left: 6px; bottom: 6px; font-size: 10.5px; font-weight: 800; background: rgba(0, 0, 0, .55); color: #fff; border-radius: 999px; padding: 1px 7px; }
.chart { width: 100%; height: 150px; display: block; }
.big-num { font: 700 34px/1 var(--display); }
.delta { font-weight: 800; font-size: 13px; }
.delta.down { color: var(--personal); } .delta.up { color: var(--t1); }

/* score */
.verdict { font: 700 26px/1.15 var(--display); }
.bars14 { display: grid; grid-template-columns: repeat(14, 1fr); gap: 4px; align-items: end; height: 120px; }
.bars14 div { border-radius: 6px 6px 3px 3px; background: var(--line); min-height: 4px; position: relative; }
.bars14-days { display: grid; grid-template-columns: repeat(14, 1fr); gap: 4px; text-align: center; font-size: 10px; font-weight: 800; color: var(--muted); }
.badges { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.ach { display: flex; gap: 10px; align-items: center; padding: 10px; border-radius: 14px; background: var(--raised); opacity: .45; }
.ach.got { opacity: 1; background: var(--accent-soft); }
.ach .em { font-size: 26px; flex: 0 0 auto; }
.ach b { display: block; font-size: 13.5px; line-height: 1.2; }
.ach small { display: block; font-size: 11.5px; color: var(--muted); line-height: 1.3; }

/* sheet */
.sheet { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(5, 7, 12, .5); }
.sheet-card { position: relative; width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; background: var(--surface); border-radius: 24px 24px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 12px; box-shadow: 0 -10px 40px rgba(0, 0, 0, .3); animation: up .22s ease-out; }
@media (min-width: 700px) { .sheet { align-items: center; } .sheet-card { border-radius: 24px; } }
@keyframes up { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.steps { display: flex; gap: 6px; }
.steps i { flex: 1; height: 4px; border-radius: 4px; background: var(--line); }
.steps i.on { background: var(--accent); }
.pick { display: flex; flex-direction: column; gap: 6px; }
.pick-item { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 12px; background: var(--raised); }
.pick-item b { font-size: 14px; font-weight: 700; overflow-wrap: anywhere; }

.toast { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--bg); border-radius: 999px; padding: 10px 18px; font-weight: 700; font-size: 14px; box-shadow: var(--shadow); max-width: calc(100% - 32px); z-index: 80; text-align: center; }
.viewer { position: fixed; inset: 0; z-index: 90; background: rgba(0, 0, 0, .9); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 20px; color: #fff; }
.viewer img { max-width: 100%; max-height: 75vh; border-radius: 12px; }
@media (prefers-reduced-motion: reduce) { .sheet-card { animation: none; } }

/* ---------------------------------------------------------------- wide screens: tablet and computer */
.side { display: none; }
.cols { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.cols > div { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
@media (min-width: 980px) {
  body { padding-inline: 24px; }
  .app { max-width: 1480px; display: grid; grid-template-columns: 236px minmax(0, 1fr); grid-auto-rows: auto; column-gap: 28px; row-gap: 14px; align-items: start; padding-top: 22px; }
  .app > header.top, .demo-tag, .auth { grid-column: 1; }
  .auth { grid-column: 1 / -1; max-width: 460px; margin: 40px auto; width: 100%; }
  nav.tabs { grid-column: 1; position: sticky; top: 22px; background: var(--surface); }
  nav.tabs .inner { grid-template-columns: 1fr; gap: 4px; }
  nav.tabs button { flex-direction: row; gap: 12px; padding: 11px 14px; font-size: 14.5px; justify-content: flex-start; }
  .side { grid-column: 1; display: flex; flex-direction: column; gap: 12px; position: sticky; top: 260px; }
  #appBody > .tab { grid-column: 2; grid-row: 1 / span 30; }
  h1 { font-size: 34px; }
  .sheet-card { max-width: 620px; }
}
@media (max-width: 979px) { .cols, .grid3, .grid2 { grid-template-columns: minmax(0, 1fr); } }

/* sidebar */
.side .card { padding: 14px; }
.side .mini { display: flex; gap: 12px; align-items: center; }
.side .ring { width: 64px; height: 64px; } .side .ring > div { width: 50px; height: 50px; } .side .ring b { font-size: 19px; }
.side .mini h3 { font-size: 16px; line-height: 1.2; }
.kv { display: flex; justify-content: space-between; font-size: 13.5px; font-weight: 700; color: var(--muted); }
.kv b { color: var(--ink); }
.keys { font-size: 12px; color: var(--muted); line-height: 1.7; }
kbd { font: 700 11px var(--ui); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; background: var(--raised); color: var(--ink); }

/* the day planner: tasks as blocks on an hour grid */
.planner { position: relative; border-top: 1px solid var(--line); }
.hour { height: 52px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 46px 1fr; }
.hour time { font-size: 11.5px; font-weight: 800; color: var(--muted); padding-top: 3px; font-variant-numeric: tabular-nums; }
.hour button { border: 0; background: none; padding: 0; border-left: 1px dashed var(--line); }
.hour button:hover { background: var(--accent-soft); }
.pblock { --c: var(--work); position: absolute; left: 52px; right: 4px; border-radius: 10px; padding: 4px 9px; background: color-mix(in srgb, var(--c) 16%, var(--surface)); border-left: 4px solid var(--c); font-size: 13px; font-weight: 700; overflow: hidden; text-align: left; border-top: 0; border-right: 0; border-bottom: 0; color: var(--ink); }
.pblock.personal { --c: var(--personal); }
.pblock.done { opacity: .5; text-decoration: line-through; }
.pblock small { display: block; font-size: 11px; color: var(--muted); font-weight: 700; text-decoration: none; }
.nowline { position: absolute; left: 46px; right: 0; height: 2px; background: var(--accent); z-index: 2; pointer-events: none; }
.nowline::before { content: ""; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }

/* the week board */
.board { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; align-items: start; }
.col { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 260px; box-shadow: var(--shadow); }
.col.today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow); }
.col.over, .later-drop.over { background: var(--accent-soft); border-style: dashed; }
.col-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 6px; }
.col-head small { display: block; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.col-head b { font: 700 22px/1 var(--display); }
.col .toggles { display: flex; gap: 4px; }
.mini-flag { border: 1px solid var(--line); background: var(--raised); border-radius: 8px; padding: 2px 6px; font-size: 13px; line-height: 1.3; }
.mini-flag[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); }
.card-task { --c: var(--work); display: flex; gap: 7px; align-items: flex-start; padding: 7px 8px; border-radius: 10px; background: var(--raised); border-left: 3px solid var(--c); font-size: 13px; font-weight: 700; cursor: grab; text-align: left; border-top: 0; border-right: 0; border-bottom: 0; width: 100%; color: var(--ink); }
.card-task.personal { --c: var(--personal); }
.card-task.done { opacity: .55; text-decoration: line-through; }
.card-task.dragging { opacity: .35; }
.card-task span { min-width: 0; overflow-wrap: anywhere; }
.card-task em { font-style: normal; color: var(--muted); font-size: 11px; display: block; }
.col input { min-height: 36px; padding: 6px 9px; font-size: 13px; border-radius: 10px; }
.later-drop { border: 1.5px dashed var(--line); border-radius: 14px; padding: 10px; display: flex; flex-wrap: wrap; gap: 6px; min-height: 56px; }
.later-drop .card-task { width: auto; max-width: 260px; }
.big-num { white-space: nowrap; }
.grid3 .spread, .grid2 .spread { flex-wrap: wrap; }

/* priorities: P1 must finish, P2 important, P3 can wait */
.prio { flex: 0 0 auto; min-width: 38px; height: 30px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); font-size: 12px; font-weight: 800; padding: 0 8px; color: var(--muted); }
.prio.p1 { background: var(--t0); border-color: var(--t0); color: #fff; }
.prio.p2 { color: var(--work); border-color: color-mix(in srgb, var(--work) 50%, var(--line)); }
.prio.p3 { color: var(--muted); border-style: dashed; }
.task.p3 .task-body b { color: var(--muted); }
.prio-seg button { font-size: 12px; padding: 6px 6px; }
.prio-seg button[data-p="1"][aria-pressed="true"] { color: var(--t0); }
.prio-seg button[data-p="2"][aria-pressed="true"] { color: var(--work); }
.prio-chip.p1[aria-pressed="true"] { border-color: var(--t0); background: color-mix(in srgb, var(--t0) 14%, transparent); }
.card.must { border-color: color-mix(in srgb, var(--t0) 45%, var(--line)); }
