/* NEXT — layout & components. Colors/fonts/radii come from tokens.css only. */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--color-bg); color: var(--color-ink);
  font-family: var(--font-ui); font-size: var(--text-body); line-height: 1.4;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
:focus-visible { outline: 3px solid var(--color-action); outline-offset: 2px; border-radius: var(--radius-xs); }
img { max-width: 100%; display: block; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.i { width: 22px; height: 22px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- app frame ---------- */
.app { max-width: var(--app-max); margin: 0 auto; min-height: 100%; position: relative; background: var(--color-bg); }
@media (min-width: 640px) {
  body { background: var(--color-surface-2); }
  .app { box-shadow: 0 0 0 1px var(--color-line), 0 30px 80px rgba(0,0,0,.06); min-height: 100vh; }
}
main.view {
  padding: calc(env(safe-area-inset-top) + 18px) var(--pad) calc(var(--nav-h) + env(safe-area-inset-bottom) + 36px);
  min-height: 100vh;
}
.view-enter { animation: fadeUp var(--dur) var(--ease); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- headers ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 22px; min-height: 44px; }
.brand { display: inline-flex; align-items: center; color: var(--color-ink); line-height: 0; }
.brand svg { height: 20px; width: auto; display: block; }
.brand svg .dot { fill: var(--color-accent); }
.avatar { text-decoration: none; width: 40px; height: 40px; border-radius: var(--radius-pill); background: var(--color-ink); color: var(--color-bg); display: grid; place-items: center; font-weight: 700; font-size: 15px; }
.hello { margin: 0 0 4px; font-family: var(--font-display); font-weight: var(--weight-display); letter-spacing: var(--tracking-display); font-size: var(--text-h1); line-height: 1.12; }
.subhello { margin: 0 0 26px; color: var(--color-ink-2); font-size: 15px; }
.h1 { margin: 0; font-family: var(--font-display); font-weight: var(--weight-display); letter-spacing: var(--tracking-display); font-size: var(--text-h1); line-height: 1.1; }
.sub { color: var(--color-ink-2); margin: 6px 0 22px; font-size: 15px; }
.section { margin-top: 30px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 0 2px 12px; }
.label { font-size: var(--text-h2); font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--color-ink-3); margin: 0; }
.link { text-decoration: none; color: var(--color-action); font-weight: 600; font-size: 14px; padding: 8px 4px; margin: -8px -4px; }
.iconbtn { width: 44px; height: 44px; border-radius: var(--radius-pill); display: grid; place-items: center; color: var(--color-ink); background: var(--color-surface); box-shadow: var(--shadow-card); }

/* ---------- DO THIS NOW ---------- */
.now {
  position: relative; overflow: hidden;
  background: var(--color-ink); color: var(--color-bg); border-radius: var(--radius-lg);
  padding: 22px 22px 20px; box-shadow: var(--shadow-float);
}
.now .label { color: color-mix(in srgb, var(--color-bg) 62%, transparent); display: flex; align-items: center; gap: 8px; }
.now .label::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--color-accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--color-accent) 30%, transparent); }
.now-title { font-family: var(--font-title); font-weight: var(--weight-title); letter-spacing: var(--tracking-display); font-size: var(--text-hero); line-height: 1.12; margin: 14px 0 8px; overflow-wrap: anywhere; }
.now-meta { color: color-mix(in srgb, var(--color-bg) 72%, transparent); font-size: 15px; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.now-why { margin-top: 4px; font-size: 13.5px; color: color-mix(in srgb, var(--color-bg) 55%, transparent); }
.now-actions { display: flex; gap: 10px; margin-top: 20px; }
.btn { min-height: 48px; padding: 0 18px; border-radius: var(--radius-pill); font-weight: 650; font-size: 15.5px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: transform .12s var(--ease), background var(--dur); }
.btn:active { transform: scale(.97); }
.btn-accent { background: var(--color-accent); color: var(--color-accent-ink); }
.btn-ghost-dark { background: color-mix(in srgb, var(--color-bg) 12%, transparent); color: var(--color-bg); }
.btn-quiet { background: var(--color-surface-2); color: var(--color-ink); }
.btn-line { background: var(--color-surface); color: var(--color-ink); box-shadow: inset 0 0 0 1px var(--color-line); }
.btn-danger { background: var(--color-danger-soft); color: var(--color-danger); }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .4; pointer-events: none; }

/* ---------- cards & rows ---------- */
.card { background: var(--color-surface); border-radius: var(--radius-md); box-shadow: var(--shadow-card); }
.list { background: var(--color-surface); border-radius: var(--radius-md); box-shadow: var(--shadow-card); overflow: hidden; }
.row-wrap { position: relative; overflow: hidden; }
.row-wrap + .row-wrap::before { content: ""; position: absolute; left: 68px; right: 0; top: 0; border-top: 1px solid var(--color-line); z-index: 2; }
.swipe-bg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: space-between; padding: 0 22px; font-weight: 650; font-size: 14px; }
.swipe-bg .done { color: var(--color-success); display: flex; gap: 8px; align-items: center; }
.swipe-bg .later { color: var(--color-warn); display: flex; gap: 8px; align-items: center; }
.row {
  position: relative; z-index: 1; display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  padding: 14px 12px 14px 14px; min-height: 68px; background: var(--color-surface); touch-action: pan-y;
  transition: transform var(--dur) var(--ease);
}
.row.dragging { transition: none; }
.chip-ic { width: 40px; height: 40px; border-radius: var(--radius-sm); display: grid; place-items: center; flex: none; }
.chip-ic svg.i { width: 20px; height: 20px; }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 600; font-size: 16px; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.row-meta { color: var(--color-ink-2); font-size: var(--text-small); margin-top: 3px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.row-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--color-ink-3); }
.row-meta .over { color: var(--color-danger); font-weight: 600; }
.row-meta .soon { color: var(--color-action); font-weight: 600; }
.row-meta svg.i { width: 14px; height: 14px; }
.check { width: 44px; height: 44px; display: grid; place-items: center; flex: none; border-radius: 50%; }
.check span { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--color-line); display: grid; place-items: center; transition: all var(--dur) var(--ease); }
.check:hover span { border-color: var(--color-action); }
.check.on span { background: var(--color-success); border-color: var(--color-success); color: #fff; }
.check svg.i { width: 15px; height: 15px; stroke-width: 3; opacity: 0; }
.check.on svg.i { opacity: 1; }
.row.done-anim { opacity: .35; }
.row.is-done .row-title { text-decoration: line-through; color: var(--color-ink-3); }
.thumb { width: 40px; height: 40px; border-radius: var(--radius-sm); object-fit: cover; flex: none; }

/* category tints */
.cat-task { background: var(--cat-task-bg); color: var(--cat-task-ink); }
.cat-shopping { background: var(--cat-shopping-bg); color: var(--cat-shopping-ink); }
.cat-appointment { background: var(--cat-appointment-bg); color: var(--cat-appointment-ink); }
.cat-bill { background: var(--cat-bill-bg); color: var(--cat-bill-ink); }
.cat-reminder { background: var(--cat-reminder-bg); color: var(--cat-reminder-ink); }
.cat-followup { background: var(--cat-followup-bg); color: var(--cat-followup-ink); }
.cat-date { background: var(--cat-date-bg); color: var(--cat-date-ink); }
.cat-document { background: var(--cat-document-bg); color: var(--cat-document-ink); }
.cat-saved { background: var(--cat-saved-bg); color: var(--cat-saved-ink); }
.cat-idea { background: var(--cat-idea-bg); color: var(--cat-idea-ink); }

/* coming up — date pill rows */
.date-pill { width: 44px; flex: none; text-align: center; border-radius: var(--radius-sm); padding: 6px 0; background: var(--color-surface-2); }
.date-pill small { display: block; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--color-ink-3); }
.date-pill b { display: block; font-family: var(--font-title); font-size: 19px; line-height: 1.1; }
.date-pill.today { background: var(--color-action-soft); }
.date-pill.today small, .date-pill.today b { color: var(--color-action); }

/* saved for later — horizontal cards */
.hscroll { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 calc(-1 * var(--pad)); padding: 2px var(--pad) 10px; scrollbar-width: none; }
.hscroll::-webkit-scrollbar { display: none; }
.scard { scroll-snap-align: start; flex: none; width: 150px; text-align: left; background: var(--color-surface); border-radius: var(--radius-md); box-shadow: var(--shadow-card); overflow: hidden; display: flex; flex-direction: column; }
.scard-media { height: 96px; display: grid; place-items: center; position: relative; overflow: hidden; flex: none; }
.scard-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 30%; }
.scard-media svg.i { width: 28px; height: 28px; }
.scard-body { padding: 10px 12px 12px; }
.scard-title { font-weight: 600; font-size: 14.5px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.scard-meta { font-size: 12.5px; color: var(--color-ink-3); margin-top: 4px; }

/* calm states */
.calm { text-align: center; padding: 34px 24px 30px; }
.calm-mark { width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 14px; display: grid; place-items: center; background: var(--color-success-soft); color: var(--color-success); }
.calm-mark svg.i { width: 30px; height: 30px; stroke-width: 2.2; }
.calm h3 { margin: 0 0 6px; font-family: var(--font-display); font-size: 22px; letter-spacing: var(--tracking-display); }
.calm p { margin: 0; color: var(--color-ink-2); font-size: 15px; }
.quiet-line { display: flex; align-items: center; gap: 10px; padding: 16px; color: var(--color-ink-2); font-size: 15px; }
.quiet-line svg.i { color: var(--color-success); }
.empty { text-align: center; color: var(--color-ink-3); padding: 40px 20px; font-size: 15px; }

/* ---------- bottom nav ---------- */
.nav {
  position: fixed; z-index: 30; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: var(--app-max);
  padding: 8px 10px calc(env(safe-area-inset-bottom) + 8px);
  background: color-mix(in srgb, var(--color-bg) 86%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(18px); backdrop-filter: saturate(1.4) blur(18px);
  border-top: 1px solid var(--color-line);
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
}
.nav a { text-decoration: none; color: var(--color-ink-3); display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; font-weight: 600; min-height: 50px; justify-content: center; border-radius: var(--radius-sm); }
.nav a.on { color: var(--color-ink); }
.nav a.on svg.i { stroke-width: 2.2; }
.fab {
  justify-self: center; width: 60px; height: 60px; border-radius: 22px; margin-top: -26px;
  background: var(--color-accent); color: var(--color-accent-ink); display: grid; place-items: center;
  box-shadow: var(--shadow-accent); transition: transform .15s var(--ease);
}
.fab:active { transform: scale(.94); }
.fab svg.i { width: 28px; height: 28px; stroke-width: 2.4; }

/* ---------- sheets ---------- */
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(15, 15, 15, .32); opacity: 0; transition: opacity var(--dur) var(--ease); }
.scrim.open { opacity: 1; }
.sheet {
  position: fixed; z-index: 41; left: 50%; bottom: 0; width: 100%; max-width: var(--app-max);
  transform: translate(-50%, 100%); transition: transform 320ms var(--ease);
  background: var(--color-bg); border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  max-height: calc(100% - env(safe-area-inset-top) - 12px); display: flex; flex-direction: column;
  box-shadow: 0 -10px 40px rgba(0,0,0,.12);
}
.sheet.open { transform: translate(-50%, 0); }
.sheet-grab { width: 40px; height: 5px; border-radius: 3px; background: var(--color-line); margin: 10px auto 0; flex: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 14px 4px 20px; flex: none; }
.sheet-head h2 { margin: 0; font-family: var(--font-title); font-size: 20px; letter-spacing: var(--tracking-display); }
.sheet-body { overflow-y: auto; padding: 8px var(--pad) calc(env(safe-area-inset-bottom) + 22px); -webkit-overflow-scrolling: touch; }
.sheet-foot { flex: none; padding: 12px var(--pad) calc(env(safe-area-inset-bottom) + 14px); border-top: 1px solid var(--color-line); background: var(--color-bg); }
.closebtn { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: var(--color-ink-2); }

/* capture */
.cap-box { background: var(--color-surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); padding: 16px 18px 12px; }
.cap-box textarea { width: 100%; min-height: 128px; border: 0; outline: 0; resize: none; background: transparent; font-size: 21px; line-height: 1.35; font-family: var(--font-title); letter-spacing: -0.01em; }
.cap-box textarea::placeholder { color: var(--color-ink-3); }
.cap-tools { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.tool { min-height: 76px; border-radius: var(--radius-md); background: var(--color-surface); box-shadow: var(--shadow-card); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; font-size: 13.5px; font-weight: 600; color: var(--color-ink); position: relative; }
.tool svg.i { width: 24px; height: 24px; color: var(--color-action); }
.tool.live { background: var(--color-accent); color: var(--color-accent-ink); }
.tool.live svg.i { color: var(--color-accent-ink); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { transform: scale(1.18); } }
.tool input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.atts { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.att { position: relative; width: 74px; height: 74px; border-radius: var(--radius-sm); overflow: hidden; background: var(--color-surface-2); display: grid; place-items: center; font-size: 11px; color: var(--color-ink-2); text-align: center; padding: 4px; }
.att img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.att .x { position: absolute; top: 3px; right: 3px; width: 24px; height: 24px; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; display: grid; place-items: center; z-index: 2; }
.att .x svg.i { width: 14px; height: 14px; stroke-width: 2.6; }
.att .prog { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.62); color: #fff; font-size: 10.5px; padding: 3px 2px; z-index: 1; }
.hint { color: var(--color-ink-3); font-size: 13px; margin: 10px 4px 0; }

.understood { margin-top: 18px; background: var(--color-surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); padding: 16px 16px 6px; animation: fadeUp var(--dur) var(--ease); }
.understood-head { display: flex; align-items: center; gap: 8px; color: var(--color-ink-2); font-size: 13.5px; font-weight: 600; margin-bottom: 12px; }
.understood-head svg.i { color: var(--color-action); width: 18px; height: 18px; }
.u-title { width: 100%; border: 0; outline: 0; background: transparent; font-family: var(--font-title); font-weight: 700; font-size: 20px; letter-spacing: -0.015em; padding: 2px 0 10px; border-bottom: 1px dashed var(--color-line); }
.u-title:focus { border-bottom-color: var(--color-action); }
.field { display: flex; align-items: center; gap: 12px; min-height: 52px; border-bottom: 1px solid var(--color-line); }
.field:last-child { border-bottom: 0; }
.field > svg.i { color: var(--color-ink-3); width: 20px; height: 20px; }
.field-label { width: 76px; flex: none; font-size: 14px; color: var(--color-ink-2); }
.field-val { flex: 1; min-width: 0; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; text-align: right; font-weight: 600; font-size: 15px; }
.field select, .field input[type=date], .field input[type=time], .field input[type=text], .field input[type=search] {
  border: 0; background: var(--color-surface-2); border-radius: var(--radius-xs); padding: 8px 10px; min-height: 38px; font-size: 15px; font-weight: 600; max-width: 100%;
  -webkit-appearance: none; appearance: none;
}
.field input[type=text] { width: 100%; text-align: right; }
.when-val { flex: 1; min-width: 0; display: grid; grid-template-columns: 1.3fr 1fr; gap: 8px; padding: 7px 0; }
.when-val input[type=date], .when-val input[type=time] { width: 100%; min-width: 0 !important; text-align: left; }
.field input[type=date] { min-width: 132px; }
.field input[type=time] { min-width: 96px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: var(--radius-pill); font-size: 14px; font-weight: 650; }
.pill svg.i { width: 16px; height: 16px; }
.catpick { display: flex; flex-wrap: wrap; gap: 8px; padding: 6px 0 14px; justify-content: flex-start; }
.catpick button { opacity: .55; }
.catpick button.on { opacity: 1; box-shadow: inset 0 0 0 2px currentColor; }
.person { background: var(--color-surface-2); color: var(--color-ink); }

/* detail */
.detail-title { width: 100%; border: 0; outline: 0; background: transparent; font-family: var(--font-title); font-weight: var(--weight-title); font-size: 26px; letter-spacing: var(--tracking-display); line-height: 1.15; resize: none; padding: 0; }
.detail-card { background: var(--color-surface); border-radius: var(--radius-md); box-shadow: var(--shadow-card); padding: 2px 16px; margin-top: 16px; }
.detail-card textarea { width: 100%; border: 0; outline: 0; resize: vertical; min-height: 84px; background: transparent; padding: 14px 0; font-size: 15.5px; }
.postpone { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 10px; }
.postpone button { min-height: 58px; border-radius: var(--radius-sm); background: var(--color-surface); box-shadow: var(--shadow-card); font-size: 13px; font-weight: 650; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.postpone button small { font-weight: 500; color: var(--color-ink-3); font-size: 11.5px; }
.att-full { margin-top: 12px; border-radius: var(--radius-md); overflow: hidden; background: var(--color-surface); box-shadow: var(--shadow-card); }
.att-full img { width: 100%; max-height: 360px; object-fit: contain; background: var(--color-surface-2); }
.att-full audio { width: 100%; display: block; padding: 10px; }
.att-full .file { display: flex; align-items: center; gap: 12px; padding: 14px 16px; text-decoration: none; color: inherit; font-weight: 600; }
.ocr { margin-top: 12px; padding: 14px 16px; border-radius: var(--radius-md); background: var(--color-surface-2); font-size: 14px; color: var(--color-ink-2); white-space: pre-wrap; max-height: 180px; overflow: auto; }
.meta-note { color: var(--color-ink-3); font-size: 12.5px; margin-top: 18px; text-align: center; }

/* my stuff */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile { text-align: left; background: var(--color-surface); border-radius: var(--radius-md); box-shadow: var(--shadow-card); padding: 16px; min-height: 118px; display: flex; flex-direction: column; justify-content: space-between; text-decoration: none; color: inherit; }
.tile .chip-ic { width: 42px; height: 42px; }
.tile-count { font-family: var(--font-title); font-weight: 700; font-size: 26px; letter-spacing: var(--tracking-display); line-height: 1; margin-top: 14px; }
.tile-name { font-size: 14px; font-weight: 600; color: var(--color-ink-2); margin-top: 4px; }
.tile.zero { opacity: .5; box-shadow: none; background: transparent; outline: 1px dashed var(--color-line); }
.seg { display: inline-flex; background: var(--color-surface-2); border-radius: var(--radius-pill); padding: 4px; margin-bottom: 16px; }
.seg button { padding: 8px 18px; border-radius: var(--radius-pill); font-weight: 600; font-size: 14px; color: var(--color-ink-2); min-height: 38px; }
.seg button.on { background: var(--color-surface); color: var(--color-ink); box-shadow: var(--shadow-card); }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--color-ink-2); font-weight: 600; text-decoration: none; min-height: 44px; margin: -6px 0 8px -6px; padding-right: 10px; }

/* calendar */
.cal { background: var(--color-surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); padding: 14px 10px 12px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 10px; }
.cal-head h2 { margin: 0; font-family: var(--font-title); font-size: 19px; letter-spacing: var(--tracking-display); }
.cal-head .iconbtn { box-shadow: none; background: var(--color-surface-2); width: 38px; height: 38px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-dow { text-align: center; font-size: 11.5px; font-weight: 700; color: var(--color-ink-3); padding: 4px 0 8px; letter-spacing: .04em; }
.cal-day { aspect-ratio: 1 / 1.08; border-radius: var(--radius-sm); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 15px; font-weight: 600; position: relative; }
.cal-day.out { color: var(--color-ink-3); opacity: .45; }
.cal-day.today span.n { color: var(--color-action); }
.cal-day.today::after { content: ""; position: absolute; inset: 3px; border-radius: var(--radius-sm); box-shadow: inset 0 0 0 1.5px var(--color-action); pointer-events: none; }
.cal-day.sel { background: var(--color-ink); color: var(--color-bg); }
.cal-day.sel span.n { color: var(--color-bg); }
.dots { display: flex; gap: 3px; height: 6px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.cal-day .dots i { background: var(--dot, var(--color-action)); }

/* search */
.searchbar { position: relative; margin-bottom: 18px; }
.searchbar input { width: 100%; min-height: 54px; border-radius: var(--radius-md); border: 0; background: var(--color-surface); box-shadow: var(--shadow-card); padding: 0 16px 0 48px; font-size: 17px; outline: 0; -webkit-appearance: none; appearance: none; }
.searchbar input:focus { box-shadow: var(--shadow-card), 0 0 0 2px var(--color-action); }
.searchbar input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; width: 16px; height: 16px; margin-right: 2px; cursor: pointer; background: var(--color-ink-3);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 3l10 10M13 3L3 13' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 3l10 10M13 3L3 13' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center/contain no-repeat; }
.searchbar svg.i { position: absolute; left: 16px; top: 16px; color: var(--color-ink-3); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
mark { background: var(--color-action-soft); color: inherit; border-radius: 4px; padding: 0 2px; }
.snippet { font-size: 13px; color: var(--color-ink-3); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* settings */
.set-row { display: flex; align-items: center; gap: 14px; min-height: 60px; padding: 8px 16px; border-bottom: 1px solid var(--color-line); width: 100%; text-align: left; }
.set-row:last-child { border-bottom: 0; }
.set-row .grow { flex: 1; min-width: 0; }
.set-row small { display: block; color: var(--color-ink-3); font-size: 13px; margin-top: 2px; }
.set-row input[type=text] { border: 0; background: var(--color-surface-2); border-radius: var(--radius-xs); padding: 9px 12px; width: 150px; font-weight: 600; }
.switch { width: 52px; height: 32px; border-radius: 16px; background: var(--color-line); position: relative; flex: none; transition: background var(--dur); }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform var(--dur) var(--ease); }
.switch.on { background: var(--color-success); }
.switch.on::after { transform: translateX(20px); }

/* toast */
.toast {
  position: fixed; z-index: 60; left: 50%; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 18px);
  transform: translate(-50%, 20px); opacity: 0; transition: all var(--dur) var(--ease);
  width: calc(100% - 32px); max-width: calc(var(--app-max) - 32px);
  background: var(--color-ink); color: var(--color-bg); border-radius: var(--radius-md); padding: 14px 16px;
  display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow-float); font-size: 15px; pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast .grow { flex: 1; min-width: 0; }
.toast small { display: block; opacity: .7; font-size: 13px; }
.toast button { color: var(--color-bg); font-weight: 700; padding: 10px 6px; text-decoration: underline; text-underline-offset: 3px; }

/* onboarding */
.onb { position: fixed; inset: 0; z-index: 80; background: var(--color-bg); display: flex; justify-content: center; }
.onb-in { width: 100%; max-width: var(--app-max); display: flex; flex-direction: column; padding: calc(env(safe-area-inset-top) + 24px) 28px calc(env(safe-area-inset-bottom) + 28px); }
.onb-top { display: flex; justify-content: space-between; align-items: center; min-height: 44px; }
.onb-art { flex: 1; display: grid; place-items: center; }
.onb-art .big { width: 200px; height: 200px; border-radius: 56px; background: var(--color-ink); color: var(--color-bg); display: grid; place-items: center; box-shadow: var(--shadow-float); position: relative; }
.onb-art .big svg.i { width: 84px; height: 84px; stroke-width: 1.6; }
.onb-art .big.accent { background: var(--color-accent); color: var(--color-accent-ink); box-shadow: var(--shadow-accent); }
.onb h1 { font-family: var(--font-display); font-weight: var(--weight-display); letter-spacing: var(--tracking-display); font-size: 30px; line-height: 1.12; margin: 0 0 12px; }
.onb p { color: var(--color-ink-2); font-size: 17px; margin: 0 0 26px; }
.onb-dots { display: flex; gap: 6px; margin-bottom: 22px; }
.onb-dots i { width: 8px; height: 8px; border-radius: 4px; background: var(--color-line); transition: all var(--dur); }
.onb-dots i.on { width: 24px; background: var(--color-ink); }
.onb input[type=text] { width: 100%; min-height: 58px; border-radius: var(--radius-md); border: 0; background: var(--color-surface); box-shadow: var(--shadow-card); padding: 0 18px; font-size: 18px; margin-bottom: 14px; outline: 0; }
.onb input[type=text]:focus { box-shadow: var(--shadow-card), 0 0 0 2px var(--color-action); }
.wordmark { display: inline-flex; color: var(--color-ink); line-height: 0; }
.wordmark svg { height: 22px; width: auto; display: block; }
.wordmark svg .dot { fill: var(--color-accent); }
.btn-ink { background: var(--color-action); color: var(--color-action-ink); }
.onb-art .big.logo { background: none; box-shadow: var(--shadow-float); overflow: hidden; }
.onb-art .big.logo img { width: 100%; height: 100%; display: block; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media (max-width: 360px) { :root { --pad: 16px; --text-hero: 26px; } .postpone { grid-template-columns: repeat(2, 1fr); } }

/* ---------- v3: Forward to NEXT ---------- */
.src-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px 2px 6px; border-radius: var(--radius-pill); background: var(--color-surface-2); color: var(--color-ink-2); font-size: 12px; font-weight: 700; line-height: 18px; }
.src-chip svg.i { width: 13px; height: 13px; }
.fwd-card { padding: 22px 20px; margin-top: 6px; }
.fwd-card .label { margin: 0 0 8px; }
.fwd-ic { width: 52px; height: 52px; border-radius: var(--radius-md); display: grid; place-items: center; background: var(--cat-appointment-bg); color: var(--cat-appointment-ink); margin-bottom: 14px; }
.fwd-ic svg.i { width: 26px; height: 26px; }
.fwd-h { font-family: var(--font-title); font-weight: var(--weight-title); font-size: 20px; margin: 0 0 6px; }
.fwd-p { color: var(--color-ink-2); margin: 0 0 18px; }
.fwd-addr { font-family: var(--font-title); font-weight: 800; font-size: 18px; line-height: 1.35; letter-spacing: -0.01em; overflow-wrap: anywhere; color: var(--color-ink); padding: 14px 16px; border-radius: var(--radius-sm); background: var(--color-surface-2); user-select: all; -webkit-user-select: all; }
.fwd-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.fwd-actions .btn { flex: 1; min-width: 0; }
.fwd-status { color: var(--color-ink-3); font-size: 13px; margin: 12px 2px 0; }
.steps { padding: 6px 18px; }
.step { display: flex; gap: 14px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--color-line); }
.step:last-child { border-bottom: 0; }
.step b { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--color-ink); color: var(--color-action-ink); display: grid; place-items: center; font-size: 13px; font-weight: 800; margin-top: 1px; }
.step p { margin: 0; color: var(--color-ink-2); font-size: 15px; line-height: 1.45; }
.tag { flex: none; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: var(--radius-pill); background: var(--color-surface-2); color: var(--color-ink-3); white-space: nowrap; }
.tag-live { background: var(--color-ink); color: var(--color-action-ink); }
.demo-card { padding: 16px; }
.demo-card textarea { width: 100%; border: 0; resize: none; background: var(--color-surface-2); border-radius: var(--radius-sm); padding: 12px 14px; font: inherit; font-size: 16px; color: var(--color-ink); }
.origin { margin-top: 22px; }
.origin-card { padding: 14px 16px; }
.origin-row { display: flex; gap: 10px; font-size: 14px; padding: 3px 0; color: var(--color-ink-2); }
.origin-row span:first-child { color: var(--color-ink-3); width: 62px; flex: none; }
.origin-row span:last-child { min-width: 0; overflow-wrap: anywhere; }
.origin details { margin-top: 8px; }
.origin summary { cursor: pointer; font-size: 14px; font-weight: 700; color: var(--color-ink); padding: 6px 0; }
.understood-by { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--color-ink-2); margin: 10px 0 0; }
.understood-by svg.i { width: 15px; height: 15px; }
