:root {
  --bg: #ECEFF2;
  --surface: #FCFCFB;
  --surface-2: #F4F6F8;
  --ink: #18202A;
  --ink-2: #4A5866;
  --muted: #6E7C89;
  --line: #D3DAE0;
  --track: #E2E7EB;
  --over: #C2342F;
  --focus: #2F5BEA;

  --c-health: #00977F;
  --c-sport: #2F5BEA;
  --c-business: #B07800;
  --c-mental: #8E44AD;
  --c-social: #D6407A;

  --radius-sheet: 22px;
  --radius-row: 14px;
  --radius-chip: 999px;
  --shadow-sheet: 0 -8px 40px rgba(24, 32, 42, 0.18);

  --font: 'Schibsted Grotesk', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --tab-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11161C;
    --surface: #1A2129;
    --surface-2: #212A33;
    --ink: #E8EDF1;
    --ink-2: #B5C0CA;
    --muted: #8795A2;
    --line: #2E3944;
    --track: #2A343E;
    --over: #F0655E;
    --focus: #7D9BFF;
    --c-health: #14A08E;
    --c-sport: #5A7CF0;
    --c-business: #BC8708;
    --c-mental: #A85AB0;
    --c-social: #DE5A8A;
    --shadow-sheet: 0 -8px 40px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
/* links keep the text colour (the browser's default blue is hard to read on dark) */
a { color: var(--ink); }
.hint a { color: var(--ink-2); font-weight: 600; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100dvh;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

.app {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 12px) 16px calc(var(--tab-h) + env(safe-area-inset-bottom) + 24px);
}

/* ---------- Header: date + period ---------- */
.top { display: flex; align-items: center; gap: 8px; margin: 4px 0 14px; }
.top h1 {
  flex: 1;
  margin: 0;
  font-size: 30px;
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.top h1 small { display: block; font-size: 14px; font-weight: 500; color: var(--muted); letter-spacing: 0; margin-top: 4px; }
.icon-btn {
  width: 40px; height: 40px;
  display: inline-grid; place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
}
.icon-btn:disabled { opacity: 0.35; cursor: default; }
.icon-btn svg { width: 18px; height: 18px; }

.periods {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--track);
  border-radius: 12px;
  padding: 3px;
  margin-bottom: 18px;
}
.periods button {
  border: 0;
  background: transparent;
  padding: 8px 0;
  border-radius: 9px;
  font-weight: 600;
  font-size: 15px;
  color: var(--ink-2);
}
.periods button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }

/* ---------- The strip: one segment per goal in this period ---------- */
.strip { margin-bottom: 26px; }
.strip-bar { display: flex; gap: 3px; height: 34px; }
.strip-seg {
  flex: 1;
  border-radius: 4px;
  background: var(--track);
  position: relative;
  overflow: hidden;
  border: 0;
  padding: 0;
}
.strip-seg .fill { position: absolute; left: 0; bottom: 0; right: 0; background: var(--cat); opacity: 0.35; }
.strip-seg.done .fill { opacity: 1; }
.strip-seg.over { background: repeating-linear-gradient(135deg, var(--over) 0 3px, transparent 3px 7px); }
.strip-seg.over .fill { display: none; }
.strip-seg:first-child { border-top-left-radius: 9px; border-bottom-left-radius: 9px; }
.strip-seg:last-child { border-top-right-radius: 9px; border-bottom-right-radius: 9px; }
.strip-caption { display: flex; justify-content: space-between; margin-top: 8px; font-size: 14px; color: var(--ink-2); }
.strip-caption b { color: var(--ink); font-weight: 700; }

/* ---------- Goal rows ---------- */
.group { margin-bottom: 22px; }
.group h2 {
  display: flex; align-items: center; gap: 8px;
  font-size: 15px; font-weight: 700; margin: 0 0 8px 2px; color: var(--ink-2);
}
.group h2::before { content: ''; width: 10px; height: 10px; border-radius: 3px; background: var(--cat); }
.rows { background: var(--surface); border-radius: var(--radius-row); border: 1px solid var(--line); }
.row { display: flex; align-items: center; gap: 12px; padding: 14px 14px 14px 16px; }
.row + .row { border-top: 1px solid var(--line); }
.row-main { flex: 1; min-width: 0; text-align: left; background: none; border: 0; padding: 0; }
.row-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.row-title .dot { display: inline-block; width: 9px; height: 9px; border-radius: 3px; background: var(--cat); margin-right: 7px; vertical-align: 1px; }
.row-tag { font-weight: 500; font-size: 13px; color: var(--muted); margin-left: 8px; }
.row-title { font-weight: 600; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-value { font-size: 15px; white-space: nowrap; color: var(--ink-2); }
.row-value b { color: var(--ink); font-weight: 700; font-size: 17px; }
.row-status { font-size: 13px; color: var(--muted); margin-top: 6px; display: flex; gap: 10px; }
.row-status .st-done { color: var(--ink); font-weight: 600; }
.row-status .st-over { color: var(--over); font-weight: 600; }
.row-status .st-behind { color: var(--ink-2); font-weight: 600; }

.bar { position: relative; height: 8px; background: var(--track); border-radius: 4px; margin-top: 8px; }
.bar .fill { position: absolute; inset: 0 auto 0 0; background: var(--cat); border-radius: 4px; }
.bar.over .fill { background: var(--over); }
.bar .pace { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink); border-radius: 1px; }
.bar .limit { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink); border-radius: 1px; }

.log-btn {
  flex: none;
  min-width: 52px; height: 40px; padding: 0 12px;
  border-radius: 12px;
  border: 1.5px solid var(--cat);
  background: transparent;
  color: var(--ink);
  font-weight: 700;
  font-size: 15px;
}
.log-btn:active { background: var(--cat); color: #fff; }

.empty { text-align: center; padding: 40px 16px; color: var(--ink-2); }
.empty h2 { color: var(--ink); font-size: 20px; margin: 0 0 6px; }
.empty p { margin: 0 0 18px; }

/* ---------- Buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 46px; padding: 0 18px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-weight: 600;
}
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.btn.danger { color: var(--over); }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.5; }
.btn-row { display: flex; gap: 10px; margin-top: 18px; }
.btn-row .btn { flex: 1; }

label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; color: var(--ink-2); }
.input, select.input, textarea.input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 16px;
}
textarea.input { height: auto; min-height: 70px; padding: 10px 14px; }
.input-unit { position: relative; }
.input-unit .unit { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hint { font-size: 13px; color: var(--muted); margin: -6px 0 14px; }

.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius-chip);
  padding: 7px 13px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-2);
}
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.seg button .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--cat); margin-right: 6px; vertical-align: 1px; }

.sentence {
  background: var(--surface-2);
  border-radius: 12px;
  padding: 12px 14px;
  margin: 4px 0 16px;
  font-size: 15px;
  color: var(--ink-2);
}
.sentence b { color: var(--ink); }

.templates { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin: 0 -16px 16px; padding-left: 16px; padding-right: 16px; scrollbar-width: none; }
.templates button {
  flex: none;
  text-align: left;
  border: 1px solid var(--line);
  border-left: 4px solid var(--cat);
  background: var(--surface);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 14px;
  max-width: 200px;
}

/* ---------- Bottom tabs ---------- */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: center;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 20;
}
.tabs nav { display: grid; grid-template-columns: repeat(5, 1fr); width: 100%; max-width: 560px; }
.tabs a {
  height: var(--tab-h);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  text-decoration: none; color: var(--muted); font-size: 12px; font-weight: 600;
}
.tabs a svg { width: 22px; height: 22px; }
.tabs a[aria-current="page"] { color: var(--ink); }

/* ---------- Sheets ---------- */
.scrim { position: fixed; inset: 0; background: rgba(10, 14, 20, 0.45); z-index: 40; opacity: 0; transition: opacity .2s; }
.scrim.open { opacity: 1; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0;
  margin: 0 auto;
  max-width: 560px;
  max-height: 92dvh;
  overflow-y: auto;
  background: var(--bg);
  border-radius: var(--radius-sheet) var(--radius-sheet) 0 0;
  box-shadow: var(--shadow-sheet);
  z-index: 50;
  padding: 10px 16px calc(env(safe-area-inset-bottom) + 20px);
  transform: translateY(100%);
  transition: transform .25s cubic-bezier(.2,.8,.2,1), visibility 0s linear .25s;
}
.sheet.open { transform: none; transition: transform .25s cubic-bezier(.2,.8,.2,1), visibility 0s; }
.sheet[aria-hidden="true"] { visibility: hidden; }
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 12px; }
.sheet-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 14px; }
.sheet-head h2 { flex: 1; margin: 0; font-size: 22px; line-height: 1.2; font-weight: 800; letter-spacing: -0.01em; }
.sheet-head h2 small { display: block; font-size: 14px; color: var(--muted); font-weight: 500; letter-spacing: 0; margin-top: 3px; }

/* Goal detail */
.big { display: flex; align-items: baseline; gap: 8px; margin: 4px 0 2px; }
.big b { font-size: 44px; line-height: 1; font-weight: 800; letter-spacing: -0.03em; }
.big span { color: var(--ink-2); }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 16px 0; }
.facts div { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.facts dt { font-size: 13px; color: var(--muted); }
.facts dd { margin: 2px 0 0; font-weight: 700; font-size: 17px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-row); padding: 14px; margin-bottom: 14px; }
.card h3 { margin: 0 0 10px; font-size: 15px; font-weight: 700; }
.card p { margin: 0 0 10px; color: var(--ink-2); font-size: 15px; }
.card p:last-child { margin-bottom: 0; }

.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .axis text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .target { stroke: var(--ink); stroke-width: 1.5; stroke-dasharray: 4 3; }
.chart .target-label { fill: var(--ink-2); font-size: 11px; font-weight: 600; font-family: var(--font); }
.tip {
  position: absolute; pointer-events: none;
  background: var(--ink); color: var(--surface);
  font-size: 13px; padding: 5px 9px; border-radius: 8px; white-space: nowrap;
  transform: translate(-50%, calc(-100% - 8px));
}

.entries { list-style: none; margin: 0; padding: 0; }
.entries li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 15px; }
.entries li:first-child { border-top: 0; }
.entries .e-main { flex: 1; min-width: 0; }
.entries .e-sub { font-size: 13px; color: var(--muted); }
.entries .e-val { font-weight: 700; }
.entries .del { border: 0; background: none; color: var(--muted); padding: 6px; border-radius: 8px; }
.entries .del svg { width: 18px; height: 18px; display: block; }
.date-head { font-size: 14px; font-weight: 700; color: var(--ink-2); margin: 18px 0 6px 2px; }

.source { display: flex; gap: 12px; align-items: flex-start; }
.source .badge { width: 10px; height: 10px; border-radius: 50%; margin-top: 7px; flex: none; background: var(--line); }
.source .badge.on { background: var(--c-health); }
.source .badge.err { background: var(--over); }
code, .mono { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: 13px; background: var(--surface-2); padding: 2px 6px; border-radius: 6px; word-break: break-all; }
ol.steps { margin: 0; padding-left: 20px; color: var(--ink-2); font-size: 15px; }
ol.steps li { margin-bottom: 6px; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 14px);
  transform: translate(-50%, 20px); opacity: 0;
  background: var(--ink); color: var(--surface);
  padding: 10px 10px 10px 16px; border-radius: 12px;
  display: flex; align-items: center; gap: 14px;
  font-size: 15px; z-index: 60; transition: all .2s; max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast button { background: none; border: 0; color: var(--surface); font-weight: 700; text-decoration: underline; padding: 4px 6px; }

/* login */
.login { max-width: 360px; margin: 18vh auto 0; }
.login h1 { font-size: 34px; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 6px; }
.login p { color: var(--ink-2); margin: 0 0 24px; }
.login .strip-bar { margin-bottom: 28px; height: 14px; }
.error { color: var(--over); font-size: 14px; margin: -4px 0 12px; }

.page-title { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; margin: 4px 0 16px; line-height: 1.1; }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 18px; }
.toolbar .btn { flex: none; }
.pill { font-size: 12px; font-weight: 600; color: var(--ink-2); background: var(--surface-2); border-radius: 6px; padding: 2px 7px; }
.hidden { display: none !important; }

/* accounts & friends */
label.check { display: flex; gap: 10px; align-items: flex-start; margin: 4px 0 16px; font-size: 14px; color: var(--ink-2); cursor: pointer; }
label.check input { width: 20px; height: 20px; margin: 1px 0 0; flex: none; accent-color: var(--ink); }
label.check a, .switch a { color: var(--ink); font-weight: 600; }
.switch { text-align: center; margin-top: 18px; color: var(--ink-2); font-size: 15px; }
.code-input { font-size: 24px; letter-spacing: 6px; text-align: center; font-variant-numeric: tabular-nums; }
.login .hint a { color: var(--ink); font-weight: 600; }
.copy-row { display: flex; gap: 8px; }
.copy-row .input { flex: 1; min-width: 0; font-size: 14px; }
.link-btn { background: none; border: 0; color: var(--muted); font-size: 14px; font-weight: 600; padding: 4px 6px; }
.friend-head { display: flex; align-items: baseline; justify-content: space-between; margin: 0 0 8px 2px; }
.friend-head h2.friend-name { margin: 0; font-size: 18px; color: var(--ink); }
.friend-head h2.friend-name::before { display: none; }
.muted { color: var(--muted); margin: 0 2px; font-size: 15px; }
a.btn { text-decoration: none; color: inherit; }
.btn-row .btn { white-space: nowrap; padding: 0 12px; font-size: 15px; }

/* ---------- admin (owner only) ---------- */
.app.wide { max-width: 1100px; }
.admin-h { font-size: 18px; font-weight: 800; margin: 22px 0 10px; }
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
@media (min-width: 760px) { .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-row); padding: 12px 14px; min-width: 0; }
.kpi-label { font-size: 13px; color: var(--ink-2); font-weight: 600; }
.kpi-value { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; margin-top: 2px; }
.kpi-sub { font-size: 12px; color: var(--muted); margin-top: 2px; line-height: 1.35; }
.admin-grid { display: grid; grid-template-columns: 1fr; gap: 0 14px; }
@media (min-width: 760px) { .admin-grid { grid-template-columns: 1fr 1fr; } .admin-grid.three { grid-template-columns: 1fr 1fr 1fr; } }
.vbars { display: flex; align-items: flex-end; gap: 2px; height: 120px; border-bottom: 1px solid var(--line); }
.vbar { flex: 1; min-width: 0; height: 100%; justify-content: center; display: flex; align-items: flex-end; position: relative; cursor: default; outline-offset: 0; }
.vbar i { display: block; width: 100%; max-width: 28px; background: var(--c-sport); border-radius: 4px 4px 0 0; }
.vbar:hover i, .vbar:focus i { background: var(--ink); }
.vbar:hover::after, .vbar:focus::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--bg); font-size: 12px; padding: 4px 8px; border-radius: 6px; white-space: nowrap; z-index: 5; pointer-events: none;
}
.vbars-axis { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 6px; }
.hbars { display: grid; gap: 8px; }
.hbar { display: grid; grid-template-columns: 110px 1fr 36px; align-items: center; gap: 8px; font-size: 14px; }
.hbar-label { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { height: 8px; background: var(--track); border-radius: 4px; overflow: hidden; }
.hbar-track i { display: block; height: 100%; background: var(--ink-2); border-radius: 4px; }
.hbar-n { text-align: right; font-weight: 600; }
.admin-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 10px; }
.admin-tools .input { flex: 1; min-width: 200px; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-row); }
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table caption { caption-side: bottom; text-align: left; padding: 10px 12px; font-size: 13px; color: var(--muted); }
.admin-table th, .admin-table td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.admin-table th button { background: none; border: 0; padding: 0; font-weight: 700; color: var(--ink-2); font-size: 13px; }
.admin-table td.num { text-align: right; }
.admin-table .muted { color: var(--muted); }
.admin-table .tag { font-size: 11px; padding: 1px 6px; border-radius: 999px; background: var(--surface-2); color: var(--muted); margin-left: 4px; }
.vbar.tip-r:hover::after, .vbar.tip-r:focus::after { left: auto; right: 0; transform: none; }
.vbar.tip-l:hover::after, .vbar.tip-l:focus::after { left: 0; transform: none; }
.chart-note { font-size: 12px !important; color: var(--muted) !important; margin: 8px 0 0 !important; line-height: 1.4; }

/* ---------- goals with an end date ---------- */
.field-label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; color: var(--ink-2); }
.run-label { color: var(--ink-2); font-weight: 600; }
.section-h { font-size: 15px; font-weight: 700; margin: 22px 0 8px 2px; color: var(--ink-2); }
.result-card, .note-card { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--cat); border-radius: var(--radius-row); padding: 14px; margin-bottom: 12px; }
.result-card h3, .note-card h3 { margin: 0; font-size: 16px; }
.result-card p, .note-card p { margin: 4px 0 0; color: var(--ink-2); font-size: 15px; }
.result-top { display: flex; gap: 12px; align-items: center; }
.result-badge { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--cat); color: #fff; font-weight: 800; font-size: 18px; }
.result-card.big { background: color-mix(in srgb, var(--cat) 10%, var(--surface)); }
.result-card.big .result-badge { width: 44px; height: 44px; font-size: 22px; animation: pop .5s ease-out; }
@keyframes pop { 0% { transform: scale(.4); opacity: 0; } 70% { transform: scale(1.12); } 100% { transform: scale(1); opacity: 1; } }
.result-card .btn-row, .note-card .btn-row { flex-wrap: wrap; }
.result-card .btn-row .btn, .note-card .btn-row .btn { flex: 1 1 auto; }

/* ---------- guided goal setup ---------- */
.steps { display: flex; gap: 4px; margin: -4px 0 16px; }
.steps i { flex: 1; height: 4px; border-radius: 2px; background: var(--track); }
.steps i.on { background: var(--ink); }
.guided.anim { animation: stepIn .22s ease-out; }
@keyframes stepIn { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
.q { font-size: 22px; font-weight: 800; letter-spacing: -0.01em; margin: 0 0 12px; }
.type-box { position: relative; display: flex; gap: 8px; }
.type-box .input { flex: 1; }
.type-ph { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; font-size: 16px; transition: opacity .25s; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: calc(100% - 90px); }
.type-ph.out { opacity: 0; }
.pick-group h4 { font-size: 13px; font-weight: 700; color: var(--ink-2); margin: 16px 0 6px; }
.pick-group h4 .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--cat); margin-right: 6px; }
.pick { display: flex; flex-wrap: wrap; gap: 6px; }
.pick button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 8px 12px; font-size: 15px; }
.pick button[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.big-choices { display: grid; gap: 8px; }
.big-choices button { text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-row); padding: 14px 16px; font-size: 17px; font-weight: 600; }
.big-choices button small { display: block; font-size: 13px; font-weight: 400; color: var(--muted); margin-top: 2px; }
.big-choices button[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.big-input { font-size: 24px; height: 56px; }
.guided-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 18px; }
.link-btn { background: none; border: 0; color: var(--ink); font-weight: 600; font-size: 15px; padding: 10px 0; text-decoration: underline; text-underline-offset: 3px; }
.summary-sentence { font-size: 17px; margin-bottom: 16px; }
@media (prefers-reduced-motion: reduce) { .guided.anim { animation: none; } }

/* ---------- Hit/miss grid (goal detail) ---------- */
.grid-chart svg { display: block; width: 100%; height: auto; }
.grid-chart .axis text { fill: var(--muted); font-size: 9px; font-family: var(--font); }
.gc { fill: var(--track); }
.gc.hit { fill: var(--cat); }
.gc.over { fill: var(--over); }
.gc.open { fill: var(--surface); stroke: var(--cat); stroke-width: 1.5; }
.gc.before { fill: var(--surface-2); }
.chart-note .legend { display: inline-flex; gap: 6px; align-items: center; margin-left: 8px; white-space: nowrap; }
.chart-note .legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2.5px; background: var(--track); margin-left: 4px; }
.chart-note .legend i.hit { background: var(--cat); }
.chart-note .legend i.over { background: var(--over); }
button.link { background: none; border: 0; padding: 0; color: var(--ink); font-weight: 600; text-decoration: underline; }

/* ---------- Wide screens (desktop website) ---------- */
@media (min-width: 1100px) {
  body { padding-left: 232px; transition: padding-right .25s; }
  body.no-tabs { padding-left: 0; }
  body.panel { padding-right: 560px; }
  .app { max-width: 1320px; padding: 28px 32px 48px; }
  .app.wide { max-width: 1320px; }
  .app:not(.roomy) { max-width: 760px; }
  .tabs { top: 0; right: auto; width: 232px; border-top: 0; border-right: 1px solid var(--line); flex-direction: column; justify-content: flex-start; padding: 28px 12px; }
  .tabs::before { content: 'Diemly'; display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 22px; letter-spacing: -0.3px; padding: 0 12px 24px; color: var(--ink);
    line-height: 30px; background: url(/icon.svg) left top / 30px 30px no-repeat; padding-left: 42px; margin-left: 12px; }
  .tabs nav { display: flex; flex-direction: column; gap: 2px; max-width: none; }
  .tabs a { height: 44px; flex-direction: row; justify-content: flex-start; gap: 12px; padding: 0 12px; border-radius: 10px; font-size: 15px; }
  .tabs a:hover { background: var(--surface-2); }
  .tabs a[aria-current="page"] { background: var(--surface); box-shadow: 0 0 0 1px var(--line) inset; }

  /* sheets become a panel docked on the right, so the list stays visible next to it */
  .scrim { background: transparent; pointer-events: none; }
  .sheet { top: 0; left: auto; right: 0; bottom: 0; width: 560px; max-width: 560px; max-height: none; height: 100dvh; margin: 0;
    border-radius: 0; border-left: 1px solid var(--line); box-shadow: -12px 0 40px rgba(10, 14, 20, 0.12); transform: translateX(100%); padding: 24px 24px 32px; }
  .sheet .grab { display: none; }

  .wide-top { margin: 0 0 22px; }
  .wide-top h1 { max-width: none; font-size: 34px; }
  .wide-top .btn { width: auto; }
  .cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 20px; align-items: start; margin-bottom: 32px; }
  .col-head { display: flex; align-items: baseline; justify-content: space-between; margin: 0 2px 10px; }
  .col-head h2 { margin: 0; font-size: 19px; }
  .col-head span { font-size: 14px; color: var(--ink-2); }
  .col-head b { color: var(--ink); }
  .strip-bar.mini { height: 14px; margin-bottom: 12px; }
  .strip-bar.mini .strip-seg:first-child { border-radius: 5px 3px 3px 5px; }
  .strip-bar.mini .strip-seg:last-child { border-radius: 3px 5px 5px 3px; }
  .col-empty { color: var(--muted); font-size: 15px; padding: 18px 16px; border: 1px dashed var(--line); border-radius: var(--radius-row); }
  .rows.two { display: grid; grid-template-columns: 1fr 1fr; }
  .rows.two .row + .row { border-top: 0; }
  .rows.two .row:nth-child(n+3) { border-top: 1px solid var(--line); }
  .rows.two .row:nth-child(even) { border-left: 1px solid var(--line); }
  .group.pinned h2::before { display: none; }

  .section-title { font-size: 21px; margin: 0 0 14px; }
  .section-title small { font-size: 14px; font-weight: 500; color: var(--muted); margin-left: 8px; }
  .trend-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
  .trend { margin: 0; }
  .trend h3 { display: flex; align-items: center; gap: 8px; }
  .trend h3::before { content: ''; width: 10px; height: 10px; border-radius: 3px; background: var(--cat); }
  .trend-num { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
  .trend-num b { font-size: 26px; letter-spacing: -0.5px; }
  .trend-num span { font-size: 13px; color: var(--muted); line-height: 1.3; }
  .trend-num { flex-direction: column; gap: 0; }
}
@media (min-width: 1800px) { .cols { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1100px) and (max-width: 1700px) { body.panel .cols { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { body { transition: none; } }

/* collapsible card (Account › Change password) */
.expander summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; }
.expander summary::-webkit-details-marker { display: none; }
.expander summary h3 { margin: 0; }
/* a clear chevron (drawn, so it's the same size everywhere), turns when open */
.expander summary::after { content: ''; width: 9px; height: 9px; margin: -4px 4px 0 12px; border-right: 2.5px solid var(--ink-2); border-bottom: 2.5px solid var(--ink-2); transform: rotate(45deg); transition: transform .15s; flex: none; }
.expander[open] summary::after { transform: rotate(-135deg); margin-top: 4px; }
.expander[open] summary { margin-bottom: 12px; }
.feedback-card a.btn { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }

/* Sign in with Apple (website) */
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; margin: 14px 0; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.apple-btn { background: #000; color: #fff; border-color: #000; gap: 8px; }
#appleBox { margin-bottom: 22px; } /* room before "Already have an account?" */
@media (prefers-color-scheme: dark) { .apple-btn { background: #fff; color: #000; border-color: #fff; } }

/* ---------- Design B: rings ---------- */
.row-main.with-ring { display: flex; align-items: center; gap: 12px; }
.row-main.with-ring .row-text { flex: 1; min-width: 0; display: block; }
.row-main.with-ring .row-head, .row-main.with-ring .row-status { display: flex; }
.row-main.with-ring .row-status { margin-top: 3px; }
.row:has(.with-ring) { padding-left: 12px; }
.ring { flex: none; --ring: var(--cat); }
.ring.over { --ring: var(--over); }
.ring .ring-track { stroke: color-mix(in srgb, var(--ring) 22%, var(--surface)); }
.day-sum { display: flex; align-items: center; gap: 18px; margin-bottom: 24px; }
.day-sum > div { display: flex; flex-direction: column; gap: 3px; }
.day-sum b { font-size: 17px; }
.day-sum span { font-size: 14px; color: var(--ink-2); }
.day-sum span.attn { color: var(--ink); font-weight: 600; }
.day-sum small { font-size: 13px; color: var(--muted); }
.day-ring { flex: none; }
.day-ring .dr-num { font-size: 26px; font-weight: 800; fill: var(--ink); font-family: var(--font); letter-spacing: -0.5px; }
.day-ring .dr-sub { font-size: 12px; fill: var(--ink-2); font-family: var(--font); }

.show-more { display: block; margin: 10px auto 0; }

/* ---------- Progress header, design B (as in the app) ---------- */
.hdr-b { align-items: center; gap: 16px; }
.hdr-b .day-ring { width: 108px; height: 108px; }
.hdr-text { flex: 1; min-width: 0; }
.hdr-text h1 { max-width: none; }
.hdr-sum { margin: 8px 0 0; font-size: 14px; color: var(--ink-2); line-height: 1.35; }
.hdr-sum.attn { color: var(--ink); font-weight: 600; }
.hdr-sum span { font-weight: 400; color: var(--ink-2); }
.period-row { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; }
.period-row .periods { flex: 1; margin: 0; }
.period-row .icon-btn { width: 38px; height: 38px; flex: none; }

/* ---------- First-open screen ---------- */
.fg-card { padding: 20px; }
.fg-card h2 { font-size: 24px; margin: 12px 0 6px; letter-spacing: -0.3px; }
.fg-bars { display: flex; align-items: flex-end; gap: 6px; height: 52px; }
.fg-bars i { width: 16px; border-radius: 5px; }
.fg-row { display: flex; gap: 8px; }
.fg-row .input { flex: 1; }
.fg-h { font-size: 15px; color: var(--ink-2); margin: 18px 2px 10px; }
.fg-picks { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fg-pick { text-align: left; display: flex; flex-direction: column; gap: 4px; padding: 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); }
.fg-pick:hover { background: var(--surface-2); }
.fg-pick i { width: 28px; height: 6px; border-radius: 3px; margin-bottom: 6px; }
.fg-pick span { font-size: 13px; color: var(--ink-2); }

/* ---------- Floating New goal button (phones; desktop has it in the header) ---------- */
.fab { position: fixed; right: 16px; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 14px); z-index: 15;
  display: inline-flex; align-items: center; gap: 8px; height: 52px; padding: 0 20px; border-radius: 26px; border: 0;
  background: var(--ink); color: var(--surface); font-weight: 600; font-size: 17px; box-shadow: 0 6px 18px rgba(10, 14, 20, 0.22); }
.fab-fade { position: fixed; left: 0; right: 0; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom)); height: 90px; z-index: 14; pointer-events: none;
  background: linear-gradient(to bottom, transparent, var(--bg) 85%); backdrop-filter: blur(2px); -webkit-mask-image: linear-gradient(to bottom, transparent, #000 70%); mask-image: linear-gradient(to bottom, transparent, #000 70%); }
.app:has(.fab) { padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 100px); }
@media (min-width: 1100px) { .fab, .fab-fade { display: none; } }

/* ---------- Goals ⋯ menu ---------- */
.row-menu { position: relative; flex: none; }
.row-menu summary { list-style: none; cursor: pointer; width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; font-size: 20px; color: var(--ink-2); }
.row-menu summary::-webkit-details-marker { display: none; }
.row-menu summary:hover { background: var(--surface-2); }
.row-menu .menu { position: absolute; right: 0; top: 42px; z-index: 30; min-width: 170px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(10, 14, 20, 0.16); padding: 6px; display: flex; flex-direction: column; }
.row-menu .menu button { text-align: left; background: none; border: 0; padding: 10px 12px; border-radius: 8px; font-size: 15px; }
.row-menu .menu button:hover { background: var(--surface-2); }
.row-menu .menu .danger { color: var(--over); }

/* ---------- Celebrations ---------- */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 90; overflow: hidden; }
.confetti i { position: absolute; top: -20px; height: 12px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { transform: translate(var(--dx), 92vh) rotate(var(--rot)); opacity: 0.2; } }
.cel-banner { position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + 12px); transform: translateX(-50%); z-index: 95; width: min(520px, calc(100% - 32px));
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 12px 16px; box-shadow: 0 10px 30px rgba(10, 14, 20, 0.15); display: flex; flex-direction: column; gap: 2px; cursor: pointer; animation: celIn .25s ease-out; }
.cel-banner b { font-size: 13px; } .cel-banner strong { font-size: 17px; } .cel-banner span { font-size: 14px; color: var(--ink-2); }
.cel-scrim { position: fixed; inset: 0; z-index: 92; background: rgba(10, 14, 20, 0.45); display: grid; place-items: center; padding: 24px; animation: celIn .25s ease-out; }
.cel-card { background: var(--surface); border-radius: 24px; padding: 24px; width: min(340px, 100%); text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.cel-card h2 { margin: 0; font-size: 22px; } .cel-card p { margin: 0 0 8px; color: var(--ink-2); }
.cel-tick { width: 64px; height: 64px; border-radius: 32px; color: #fff; font-size: 30px; font-weight: 800; display: grid; place-items: center; }
.cel-full { position: fixed; inset: 0; z-index: 92; color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 24px; animation: celIn .35s ease-out; }
.cel-you { font-weight: 700; font-size: 17px; margin: 0; opacity: .92; }
.cel-share { background: #FCFCFB; color: #18202A; border-radius: 24px; padding: 22px; width: min(320px, 100%); display: flex; flex-direction: column; gap: 8px; }
.cel-share h2 { margin: 0; font-size: 24px; line-height: 1.15; } .cel-share p { margin: 0; color: #4A5866; } .cel-share small { color: #6E7C89; }
.cel-area { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: #4A5866; }
.cel-area i { width: 10px; height: 10px; border-radius: 3px; }
.cel-btns { display: flex; gap: 12px; }
.cel-btns .btn { background: #fff; color: #18202A; border-color: #fff; }
.cel-btns .btn.ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.75); }
.cel-note { font-size: 13px; opacity: .85; margin: 0; text-align: center; max-width: 300px; }
@keyframes celIn { from { opacity: 0; } to { opacity: 1; } }

/* show/hide password */
.pw-wrap { position: relative; display: block; }
.pw-wrap input { width: 100%; padding-right: 48px; }
.pw-eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border: 0; border-radius: 10px; background: transparent; color: var(--ink-2); display: grid; place-items: center; cursor: pointer; }
.pw-eye:hover { color: var(--ink); background: var(--surface-2); }
.pw-eye:focus-visible { outline: 3px solid var(--focus); outline-offset: 0; }

/* challenges */
.ch-card { display: block; text-decoration: none; color: var(--ink); margin-bottom: 10px; }
.ch-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.ch-sub { display: block; color: var(--ink-2); font-size: 14px; margin-top: 4px; }
.ch-bar { display: block; height: 8px; border-radius: 4px; background: color-mix(in srgb, var(--cat) 20%, var(--surface)); margin-top: 10px; overflow: hidden; }
.ch-bar.thin { height: 6px; margin-top: 6px; }
.ch-bar i { display: block; height: 100%; background: var(--cat); border-radius: 4px; }
.ch-row { padding: 10px 0; }
.ch-row + .ch-row { border-top: 1px solid var(--line); }
