/* =========================================================
   Tempo — design tokens
   ========================================================= */
:root {
  --font: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  --desk: #E7E7F0;
  --bg: #F4F4F8;
  --surface: #FFFFFF;
  --surface-2: #EFEFF5;
  --surface-3: #E3E3EC;
  --sheet: #FFFFFF;
  --text: #0D0D14;
  --text-2: #5C5C6E;
  --text-3: #9A9AAD;
  --line: rgba(16, 16, 40, .08);
  --scrim: rgba(10, 10, 20, .38);
  --glass: rgba(244, 244, 248, .78);
  --shadow-sm: 0 1px 2px rgba(16, 16, 40, .06);
  --shadow: 0 1px 2px rgba(16, 16, 40, .04), 0 10px 30px -10px rgba(16, 16, 40, .12);
  --shadow-lg: 0 24px 60px -12px rgba(16, 16, 40, .30);
  --danger: #E5484D;
  --ok: #12A871;

  --accent: #6D5CFF;
  --on-accent: #FFFFFF;

  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --sheet-ease: cubic-bezier(.32, .72, 0, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --desk: #050508;
    --bg: #0B0B11;
    --surface: #16161F;
    --surface-2: #1F1F2A;
    --surface-3: #2A2A37;
    --sheet: #17171F;
    --text: #F3F3F8;
    --text-2: #A7A7BA;
    --text-3: #6C6C82;
    --line: rgba(255, 255, 255, .07);
    --scrim: rgba(0, 0, 0, .55);
    --glass: rgba(11, 11, 17, .74);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow: inset 0 1px 0 rgba(255, 255, 255, .03), 0 10px 30px -12px rgba(0, 0, 0, .7);
    --shadow-lg: 0 24px 60px -12px rgba(0, 0, 0, .75);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --desk: #050508;
  --bg: #0B0B11;
  --surface: #16161F;
  --surface-2: #1F1F2A;
  --surface-3: #2A2A37;
  --sheet: #17171F;
  --text: #F3F3F8;
  --text-2: #A7A7BA;
  --text-3: #6C6C82;
  --line: rgba(255, 255, 255, .07);
  --scrim: rgba(0, 0, 0, .55);
  --glass: rgba(11, 11, 17, .74);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: inset 0 1px 0 rgba(255, 255, 255, .03), 0 10px 30px -12px rgba(0, 0, 0, .7);
  --shadow-lg: 0 24px 60px -12px rgba(0, 0, 0, .75);
  color-scheme: dark;
}

/* Accent-derived tokens are recomputed wherever an accent is set */
:root, .tint {
  --accent-soft: color-mix(in srgb, var(--accent) 13%, var(--surface));
  --accent-soft-2: color-mix(in srgb, var(--accent) 24%, var(--surface));
  --accent-strong: color-mix(in srgb, var(--accent) 78%, var(--text));
  --accent-light: color-mix(in srgb, var(--accent) 55%, #fff);
}

/* =========================================================
   Base
   ========================================================= */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  font-feature-settings: "cv11", "ss01", "ss03";
  background: var(--desk);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  display: flex; align-items: center; justify-content: center;
  min-height: 100dvh; overflow: hidden;
}
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; }
input { font: inherit; color: inherit; }
button:focus-visible, input:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; }
.ic { width: 22px; height: 22px; flex: none; }
.num { font-variant-numeric: tabular-nums; }
.hide { visibility: hidden; }

/* Device frame (desktop) / full-bleed (mobile) */
.device {
  position: relative; width: 100%; height: 100dvh;
  background: var(--bg); overflow: hidden; isolation: isolate;
}
.statusbar, .home-indicator { display: none; }

@media (min-width: 640px) {
  body {
    background:
      radial-gradient(1100px 600px at 15% 10%, color-mix(in srgb, #6D5CFF 20%, transparent), transparent 60%),
      radial-gradient(900px 500px at 90% 90%, color-mix(in srgb, #FF6FB5 15%, transparent), transparent 60%),
      var(--desk);
  }
  .device {
    width: 402px; height: min(874px, calc(100dvh - 40px));
    border-radius: 56px;
    box-shadow: 0 0 0 11px #0C0C10, 0 0 0 12.5px #2B2B34, 0 50px 100px -24px rgba(0, 0, 0, .5);
    --sat: 54px; --sab: 22px;
  }
  .statusbar {
    display: flex; position: absolute; inset: 0 0 auto; height: 54px; z-index: 90;
    align-items: center; justify-content: space-between;
    padding: 4px 30px 0 46px; font-weight: 650; font-size: 15.5px; pointer-events: none;
  }
  .statusbar .island {
    position: absolute; left: 50%; top: 12px; width: 124px; height: 36px;
    border-radius: 20px; background: #000; transform: translateX(-50%);
  }
  .sb-icons { display: flex; gap: 6px; align-items: center; }
  .home-indicator {
    display: block; position: absolute; bottom: 8px; left: 50%; z-index: 90;
    width: 136px; height: 5px; border-radius: 3px; background: var(--text); opacity: .8;
    transform: translateX(-50%); pointer-events: none;
  }
}

/* =========================================================
   Screens & transitions
   ========================================================= */
#app { position: absolute; inset: 0; }
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; background: var(--bg); }
.scroller {
  flex: 1; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain;
  scrollbar-width: none;
  padding: calc(var(--sat) + 8px) 20px calc(var(--sab) + 120px);
}
.scroller::-webkit-scrollbar { display: none; }

.in-fwd   { animation: inFwd .52s var(--ease) both; box-shadow: -20px 0 50px -20px rgba(0,0,0,.25); }
.out-fwd  { animation: outFwd .52s var(--ease) both; pointer-events: none; }
.in-back  { animation: inBack .52s var(--ease) both; }
.out-back { animation: outBack .52s var(--ease) both; pointer-events: none; z-index: 2; box-shadow: -20px 0 50px -20px rgba(0,0,0,.25); }
@keyframes inFwd   { from { transform: translateX(100%); } }
@keyframes outFwd  { to   { transform: translateX(-28%); filter: brightness(.9); } }
@keyframes inBack  { from { transform: translateX(-28%); filter: brightness(.9); } }
@keyframes outBack { to   { transform: translateX(100%); } }

.rise { animation: rise .6s var(--ease) both; animation-delay: calc(var(--d, 0) * 55ms + 60ms); }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }
.no-enter .rise, .no-enter .pcard { animation: none; }

/* =========================================================
   Shared components
   ========================================================= */
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: var(--surface); box-shadow: var(--shadow-sm); color: var(--text);
  transition: transform .25s var(--spring), background .2s;
}
.icon-btn:active { transform: scale(.88); }
.icon-btn.sm { width: 40px; height: 40px; background: var(--surface-2); box-shadow: none; }
.icon-btn.sm .ic { width: 20px; height: 20px; }

.btn {
  height: 56px; padding: 0 20px; border-radius: 20px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 700; font-size: 16px; letter-spacing: -.01em;
  transition: transform .25s var(--spring), filter .2s, background .2s, opacity .2s;
}
.btn:active { transform: scale(.96); }
.btn .ic { width: 20px; height: 20px; }
.btn.primary { background: var(--accent); color: var(--on-accent); box-shadow: 0 12px 26px -14px var(--accent); }
.btn.tonal { background: var(--accent-soft); color: var(--accent-strong); }
.btn.plain { background: var(--surface-2); }
.btn.text { background: none; color: var(--text-2); height: 50px; }
.btn.danger { color: var(--danger); }
.btn.danger-fill { background: var(--danger); color: #fff; }
.btn.block { width: 100%; }
.btn.sm { height: 40px; padding: 0 14px; border-radius: 14px; font-size: 14px; gap: 6px; }
.btn.sm .ic { width: 17px; height: 17px; }
.btn:disabled { opacity: .4; pointer-events: none; }
.mt { margin-top: 22px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px;
  border-radius: 999px; background: var(--surface-2);
  font-size: 12.5px; font-weight: 650; color: var(--text-2); white-space: nowrap;
}
.chip .ic { width: 14px; height: 14px; }
.chip.accent { background: var(--accent-soft); color: var(--accent-strong); }
.chip.ok { background: color-mix(in srgb, var(--ok) 14%, var(--surface)); color: var(--ok); }
.chip.sm { height: 24px; padding: 0 10px; font-size: 11.5px; }
.muted { color: var(--text-3); font-size: 12.5px; font-weight: 500; }

.card {
  background: var(--surface); border-radius: 28px; padding: 18px;
  box-shadow: var(--shadow); margin-top: 14px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
.card-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; font-weight: 700; color: var(--text-2);
  text-transform: uppercase; letter-spacing: .07em;
}
.card-title .ic { width: 16px; height: 16px; color: var(--accent); }
.card-meta { font-size: 13px; font-weight: 700; color: var(--text-2); }

.ptile {
  width: 48px; height: 48px; border-radius: 16px; flex: none;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
  transition: background .3s, color .3s;
}
.ptile.lg { width: 64px; height: 64px; border-radius: 22px; }
.ptile.lg .ic { width: 30px; height: 30px; }

.ring { display: block; }
.ring-bg { stroke: var(--surface-3); }
.ring-fg { transition: stroke-dashoffset 1.3s var(--ease); }
.ring-fg.zero { opacity: 0; }

/* =========================================================
   Home
   ========================================================= */
.home-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 14px 4px 20px; }
.eyebrow { margin: 0 0 6px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.large-title { margin: 0; font-size: 34px; line-height: 1.05; font-weight: 800; letter-spacing: -.04em; }

.summary {
  position: relative; overflow: hidden; border-radius: 32px; padding: 22px; color: #fff;
  background: linear-gradient(135deg, #5B4BFF 0%, #8A4DFF 48%, #E0529C 100%);
  box-shadow: 0 22px 44px -22px rgba(109, 92, 255, .8);
  margin-bottom: 28px;
}
.summary::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(320px 200px at 100% 0%, rgba(255,255,255,.30), transparent 60%),
    radial-gradient(260px 180px at 0% 100%, rgba(0,0,0,.20), transparent 60%);
}
.summary > * { position: relative; }
.sum-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.sum-label { font-size: 13px; font-weight: 650; opacity: .85; }
.sum-value { font-size: 46px; font-weight: 800; letter-spacing: -.045em; line-height: 1; margin-top: 8px; }
.sum-value small { font-size: 19px; font-weight: 700; opacity: .8; margin-left: 3px; letter-spacing: 0; }
.sum-pill {
  background: rgba(255,255,255,.18); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  padding: 7px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 650; white-space: nowrap;
}
.sum-bars { display: flex; gap: 8px; height: 76px; margin-top: 18px; }
.sum-bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 7px; }
.sb-track { flex: 1; width: 100%; display: flex; align-items: flex-end; }
.sb-track i { display: block; width: 100%; height: 0; border-radius: 8px; background: rgba(255,255,255,.30); transition: height .9s var(--ease); }
.sum-bar.today .sb-track i { background: #fff; }
.sum-bar span { font-size: 11px; font-weight: 650; opacity: .75; }
.sum-foot { display: flex; gap: 10px; margin-top: 16px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.2); font-size: 12.5px; }
.sum-foot > div { flex: 1; }
.sum-foot b { display: block; font-size: 17px; font-weight: 750; letter-spacing: -.02em; }
.sum-foot span { opacity: .8; }

.sec-head { display: flex; justify-content: space-between; align-items: baseline; margin: 0 4px 12px; }
.sec-head h2 { margin: 0; font-size: 20px; font-weight: 750; letter-spacing: -.025em; }

.pcard {
  display: block; width: 100%; text-align: left; position: relative; overflow: hidden;
  background: var(--surface); border-radius: 26px; padding: 16px; margin-bottom: 12px;
  box-shadow: var(--shadow);
  transition: transform .3s var(--spring);
  animation: rise .6s var(--ease) both; animation-delay: calc(var(--d, 0) * 60ms + 120ms);
}
.pcard:active { transform: scale(.975); }
.pcard-top { display: flex; align-items: center; gap: 14px; }
.pmeta { flex: 1; min-width: 0; }
.pmeta h3 { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -.015em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pmeta p { margin: 4px 0 0; font-size: 13.5px; color: var(--text-2); }
.pmeta p b { color: var(--text); font-weight: 750; }
.mini { position: relative; width: 54px; height: 54px; flex: none; }
.mini span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 12px; font-weight: 750; }
.pcard-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; gap: 8px; }

.fab {
  position: absolute; right: 20px; bottom: calc(var(--sab) + 18px); z-index: 5;
  height: 60px; padding: 0 22px 0 19px; border-radius: 22px;
  display: flex; align-items: center;
  background: var(--accent); color: var(--on-accent);
  font-weight: 700; font-size: 15.5px;
  box-shadow: 0 16px 32px -12px var(--accent), 0 4px 10px rgba(0,0,0,.12);
  transition: padding .35s var(--ease), transform .25s var(--spring);
  animation: fabIn .6s var(--spring) .35s both;
}
.fab:active { transform: scale(.92); }
.fab span { max-width: 140px; margin-left: 10px; overflow: hidden; white-space: nowrap; transition: max-width .35s var(--ease), margin .35s var(--ease), opacity .2s; }
.fab.shrink { padding: 0 18px; }
.fab.shrink span { max-width: 0; margin-left: 0; opacity: 0; }
.fab .ic { width: 24px; height: 24px; }
@keyframes fabIn { from { transform: scale(.4); opacity: 0; } }

.empty { text-align: center; padding: 28px 12px 0; }
.empty-art { width: 170px; height: 170px; margin: 10px auto 26px; position: relative; }
.empty-art circle.fg { animation: draw 1.6s var(--ease) both; }
.empty-art circle.fg:nth-of-type(4) { animation-delay: .12s; }
.empty-art circle.fg:nth-of-type(6) { animation-delay: .24s; }
@keyframes draw { from { stroke-dashoffset: var(--len); } }
.empty h2 { margin: 0 0 10px; font-size: 26px; font-weight: 800; letter-spacing: -.035em; }
.empty p { margin: 0 auto 28px; max-width: 300px; color: var(--text-2); font-size: 15px; line-height: 1.55; }
.empty .btn.text { margin-top: 6px; }

/* =========================================================
   Project detail
   ========================================================= */
.topbar {
  position: absolute; inset: 0 0 auto; z-index: 10;
  display: flex; align-items: center; gap: 8px;
  padding: calc(var(--sat) + 6px) 16px 10px;
  transition: background .25s, box-shadow .25s;
}
.topbar.solid {
  background: var(--glass);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 1px 0 var(--line);
}
.topbar-title {
  flex: 1; text-align: center; font-weight: 700; font-size: 16px; letter-spacing: -.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  opacity: 0; transform: translateY(6px); transition: opacity .25s, transform .25s var(--ease);
}
.topbar.titled .topbar-title { opacity: 1; transform: none; }
.detail .scroller { padding-top: calc(var(--sat) + 62px); }

.hero { position: relative; isolation: isolate; text-align: center; padding: 2px 0 6px; }
.hero-glow {
  position: absolute; left: 50%; top: 70px; width: 360px; height: 360px; z-index: -1; pointer-events: none;
  transform: translateX(-50%);
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 32%, transparent), transparent);
  filter: blur(24px); opacity: .9;
}
.hero-id { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.hero-id h1 { margin: 2px 0 0; font-size: 27px; font-weight: 800; letter-spacing: -.035em; line-height: 1.15; overflow-wrap: anywhere; }
.hero-id p { margin: -6px 0 0; color: var(--text-2); font-size: 14px; font-weight: 500; }
.big-ring { position: relative; width: 240px; height: 240px; margin: 22px auto 24px; }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-num { font-size: 60px; font-weight: 800; letter-spacing: -.055em; line-height: 1; }
.ring-num.long { font-size: 46px; }
.ring-lbl { font-size: 14px; font-weight: 650; color: var(--text-2); margin-top: 6px; }
.ring-sub {
  display: inline-flex; align-items: center; gap: 5px; margin-top: 12px;
  font-size: 12px; font-weight: 750; color: var(--accent-strong); background: var(--accent-soft);
  padding: 5px 11px; border-radius: 999px;
}
.ring-sub .ic { width: 14px; height: 14px; }
.actions { display: grid; grid-template-columns: 1.35fr 1fr; gap: 10px; }

.fc-date { font-size: 31px; font-weight: 800; letter-spacing: -.04em; line-height: 1.1; }
.fc-sub { color: var(--text-2); font-size: 14px; margin-top: 6px; line-height: 1.45; }
.fc-sub b { color: var(--text); font-weight: 700; }
.timeline { position: relative; height: 8px; border-radius: 99px; background: var(--surface-2); margin: 42px 0 10px; }
.timeline i {
  position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-light), var(--accent));
  transition: width 1.2s var(--ease);
}
.timeline b {
  position: absolute; top: 50%; left: 0; width: 20px; height: 20px; border-radius: 50%;
  background: var(--surface); border: 5px solid var(--accent); transform: translate(-50%, -50%);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 18%, transparent);
  transition: left 1.2s var(--ease);
}
.timeline em {
  position: absolute; bottom: 20px; left: 0; transform: translateX(-50%);
  font-style: normal; font-size: 11px; font-weight: 750; color: var(--on-accent);
  background: var(--accent); padding: 3px 8px; border-radius: 8px; white-space: nowrap;
  transition: left 1.2s var(--ease);
}
.tl-labels { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-3); font-weight: 650; }
.whatif {
  display: flex; align-items: center; gap: 12px; margin-top: 16px; padding: 13px 14px;
  border-radius: 18px; background: var(--surface-2); font-size: 13.5px; line-height: 1.45; color: var(--text-2);
}
.whatif .ic { width: 18px; height: 18px; color: var(--accent); }
.whatif b { color: var(--text); }
.fc-empty { display: flex; gap: 14px; align-items: center; }
.fc-empty-ic { width: 52px; height: 52px; border-radius: 18px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex: none; }
.fc-empty p { margin: 0; color: var(--text-2); font-size: 14px; line-height: 1.5; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.stat { background: var(--surface); border-radius: 24px; padding: 16px; box-shadow: var(--shadow); }
.stat-ic { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.stat-ic .ic { width: 18px; height: 18px; }
.stat-val { font-size: 25px; font-weight: 800; letter-spacing: -.035em; margin-top: 14px; line-height: 1; }
.stat-val small { font-size: 13px; font-weight: 650; color: var(--text-3); margin-left: 3px; letter-spacing: 0; }
.stat-lbl { font-size: 13px; color: var(--text-2); font-weight: 500; margin-top: 6px; }

.bars { display: flex; gap: 6px; height: 128px; }
.bars .b { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.bars .bt { flex: 1; width: 100%; display: flex; align-items: flex-end; }
.bars .bt i { display: block; width: 100%; height: 0; border-radius: 7px; background: var(--surface-2); transition: height .9s var(--ease); }
.bars .b.on .bt i { background: linear-gradient(180deg, var(--accent-light), var(--accent)); }
.bars .b span { font-size: 10.5px; font-weight: 650; color: var(--text-3); }
.bars .b.today span { color: var(--accent-strong); font-weight: 800; }

.hist-row {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  padding: 11px 2px; border-bottom: 1px solid var(--line); border-radius: 0;
  transition: background .2s, transform .2s var(--spring);
}
.hist-row:last-child { border-bottom: 0; padding-bottom: 2px; }
.hist-row:active { transform: scale(.98); }
.dbadge { width: 46px; height: 50px; border-radius: 15px; background: var(--surface-2); display: flex; flex-direction: column; align-items: center; justify-content: center; flex: none; }
.dbadge b { font-size: 17px; font-weight: 800; line-height: 1; }
.dbadge span { font-size: 10.5px; font-weight: 750; color: var(--text-3); text-transform: uppercase; margin-top: 3px; }
.hist-main { flex: 1; min-width: 0; }
.hist-main strong { display: block; font-size: 15px; font-weight: 650; }
.hist-main .sub { display: block; margin: 3px 0 0; font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hist-val { font-weight: 750; font-size: 15px; color: var(--accent-strong); }
.hint { margin: 0; color: var(--text-2); font-size: 14px; line-height: 1.5; }

/* =========================================================
   Sheets, dialogs, toast
   ========================================================= */
#sheet-root { position: absolute; inset: 0; z-index: 50; pointer-events: none; }
.sheet-wrap { position: absolute; inset: 0; pointer-events: auto; }
.sheet-wrap.closing { pointer-events: none; }
.scrim { position: absolute; inset: 0; background: var(--scrim); opacity: 0; transition: opacity .4s var(--ease); }
.sheet-wrap.open .scrim { opacity: 1; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0;
  max-height: calc(100% - var(--sat) - 10px);
  display: flex; flex-direction: column;
  background: var(--sheet); border-radius: 34px 34px 0 0; box-shadow: var(--shadow-lg);
  transform: translateY(105%); transition: transform .5s var(--sheet-ease);
}
.sheet-wrap.open .sheet { transform: translateY(0); }
.sheet.dragging { transition: none; }
.grabber { flex: none; padding: 10px 0 6px; display: flex; justify-content: center; touch-action: none; cursor: grab; }
.grabber::before { content: ""; width: 40px; height: 5px; border-radius: 3px; background: var(--surface-3); }
.sheet-body { overflow-y: auto; padding: 4px 20px calc(var(--sab) + 18px); overscroll-behavior: contain; scrollbar-width: none; }
.sheet-body::-webkit-scrollbar { display: none; }
.sheet-head { padding: 4px 0 18px; touch-action: none; }
.sheet-head.row { display: flex; align-items: center; gap: 14px; }
.sheet-head h2 { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -.035em; }
.sheet-head p { margin: 4px 0 0; color: var(--text-2); font-size: 14px; }

.dialog-wrap { display: grid; place-items: center; padding: 24px; }
.dialog {
  position: relative; width: 100%; max-width: 320px;
  background: var(--sheet); border-radius: 30px; padding: 24px 22px 18px; box-shadow: var(--shadow-lg);
  transform: scale(.88); opacity: 0; transition: transform .35s var(--spring), opacity .25s;
}
.dialog-wrap.open .dialog { transform: none; opacity: 1; }
.dialog h3 { margin: 0 0 8px; font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.dialog p { margin: 0 0 22px; color: var(--text-2); font-size: 14.5px; line-height: 1.5; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.dialog .btn { height: 46px; padding: 0 20px; border-radius: 15px; font-size: 15px; }

.menu { display: flex; flex-direction: column; gap: 8px; }
.menu-item {
  display: flex; align-items: center; gap: 14px; height: 60px; padding: 0 18px;
  border-radius: 20px; background: var(--surface-2); font-weight: 650; font-size: 16px;
  transition: transform .2s var(--spring);
}
.menu-item:active { transform: scale(.97); }
.menu-item .ic { color: var(--text-2); }
.menu-item.danger, .menu-item.danger .ic { color: var(--danger); }

#toast-root {
  position: absolute; left: 0; right: 0; bottom: calc(var(--sab) + 92px); z-index: 70;
  display: flex; justify-content: center; padding: 0 16px; pointer-events: none;
}
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px; max-width: 100%;
  min-height: 52px; padding: 8px 20px 8px 16px; border-radius: 18px;
  background: var(--text); color: var(--bg); box-shadow: var(--shadow-lg);
  font-size: 14.5px; font-weight: 600;
  animation: toastIn .5s var(--spring) both;
}
.toast.has-action { padding-right: 8px; }
.toast .ic { width: 20px; height: 20px; color: var(--accent-light); }
.toast button { height: 38px; padding: 0 14px; border-radius: 12px; font-weight: 750; color: var(--accent-light); background: color-mix(in srgb, var(--bg) 10%, transparent); }
.toast.out { animation: toastOut .25s ease both; }
@keyframes toastIn { from { transform: translateY(24px) scale(.94); opacity: 0; } }
@keyframes toastOut { to { transform: translateY(12px); opacity: 0; } }

.confetti { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 80; pointer-events: none; }

.shake { animation: shake .45s var(--ease); }
@keyframes shake { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }

/* =========================================================
   Inputs — wheel picker, ruler, chips, fields
   ========================================================= */
.wheels {
  position: relative; display: flex; justify-content: center; align-items: center; gap: 2px;
  height: 220px; margin-bottom: 12px; border-radius: 26px; background: var(--surface-2); overflow: hidden;
}
.wheel-band {
  position: absolute; left: 12px; right: 12px; top: 50%; height: 46px; transform: translateY(-50%);
  border-radius: 15px; background: var(--sheet); box-shadow: var(--shadow-sm); pointer-events: none;
}
.wheel {
  position: relative; height: 100%; width: 84px;
  overflow-y: scroll; scroll-snap-type: y mandatory; scrollbar-width: none;
  perspective: 700px; cursor: grab; touch-action: pan-y; outline: none;
  -webkit-mask-image: linear-gradient(transparent, #000 28%, #000 72%, transparent);
  mask-image: linear-gradient(transparent, #000 28%, #000 72%, transparent);
}
.wheel::-webkit-scrollbar { display: none; }
.wheel-pad { height: 87px; }
.wheel-item {
  height: 46px; display: flex; align-items: center; justify-content: center;
  scroll-snap-align: center; font-size: 25px; font-weight: 600; color: var(--text-2);
  font-variant-numeric: tabular-nums; user-select: none; will-change: transform, opacity;
}
.wheel-item.sel { color: var(--text); font-weight: 800; }
.wheel-unit { position: relative; width: 42px; font-size: 16px; font-weight: 700; color: var(--text-2); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.center { justify-content: center; }
.chip-btn {
  height: 38px; padding: 0 14px; border-radius: 13px; background: var(--surface-2);
  font-weight: 650; font-size: 14px; border: 1.5px solid transparent;
  transition: background .2s, color .2s, border-color .2s, transform .2s var(--spring);
}
.chip-btn:active { transform: scale(.93); }
.chip-btn.on { background: var(--accent-soft); color: var(--accent-strong); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.chips.fill { flex-wrap: nowrap; }
.chips.fill .chip-btn { flex: 1; padding: 0 6px; white-space: nowrap; }
.target-box .chips { display: grid; grid-template-columns: repeat(3, 1fr); padding: 0 18px; }
.target-box .chip-btn { background: var(--sheet); }
.target-box .chip-btn.on { background: var(--accent-soft); }

.impact {
  display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 14px;
  font-size: 13.5px; color: var(--text-2); font-weight: 550; min-height: 20px;
}
.impact b { color: var(--accent-strong); font-weight: 750; }
.impact .ic { width: 16px; height: 16px; color: var(--text-3); }

.field-label { font-size: 13px; font-weight: 700; color: var(--text-2); margin: 22px 2px 10px; }
.date-strip {
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  margin: 0 -20px; padding: 2px 20px 4px; scroll-snap-type: x proximity;
}
.date-strip::-webkit-scrollbar { display: none; }
.dchip {
  flex: none; width: 56px; height: 74px; border-radius: 19px; background: var(--surface-2);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  scroll-snap-align: center; transition: background .2s, color .2s, transform .2s var(--spring);
}
.dchip:active { transform: scale(.92); }
.dchip small { font-size: 10.5px; font-weight: 750; color: var(--text-3); text-transform: uppercase; letter-spacing: .02em; }
.dchip b { font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.dchip .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.dchip.on { background: var(--accent); color: var(--on-accent); box-shadow: 0 10px 20px -12px var(--accent); }
.dchip.on small { color: inherit; opacity: .8; }
.dchip.on .dot { background: currentColor; }

.field { position: relative; margin-top: 18px; }
.field input {
  width: 100%; height: 60px; border-radius: 18px; border: 1.5px solid transparent;
  background: var(--surface-2); padding: 22px 16px 6px; font-size: 16px; font-weight: 550;
  outline: none; transition: border-color .2s, background .2s;
}
.field label {
  position: absolute; left: 17px; top: 19px; font-size: 16px; color: var(--text-3);
  pointer-events: none; transform-origin: left top; transition: transform .2s var(--ease), color .2s;
}
.field input:focus { border-color: var(--accent); background: var(--sheet); }
.field input:focus + label,
.field input:not(:placeholder-shown) + label { transform: translateY(-10px) scale(.76); color: var(--text-2); }
.field input:focus + label { color: var(--accent-strong); }

.target-box { margin-top: 16px; background: var(--surface-2); border-radius: 28px; padding: 20px 0 18px; overflow: hidden; }
.tb-row { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 0 18px; }
.round-btn {
  width: 50px; height: 50px; border-radius: 50%; flex: none;
  display: grid; place-items: center; background: var(--sheet); box-shadow: var(--shadow-sm);
  touch-action: manipulation; user-select: none; transition: transform .2s var(--spring);
}
.round-btn:active { transform: scale(.88); }
.tb-val { display: flex; flex-direction: column; align-items: center; min-width: 0; }
.tb-val input {
  width: 170px; text-align: center; border: 0; background: none; outline: none; padding: 0;
  font-size: 58px; font-weight: 800; letter-spacing: -.055em; line-height: 1.05;
}
.tb-val span { font-size: 12px; font-weight: 750; color: var(--text-2); text-transform: uppercase; letter-spacing: .1em; }
.ruler { position: relative; height: 62px; margin: 16px 0 14px; }
.ruler-track {
  height: 100%; display: flex; overflow-x: scroll; scroll-snap-type: x mandatory;
  scrollbar-width: none; cursor: grab; touch-action: pan-x;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 22%, #000 78%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 22%, #000 78%, transparent);
}
.ruler-track::-webkit-scrollbar { display: none; }
.ruler-pad { flex: none; width: calc(50% - 6px); }
.tick { flex: none; width: 12px; height: 100%; position: relative; scroll-snap-align: center; }
.tick::before {
  content: ""; position: absolute; left: 50%; top: 8px; width: 2px; height: 12px;
  border-radius: 2px; background: var(--text-3); opacity: .45; transform: translateX(-50%);
}
.tick.mid::before { height: 18px; opacity: .7; }
.tick.major::before { height: 26px; opacity: 1; background: var(--text-2); }
.tick span { position: absolute; top: 40px; left: 50%; transform: translateX(-50%); font-size: 11px; font-weight: 700; color: var(--text-3); user-select: none; }
.ruler-needle {
  position: absolute; left: 50%; top: 2px; width: 4px; height: 36px; border-radius: 3px;
  background: var(--accent); transform: translateX(-50%); pointer-events: none;
  box-shadow: 0 0 0 3px var(--surface-2);
}
.tb-hint { text-align: center; margin: 14px 0 0; padding: 0 18px; font-size: 13px; color: var(--text-2); font-weight: 550; }
.tb-hint b { color: var(--text); }

.swatches { display: flex; justify-content: space-between; gap: 6px; }
.sw {
  width: 36px; height: 36px; border-radius: 50%; background: var(--c); color: #fff;
  display: grid; place-items: center; transition: transform .25s var(--spring), box-shadow .2s;
}
.sw .ic { width: 18px; height: 18px; opacity: 0; transform: scale(.4); transition: .25s var(--spring); }
.sw.on { box-shadow: 0 0 0 3px var(--sheet), 0 0 0 5.5px var(--c); }
.sw.on .ic { opacity: 1; transform: none; }
.sw:active { transform: scale(.88); }
.icon-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.ig {
  aspect-ratio: 1; border-radius: 16px; background: var(--surface-2); color: var(--text-2);
  display: grid; place-items: center; transition: background .2s, color .2s, transform .2s var(--spring);
}
.ig:active { transform: scale(.9); }
.ig.on { background: var(--accent); color: var(--on-accent); }

/* =========================================================
   Calendar
   ========================================================= */
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 2px 0 14px; }
.cal-title { flex: 1; touch-action: none; }
.cal-title h2 { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -.035em; }
.cal-title p { margin: 4px 0 0; color: var(--text-2); font-size: 13.5px; }
.cal-nav { display: flex; gap: 8px; }
.cal-week, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; text-align: center; }
.cal-week span { font-size: 12px; font-weight: 750; color: var(--text-3); padding: 4px 0 8px; }
.cal-grid { touch-action: pan-y; }
.cal-grid.sr { animation: slideR .35s var(--ease); }
.cal-grid.sl { animation: slideL .35s var(--ease); }
@keyframes slideR { from { opacity: 0; transform: translateX(24px); } }
@keyframes slideL { from { opacity: 0; transform: translateX(-24px); } }
.cday {
  position: relative; aspect-ratio: 1 / 1.08; border-radius: 15px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 650; font-variant-numeric: tabular-nums;
  transition: transform .2s var(--spring), background .2s;
}
.cday:active { transform: scale(.9); }
.cday small { font-size: 9.5px; font-weight: 750; margin-top: 1px; opacity: .8; }
.cday.out { visibility: hidden; }
.cday.future { color: var(--text-3); }
.cday.has { background: color-mix(in srgb, var(--accent) var(--mix), var(--surface-2)); }
.cday.has.dark { color: var(--on-accent); }
.cday.today { box-shadow: inset 0 0 0 2px var(--accent); }
.cday.sel { outline: 2.5px solid var(--text); outline-offset: 2px; }
.cday.finish::after {
  content: ""; position: absolute; top: 5px; right: 5px; width: 7px; height: 7px;
  border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 2px var(--sheet);
}
.legend { display: flex; align-items: center; justify-content: center; gap: 5px; margin-top: 14px; font-size: 11.5px; font-weight: 600; color: var(--text-3); }
.legend i { width: 13px; height: 13px; border-radius: 4px; background: color-mix(in srgb, var(--accent) var(--mix), var(--surface-2)); }
.legend .lg-sep { width: 12px; }
.legend i.lg-fin { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.day-panel { display: flex; align-items: center; gap: 14px; margin-top: 16px; padding: 14px; border-radius: 22px; background: var(--surface-2); }
.dp-date {
  width: 48px; height: 52px; border-radius: 15px; background: var(--accent); color: var(--on-accent);
  display: flex; flex-direction: column; align-items: center; justify-content: center; flex: none;
}
.dp-date b { font-size: 19px; font-weight: 800; line-height: 1; }
.dp-date span { font-size: 10.5px; font-weight: 750; text-transform: uppercase; opacity: .85; margin-top: 3px; }
.dp-main { flex: 1; min-width: 0; }
.dp-main strong { display: block; font-size: 15px; font-weight: 700; }
.dp-main p { margin: 3px 0 0; font-size: 13px; color: var(--text-2); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
