/* ==========================================================================
   TodoXMock — first-time personal setup (onboarding)
   Loads AFTER css/tokens.css. Same design language as the landing page:
   #2563EB · #0F172A · #475569 · #F8FAFC · white cards · #E2E8F0 borders.
   ========================================================================== */

/* illustration palette (adapts to theme) */
:root {
  --ill-bg: #EFF6FF;
  --ill-bg-2: #DBEAFE;
  --ill-line: #2563EB;
  --ill-soft: #BFDBFE;
  --ill-ink: #0F172A;
  --ob-bar: 0 4px 20px rgba(15, 23, 42, .06);
}
html[data-theme="dark"] {
  --ill-bg: #16223A;
  --ill-bg-2: #1E2B44;
  --ill-line: #60A5FA;
  --ill-soft: #33445F;
  --ill-ink: #E2E8F0;
}

/* ------------------------------- base ------------------------------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background .25s var(--ease), color .25s var(--ease);
}
h1, h2, h3, p, ul, li, dl, dd, dt { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }

.sprite { display: none; }
.ic { width: 20px; height: 20px; display: block; }
.ic.sm { width: 16px; height: 16px; }

:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; border-radius: 6px; }

/* ------------------------------- buttons ------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px;
  border-radius: var(--r-btn);
  border: 1px solid transparent;
  font-size: 14.5px; font-weight: 620;
  cursor: pointer; white-space: nowrap;
  transition: transform .16s var(--ease), box-shadow .22s var(--ease),
              background .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease);
}
.btn .btn-ic { width: 17px; height: 17px; flex: 0 0 17px; }
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn-block { width: 100%; }
.btn-lg { padding: 14px 24px; font-size: 15.5px; }

.btn-primary {
  color: #fff;
  background: linear-gradient(180deg, var(--btn-a) 0%, var(--btn-b) 100%);
  box-shadow: var(--sh-blue), inset 0 1px 0 rgba(255, 255, 255, .16);
}
.btn-primary:hover {
  background: linear-gradient(180deg, var(--btn-a-h) 0%, var(--btn-b-h) 100%);
  box-shadow: 0 14px 30px rgba(37, 99, 235, .34), inset 0 1px 0 rgba(255, 255, 255, .18);
}
.btn-primary[disabled], .btn-primary.is-loading { opacity: .75; pointer-events: none; transform: none; }

.btn-ghost { background: transparent; color: var(--muted); border-color: transparent; }
.btn-ghost:hover { color: var(--ink); background: var(--primary-soft); }

.btn-quiet {
  background: var(--card); border-color: var(--line); color: var(--muted);
}
.btn-quiet:hover { color: var(--ink); border-color: var(--blue-border); background: var(--card); }

.icon-btn {
  width: 38px; height: 38px; flex: 0 0 38px;
  display: grid; place-items: center;
  background: transparent; border: 1px solid var(--line);
  border-radius: var(--pill); cursor: pointer; color: var(--muted);
  transition: background .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease);
}
.icon-btn:hover { background: var(--primary-soft); border-color: var(--primary-line); color: var(--primary); }

.ic-moon { display: none; }
html[data-theme="dark"] .ic-sun { display: none; }
html[data-theme="dark"] .ic-moon { display: block; }

/* spinner */
.spinner {
  width: 16px; height: 16px; flex: 0 0 16px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------- brand ------------------------------- */
.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 34px; height: 34px; flex: 0 0 34px;
  display: grid; place-items: center;
  border-radius: 10px;
  box-shadow: 0 6px 16px rgba(37, 99, 235, .28);
}
.brand-mark .ic { width: 34px; height: 34px; }
.brand-txt { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-size: 17px; font-weight: 780; letter-spacing: -.025em; color: var(--ink); }
.brand-name em { font-style: normal; color: var(--accent-text); }
.brand-tag { font-size: 9.5px; letter-spacing: .13em; text-transform: uppercase; color: var(--muted); margin-top: 3px; }

/* ------------------------------- page shell ------------------------------- */
.ob { display: flex; flex-direction: column; min-height: 100vh; }

.ob-bg { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.ob-bg::before {
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: 32px 32px;
  -webkit-mask-image: radial-gradient(80% 60% at 50% 8%, #000 20%, transparent 78%);
  mask-image: radial-gradient(80% 60% at 50% 8%, #000 20%, transparent 78%);
}
.ob-bg::after {
  content: ""; position: absolute; inset: -10% -10% auto -10%; height: 620px; filter: blur(8px);
  background:
    radial-gradient(30rem 20rem at 22% 6%, var(--glow-1), transparent 62%),
    radial-gradient(28rem 18rem at 82% 12%, var(--glow-2), transparent 64%);
}

.ob-top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 28px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.ob-top .edit-chip {
  font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--outline-fg); background: var(--primary-soft);
  border: 1px solid var(--primary-line);
  padding: 4px 10px; border-radius: var(--pill);
}
.ob-top-right { display: flex; align-items: center; gap: 10px; }

.ob-main {
  position: relative; z-index: 1;
  flex: 1;
  width: 100%; max-width: 760px;
  margin: 0 auto;
  padding: 28px 24px 40px;
}

/* ------------------------------- progress ------------------------------- */
.ob-progress { margin-bottom: 18px; }
.ob-progress.is-done .ob-step { color: var(--primary); }
.ob-step {
  font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 9px;
}
.ob-step b { color: var(--ink); font-weight: 800; }
.ob-track { display: flex; gap: 6px; }
.ob-seg {
  flex: 1; height: 5px; border-radius: 99px;
  background: var(--line);
  overflow: hidden;
  position: relative;
}
.ob-seg i {
  position: absolute; inset: 0; display: block;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--primary-400), var(--primary-600));
  transform: scaleX(0); transform-origin: left center;
  transition: transform .45s var(--ease);
}
.ob-seg.is-filled i { transform: scaleX(1); }

/* ------------------------------- card ------------------------------- */
.ob-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--ob-bar);
  padding: 30px 32px 26px;
  min-height: 430px;
  display: flex; flex-direction: column;
  animation: cardUp .4s var(--ease) both;
}
@keyframes cardUp { from { opacity: 0; transform: translateY(12px); } }

.ob-screens { flex: 1; display: flex; flex-direction: column; }
.screen { display: none; flex-direction: column; flex: 1; }
.screen.is-active { display: flex; }
.screen.is-active > * { animation: scrFwd .3s var(--ease) both; }
.screen.is-active > *:nth-child(2) { animation-delay: .05s; }
.screen.is-active > *:nth-child(3) { animation-delay: .1s; }
.ob-screens.is-back .screen.is-active > * { animation-name: scrBack; }
@keyframes scrFwd { from { opacity: 0; transform: translateX(14px); } }
@keyframes scrBack { from { opacity: 0; transform: translateX(-14px); } }

.ob-eyebrow {
  display: inline-flex; align-items: center; gap: 7px;
  align-self: flex-start;
  padding: 6px 14px 6px 10px;
  background: var(--card);
  border: 1px solid var(--blue-border);
  border-radius: var(--pill);
  font-size: 12.5px; font-weight: 600; color: var(--accent-text);
  box-shadow: var(--sh-xs);
}
.ob-eyebrow .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 4px rgba(37, 99, 235, .16); }

.ob-logo { display: grid; place-items: center; margin-bottom: 16px; }
.ob-logo .brand-mark { width: 44px; height: 44px; flex-basis: 44px; border-radius: 13px; }
.ob-logo .brand-mark .ic { width: 44px; height: 44px; }

.ob-title {
  margin-top: 16px;
  font-size: clamp(23px, 3.1vw, 29px); font-weight: 830;
  letter-spacing: -.032em; line-height: 1.2; color: var(--ink);
}
.ob-desc { margin-top: 10px; font-size: 15px; color: var(--muted); line-height: 1.65; max-width: 52ch; }

.ob-art { display: grid; place-items: center; margin: 22px 0 4px; }
.ob-art svg { width: 100%; max-width: 330px; height: auto; }

/* ------------------------------- actions ------------------------------- */
.ob-actions {
  display: flex; gap: 10px;
  margin-top: 24px; padding-top: 22px;
  border-top: 1px solid var(--line-2);
}
.ob-actions .btn-ghost { flex: 0 0 auto; }
.ob-actions .btn-primary { flex: 1; }
.ob-actions.is-single .btn-primary { flex: 1; }

.ob-skip {
  display: block; margin: 14px auto 0;
  background: none; border: 0; padding: 6px 8px;
  font-size: 13.5px; font-weight: 600; color: var(--muted);
  cursor: pointer; border-radius: 8px;
}
.ob-skip:hover { color: var(--ink); background: var(--primary-soft); }

.ob-note { margin-top: 14px; font-size: 12px; color: var(--muted-2); text-align: center; }

/* ------------------------------- fields ------------------------------- */
.field { margin-top: 18px; }
.label {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 650; color: var(--ink);
  margin-bottom: 7px;
}
.label .opt-tag {
  font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted-2); background: var(--chip);
  border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px;
}
.hint { font-size: 12.5px; color: var(--muted-2); margin-top: 7px; }

.input {
  width: 100%; height: 50px;
  padding: 0 14px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); color: var(--ink);
  font: inherit; font-size: 15px;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease), background .18s var(--ease);
}
.input::placeholder { color: #94A3B8; }
.input:hover { border-color: #CBD5E1; }
.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .14);
}
.input[type="date"] { position: relative; }
html[data-theme="dark"] .input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(1) opacity(.65); }

.field-error {
  display: none; align-items: center; gap: 6px;
  margin-top: 7px; font-size: 12.5px; font-weight: 600; color: var(--err);
}
.field.is-invalid .input { border-color: var(--err); box-shadow: 0 0 0 3px rgba(239, 68, 68, .12); }
.field.is-invalid .field-error { display: flex; }
.field-error .ic { width: 14px; height: 14px; }

.field-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
.field-row .field { margin-top: 18px; }

/* ------------------------------- selectable options ------------------------------- */
.opt-grid {
  display: grid; gap: 10px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 14px;
}
.opt {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 9px;
  padding: 15px 8px 13px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer; text-align: center;
  transition: transform .16s var(--ease), border-color .18s var(--ease),
              background .18s var(--ease), box-shadow .18s var(--ease);
}
.opt:hover { transform: translateY(-2px); border-color: var(--blue-border); box-shadow: var(--sh-sm); }
.opt-ico {
  width: 40px; height: 40px; display: grid; place-items: center;
  border-radius: 11px;
  background: var(--primary-soft);
  border: 1px solid var(--primary-line);
  color: var(--primary);
  transition: background .18s var(--ease), color .18s var(--ease), border-color .18s var(--ease);
}
.opt-ico .ic { width: 20px; height: 20px; }
.opt-name { font-size: 13.5px; font-weight: 650; color: var(--ink); line-height: 1.3; }
.opt-check {
  position: absolute; top: -7px; right: -7px;
  width: 20px; height: 20px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--primary); color: #fff;
  border: 2px solid var(--card);
  transform: scale(0); opacity: 0;
  transition: transform .22s var(--ease), opacity .22s var(--ease);
}
.opt-check .ic { width: 12px; height: 12px; }
.opt[aria-checked="true"], .opt[aria-pressed="true"] {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.opt[aria-checked="true"] .opt-check, .opt[aria-pressed="true"] .opt-check { transform: scale(1); opacity: 1; }
.opt[aria-checked="true"] .opt-ico, .opt[aria-pressed="true"] .opt-ico {
  background: var(--primary); border-color: var(--primary); color: #fff;
}

/* motivation cards (3-up, with description) */
.opt-grid.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.opt.wide { flex-direction: row; align-items: flex-start; gap: 12px; text-align: left; padding: 15px 14px; }
.opt.wide .opt-ico { flex: 0 0 40px; }
.opt.wide .opt-body { min-width: 0; }
.opt.wide .opt-name { font-size: 14.5px; }
.opt.wide .opt-sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; line-height: 1.5; }

/* chips (multi / single select) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip {
  height: 40px; padding: 0 16px;
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--pill);
  font-size: 14px; font-weight: 620; color: var(--muted);
  cursor: pointer;
  transition: transform .14s var(--ease), border-color .18s var(--ease),
              background .18s var(--ease), color .18s var(--ease);
}
.chip:hover { transform: translateY(-2px); border-color: var(--blue-border); color: var(--ink); }
.chip[aria-checked="true"], .chip[aria-pressed="true"] {
  border-color: var(--primary); background: var(--primary-soft); color: var(--outline-fg);
}
.chip .ic { width: 15px; height: 15px; opacity: 0; transition: opacity .18s var(--ease); }
.chip[aria-checked="true"] .ic, .chip[aria-pressed="true"] .ic { opacity: 1; }

.days { display: flex; gap: 8px; margin-top: 12px; }
.day {
  flex: 1; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 13.5px; font-weight: 650; color: var(--muted);
  cursor: pointer;
  transition: transform .14s var(--ease), border-color .18s var(--ease),
              background .18s var(--ease), color .18s var(--ease);
}
.day:hover { transform: translateY(-2px); border-color: var(--blue-border); color: var(--ink); }
.day[aria-pressed="true"] { border-color: var(--primary); background: var(--primary-soft); color: var(--outline-fg); }

.ob-subhead {
  margin-top: 22px;
  font-size: 12px; font-weight: 750; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted-2);
}

/* ------------------------------- ready screen ------------------------------- */
.ready-top { display: grid; place-items: center; margin: 8px 0 4px; }
.check-wrap {
  width: 82px; height: 82px; border-radius: 50%;
  display: grid; place-items: center;
  background: #ECFDF5;
  border: 1px solid #A7F3D0;
  animation: pop .5s var(--ease) both;
}
html[data-theme="dark"] .check-wrap { background: rgba(16, 185, 129, .13); border-color: rgba(16, 185, 129, .35); }
.check-wrap svg { width: 44px; height: 44px; }
.check-ring {
  stroke: var(--ok); stroke-width: 2.5; fill: none;
  stroke-dasharray: 138; stroke-dashoffset: 138;
  animation: draw .55s var(--ease) .08s forwards;
}
.check-tick {
  stroke: var(--ok); stroke-width: 3; fill: none; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 32; stroke-dashoffset: 32;
  animation: draw .35s var(--ease) .5s forwards;
}
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes pop { 0% { opacity: 0; transform: scale(.85); } 60% { transform: scale(1.04); } 100% { opacity: 1; transform: scale(1); } }

.ready-title { text-align: center; }
.ready-desc { text-align: center; margin-left: auto; margin-right: auto; }

.summary {
  margin-top: 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  overflow: hidden;
}
.sum-row {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.sum-row:last-child { border-bottom: 0; }
.sum-k {
  flex: 0 0 118px;
  font-size: 11.5px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted-2);
}
.sum-v { font-size: 14.5px; font-weight: 620; color: var(--ink); }
.sum-v .tag {
  display: inline-block;
  font-size: 12px; font-weight: 620; color: var(--outline-fg);
  background: var(--primary-soft); border: 1px solid var(--primary-line);
  border-radius: 7px; padding: 2px 8px; margin: 2px 4px 2px 0;
}
.sum-v .tag:last-child { margin-right: 0; }
.sum-v .na { color: var(--muted-2); font-weight: 550; }

/* ------------------------------- toast ------------------------------- */
.toast {
  position: fixed; left: 50%; bottom: 26px; z-index: 200;
  transform: translate(-50%, 14px);
  display: flex; align-items: center; gap: 9px;
  padding: 11px 18px;
  background: var(--ink); color: var(--bg);
  border-radius: var(--pill);
  font-size: 13.5px; font-weight: 600;
  box-shadow: var(--sh-lg);
  opacity: 0; pointer-events: none;
  transition: opacity .25s var(--ease), transform .25s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast .ic { width: 16px; height: 16px; color: #34D399; }

/* ------------------------------- dashboard placeholder ------------------------------- */
.db-wrap { width: 100%; max-width: 620px; margin: 0 auto; padding: 40px 24px 56px; }
.db-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: var(--ob-bar);
  padding: 28px;
  animation: cardUp .4s var(--ease) both;
}
.db-eyebrow {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 11px; font-weight: 750; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent-text);
}
.db-title { margin-top: 12px; font-size: 26px; font-weight: 820; letter-spacing: -.03em; color: var(--ink); }
.db-desc { margin-top: 8px; font-size: 14.5px; color: var(--muted); }
.db-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.db-hint {
  margin-top: 18px; padding: 12px 14px;
  border: 1px dashed var(--blue-border); border-radius: 10px;
  background: var(--primary-soft);
  font-size: 13px; color: var(--muted);
}

/* ------------------------------- responsive ------------------------------- */
@media (max-width: 900px) {
  .ob-main { padding: 22px 18px 32px; }
  .ob-card { padding: 26px 24px 22px; min-height: 0; }
  .opt-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
  .opt { padding: 12px 6px 11px; }
  .opt-ico { width: 36px; height: 36px; }
}

@media (max-width: 720px) {
  .ob-top { padding: 12px 16px; }
  .ob-main { padding: 16px 12px 28px; max-width: none; }
  .ob-progress {
    position: sticky; top: 59px; z-index: 15;
    padding: 10px 0 8px;
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    backdrop-filter: saturate(160%) blur(8px);
    -webkit-backdrop-filter: saturate(160%) blur(8px);
  }
  .ob-card {
    padding: 22px 18px 0;
    border-radius: 16px;
    min-height: 0;
  }
  .ob-title { font-size: 23px; }
  .ob-desc { font-size: 14.5px; }
  .ob-art svg { max-width: 280px; }
  .ob-art { margin: 16px 0 0; }

  /* sticky action bar */
  .ob-actions {
    position: sticky; bottom: 0;
    margin: 20px -18px 0;
    padding: 12px 18px calc(12px + env(safe-area-inset-bottom, 0px));
    background: color-mix(in srgb, var(--card) 92%, transparent);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid var(--line);
    border-bottom: 0;
  }
  .ob-actions .btn { height: 52px; }
  .ob-actions .btn-ghost { flex: 0 0 92px; padding: 12px 10px; }
  .ob-skip { margin-bottom: 4px; }

  .input, .input[type="date"] { height: 52px; font-size: 16px; }
  .chip { height: 46px; padding: 0 15px; font-size: 14.5px; }
  .day { height: 48px; font-size: 13px; }
  .opt-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .opt-grid.g3 { grid-template-columns: minmax(0, 1fr); }
  .opt.wide { padding: 14px; }

  .sum-row { flex-direction: column; align-items: flex-start; gap: 4px; }
  .sum-k { flex: none; }
  .db-wrap { padding: 24px 16px 40px; }
  .db-card { padding: 22px 18px; }
  .db-actions .btn { flex: 1 1 100%; }
  .field-row { grid-template-columns: minmax(0, 1fr); gap: 0; }
}

@media (max-width: 380px) {
  .days { gap: 6px; }
  .day { font-size: 12px; padding: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  .check-ring, .check-tick { stroke-dashoffset: 0; }
}
