/* ───────────────────────── Broadwater — styles ───────────────────────── */

:root {
  --paper: #F5F0E6;
  --paper-2: #EEE7D9;
  --card: #FCFAF5;
  --card-2: #F8F4EC;
  --ink: #1D2630;
  --ink-2: #4A5561;
  --ink-3: #828A92;
  --line: #DCD3C2;
  --line-soft: #E9E2D4;
  --clay: #B85C38;
  --clay-ink: #FFF8F2;
  --sea: #2C7A78;
  --weekend: rgba(120, 100, 70, .035);
  --shadow: 0 1px 2px rgba(29, 38, 48, .06), 0 8px 24px -8px rgba(29, 38, 48, .14);
  --shadow-lg: 0 2px 6px rgba(29, 38, 48, .08), 0 30px 60px -20px rgba(29, 38, 48, .35);
  --heat: 184, 92, 56;

  --c-clinic: #2C7A78;
  --c-personal: #B85C38;
  --c-family: #B04A6A;
  --c-learning: #4E5BA6;
  --c-admin: #9A7318;
  --c-health: #4B8739;
  --c-holiday: #2C7A78;

  --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;

  --hour: 52px;
  --gutter: 58px;
  --side-w: 296px;
  --rail-w: 340px;
  --r: 12px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #13181D; --paper-2: #0F1317; --card: #1A2128; --card-2: #171D23;
    --ink: #ECE6DA; --ink-2: #B9B2A5; --ink-3: #7F8891;
    --line: #2B343D; --line-soft: #222A32;
    --clay: #E2835C; --clay-ink: #1A1410; --sea: #62B7B1;
    --weekend: rgba(255, 255, 255, .018);
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px -8px rgba(0,0,0,.5);
    --shadow-lg: 0 2px 6px rgba(0,0,0,.4), 0 30px 60px -20px rgba(0,0,0,.7);
    --heat: 226, 131, 92;
    --c-clinic: #5DB3AD; --c-personal: #E2835C; --c-family: #E07A9A; --c-learning: #8C98E6;
    --c-admin: #D6AE52; --c-health: #86C06F; --c-holiday: #62B7B1;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #13181D; --paper-2: #0F1317; --card: #1A2128; --card-2: #171D23;
  --ink: #ECE6DA; --ink-2: #B9B2A5; --ink-3: #7F8891;
  --line: #2B343D; --line-soft: #222A32;
  --clay: #E2835C; --clay-ink: #1A1410; --sea: #62B7B1;
  --weekend: rgba(255, 255, 255, .018);
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px -8px rgba(0,0,0,.5);
  --shadow-lg: 0 2px 6px rgba(0,0,0,.4), 0 30px 60px -20px rgba(0,0,0,.7);
  --heat: 226, 131, 92;
  --c-clinic: #5DB3AD; --c-personal: #E2835C; --c-family: #E07A9A; --c-learning: #8C98E6;
  --c-admin: #D6AE52; --c-health: #86C06F; --c-holiday: #62B7B1;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 14px/1.45 var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
svg { display: block; }
kbd {
  font: 500 11px/1 var(--sans); padding: 3px 5px; border-radius: 5px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink-2);
}
[hidden] { display: none !important; }

/* icons drawn with strokes */
.icon-btn svg, .fab svg, .quick-ico, .side-close svg, .wx svg, .tiny-ico, .mo-wx svg, .tg-wx svg, .dp-wx svg {
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}

/* ─────────── layout ─────────── */
.app {
  height: 100dvh;
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr) var(--rail-w);
  padding-top: env(safe-area-inset-top);
}
.app.rail-off { grid-template-columns: var(--side-w) minmax(0, 1fr) 0; }
.app.rail-off .rail { visibility: hidden; }

/* ─────────── sidebar ─────────── */
.side {
  background: var(--paper-2);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  padding: 20px 18px 28px;
  display: flex; flex-direction: column; gap: 22px;
  scrollbar-width: thin;
  position: relative;
}
.side::before { /* faint paper grain */
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .45 0 0 0 0 .38 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.side > * { position: relative; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 34px; height: 34px; flex: none; }
.brand-name { font: 600 21px/1 var(--serif); letter-spacing: -.01em; }
.brand-sub { font-size: 11px; color: var(--ink-3); letter-spacing: .04em; margin-top: 3px; }
.side .side-close { margin-left: auto; display: none; }

.clock {
  background: var(--card); border: 1px solid var(--line-soft); border-radius: 16px;
  padding: 16px 16px 14px; box-shadow: var(--shadow);
}
.clock-place {
  font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--sea);
  display: flex; align-items: center; gap: 7px;
}
.dot-live { width: 7px; height: 7px; border-radius: 50%; background: var(--sea); box-shadow: 0 0 0 0 var(--sea); animation: pulse 2.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--sea) 55%, transparent); } 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.clock-time {
  display: flex; align-items: flex-start; gap: 6px; margin-top: 6px;
  font: 400 64px/0.95 var(--serif); letter-spacing: -.03em; font-variant-numeric: lining-nums tabular-nums;
}
.clock-side { display: flex; flex-direction: column; gap: 4px; padding-top: 8px; font: 500 13px/1 var(--sans); color: var(--ink-3); letter-spacing: .02em; }
.clock-side #clk-ap { text-transform: uppercase; color: var(--clay); font-weight: 600; }
.clock-date { font: italic 400 17px/1.3 var(--serif); color: var(--ink-2); margin-top: 8px; }
.clock-meta { display: flex; justify-content: space-between; gap: 8px; font-size: 11.5px; color: var(--ink-3); margin-top: 10px; }
.dayline { height: 3px; border-radius: 3px; background: var(--line-soft); margin-top: 8px; overflow: hidden; }
.dayline-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--sea), var(--clay)); border-radius: 3px; transition: width 1s linear; }
.clock-next { font-size: 12.5px; color: var(--ink-2); margin-top: 10px; min-height: 1em; }
.clock-next b { color: var(--ink); font-weight: 600; }
.clock-next .pill { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }

/* mini month */
.mini-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.mini-title { font: 500 16px/1 var(--serif); }
.mini-nav { display: flex; gap: 2px; }
.mini-nav .icon-btn { width: 28px; height: 28px; }
.mini-nav .icon-btn svg { width: 16px; height: 16px; }
.mini-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; text-align: center; }
.mini-dow { font-size: 10px; font-weight: 600; color: var(--ink-3); letter-spacing: .06em; padding: 4px 0; }
.mini-day {
  position: relative; aspect-ratio: 1; border-radius: 50%; font-size: 12px; font-variant-numeric: tabular-nums;
  display: grid; place-items: center; color: var(--ink); transition: background .15s;
}
.mini-day:hover { background: var(--line-soft); }
.mini-day.out { color: var(--ink-3); opacity: .55; }
.mini-day.hol { color: var(--sea); font-weight: 600; }
.mini-day.sel { background: var(--ink); color: var(--paper); }
.mini-day.today { background: var(--clay); color: var(--clay-ink); font-weight: 600; }
.mini-day.has::after { content: ""; position: absolute; bottom: 3px; width: 3px; height: 3px; border-radius: 50%; background: var(--clay); }
.mini-day.today.has::after, .mini-day.sel.has::after { background: currentColor; }
.mini-day.wk { border-radius: 0; }

/* weather */
.sec-label { font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 10px; display: flex; justify-content: space-between; align-items: baseline; }
.sec-label small { letter-spacing: 0; text-transform: none; font-weight: 400; }
.wx-empty { font-size: 12.5px; color: var(--ink-3); }
.wx-now { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.wx-now svg { width: 42px; height: 42px; color: var(--clay); stroke-width: 1.5; }
.wx-temp { font: 400 38px/1 var(--serif); letter-spacing: -.02em; }
.wx-temp sup { font-size: 16px; vertical-align: 16px; margin-left: 1px; color: var(--ink-3); }
.wx-desc { font-size: 12.5px; color: var(--ink-2); line-height: 1.35; }
.wx-list { display: grid; gap: 2px; }
.wx-row { display: grid; grid-template-columns: 38px 22px 32px 26px 1fr 26px; align-items: center; gap: 6px; font-size: 12.5px; padding: 4px 6px; border-radius: 8px; }
.wx-row:hover { background: var(--line-soft); }
.wx-row.is-today { background: var(--card); }
.wx-row svg { width: 18px; height: 18px; color: var(--ink-2); }
.wx-d { font-weight: 500; }
.wx-p { color: var(--sea); font-size: 11px; text-align: right; }
.wx-lo { color: var(--ink-3); text-align: right; font-variant-numeric: tabular-nums; }
.wx-hi { text-align: right; font-weight: 500; font-variant-numeric: tabular-nums; }
.wx-bar { height: 4px; border-radius: 4px; background: var(--line-soft); position: relative; }
.wx-bar i { position: absolute; top: 0; bottom: 0; border-radius: 4px; background: linear-gradient(90deg, var(--sea), var(--clay)); }
.wx-foot { font-size: 10.5px; color: var(--ink-3); margin-top: 8px; }

/* categories */
.cat-list { display: grid; gap: 2px; }
.cat {
  display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; font-size: 13px; text-align: left; width: 100%;
}
.cat:hover { background: var(--line-soft); }
.cat .sw { width: 12px; height: 12px; border-radius: 4px; background: var(--c); flex: none; transition: all .15s; }
.cat.off { color: var(--ink-3); }
.cat.off .sw { background: transparent; box-shadow: inset 0 0 0 1.5px var(--c); }
.cat .n { margin-left: auto; font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* ─────────── main ─────────── */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--paper); }
.bar {
  display: flex; align-items: center; gap: 10px; padding: 14px 20px 10px;
}
.nav { display: flex; align-items: center; gap: 2px; }
.title { font: 400 30px/1.1 var(--serif); letter-spacing: -.02em; margin: 0 0 0 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.title em { font-style: italic; color: var(--ink-3); }
.bar-spacer { flex: 1; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px; border-radius: 999px; font-weight: 500; font-size: 13px;
  border: 1px solid var(--line); background: var(--card); transition: background .15s, border-color .15s, transform .1s;
}
.btn:hover { border-color: var(--ink-3); }
.btn:active { transform: scale(.97); }
.btn-ghost { background: transparent; }
.btn-primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn-primary:hover { background: color-mix(in srgb, var(--ink) 88%, var(--clay)); }
.btn-danger { color: #B3372E; border-color: transparent; background: transparent; }
:root[data-theme="dark"] .btn-danger { color: #F08A7E; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-danger { color: #F08A7E; } }
.btn-danger:hover { background: color-mix(in srgb, #B3372E 10%, transparent); border-color: transparent; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; color: var(--ink-2); transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--line-soft); color: var(--ink); }
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn.on { background: var(--ink); color: var(--paper); }

.seg {
  position: relative; display: flex; padding: 3px; border-radius: 999px; background: var(--paper-2); border: 1px solid var(--line-soft);
}
.seg button { position: relative; z-index: 1; height: 28px; padding: 0 13px; border-radius: 999px; font-size: 12.5px; font-weight: 500; color: var(--ink-2); transition: color .2s; }
.seg button[aria-selected="true"] { color: var(--ink); }
.seg-ind { position: absolute; top: 3px; bottom: 3px; left: 0; width: 0; border-radius: 999px; background: var(--card); box-shadow: var(--shadow); transition: transform .28s cubic-bezier(.3,.7,.2,1), width .28s cubic-bezier(.3,.7,.2,1); }

.quick { padding: 0 20px 12px; position: relative; }
.quick-box {
  display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 12px; border-radius: 12px;
  background: var(--card); border: 1px solid var(--line-soft); transition: border-color .15s, box-shadow .15s;
}
.quick-box:focus-within { border-color: var(--clay); box-shadow: 0 0 0 3px color-mix(in srgb, var(--clay) 18%, transparent); }
.quick-ico { width: 17px; height: 17px; color: var(--clay); flex: none; }
.quick-box input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 14px; }
.quick-box input::placeholder { color: var(--ink-3); }
.quick-preview {
  position: absolute; left: 20px; right: 20px; top: 46px; z-index: 30;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 10px 12px; font-size: 13px;
}
.qp-line { display: flex; align-items: center; gap: 10px; }
.qp-title { font-weight: 600; }
.qp-when { color: var(--ink-2); }
.qp-hint { color: var(--ink-3); font-size: 11.5px; margin-top: 4px; }
.qp-cat { width: 10px; height: 10px; border-radius: 3px; background: var(--c); flex: none; }

.view { flex: 1; min-height: 0; position: relative; padding: 0 20px 20px; display: flex; flex-direction: column; }
.panel {
  flex: 1; min-height: 0; background: var(--card); border: 1px solid var(--line-soft); border-radius: 16px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; overflow: hidden;
}
.fade-in { animation: fadeIn .22s ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ─────────── time grid (day / week) ─────────── */
.tg-head { display: grid; grid-template-columns: var(--gutter) repeat(var(--cols), minmax(0, 1fr)); border-bottom: 1px solid var(--line-soft); }
.tg-dh { padding: 10px 8px 8px; text-align: center; border-left: 1px solid var(--line-soft); cursor: pointer; position: relative; }
.tg-dh:hover .tg-num { background: var(--line-soft); }
.tg-dow { font-size: 10.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.tg-num { display: inline-grid; place-items: center; min-width: 38px; height: 38px; padding: 0 4px; margin-top: 2px; border-radius: 50%; font: 400 24px/1 var(--serif); transition: background .15s; }
.tg-dh.today .tg-dow { color: var(--clay); }
.tg-dh.today .tg-num { background: var(--clay); color: var(--clay-ink); }
.tg-dh.sel:not(.today) .tg-num { box-shadow: inset 0 0 0 1.5px var(--ink); }
.tg-wx { position: absolute; top: 8px; right: 8px; display: flex; align-items: center; gap: 2px; font-size: 11px; color: var(--ink-3); }
.tg-wx svg { width: 15px; height: 15px; }
.tg-hol { font: italic 12px/1.2 var(--serif); color: var(--sea); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.tg-allday { display: grid; grid-template-columns: var(--gutter) repeat(var(--cols), minmax(0, 1fr)); border-bottom: 1px solid var(--line-soft); min-height: 30px; }
.tg-allday-l { font-size: 10px; color: var(--ink-3); text-align: right; padding: 8px 8px 0 0; letter-spacing: .04em; }
.tg-allday-c { border-left: 1px solid var(--line-soft); padding: 3px 3px 4px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.tg-body { flex: 1; overflow-y: auto; position: relative; overscroll-behavior: contain; scrollbar-width: thin; }
.tg-grid { display: grid; grid-template-columns: var(--gutter) repeat(var(--cols), minmax(0, 1fr)); position: relative; height: calc(var(--hour) * 24); }
.tg-gutter { position: relative; }
.tg-hl { position: absolute; right: 8px; font-size: 10.5px; color: var(--ink-3); transform: translateY(-50%); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tg-col {
  position: relative; border-left: 1px solid var(--line-soft);
  background-image:
    linear-gradient(to bottom, var(--line-soft) 1px, transparent 1px),
    linear-gradient(to bottom, transparent calc(var(--hour) / 2), color-mix(in srgb, var(--line-soft) 55%, transparent) calc(var(--hour) / 2), color-mix(in srgb, var(--line-soft) 55%, transparent) calc(var(--hour) / 2 + 1px), transparent calc(var(--hour) / 2 + 1px));
  background-size: 100% var(--hour);
  cursor: cell;
}
.tg-col.weekend { background-color: var(--weekend); }
.tg-col.today { background-color: color-mix(in srgb, var(--clay) 4%, transparent); }
.tg-night { position: absolute; left: 0; right: 0; background: color-mix(in srgb, var(--ink) 2.2%, transparent); pointer-events: none; }
.tg-now { position: absolute; left: -1px; right: 0; height: 2px; background: var(--clay); z-index: 4; pointer-events: none; }
.tg-now::before { content: ""; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--clay); }
.tg-now-l { position: absolute; right: 4px; z-index: 5; transform: translateY(-50%); background: var(--clay); color: var(--clay-ink); font-size: 10px; font-weight: 600; padding: 2px 5px; border-radius: 6px; font-variant-numeric: tabular-nums; }

.ev {
  --c: var(--c-personal);
  position: absolute; border-radius: 8px; padding: 4px 7px 4px 9px; overflow: hidden; cursor: pointer;
  background: color-mix(in srgb, var(--c) 15%, var(--card));
  color: var(--ink);
  border: 1px solid color-mix(in srgb, var(--c) 28%, transparent);
  box-shadow: inset 3px 0 0 var(--c);
  font-size: 12px; line-height: 1.25; z-index: 2;
  transition: box-shadow .15s, transform .1s;
  touch-action: pan-y;
  user-select: none; -webkit-user-select: none;
}
.ev:hover { box-shadow: inset 3px 0 0 var(--c), var(--shadow); z-index: 3; }
.ev.past { opacity: .62; }
.ev-t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev.tall .ev-t { white-space: normal; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.ev-m { color: var(--ink-2); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.ev-rs { position: absolute; left: 0; right: 0; bottom: 0; height: 8px; cursor: ns-resize; }
.ev.dragging { opacity: .9; box-shadow: inset 3px 0 0 var(--c), var(--shadow-lg); z-index: 10; transform: scale(1.01); }
.ev.ghost { background: color-mix(in srgb, var(--clay) 20%, var(--card)); border: 1.5px dashed var(--clay); box-shadow: none; }
.ev.short { padding-top: 1px; padding-bottom: 1px; }
.ev.short { white-space: nowrap; }
.ev.short .ev-t { display: inline; }
.ev.short .ev-m { display: inline; margin-left: 6px; }
.ev-rec { display: inline-block; width: 10px; height: 10px; margin-left: 3px; vertical-align: -1px; opacity: .6; }

.chip {
  --c: var(--c-personal);
  display: flex; align-items: center; gap: 5px; min-width: 0;
  font-size: 11.5px; line-height: 1.3; padding: 2px 6px; border-radius: 6px; cursor: pointer; text-align: left; width: 100%;
  color: var(--ink);
}
.chip:hover { background: color-mix(in srgb, var(--c) 12%, transparent); }
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--c); flex: none; }
.chip .tm { color: var(--ink-3); font-variant-numeric: tabular-nums; flex: none; font-size: 10.5px; }
.chip .tx { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip.full { background: color-mix(in srgb, var(--c) 16%, var(--card)); box-shadow: inset 2px 0 0 var(--c); font-weight: 500; }
.chip.full .dot { display: none; }
.chip.hol { --c: var(--c-holiday); background: transparent; box-shadow: none; font: italic 12px/1.3 var(--serif); color: var(--sea); cursor: default; }
.chip.hol .dot { display: none; }

/* ─────────── month ─────────── */
.mo-dows { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-bottom: 1px solid var(--line-soft); }
.mo-dows div { padding: 9px 10px; font-size: 10.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.mo-grid { flex: 1; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-auto-rows: minmax(0, 1fr); min-height: 0; }
.mo-cell {
  border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft);
  padding: 6px 6px 4px; min-width: 0; min-height: 0; overflow: hidden; display: flex; flex-direction: column; gap: 1px; cursor: pointer; position: relative;
  transition: background .15s;
}
.mo-cell:nth-child(7n) { border-right: 0; }
.mo-cell:hover { background: color-mix(in srgb, var(--line-soft) 45%, transparent); }
.mo-cell.weekend { background-color: var(--weekend); }
.mo-cell.out .mo-num { color: var(--ink-3); opacity: .55; }
.mo-cell.out .chip { opacity: .55; }
.mo-cell.sel { background: color-mix(in srgb, var(--ink) 4%, transparent); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--ink) 50%, transparent); }
.mo-top { display: flex; align-items: center; gap: 4px; margin-bottom: 2px; }
.mo-num { display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 26px; border-radius: 50%; font: 400 16px/1 var(--serif); font-variant-numeric: lining-nums; }
.mo-num.first { padding: 0 4px 0 6px; border-radius: 13px; }
.mo-num.first::after { content: attr(data-mon); font: 500 11px var(--sans); color: var(--ink-3); margin-left: 4px; }
.mo-cell.today .mo-num.first::after { color: inherit; }
.mo-cell.today .mo-num { background: var(--clay); color: var(--clay-ink); font-weight: 500; }
.mo-hol { font: italic 11.5px/1.2 var(--serif); color: var(--sea); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.mo-wx { margin-left: auto; display: flex; align-items: center; gap: 2px; font-size: 10.5px; color: var(--ink-3); flex: none; }
.mo-wx svg { width: 14px; height: 14px; }
.mo-more { font-size: 11px; color: var(--ink-3); padding: 0 6px; font-weight: 500; }
.mo-journal { position: absolute; right: 7px; bottom: 6px; width: 12px; height: 12px; color: var(--ink-3); opacity: .7; }
.mo-add { position: absolute; right: 5px; bottom: 4px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; color: var(--ink-3); opacity: 0; transition: opacity .15s, background .15s; }
.mo-add svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.mo-cell:hover .mo-add { opacity: 1; }
.mo-add:hover { background: var(--line-soft); color: var(--ink); }
.mo-cell:hover .mo-journal { opacity: 0; }
.mo-dots { display: none; gap: 3px; flex-wrap: wrap; padding: 2px 4px; }
.mo-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--c); }
.mo-list { border-top: 1px solid var(--line-soft); overflow-y: auto; display: none; }

/* ─────────── year ─────────── */
.yr { flex: 1; overflow-y: auto; padding: 18px 22px 24px; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 22px 28px; align-content: start; }
.yr-m h3 { margin: 0 0 8px; font: 500 17px/1 var(--serif); cursor: pointer; display: flex; justify-content: space-between; align-items: baseline; }
.yr-m h3 small { font: 400 11px var(--sans); color: var(--ink-3); }
.yr-m h3:hover { color: var(--clay); }
.yr-m.cur h3 { color: var(--clay); }
.yr-g { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.yr-dow { font-size: 9.5px; color: var(--ink-3); text-align: center; font-weight: 600; padding-bottom: 2px; }
.yr-d {
  aspect-ratio: 1; display: grid; place-items: center; font-size: 11px; border-radius: 6px; font-variant-numeric: tabular-nums;
  background: rgba(var(--heat), var(--h, 0)); color: var(--ink); transition: transform .1s;
}
.yr-d:hover { transform: scale(1.15); box-shadow: 0 0 0 1px var(--ink-3); }
.yr-d.hol { color: var(--sea); font-weight: 600; box-shadow: inset 0 -2px 0 var(--sea); }
.yr-d.today { background: var(--clay); color: var(--clay-ink); font-weight: 600; }
.yr-d.we { color: var(--ink-3); }
.yr-d.jr { text-decoration: underline; text-decoration-color: var(--sea); text-underline-offset: 2px; }
.yr-legend { grid-column: 1 / -1; display: flex; gap: 16px; align-items: center; font-size: 11.5px; color: var(--ink-3); flex-wrap: wrap; padding-top: 4px; }
.yr-legend span { display: inline-flex; align-items: center; gap: 6px; }
.yr-legend i { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }

/* ─────────── agenda ─────────── */
.ag { flex: 1; overflow-y: auto; padding: 8px 0 24px; }
.ag-day { display: grid; grid-template-columns: 96px 1fr; gap: 12px; padding: 14px 22px; border-bottom: 1px solid var(--line-soft); }
.ag-date { cursor: pointer; }
.ag-dow { font-size: 10.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.ag-num { font: 400 32px/1 var(--serif); letter-spacing: -.02em; }
.ag-mon { font: italic 13px/1.2 var(--serif); color: var(--ink-2); }
.ag-day.today .ag-num, .ag-day.today .ag-dow { color: var(--clay); }
.ag-items { display: grid; gap: 6px; min-width: 0; }
.ag-it {
  --c: var(--c-personal);
  display: grid; grid-template-columns: 110px 1fr; gap: 12px; align-items: start; padding: 8px 12px; border-radius: 10px; cursor: pointer; text-align: left; width: 100%;
  background: color-mix(in srgb, var(--c) 9%, transparent); box-shadow: inset 3px 0 0 var(--c);
}
.ag-it:hover { background: color-mix(in srgb, var(--c) 16%, transparent); }
.ag-time { font-size: 12.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; padding-top: 1px; }
.ag-title { font-weight: 600; }
.ag-sub { font-size: 12px; color: var(--ink-3); margin-top: 1px; }
.ag-hol { font: italic 14px/1.3 var(--serif); color: var(--sea); padding: 2px 0; }
.ag-empty { padding: 60px 24px; text-align: center; color: var(--ink-3); font: italic 18px/1.4 var(--serif); }
.ag-head { padding: 12px 22px 4px; font-size: 12px; color: var(--ink-3); }
mark { background: color-mix(in srgb, var(--clay) 28%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }

/* ─────────── journal ─────────── */
.app[data-view="journal"] .nav .icon-btn { display: none; }
.jr { flex: 1; overflow-y: auto; scrollbar-width: thin; }
.jr-inner { max-width: 760px; margin: 0 auto; padding: 20px 32px 64px; }
.jr-top { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; padding-bottom: 14px; border-bottom: 1px solid var(--line-soft); }
.jr-stats { font-size: 13px; color: var(--ink-2); }
.jr-stats b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.jr-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.jr-search { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--card-2); }
.jr-search:focus-within { border-color: var(--clay); }
.jr-search svg { width: 15px; height: 15px; color: var(--ink-3); fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; flex: none; }
.jr-search input { border: 0; outline: 0; background: transparent; width: 180px; font-size: 13px; }
.jr-prompt { display: flex; flex-direction: column; gap: 3px; width: 100%; text-align: left; margin-top: 18px; padding: 14px 18px; border-radius: 14px;
  border: 1.5px dashed color-mix(in srgb, var(--clay) 45%, var(--line)); background: color-mix(in srgb, var(--clay) 5%, transparent); transition: background .15s; }
.jr-prompt:hover { background: color-mix(in srgb, var(--clay) 10%, transparent); }
.jr-prompt span { font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--clay); }
.jr-prompt em { font: italic 17px/1.4 var(--serif); color: var(--ink-2); }
.jr-month { position: sticky; top: 0; z-index: 2; margin: 0; padding: 24px 0 10px; font: 400 26px/1 var(--serif); letter-spacing: -.01em;
  background: linear-gradient(var(--card) 78%, color-mix(in srgb, var(--card) 0%, transparent)); }
.jr-month em { color: var(--ink-3); }
.jr-entry { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 18px; padding: 16px 0 20px; border-bottom: 1px solid var(--line-soft); }
.jr-date { cursor: pointer; text-align: center; padding-top: 3px; border-radius: 10px; align-self: start; padding-bottom: 6px; transition: background .15s; }
.jr-date:hover { background: var(--line-soft); }
.jr-dow { font-size: 10.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.jr-num { font: 400 34px/1 var(--serif); margin-top: 3px; }
.jr-entry.today .jr-dow, .jr-entry.today .jr-num { color: var(--clay); }
.jr-text { font: 400 17.5px/1.68 var(--serif); color: var(--ink); overflow-wrap: anywhere; }
.jr-text p { margin: 0 0 .55em; }
.jr-text p:last-child { margin-bottom: 0; }
.jr-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 10px; font-size: 11.5px; color: var(--ink-3); }
.jr-open { font-size: 12px; font-weight: 500; color: var(--sea); flex: none; }
.jr-open:hover { text-decoration: underline; }
@media (max-width: 900px) {
  .jr-inner { padding: 14px 16px 96px; }
  .jr-entry { grid-template-columns: 44px minmax(0, 1fr); gap: 12px; }
  .jr-num { font-size: 26px; }
  .jr-text { font-size: 16.5px; }
  .jr-month { font-size: 22px; padding-top: 18px; }
  .jr-search input { width: 120px; }
  .seg button { font-size: 12px; padding: 0 2px; }
}

/* ─────────── day page rail ─────────── */
.rail {
  background: var(--paper-2); border-left: 1px solid var(--line); overflow-y: auto; padding: 22px 20px 30px;
  display: flex; flex-direction: column; gap: 22px; scrollbar-width: thin;
}
.dp-head { display: flex; align-items: flex-start; gap: 10px; }
.dp-dow { font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--clay); }
.dp-big { font: 400 40px/1 var(--serif); letter-spacing: -.02em; margin-top: 4px; }
.dp-big em { font-style: italic; color: var(--ink-3); font-size: .62em; margin-left: 6px; letter-spacing: 0; }
.dp-hol { font: italic 14px/1.3 var(--serif); color: var(--sea); margin-top: 6px; }
.dp-wx { margin-left: auto; text-align: right; font-size: 12px; color: var(--ink-2); }
.dp-wx svg { width: 30px; height: 30px; margin-left: auto; color: var(--clay); stroke-width: 1.5; }
.rail .dp-close { display: none; margin-left: auto; flex: none; }
.dp-wx + .dp-close { margin-left: 4px; }
.dp-sec h4 { margin: 0 0 8px; font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); display: flex; align-items: center; justify-content: space-between; }
.dp-sec h4 small { font-weight: 400; letter-spacing: 0; text-transform: none; }
.dp-sched { display: grid; gap: 4px; }
.dp-ev { --c: var(--c-personal); display: grid; grid-template-columns: 62px 1fr; gap: 10px; padding: 7px 10px; border-radius: 10px; background: var(--card); box-shadow: inset 3px 0 0 var(--c); text-align: left; width: 100%; font-size: 13px; }
.dp-ev:hover { box-shadow: inset 3px 0 0 var(--c), var(--shadow); }
.dp-ev .t { color: var(--ink-2); font-size: 12px; font-variant-numeric: tabular-nums; }
.dp-ev .n { font-weight: 500; }
.dp-empty { font: italic 14px/1.4 var(--serif); color: var(--ink-3); }

.todo-add { display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line-soft); border-radius: 10px; padding: 0 10px; height: 38px; margin-bottom: 6px; }
.todo-add:focus-within { border-color: var(--clay); }
.todo-add input { flex: 1; border: 0; outline: 0; background: transparent; font-size: 13.5px; min-width: 0; }
.todo-add svg { width: 16px; height: 16px; color: var(--ink-3); fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.todos { display: grid; gap: 1px; }
.todo { display: flex; align-items: flex-start; gap: 10px; padding: 7px 6px; border-radius: 8px; font-size: 13.5px; }
.todo:hover { background: color-mix(in srgb, var(--line-soft) 70%, transparent); }
.todo input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; width: 18px; height: 18px; border-radius: 6px; border: 1.5px solid var(--ink-3); margin: 1px 0 0; flex: none; cursor: pointer; display: grid; place-items: center; transition: all .15s;
}
.todo input[type="checkbox"]:checked { background: var(--sea); border-color: var(--sea); }
.todo input[type="checkbox"]:checked::after { content: ""; width: 5px; height: 9px; border: solid var(--card); border-width: 0 2px 2px 0; transform: rotate(45deg) translate(-1px, -1px); }
.todo .tt { flex: 1; min-width: 0; word-wrap: break-word; }
.todo.done .tt { text-decoration: line-through; color: var(--ink-3); }
.todo .roll { display: block; font-size: 11px; color: var(--clay); margin-top: 1px; }
.todo .del { opacity: 0; color: var(--ink-3); width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; flex: none; }
.todo .del svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.todo:hover .del { opacity: 1; }
.todo .del:hover { background: var(--line-soft); color: var(--ink); }
@media (hover: none) { .todo .del { opacity: .6; } }

.journal-wrap { background: var(--card); border: 1px solid var(--line-soft); border-radius: 14px; overflow: hidden; }
.journal-wrap:focus-within { border-color: color-mix(in srgb, var(--clay) 60%, var(--line)); }
.journal {
  display: block; width: 100%; min-height: 220px; resize: vertical; border: 0; outline: 0; padding: 14px 16px 10px;
  font: 400 17px/1.6 var(--serif); background: transparent;
  background-image: linear-gradient(transparent calc(1.6em - 1px), var(--line-soft) calc(1.6em - 1px), var(--line-soft) 1.6em, transparent 1.6em);
  background-size: 100% 1.6em; background-position: 0 14px; background-attachment: local;
}
.journal::placeholder { color: var(--ink-3); font-style: italic; }
.journal-foot { display: flex; align-items: center; gap: 8px; padding: 6px 8px 8px 14px; font-size: 11.5px; color: var(--ink-3); border-top: 1px solid var(--line-soft); }
.mic { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 999px; font-weight: 500; font-size: 12px; color: var(--ink-2); border: 1px solid var(--line); background: var(--card-2); }
.mic svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.mic.live { background: var(--clay); color: var(--clay-ink); border-color: var(--clay); animation: micPulse 1.6s infinite; }
@keyframes micPulse { 0%,100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--clay) 40%, transparent); } 50% { box-shadow: 0 0 0 6px transparent; } }
.journal-read { padding: 14px 16px 12px; font: 400 17px/1.6 var(--serif); color: var(--ink); overflow-wrap: anywhere; }
.journal-read p { margin: 0 0 .55em; }
.journal-read p:last-child { margin-bottom: 0; }
.journal-none { color: var(--ink-3); font-style: italic; }
.journal-locked { background: var(--card-2); }
.journal-foot .lock { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; flex: none; }
.interim { color: var(--ink-3); font-style: italic; padding: 0 16px 8px; font: italic 15px/1.5 var(--serif); }

/* ─────────── modals ─────────── */
.scrim { position: fixed; inset: 0; background: rgba(15, 20, 25, .35); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); z-index: 40; opacity: 0; pointer-events: none; transition: opacity .2s; }
.scrim.on { opacity: 1; pointer-events: auto; }
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; pointer-events: none; }
.modal .sheet { pointer-events: auto; }
.sheet {
  width: min(560px, 100%); max-height: calc(100dvh - 40px); overflow-y: auto; background: var(--card); border-radius: 20px; box-shadow: var(--shadow-lg);
  padding: 22px 24px 20px; display: flex; flex-direction: column; gap: 14px; animation: pop .22s cubic-bezier(.2,.8,.2,1);
  border: 1px solid var(--line-soft);
}
.sheet-wide { width: min(640px, 100%); }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.sheet-grip { display: none; }
.ed-title { font: 400 28px/1.2 var(--serif); border: 0; outline: 0; background: transparent; padding: 2px 0 8px; border-bottom: 1px solid var(--line-soft); letter-spacing: -.01em; }
.ed-title:focus { border-bottom-color: var(--clay); }
.ed-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 10px; align-items: end; }
.ed-grid .field input { min-width: 0; }
.ed-grid-2 { grid-template-columns: 1fr 1fr; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 11.5px; font-weight: 500; color: var(--ink-3); letter-spacing: .02em; }
.field input, .field select, .field textarea {
  font-size: 14px; font-weight: 400; color: var(--ink); letter-spacing: 0; background: var(--card-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; outline: 0; min-height: 38px; width: 100%;
}
.field textarea { resize: vertical; line-height: 1.45; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--clay); box-shadow: 0 0 0 3px color-mix(in srgb, var(--clay) 15%, transparent); }
.allday .ed-time { visibility: hidden; }
.switch { display: inline-flex; align-items: center; gap: 10px; font-size: 13px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; }
.switch span { width: 36px; height: 21px; border-radius: 999px; background: var(--line); position: relative; transition: background .2s; }
.switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 17px; height: 17px; border-radius: 50%; background: var(--card); box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .2s; }
.switch input:checked + span { background: var(--sea); }
.switch input:checked + span::after { transform: translateX(15px); }
.switch input:focus-visible + span { box-shadow: 0 0 0 3px color-mix(in srgb, var(--sea) 30%, transparent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cchip { --c: var(--c-personal); display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); font-size: 12.5px; font-weight: 500; color: var(--ink-2); background: var(--card-2); }
.cchip i { width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.cchip[aria-pressed="true"] { background: color-mix(in srgb, var(--c) 16%, var(--card)); border-color: var(--c); color: var(--ink); }
.ed-scope { display: flex; gap: 16px; align-items: center; font-size: 13px; padding: 10px 12px; background: var(--card-2); border-radius: 10px; flex-wrap: wrap; }
.ed-scope > span { font-size: 11.5px; font-weight: 500; color: var(--ink-3); }
.ed-scope label { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.ed-scope input { accent-color: var(--clay); }
.ed-actions { display: flex; align-items: center; gap: 8px; margin-top: 4px; }

.set-head { display: flex; align-items: center; justify-content: space-between; }
.set-head h2 { margin: 0; font: 400 28px/1 var(--serif); }
.set-sec { border-top: 1px solid var(--line-soft); padding-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.set-sec h3 { margin: 0; font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13.5px; flex-wrap: wrap; }
.set-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.set-note { margin: 0; font-size: 12px; color: var(--ink-3); line-height: 1.6; }
.set-status { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.set-status i { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); }
.set-status.ok i { background: var(--c-health); }
.set-form { display: flex; gap: 8px; flex-wrap: wrap; }
.set-form input { flex: 1; min-width: 180px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--card-2); padding: 0 12px; outline: 0; }
.set-form input:focus { border-color: var(--clay); }
.set-err { color: #B3372E; font-size: 12.5px; }
.mini-seg { display: inline-flex; padding: 3px; background: var(--paper-2); border-radius: 999px; border: 1px solid var(--line-soft); }
.mini-seg button { height: 28px; padding: 0 12px; border-radius: 999px; font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.mini-seg button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); z-index: 70;
  background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 999px; font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: all .25s cubic-bezier(.2,.8,.2,1); display: flex; gap: 12px; align-items: center;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast button { color: var(--clay); font-weight: 600; }

.fab {
  position: fixed; right: 18px; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 35; width: 56px; height: 56px; border-radius: 18px;
  background: var(--clay); color: var(--clay-ink); display: grid; place-items: center; box-shadow: var(--shadow-lg);
}
.fab svg { width: 24px; height: 24px; stroke-width: 2.2; }
.only-narrow { display: none !important; }

/* ─────────── responsive ─────────── */
@media (max-width: 1320px) {
  .app { grid-template-columns: var(--side-w) minmax(0, 1fr); }
  .app.rail-off { grid-template-columns: var(--side-w) minmax(0, 1fr); }
  .rail {
    position: fixed; top: 0; right: 0; bottom: 0; width: min(var(--rail-w), 100vw); z-index: 45;
    transform: translateX(100%); transition: transform .3s cubic-bezier(.3,.7,.2,1); box-shadow: var(--shadow-lg);
    padding-top: calc(22px + env(safe-area-inset-top));
  }
  .app.rail-open .rail { transform: none; }
  .app.rail-off .rail { visibility: visible; }
  .rail .dp-close { display: inline-grid; }
}
@media (max-width: 1080px) {
  .seg button { padding: 0 10px; }
}
@media (max-width: 900px) {
  :root { --hour: 46px; --gutter: 46px; }
  .app { grid-template-columns: minmax(0, 1fr) !important; }
  .side {
    position: fixed; top: 0; left: 0; bottom: 0; width: min(330px, 88vw); z-index: 45;
    transform: translateX(-100%); transition: transform .3s cubic-bezier(.3,.7,.2,1); box-shadow: var(--shadow-lg);
    padding-top: calc(20px + env(safe-area-inset-top));
  }
  .app.side-open .side { transform: none; }
  .side .side-close { display: inline-grid; }
  .only-narrow { display: inline-grid !important; }
  .bar { flex-wrap: wrap; padding: 10px 12px 8px; gap: 6px; }
  .title { font-size: 23px; order: 2; flex: 1; margin-left: 4px; }
  .nav .btn { padding: 0 11px; }
  .bar > .bar-spacer { display: none; }
  .nav { order: 3; }
  .bar > .icon-btn[data-action="toggle-rail"] { order: 4; }
  .bar > .icon-btn[data-action="settings"] { order: 5; }
  .bar > .icon-btn[data-action="open-side"] { order: 1; }
  .seg { order: 6; width: 100%; justify-content: space-between; }
  .seg button { flex: 1; padding: 0 4px; }
  .quick { padding: 0 12px 10px; }
  .quick-kbd { display: none; }
  .quick-preview { left: 12px; right: 12px; }
  .view { padding: 0 8px calc(8px + env(safe-area-inset-bottom)); }
  .panel { border-radius: 14px; }
  .tg-num { font-size: 20px; min-width: 32px; height: 32px; }
  .tg-dh { padding: 8px 2px 6px; }
  .tg-wx { display: none; }
  .tg-hol { font-size: 10.5px; }
  .tg-dow { letter-spacing: .06em; }
  .mo-cell { padding: 4px 2px; align-items: center; }
  .mo-top { justify-content: center; }
  .mo-num { font-size: 15px; min-width: 28px; height: 28px; }
  .mo-num.first::after { display: none; }
  .mo-hol, .mo-wx, .mo-more, .mo-add, .mo-journal { display: none; }
  .mo-cell .chip { display: none; }
  .mo-dots { display: flex; justify-content: center; }
  .mo-grid { flex: 0 0 auto; grid-auto-rows: 52px; }
  .mo-list { display: block; flex: 1; }
  .mo-dows div { text-align: center; padding: 8px 0; letter-spacing: .04em; }
  .mo-cell.hol .mo-num { color: var(--sea); font-weight: 600; }
  .ag-day { grid-template-columns: 58px 1fr; padding: 12px 14px; gap: 10px; }
  .ag-num { font-size: 26px; }
  .ag-it { grid-template-columns: 1fr; gap: 2px; }
  .yr { padding: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 16px; }
  .yr-d { font-size: 9.5px; border-radius: 4px; }
  .modal { place-items: end center; padding: 0; }
  .sheet { width: 100%; border-radius: 22px 22px 0 0; padding: 10px 18px calc(18px + env(safe-area-inset-bottom)); max-height: 92dvh; animation: slideUp .3s cubic-bezier(.2,.8,.2,1); }
  .sheet-grip { display: block; width: 40px; height: 5px; border-radius: 5px; background: var(--line); margin: 0 auto 4px; }
  @keyframes slideUp { from { transform: translateY(100%); } to { transform: none; } }
  .ed-grid-2 { grid-template-columns: 1fr 1fr; }
  .rail { width: 100vw; }
  .fab { display: grid !important; }
  .toast { bottom: calc(90px + env(safe-area-inset-bottom)); }
}
@media (min-width: 1321px) {
  .app:not(.rail-off) .rail { position: static; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media print {
  .side, .rail, .bar, .quick, .fab { display: none !important; }
  .app { display: block; height: auto; }
  body { overflow: visible; }
}
