/* Kal — warm, calm, two-colour calendar. Mobile-first; desktop gets a top nav + 7 columns. */
@font-face { font-family: "Nunito"; src: url("/static/fonts/Nunito.ttf") format("truetype"); font-weight: 200 1000; font-display: swap; }

:root {
  color-scheme: light dark;
  --bg: #faf7f2; --bg-2: #ffffff; --bg-3: #f1ede6; --line: #e6e1d8; --line-strong: #d3cdc2;
  --text: #1f2430; --muted: #6b7080; --faint: #9aa0ad;
  --accent: #2f7bf5; --accent-ink: #fff;
  --change: #f5a524; --change-ink: #3a2a00;
  --other: #7c7f96; --unset: #d9d4ca; --weekend: #d64560;
  --ok: #1f9d6a; --err: #d64560; --warn: #f5a524;
  --radius: 16px; --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(31,36,48,.06), 0 6px 20px -8px rgba(31,36,48,.14);
  --font: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --tab-h: 62px; --top-h: 56px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161c; --bg-2: #1d2029; --bg-3: #262a35; --line: #2e323d; --line-strong: #3d424f;
    --text: #eceef3; --muted: #a0a6b5; --faint: #858c9c; --unset: #3a3f4c;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px -10px rgba(0,0,0,.6);
  }
  .seg, .now-card__who, .prop__head .who, .dot { background-color: color-mix(in oklab, var(--c, var(--unset)) 86%, white); }
  .seg--none { background-color: var(--unset); }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-gutter: stable; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 var(--font); min-height: 100dvh; overflow-x: hidden; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
a { color: var(--accent); text-decoration: none; }
button { font: inherit; color: inherit; }
h1 { font-size: 1.35rem; margin: 0; font-weight: 800; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 0 0 .5rem; font-weight: 800; }
.h-small { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 .6rem; font-weight: 800; }
.ico, .ico-inline { display: inline-flex; width: 18px; height: 18px; flex: none; vertical-align: -3px; }
.ico svg, .ico-inline svg { width: 100%; height: 100%; }
.btn .ico { width: 18px; height: 18px; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: .85rem; } .center { text-align: center; }
.row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.grow { flex: 1; }

/* layout */
.app { min-height: 100dvh; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 1rem; height: calc(var(--top-h) + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 16px 0; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px) saturate(140%); border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: .5rem; color: var(--text); font-weight: 900; font-size: 1.1rem; }
.brand img { border-radius: 8px; }
.nav--top { display: none; gap: .25rem; }
.nav--top a { padding: .45rem .9rem; border-radius: 999px; color: var(--muted); font-weight: 700; position: relative; }
.nav--top a.is-active { color: var(--text); background: var(--bg-3); }
.top__right { margin-left: auto; display: flex; gap: .5rem; align-items: center; }
.main { flex: 1; width: 100%; max-width: 1100px; margin: 0 auto; padding: 14px 16px calc(var(--tab-h) + 24px + env(safe-area-inset-bottom)); }
.main--fab { padding-bottom: calc(var(--tab-h) + 54px + 28px + env(safe-area-inset-bottom)); }
.main:focus { outline: none; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(3, 1fr); height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: color-mix(in srgb, var(--bg-2) 92%, transparent); backdrop-filter: blur(12px) saturate(140%); border-top: 1px solid var(--line); }
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); font-size: .7rem; font-weight: 800; position: relative; }
.tabbar a svg { width: 24px; height: 24px; }
.tabbar a.is-active { color: var(--accent); }
.tabbar--4 { grid-template-columns: repeat(4, 1fr); }
.badge { position: absolute; top: 6px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--err); color: #fff; font-size: .7rem; font-weight: 900; line-height: 18px; text-align: center; }
.nav--top .badge { top: 0; left: auto; right: -2px; }
@media (min-width: 860px) {
  .nav--top { display: flex; }
  .tabbar { display: none; }
  .main { padding-bottom: 40px; padding-top: 22px; }
}

/* cards & controls */
.card { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 14px; }
.card--flat { box-shadow: none; }
.card--link { display: flex; align-items: center; gap: .75rem; color: var(--text); text-decoration: none; }
.card--link:active { background: var(--bg-3); }
.card--link .ico { color: var(--muted); }
.more > summary { cursor: pointer; font-weight: 800; color: var(--muted); font-size: .88rem; padding: 6px 0; list-style: none; }
.more > summary::-webkit-details-marker { display: none; }
.more > summary::before { content: "▸ "; }
.more[open] > summary::before { content: "▾ "; }
.daystrip { margin-bottom: 4px; }
.daystrip .chip { padding: 0 12px; }
.sr-date { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 44px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--bg-2); color: var(--text); font-weight: 800; cursor: pointer; text-decoration: none; transition: transform .08s ease, background .12s ease; user-select: none; -webkit-tap-highlight-color: transparent; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: default; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn--ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn--danger { background: var(--err); border-color: var(--err); color: #fff; }
.btn--ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn--ghost:hover { background: var(--bg-3); color: var(--text); }
.btn--small { min-height: 34px; padding: 0 12px; font-size: .88rem; }
.btn--block { width: 100%; }
.btn--icon { width: 44px; padding: 0; }
.btn--icon.btn--small { width: 34px; }
.iconbtn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--muted); }
.iconbtn:hover { background: var(--bg-3); color: var(--text); }
.iconbtn--accent { background: var(--accent); color: #fff; }
.iconbtn--accent:hover { background: var(--accent); color: #fff; filter: brightness(1.08); }
.iconbtn svg { width: 22px; height: 22px; }
.field { display: flex; flex-direction: column; gap: .3rem; margin-bottom: .9rem; }
.field > span { font-size: .85rem; font-weight: 800; color: var(--muted); }
.field .hint { font-size: .8rem; color: var(--faint); font-weight: 400; }
input:not([type=checkbox]):not([type=radio]), select, textarea { width: 100%; font: inherit; color: var(--text); background: var(--bg-2); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 10px 12px; min-height: 44px; font-size: 16px; }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--accent); }
select { appearance: auto; }
textarea { min-height: 80px; resize: vertical; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.alert { padding: 10px 14px; border-radius: var(--radius-sm); background: var(--bg-3); margin-bottom: .9rem; font-weight: 600; }
.alert--err { background: color-mix(in srgb, var(--err) 14%, var(--bg-2)); color: var(--err); }
.alert--ok { background: color-mix(in srgb, var(--ok) 14%, var(--bg-2)); color: var(--ok); }
.alert--warn { background: color-mix(in srgb, var(--warn) 18%, var(--bg-2)); color: var(--change-ink); }
@media (prefers-color-scheme: dark) { .alert--warn { color: #ffd27a; } }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 12px 0; border-top: 1px solid var(--line); }
.switch:first-of-type { border-top: 0; }
.switch__text b { display: block; }
.switch__text span { font-size: .85rem; color: var(--muted); }
.toggle { position: relative; width: 50px; height: 30px; flex: none; }
.toggle input { position: absolute; inset: 0; opacity: 0; margin: 0; width: 100%; height: 100%; cursor: pointer; }
.toggle i { position: absolute; inset: 0; border-radius: 999px; background: var(--line-strong); transition: background .15s; }
.toggle i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .15s; }
.toggle input:checked + i { background: var(--accent); }
.toggle input:checked + i::after { transform: translateX(20px); }
.chips { display: flex; gap: .4rem; flex-wrap: wrap; }
.chip { min-height: 38px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--line-strong); background: var(--bg-2); font-weight: 800; cursor: pointer; display: inline-flex; align-items: center; gap: .4rem; }
.chip.is-active { border-color: var(--chip, var(--accent)); background: color-mix(in srgb, var(--chip, var(--accent)) 16%, var(--bg-2)); color: var(--text); }
.chip .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--chip, var(--accent)); }
.seg-ctl { display: inline-flex; background: var(--bg-3); border-radius: 999px; padding: 3px; }
.seg-ctl button { border: 0; background: transparent; border-radius: 999px; padding: 6px 16px; font-weight: 800; color: var(--muted); cursor: pointer; min-height: 36px; }
.seg-ctl button.is-active { background: var(--bg-2); color: var(--text); box-shadow: var(--shadow); }
.pill { display: inline-flex; align-items: center; gap: .3rem; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 800; background: var(--bg-3); color: var(--muted); }
.pill--change { background: color-mix(in srgb, var(--change) 22%, var(--bg-2)); color: var(--change-ink); }
.pill--pending { background: color-mix(in srgb, var(--accent) 14%, var(--bg-2)); color: var(--accent); }
.pill--ok { background: color-mix(in srgb, var(--ok) 16%, var(--bg-2)); color: var(--ok); }
.pill--err { background: color-mix(in srgb, var(--err) 14%, var(--bg-2)); color: var(--err); }
@media (prefers-color-scheme: dark) { .pill--change { color: #ffd27a; } }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--c, var(--unset)); flex: none; }
.empty { text-align: center; padding: 2rem 1rem; color: var(--muted); }
.empty svg { width: 48px; height: 48px; color: var(--faint); margin-bottom: .5rem; }
.lines { padding-left: 1.2rem; margin: .4rem 0 .8rem; line-height: 1.6; }
.quote { color: var(--muted); font-style: italic; margin: 0 0 .8rem; }
.legend { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .82rem; color: var(--muted); font-weight: 700; margin: .5rem 2px 0; }
.legend span { display: inline-flex; align-items: center; gap: .35rem; }
.legend .swatch { width: 22px; height: 12px; border-radius: 4px; background: var(--c, var(--unset)); }
.swatch.is-change { background-image: var(--stripes); outline: 2px solid var(--change); outline-offset: -1px; }
.swatch.is-pending { background: transparent; border: 2px dashed var(--accent); }

/* calendar header */
.calhead { display: flex; flex-direction: column; align-items: stretch; gap: 8px; margin-bottom: 10px; }
.calhead__row { display: flex; align-items: center; gap: .25rem; }
.calhead__row h1 { flex: 1; text-align: center; font-size: 1.15rem; }
.calhead > h1 { font-size: 1.35rem; }
.calhead .seg-ctl { align-self: stretch; }
.calhead .seg-ctl button { flex: 1; }
@media (min-width: 860px) {
  .calhead { flex-direction: row; align-items: center; gap: .6rem; }
  .calhead__row { flex: 1; }
  .calhead__row h1 { text-align: left; font-size: 1.3rem; }
  .calhead .seg-ctl { align-self: auto; }
}
.calhead__nav { display: inline-flex; align-items: center; gap: 2px; }
.now-card { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--radius); background: var(--bg-2); border: 1px solid var(--line); box-shadow: var(--shadow); margin-bottom: 14px; }
.now-card__who { width: 46px; height: 46px; border-radius: 50%; background: var(--c, var(--unset)); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 1.15rem; flex: none; box-shadow: inset 0 -3px 0 rgba(0,0,0,.12); }
.now-card__go { margin-left: auto; color: var(--faint); display: inline-flex; }
.now-card__go svg { width: 20px; height: 20px; }
.now-card b { font-size: 1.05rem; }
.now-card .muted { font-size: .9rem; }

/* segments — shared by week/month/day bars */
:root { --stripes: repeating-linear-gradient(135deg, rgba(255,255,255,.42) 0 5px, transparent 5px 11px); }
.bar { display: flex; border-radius: 10px; overflow: hidden; background: var(--unset); position: relative; isolation: isolate; }
.seg { flex: var(--f, 1) 1 0; background: var(--c, var(--unset)); position: relative; min-width: 0; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; font-size: .78rem; white-space: nowrap; overflow: hidden; text-shadow: 0 1px 1px rgba(0,0,0,.2); }
.seg + .seg { box-shadow: -1px 0 0 rgba(255,255,255,.55); }
.seg--none { background: var(--unset); color: var(--muted); text-shadow: none; }
.seg--other { background: var(--other); background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.16) 0 4px, transparent 4px 8px); }
.seg.is-change { background-image: var(--stripes); }
.seg.is-change::after { content: ""; position: absolute; inset: 0; border: 2.5px solid var(--change); border-radius: inherit; pointer-events: none; }
.seg__label { padding: 0 6px; overflow: hidden; text-overflow: ellipsis; }
.bar--thin .seg__label { display: none; }
.ghost { position: absolute; top: 0; bottom: 0; border: 2px dashed var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); border-radius: 6px; pointer-events: none; z-index: 2; }
.ghost::before { content: "?"; position: absolute; right: 3px; top: 1px; font-size: .65rem; font-weight: 900; color: var(--accent); }

/* week view */
.week { display: flex; flex-direction: column; gap: 8px; touch-action: pan-y; }
.day-row { display: grid; grid-template-columns: 50px 1fr; gap: 10px; align-items: center; padding: 6px 10px 6px 6px; border-radius: var(--radius); background: var(--bg-2); border: 1px solid var(--line); box-shadow: var(--shadow); cursor: pointer; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.day-row:active { background: var(--bg-3); }
.day-row.is-past .day-row__date, .day-row.is-past .day-row__meta { opacity: .6; }
.day-row__date { text-align: center; line-height: 1.1; }
.day-row__date .wd { display: block; font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 900; }
.day-row__date .num { display: inline-block; font-size: 1.2rem; font-weight: 900; width: 34px; height: 34px; line-height: 34px; border-radius: 50%; }
.day-row.is-today .day-row__date .num { background: var(--accent); color: #fff; }
.day-row.is-weekend .day-row__date .wd { color: var(--weekend); }
.day-row__body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.day-row .bar { height: 30px; }
.day-row__meta { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; font-size: .8rem; color: var(--muted); }
.day-row__meta:empty { display: none; }
@media (max-width: 859px) { .day-row__meta.is-hidden-mobile { display: none; } }
.day-row__meta .note-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60vw; }
.hours { display: none; }
@media (min-width: 860px) {
  .week { display: grid; grid-template-columns: 44px repeat(7, 1fr); gap: 8px; align-items: stretch; }
  .hours { display: flex; flex-direction: column; justify-content: space-between; height: calc(460px + 72px + 8px); padding-top: 72px; align-self: start; color: var(--faint); font-size: .72rem; font-weight: 800; text-align: right; line-height: 1; }
  .day-row { display: flex; flex-direction: column; gap: 8px; padding: 10px; align-items: stretch; }
  .day-row__date { display: flex; flex-direction: column; align-items: center; gap: 2px; }
  .day-row__body { flex: 1; }
  .day-row .bar { height: 460px; flex-direction: column; }
  .day-row .seg { font-size: .82rem; }
  .day-row .seg + .seg { box-shadow: 0 -1px 0 rgba(255,255,255,.55); }
  .day-row .ghost { left: 0; right: 0; top: var(--gs); bottom: var(--ge); }
  .day-row__meta { justify-content: center; }
  .day-row__meta .note-t { max-width: 100%; }
}
@media (max-width: 859px) {
  .day-row .ghost { top: 0; bottom: 0; left: var(--gs); right: var(--ge); }
}

/* month view */
.month { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; touch-action: pan-y; }
.month__wd { text-align: center; font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 900; padding-bottom: 4px; }
.mday { min-height: 62px; padding: 6px 4px 5px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 5px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.mday:active { background: var(--bg-3); }
.mday.is-other { opacity: .38; }
.mday.is-past .mday__num { opacity: .55; }
.mday__num { font-weight: 900; font-size: .95rem; text-align: center; width: 28px; height: 28px; line-height: 28px; border-radius: 50%; margin: 0 auto; }
.mday.is-today .mday__num { background: var(--accent); color: #fff; }
.mday .bar { height: 8px; border-radius: 4px; }
.mday .seg.is-change { background-image: none; }
.mday .seg.is-change::after { border-width: 2px; border-radius: 4px; }
.mday__marks { display: flex; gap: 3px; justify-content: center; min-height: 8px; }
.mark { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.mark--change { background: var(--change); }
.mark--pending { background: transparent; border: 2px solid var(--accent); width: 9px; height: 9px; }
.mark--note { background: var(--faint); }
@media (min-width: 860px) { .mday { min-height: 92px; } .mday .bar { height: 12px; } }

/* day view */
.dayhead { display: flex; align-items: center; gap: .5rem; margin-bottom: 8px; }
.dayhead h1 { flex: 1; font-size: 1.1rem; }
.only-narrow { display: inline; } .only-wide { display: none; }
@media (min-width: 520px) { .only-narrow { display: none; } .only-wide { display: inline; } .dayhead h1 { font-size: 1.2rem; } }
@media (max-width: 519px) { .btn--back .btn__label { display: none; } .btn--back { padding: 0 8px; } }
.timeline { display: grid; grid-template-columns: 44px 1fr; gap: 0 10px; position: relative; }
.timeline__hours { display: flex; flex-direction: column; justify-content: space-between; color: var(--faint); font-size: .72rem; font-weight: 800; text-align: right; }
.timeline .bar { flex-direction: column; height: 560px; border-radius: 14px; }
.timeline .seg { font-size: .92rem; flex-direction: column; gap: 2px; }
.timeline .seg + .seg { box-shadow: 0 -1px 0 rgba(255,255,255,.55); }
.timeline .seg small { font-weight: 700; opacity: .9; font-size: .74rem; }
.timeline .ghost { left: 55%; right: 4px; top: var(--gs); bottom: var(--ge); display: flex; align-items: center; justify-content: center; font-size: .75rem; font-weight: 800; color: var(--accent); text-align: center; padding: 2px; }
.timeline .ghost::before { display: none; }
.timeline .now-line { position: absolute; left: 48px; right: 0; top: var(--y); height: 2px; background: var(--err); z-index: 3; pointer-events: none; }
.timeline .now-line::before { content: ""; position: absolute; left: -6px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--err); }
.notes { display: flex; flex-direction: column; gap: 6px; }
.note { display: flex; gap: .6rem; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--bg-3); }
.note p { margin: 0; flex: 1; white-space: pre-wrap; word-break: break-word; }
.fab { position: fixed; right: 16px; bottom: calc(var(--tab-h) + 16px + env(safe-area-inset-bottom)); z-index: 15; height: 54px; padding: 0 20px 0 16px; border-radius: 999px; background: var(--accent); color: #fff; border: 0; font-weight: 900; box-shadow: 0 8px 24px -6px color-mix(in srgb, var(--accent) 60%, transparent); display: inline-flex; align-items: center; gap: .5rem; cursor: pointer; }
.fab svg { width: 22px; height: 22px; }
@media (min-width: 860px) { .fab { bottom: 28px; right: max(16px, calc((100vw - 1100px) / 2 + 16px)); } .main--fab { padding-bottom: 96px; } }

/* proposals */
.prop { border-left: 5px solid var(--pc, var(--line-strong)); }
.prop__head { display: flex; align-items: center; gap: .6rem; margin-bottom: .5rem; flex-wrap: wrap; }
.prop__head .who { width: 34px; height: 34px; border-radius: 50%; background: var(--pc); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 900; }
.prop__items { list-style: none; padding: 0; margin: 0 0 .6rem; display: flex; flex-direction: column; gap: 4px; }
.prop__items li { display: block; font-weight: 600; line-height: 1.45; }
.prop__items li .dot { margin-right: 6px; vertical-align: -1px; }
.prop__items li .to { font-weight: 800; white-space: nowrap; margin-left: 4px; }
.prop__actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .6rem; }

/* sheets (bottom on mobile, dialog on desktop) */
.sheet-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(20,22,28,.45); display: flex; align-items: flex-end; justify-content: center; animation: fade .15s ease; }
.sheet { width: 100%; max-height: 92dvh; overflow: auto; background: var(--bg-2); border-radius: 22px 22px 0 0; padding: 8px 16px calc(20px + env(safe-area-inset-bottom)); animation: up .2s ease; box-shadow: 0 -10px 40px rgba(0,0,0,.25); }
.sheet__grip { width: 44px; height: 5px; border-radius: 3px; background: var(--line-strong); margin: 4px auto 12px; }
.sheet__head { display: flex; align-items: center; gap: .5rem; margin-bottom: .8rem; }
.sheet__head h2 { flex: 1; margin: 0; font-size: 1.15rem; }
@media (min-width: 720px) {
  .sheet-backdrop { align-items: center; }
  .sheet { max-width: 560px; border-radius: 22px; padding-bottom: 20px; animation: fade .15s ease; }
  .sheet__grip { display: none; }
}
@keyframes up { from { transform: translateY(40px); opacity: .6; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.cart { display: flex; flex-direction: column; gap: 6px; margin: .6rem 0; }
.cart__item { display: flex; align-items: center; gap: .6rem; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--bg-3); font-weight: 700; }
.cart__item .dot { width: 12px; height: 12px; }
.timepick { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; }
.timepick .arrow { color: var(--faint); font-weight: 900; }

/* templates */
.tpl-preview { display: flex; flex-direction: column; gap: 3px; margin: .6rem 0; }
.tpl-preview__row { display: grid; grid-template-columns: 26px 1fr; gap: 6px; align-items: center; font-size: .72rem; font-weight: 900; color: var(--muted); }
.tpl-preview .bar { height: 12px; border-radius: 4px; }
.tpl-week { margin-bottom: 1rem; }
.tpl-day { padding: 10px 0; border-top: 1px solid var(--line); }
.tpl-day__head { display: flex; align-items: center; gap: .6rem; margin-bottom: 6px; }
.tpl-day__head b { width: 30px; }
.tpl-day .bar { height: 14px; flex: 1; border-radius: 5px; }
.tpl-seg { display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; align-items: center; padding: 6px 0 8px; border-top: 1px dashed var(--line); }
.tpl-seg:first-of-type { border-top: 0; }
.tpl-seg__time { display: flex; align-items: center; gap: 6px; font-weight: 800; }
.tpl-seg .chips { grid-column: 1 / -1; }
.tpl-seg__actions { display: flex; gap: 2px; }
.tpl-seg select { min-height: 38px; padding: 4px 8px; width: auto; font-size: .95rem; }
.tpl-seg .chips .chip { min-height: 34px; padding: 0 10px; font-size: .88rem; }
.period-list { list-style: none; padding: 0; margin: 0; }
.period-list li { display: flex; align-items: center; gap: .6rem; padding: 10px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.period-list li .grow { min-width: 120px; }
.period-list li:first-child { border-top: 0; }
.period-list .from { font-weight: 800; min-width: 100px; }
.period-list .is-current { color: var(--ok); }
.palette { display: flex; gap: 8px; flex-wrap: wrap; }
.palette button { width: 34px; height: 34px; border-radius: 50%; border: 3px solid transparent; background: var(--c); cursor: pointer; }
.palette button.is-active { border-color: var(--text); }

/* settings */
.settings-nav { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 12px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: .9rem; }
.kv dt { color: var(--muted); font-weight: 700; } .kv dd { margin: 0; }
.list { list-style: none; padding: 0; margin: 0; }
.list li { display: flex; gap: .6rem; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); font-size: .92rem; }
.list li:first-child { border-top: 0; }
.list .grow { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85em; }

/* toast */
.toast { position: fixed; left: 50%; bottom: calc(var(--tab-h) + 20px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px); background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-weight: 800; opacity: 0; pointer-events: none; transition: all .2s; z-index: 60; max-width: 92vw; text-align: center; }
.toast.is-on { opacity: 1; transform: translateX(-50%); }
.toast.is-err { background: var(--err); color: #fff; }
.toast.is-top { bottom: auto; top: calc(16px + env(safe-area-inset-top)); z-index: 70; }
@media (min-width: 860px) { .toast { bottom: 28px; } }

/* login */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100dvh; padding: 24px 16px; }
.login { width: 100%; max-width: 380px; }
.login--wide { max-width: 480px; }
.login__brand { text-align: center; margin-bottom: 18px; }
.login__brand img { border-radius: 16px; margin-bottom: 6px; }
.login__brand h1 { font-size: 1.6rem; }
.login__form { padding: 22px; }
.skeleton { height: 60px; border-radius: var(--radius); background: linear-gradient(90deg, var(--bg-3), var(--bg-2), var(--bg-3)); background-size: 200% 100%; animation: sk 1.2s infinite; margin-bottom: 8px; }
@keyframes sk { to { background-position: -200% 0; } }
@media (pointer: coarse) {
  .btn--small { min-height: 44px; padding: 0 14px; }
  .btn--icon.btn--small { width: 44px; }
  .chip, .tpl-seg .chip { min-height: 44px; }
  .palette button { width: 44px; height: 44px; }
  .prop__actions .btn { flex: 1 1 45%; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
