/* MyObjectives: one column, built for thumbs. Color means status; everything else is ink. */
:root {
  --paper: #f4f6f5;
  --surface: #ffffff;
  --surface-2: #eaeeec;
  --ink: #141c1a;
  --ink-2: #4b5755;
  --ink-3: #7d8886;
  --line: #d9e0dd;
  --accent: #0f6b66;        /* deep teal: progress, primary actions */
  --accent-ink: #ffffff;
  --accent-soft: #d6ebe8;
  --soon: #b8690a;          /* amber: due soon */
  --soon-soft: #fbead2;
  --over: #b53a32;          /* brick: overdue */
  --over-soft: #f8dcd9;
  --ok: #2d7a4f;            /* achieved */
  --ok-soft: #d9efe0;
  --ai: #5b4bb5;
  --ai-soft: #e6e1f7;
  --shadow: 0 1px 2px rgba(20, 28, 26, .06), 0 6px 20px rgba(20, 28, 26, .06);
  --r: 14px;
  --r-s: 8px;
  --tap: 44px;
  --pad: 16px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #101615;
    --surface: #182120;
    --surface-2: #212c2a;
    --ink: #eef2f0;
    --ink-2: #b7c1be;
    --ink-3: #7f8b88;
    --line: #2a3634;
    --accent: #3fb8ad;
    --accent-ink: #06201e;
    --accent-soft: #163f3c;
    --soon: #f0a847;
    --soon-soft: #3d2c12;
    --over: #ec7f76;
    --over-soft: #3f1f1c;
    --ok: #63c48b;
    --ok-soft: #173826;
    --ai: #a99af0;
    --ai-soft: #2a2546;
    --shadow: 0 1px 2px rgba(0,0,0,.4);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 15px/1.45 var(--font); font-variant-numeric: tabular-nums;
  min-height: 100dvh; padding-bottom: calc(64px + env(safe-area-inset-bottom));
}
body.login { padding-bottom: 0; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.01em; line-height: 1.2; }
h1 { font-size: 24px; } h2 { font-size: 17px; } h3 { font-size: 15px; }
p { margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
img { display: block; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--ink-2); }
.hidden, [hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Top bar */
.topbar { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); padding-top: env(safe-area-inset-top); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 52px; padding: 4px var(--pad); max-width: 720px; margin: 0 auto; }
.brand { font-weight: 700; font-size: 20px; letter-spacing: -0.02em; text-decoration: none; }
.topbar .back { display: inline-flex; align-items: center; gap: 2px; text-decoration: none; color: var(--ink-2); min-height: var(--tap); }
.iconbtn { display: inline-flex; align-items: center; justify-content: center; width: var(--tap); height: var(--tap); border-radius: 50%; border: 0; background: transparent; color: var(--ink); text-decoration: none; }
.iconbtn:active { background: var(--surface-2); }

.page { max-width: 720px; margin: 0 auto; padding: 8px var(--pad) 24px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--tap); padding: 0 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; font-weight: 600; cursor: pointer; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.danger { color: var(--over); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn.big { width: 100%; font-size: 17px; min-height: 52px; }
.btn:disabled { opacity: .55; }
.btn.block { width: 100%; }
.fab { position: fixed; right: 20px; bottom: calc(76px + env(safe-area-inset-bottom)); width: 56px; height: 56px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: flex; align-items: center; justify-content: center; box-shadow: 0 8px 24px rgba(15,107,102,.35); z-index: 4; }
.fab svg { width: 26px; height: 26px; stroke-width: 2.2; }

/* Chips */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 6px 0 12px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); text-decoration: none; display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.chip.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip b { font-weight: 600; opacity: .7; }

/* Cards */
.cards { display: grid; gap: 12px; padding-bottom: 72px; }  /* room under the floating button */
.card { background: var(--surface); border-radius: var(--r); padding: 14px var(--pad); box-shadow: var(--shadow); text-decoration: none; display: block; }
.card.quiet { box-shadow: none; border: 1px solid var(--line); background: transparent; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.card-head h2 { font-size: 17px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .meta { margin-top: 4px; color: var(--ink-2); font-size: 13px; display: flex; justify-content: space-between; gap: 8px; }
.card .meta .count { font-weight: 600; color: var(--ink); }
.card-foot { margin-top: 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 22px; }
.objective.soon .meta { color: var(--soon); }
.objective.over .meta { color: var(--over); }
.objective.achieved .meta { color: var(--ok); }

/* Runway: fill = tasks done, tick = share of time used */
.runway { position: relative; height: 6px; margin-top: 10px; border-radius: 3px; background: var(--surface-2); overflow: visible; }
.runway .fill { height: 100%; border-radius: 3px; background: var(--accent); transition: width .4s ease; }
.runway .tick { position: absolute; top: -4px; width: 2px; height: 14px; margin-left: -1px; border-radius: 1px; background: var(--ink-3); }
.objective.soon .runway .tick { background: var(--soon); }
.objective.over .runway .tick { background: var(--over); }
.objective.achieved .runway .fill { background: var(--ok); }
.objective.achieved .runway .tick, .objective.archived .runway .tick { display: none; }

/* Avatars and pills */
.avatars { display: flex; }
.avatar, .avatars img { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--surface); margin-left: -6px; background: var(--accent-soft); color: var(--accent); font-size: 10px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.avatars > :first-child { margin-left: 0; }
.avatar.more { background: var(--surface-2); color: var(--ink-2); }
.avatar.big { width: 56px; height: 56px; font-size: 20px; margin: 0; border: 0; }
.pill { display: inline-flex; align-items: center; min-height: 22px; padding: 0 8px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill.ai { background: var(--ai-soft); color: var(--ai); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.over { background: var(--over-soft); color: var(--over); }
.pill.soon { background: var(--soon-soft); color: var(--soon); }

/* Today strip */
.today { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 6px; scrollbar-width: none; }
.today::-webkit-scrollbar { display: none; }
.today-item { flex: none; width: 200px; background: var(--surface); border-radius: 12px; padding: 10px 12px; text-decoration: none; box-shadow: var(--shadow); }
.today-item .when { display: block; font-size: 12px; font-weight: 600; color: var(--accent); }
.today-item .when.over { color: var(--over); }
.today-item .what { display: block; margin-top: 2px; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.today-item.muted .when { color: var(--ink-3); }

/* Empty states and notices */
.empty { padding: 40px 12px; text-align: left; }
.empty h2 { font-size: 20px; }
.empty p { margin: 8px 0 16px; color: var(--ink-2); max-width: 36ch; }
.notice { padding: 10px 12px; border-radius: var(--r-s); background: var(--surface-2); color: var(--ink-2); margin: 10px 0; }
.notice.warn { background: var(--over-soft); color: var(--over); }
.notice.ok { background: var(--ok-soft); color: var(--ok); }

/* Forms */
.form { display: grid; gap: 14px; }
.form label { display: grid; gap: 6px; font-size: 13px; color: var(--ink-2); font-weight: 600; }
.form input:not([type=checkbox]), .form select, .form textarea, .row input {
  width: 100%; min-height: var(--tap); padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); font-size: 16px; }
.form textarea { min-height: 88px; resize: vertical; }
.form .check { grid-template-columns: auto 1fr; align-items: center; font-size: 15px; color: var(--ink); font-weight: 500; }
.form .check input { width: 22px; height: 22px; margin: 0; accent-color: var(--accent); }
.form .hint { font-size: 13px; color: var(--ink-3); font-weight: 400; }
.form .toggle { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 15px; color: var(--ink); font-weight: 500; }
.form .toggle input { width: 22px; height: 22px; accent-color: var(--accent); }
.row { display: flex; gap: 8px; }
.row > * { flex: 1; }
.row > .btn { flex: none; }

/* Login hero */
.hero { padding: 24px 0 40px; max-width: 520px; }
.hero h1 { font-size: 34px; line-height: 1.1; letter-spacing: -0.02em; margin: 20px 0 12px; }
.lede { color: var(--ink-2); font-size: 16px; line-height: 1.5; margin-bottom: 24px; max-width: 42ch; }
.hero-mark { display: flex; gap: 6px; align-items: flex-end; height: 44px; }
.hero-mark span { width: 14px; border-radius: 4px; background: var(--accent); }
.hero-mark span:nth-child(1) { height: 40%; opacity: .45; }
.hero-mark span:nth-child(2) { height: 70%; opacity: .7; }
.hero-mark span:nth-child(3) { height: 100%; }
.devlogin { margin-top: 28px; padding-top: 20px; border-top: 1px dashed var(--line); display: grid; gap: 8px; }
.devlogin label { font-size: 13px; color: var(--ink-3); font-weight: 600; }
.standalone-note { margin-top: 16px; font-size: 13px; color: var(--ink-3); }

/* Profile */
.profile-head { display: flex; align-items: center; gap: 14px; padding: 8px 0 16px; }
.signout { margin-top: 24px; }

/* Tab bar */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 56px; text-decoration: none; color: var(--ink-3); font-size: 11px; font-weight: 600; }
.tabbar a[aria-current] { color: var(--accent); }

/* Bottom sheet */
.sheet { border: 0; padding: 0; margin: 0; width: 100%; max-width: 100%; max-height: 92dvh; position: fixed; inset: auto 0 0 0; background: var(--surface); color: var(--ink); border-radius: 18px 18px 0 0; box-shadow: 0 -8px 40px rgba(0,0,0,.25); }
.sheet::backdrop { background: rgba(10, 16, 15, .45); }
.sheet-body { padding: 8px var(--pad) calc(16px + env(safe-area-inset-bottom)); overflow-y: auto; max-height: 92dvh; }
.sheet-body::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 4px auto 14px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.sheet-head h2 { font-size: 19px; }
@media (min-width: 720px) { .sheet { max-width: 520px; margin: 0 auto; border-radius: 18px; inset: auto 0 24px 0; } }

/* htmx states */
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; display: inline-block; }
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline-block; }
.htmx-request .hide-while-loading { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation-duration: .01ms !important; } }

/* Objective detail */
.page-title { font-size: 26px; margin: 8px 0 6px; }
.lede-s { margin-bottom: 16px; max-width: 44ch; }
.obj-head { display: grid; grid-template-columns: 64px 1fr; gap: 14px; align-items: center; padding: 8px 0 14px; }
.obj-head h1 { font-size: 22px; }
.obj-head .meta { margin-top: 4px; color: var(--ink-2); font-size: 13px; display: flex; flex-wrap: wrap; gap: 4px 12px; }
.obj-head .meta .count { color: var(--ink); font-weight: 600; }
.obj-head.soon .meta { color: var(--soon); }
.obj-head.over .meta { color: var(--over); }
.obj-head.achieved .meta { color: var(--ok); }
.ring { position: relative; width: 64px; height: 64px; }
.ring svg { width: 64px; height: 64px; transform: rotate(-90deg); }
.ring .track { stroke: var(--surface-2); stroke-width: 5; }
.ring .arc { stroke: var(--accent); stroke-width: 5; stroke-linecap: round; transition: stroke-dasharray .5s ease; }
.achieved .ring .arc { stroke: var(--ok); }
.ring .pct { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px; }
.ring .pct small { font-size: 10px; font-weight: 600; margin-left: 1px; }
.banner { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: var(--r-s); background: var(--surface-2); color: var(--ink-2); font-weight: 500; }
.banner.ok { background: var(--ok-soft); color: var(--ok); }

.tasks { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); padding: 4px 0; }
.tasklist { list-style: none; margin: 0; padding: 0; }
.task { display: flex; align-items: center; gap: 4px; min-height: 52px; padding: 2px 8px 2px 10px; border-bottom: 1px solid var(--line); }
.task:last-child { border-bottom: 0; }
.task .tick { flex: none; display: flex; align-items: center; justify-content: center; width: var(--tap); height: var(--tap); margin: 0; }
.task .tick input { width: 26px; height: 26px; margin: 0; accent-color: var(--accent); border-radius: 50%; }
.task .tick.static { color: var(--ok); font-weight: 700; }
.task-main { flex: 1; text-align: left; background: none; border: 0; padding: 8px 6px; min-height: var(--tap); display: grid; gap: 2px; }
.task .title { font-size: 15px; line-height: 1.3; }
.task.done .title { color: var(--ink-3); text-decoration: line-through; text-decoration-color: var(--ink-3); }
.task .sub { display: flex; gap: 6px; align-items: center; min-height: 0; }
.task .sub:empty { display: none; }
.task .sub .avatar { margin: 0; width: 20px; height: 20px; font-size: 9px; border: 0; }
.task.over .title { color: var(--over); }
.addtask { display: flex; gap: 8px; padding: 8px 10px 8px; border-top: 1px solid var(--line); }
.addtask input { flex: 1; min-height: var(--tap); padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--paper); font-size: 16px; }
.empty-s { padding: 14px 16px; }

.research { margin: 14px 0; }
.jobstatus { display: flex; align-items: center; gap: 10px; min-height: var(--tap); padding: 10px 14px; border-radius: 12px; background: var(--ai-soft); color: var(--ai); font-weight: 600; }
.jobstatus.failed { background: var(--over-soft); color: var(--over); }
.jobstatus.done { background: var(--ok-soft); color: var(--ok); }
.jobstatus form { margin-left: auto; }

.members, .why, .reminders, .suggestions { margin-top: 20px; }
.members h3, .why h3, .reminders h3, .suggestions h3 { font-size: 13px; color: var(--ink-3); font-weight: 600; margin-bottom: 8px; }
.people { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 6px; }
.people li { display: flex; align-items: center; gap: 10px; min-height: 32px; }
.people .avatar, .people img.avatar { margin: 0; width: 28px; height: 28px; font-size: 11px; border: 0; }
.people .role { margin-left: auto; font-size: 13px; }
.why p { color: var(--ink-2); white-space: pre-line; }
.menu { display: grid; gap: 10px; }
.sheet-actions { display: grid; gap: 8px; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.sources { margin: 0; padding-left: 18px; font-size: 14px; }
.sources a { color: var(--accent); }

/* Suggestions */
.tray-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.tray-head h3 { margin: 0; }
.suglist { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.sug { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); padding: 12px 14px; border-left: 3px solid var(--ai); }
.sug-title { font-weight: 600; }
.sug-kind { font-size: 12px; color: var(--ai); font-weight: 600; margin-top: 2px; }
.sug-details { margin-top: 4px; color: var(--ink-2); font-size: 14px; }
.sug-why { margin-top: 4px; color: var(--ink-3); font-size: 13px; }
.sug-sources { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px 10px; font-size: 13px; }
.sug-sources a { color: var(--accent); }
.sug-actions { display: flex; gap: 8px; margin-top: 10px; }
.findings { margin-top: 12px; background: var(--surface); border-radius: var(--r); padding: 10px 14px; box-shadow: var(--shadow); }
.findings summary { cursor: pointer; font-weight: 600; color: var(--ink-2); min-height: 28px; display: flex; align-items: center; }
.findings-text { margin-top: 8px; display: grid; gap: 8px; color: var(--ink-2); font-size: 14px; }

/* Sharing and the dev outbox */
.sheet-sub { font-size: 13px; color: var(--ink-3); font-weight: 600; margin: 18px 0 8px; }
.people li form { margin-left: auto; }
.people li .role + form { margin-left: 8px; }
.row-actions { display: flex; gap: 8px; }
.outbox { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
.outbox-row a { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; padding: 10px 12px; background: var(--surface); border-radius: var(--r-s); text-decoration: none; font-size: 14px; }
.outbox-row .kind { font-weight: 600; }
.email-preview { margin-top: 12px; border: 1px solid var(--line); border-radius: var(--r-s); overflow: hidden; }
.email-text { white-space: pre-wrap; font-size: 13px; color: var(--ink-2); }

/* Reminders and the calendar */
.remlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.rem { display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; align-items: center; background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); padding: 10px 8px 10px 14px; }
.rem-when { grid-column: 1; font-size: 12px; font-weight: 700; color: var(--accent); }
.rem-body { grid-column: 1; }
.rem-title { font-weight: 600; }
.rem-obj { display: block; font-size: 13px; color: var(--ink-2); text-decoration: none; margin-top: 2px; }
.rem-people { display: flex; margin-top: 6px; }
.rem-people .avatar { margin: 0 0 0 -4px; width: 20px; height: 20px; font-size: 9px; }
.rem-people .avatar:first-child { margin-left: 0; }
.rem-actions { grid-column: 2; grid-row: 1 / span 2; display: flex; }
.cal-day { margin-bottom: 18px; }
.cal-day h2 { font-size: 13px; color: var(--ink-3); font-weight: 600; margin: 10px 0 8px; }
.people-pick { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
.people-pick legend { font-size: 13px; color: var(--ink-2); font-weight: 600; margin-bottom: 6px; padding: 0; }

/* Drafts */
.handoff { flex-wrap: wrap; }
.handoff > * { flex: 1 1 auto; }
.drafts { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.drafts li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
