/* ── 佈景變數(淺/深色各自取階)────────────────────── */
:root {
  --page:        #f9f9f7;
  --surface:     #fcfcfb;
  --ink:         #0b0b0b;
  --ink-2:       #52514e;
  --muted:       #898781;
  --grid:        #e1e0d9;
  --baseline:    #c3c2b7;
  --border:      rgba(11, 11, 11, 0.10);
  --series-1:    #2a78d6;
  --series-2:    #1baf7a;
  --accent:      #2a78d6;
  --banner-info: #e7f0fb;
  --banner-warn: #fdeeee;
}
@media (prefers-color-scheme: dark) {
  :root {
    --page:        #0d0d0d;
    --surface:     #1a1a19;
    --ink:         #ffffff;
    --ink-2:       #c3c2b7;
    --muted:       #898781;
    --grid:        #2c2c2a;
    --baseline:    #383835;
    --border:      rgba(255, 255, 255, 0.10);
    --series-1:    #3987e5;
    --series-2:    #199e70;
    --accent:      #3987e5;
    --banner-info: #16233a;
    --banner-warn: #3a1a1a;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--page);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", "Microsoft JhengHei", sans-serif;
  line-height: 1.5;
}
/* 淡淡的腳印散步背景 */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160'%3E%3Cg fill='%23808080' opacity='0.05'%3E%3Cg transform='translate(28,30) rotate(-20)'%3E%3Cellipse cx='0' cy='6' rx='7' ry='6'/%3E%3Ccircle cx='-7' cy='-4' r='3'/%3E%3Ccircle cx='0' cy='-7' r='3'/%3E%3Ccircle cx='7' cy='-4' r='3'/%3E%3C/g%3E%3Cg transform='translate(108,110) rotate(15)'%3E%3Cellipse cx='0' cy='6' rx='7' ry='6'/%3E%3Ccircle cx='-7' cy='-4' r='3'/%3E%3Ccircle cx='0' cy='-7' r='3'/%3E%3Ccircle cx='7' cy='-4' r='3'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  background-size: 160px 160px;
}
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 0.8rem; }

/* ── 頂欄 ──────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; gap: 12px;
  position: sticky; top: 0; z-index: 5;
  background: var(--page);
  border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 1.15rem; margin: 0; }
.topbar-title { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.topbar-actions { display: flex; gap: 8px; }

.btn {
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 12px; font-size: 0.9rem; cursor: pointer;
}
.btn:hover { border-color: var(--accent); }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.on { border-color: var(--series-2); }
.btn-block { display: block; width: 100%; margin-top: 10px; }

/* ── 版面 ──────────────────────────────────────────── */
main { max-width: 980px; margin: 0 auto; padding: 16px 20px 48px; }
.grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
}
.card-wide { grid-column: 1 / -1; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px 18px;
}
.card-host { display: inline-flex; gap: 2px; margin-right: 7px; vertical-align: -7px; }
.card-host svg { display: inline-block; }
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.card-head h2 { font-size: 0.95rem; margin: 0; color: var(--ink-2); font-weight: 600; }
.src-badge {
  font-size: 0.7rem; color: var(--muted);
  border: 1px solid var(--border); border-radius: 99px; padding: 1px 8px;
}

/* ── 主數字區 ──────────────────────────────────────── */
.hero-row { display: flex; align-items: center; gap: 12px; margin: 4px 0 10px; }
.hero-icon { flex-shrink: 0; display: flex; align-items: center; font-size: 2.6rem; }

/* ── 可愛天氣圖示動畫 ──────────────────────────────── */
.wi .wi-rays { transform-box: fill-box; transform-origin: center; animation: wiSpin 16s linear infinite; }
@keyframes wiSpin { to { transform: rotate(360deg); } }
.wi .wi-drop { animation: wiDrop 1.3s ease-in infinite; }
@keyframes wiDrop {
  0%   { opacity: 0; transform: translateY(-4px); }
  30%  { opacity: 1; }
  100% { opacity: 0; transform: translateY(10px); }
}
.wi .wi-bolt { transform-box: fill-box; transform-origin: top center; animation: wiBolt 2.2s infinite; }
@keyframes wiBolt {
  0%, 82%, 100% { opacity: 1; }
  86%, 94% { opacity: 0.25; }
  90% { opacity: 1; transform: scale(1.15); }
}
.wi .wi-fog1 { animation: wiFog 4s ease-in-out infinite; }
.wi .wi-fog2 { animation: wiFog 4s ease-in-out infinite reverse; }
@keyframes wiFog { 0%, 100% { transform: translateX(-4px); } 50% { transform: translateX(4px); } }
@media (prefers-reduced-motion: reduce) {
  .wi .wi-rays, .wi .wi-drop, .wi .wi-bolt, .wi .wi-fog1, .wi .wi-fog2 { animation: none; }
}
.hero-num { font-size: 2.7rem; font-weight: 700; letter-spacing: -0.02em; }
.hero-desc { font-size: 1.05rem; }
.stats {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 4px 16px; margin: 0;
}
.stats div { display: flex; justify-content: space-between; gap: 8px; font-size: 0.85rem; }
.stats dt { color: var(--muted); }
.stats dd { margin: 0; font-variant-numeric: tabular-nums; }

/* ── AQI 徽章(官方色階,一律附文字)───────────────── */
.aqi-badge {
  display: inline-block; padding: 3px 12px; border-radius: 99px;
  font-size: 0.9rem; font-weight: 600; color: #fff;
}
.aqi-1 { background: #0ca30c; }                 /* 良好 */
.aqi-2 { background: #b58900; }                 /* 普通 */
.aqi-3 { background: #ec6a1e; }                 /* 敏感族群 */
.aqi-4 { background: #d03b3b; }                 /* 不健康 */
.aqi-5 { background: #8f3f97; }                 /* 非常不健康 */
.aqi-6 { background: #7e0023; }                 /* 危害 */

.mask-advice {
  margin: 2px 0 8px; padding: 6px 12px; border-radius: 10px;
  background: var(--banner-info); font-size: 0.85rem; font-weight: 600;
}

/* ── 橫幅 ──────────────────────────────────────────── */
.banner {
  border-radius: 10px; padding: 10px 14px; margin-bottom: 14px;
  font-size: 0.9rem; border: 1px solid var(--border);
}
.banner-info { background: var(--banner-info); }
.banner-warn { background: var(--banner-warn); font-weight: 600; }

/* ── 預報輪播 ──────────────────────────────────────── */
.fc-agg { padding: 2px 0; }
.fc-agg-head { display: flex; align-items: center; gap: 10px; }
.fc-cell-icon { margin: 2px 0; }
.fc-stats { margin: 6px 0 4px; }
.fc-chart { margin-top: 4px; }
.fc-fade { animation: fcFade 0.45s ease; }
@keyframes fcFade {
  from { opacity: 0; transform: translateX(14px); }
  to   { opacity: 1; transform: none; }
}

/* ── 預報列 ────────────────────────────────────────── */
.forecast-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.forecast-cell {
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px;
  font-size: 0.85rem;
}
.forecast-cell .fc-time { color: var(--muted); font-size: 0.75rem; }
.forecast-cell .fc-wx { font-weight: 600; margin: 2px 0; }
@media (max-width: 640px) { .forecast-row { grid-template-columns: 1fr; } }

/* ── 一週預報 ──────────────────────────────────────── */
.weekly-row {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px;
  text-align: center;
}
.weekly-cell {
  border: 1px solid var(--border); border-radius: 12px; padding: 8px 4px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 0.85rem;
}
.wk-day { font-weight: 700; }
.wk-temp { font-variant-numeric: tabular-nums; }
@media (max-width: 720px) { .weekly-row { grid-template-columns: repeat(4, 1fr); } }

/* ── 本週回顧 ──────────────────────────────────────── */
.ws-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.ws-table th, .ws-table td {
  padding: 6px 10px; text-align: left; border-bottom: 1px solid var(--grid);
  font-variant-numeric: tabular-nums;
}
.ws-table th { color: var(--muted); font-weight: 600; }

/* ── 潮汐 ──────────────────────────────────────────── */
.tide-box { margin: 6px 0 2px; }
.tide-chip {
  display: inline-block; margin: 2px 6px 2px 0; padding: 3px 10px;
  border-radius: 99px; font-size: 0.8rem; border: 1px solid var(--border);
}
.tide-hi { background: var(--banner-info); }
.tide-lo { background: var(--page); }

/* ── 圖表 ──────────────────────────────────────────── */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; }
.chart .empty {
  color: var(--muted); font-size: 0.85rem; padding: 24px 0; text-align: center;
}
.viz-tooltip {
  position: absolute; pointer-events: none; z-index: 10;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 10px; font-size: 0.78rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
  white-space: nowrap; display: none;
}
.viz-tooltip .tt-time { color: var(--muted); }
.viz-tooltip .tt-val { font-weight: 600; font-variant-numeric: tabular-nums; }

/* ── 颱風動向 ──────────────────────────────────────── */
.ty-item { margin-bottom: 12px; }
.ty-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.ty-name { font-weight: 700; font-size: 1.05rem; }
.ty-badge {
  padding: 3px 12px; border-radius: 99px; font-weight: 700; font-size: 0.85rem; color: #fff;
}
.ty-td     { background: #898781; }
.ty-mild   { background: #b58900; }
.ty-mid    { background: #ec6a1e; }
.ty-severe { background: #d03b3b; }
.ty-map { margin-top: 10px; }
.ty-map svg { display: block; width: 100%; height: auto; border-radius: 12px; }
.ty-pulse { animation: tyPulse 1.8s ease-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes tyPulse {
  0%   { transform: scale(0.6); opacity: 1; }
  100% { transform: scale(2.2); opacity: 0; }
}
.ty-eye { animation: tyEyeSpin 3.5s linear infinite; transform-box: fill-box; transform-origin: center; }
@keyframes tyEyeSpin { to { transform: rotate(-360deg); } }
.ty-wsp { margin-top: 6px; }
.ty-wsp summary { cursor: pointer; }
@media (prefers-reduced-motion: reduce) { .ty-pulse, .ty-eye { animation: none; } }

/* ── 地震報告 ──────────────────────────────────────── */
.quake-item {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 14px; margin-bottom: 8px; font-size: 0.85rem;
}
.quake-mag {
  font-size: 1.4rem; font-weight: 700; min-width: 64px; text-align: center;
  font-variant-numeric: tabular-nums;
}
.quake-body { flex: 1; }
.quake-loc { font-weight: 600; }
.intensity-badge {
  display: inline-block; min-width: 56px; text-align: center;
  padding: 3px 10px; border-radius: 8px;
  font-weight: 700; font-size: 0.85rem; color: #fff;
}
.int-1 { background: #0ca30c; }              /* 1–2 級 */
.int-2 { background: #b58900; }              /* 3 級 */
.int-3 { background: #ec6a1e; }              /* 4 級 */
.int-4 { background: #d03b3b; }              /* 5弱–5強 */
.int-5 { background: #8f3f97; }              /* 6弱以上 */
.quake-my { color: var(--accent); font-weight: 600; }

/* ── 飛航氣象 ──────────────────────────────────────── */
.metar-grid {
  display: grid; gap: 10px; margin-bottom: 10px;
  grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
}
.metar-cell {
  border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px; font-size: 0.83rem;
}
.metar-head { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.metar-name { font-weight: 600; }
.fltcat {
  font-size: 0.7rem; font-weight: 700; border-radius: 99px; padding: 2px 8px;
  color: #fff; white-space: nowrap;
}
.fltcat-good { background: #0ca30c; }
.fltcat-warning { background: #fab219; color: #0b0b0b; }
.fltcat-serious { background: #ec835a; color: #0b0b0b; }
.fltcat-critical { background: #d03b3b; }
.metar-row { display: flex; justify-content: space-between; gap: 8px; margin-top: 2px; }
.metar-row .k { color: var(--muted); }
.metar-raw {
  margin-top: 6px; font-family: Consolas, monospace; font-size: 0.7rem;
  color: var(--muted); word-break: break-all;
}
.taf-list { margin: 8px 0; }
.taf-item {
  font-family: Consolas, monospace; font-size: 0.75rem; color: var(--ink-2);
  border-left: 3px solid var(--grid); padding: 4px 10px; margin: 6px 0;
  word-break: break-all;
}
#taf-details { margin-bottom: 10px; }
#taf-details summary { cursor: pointer; }

/* ── 官方圖資分頁 ──────────────────────────────────── */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0 8px; }
.tab-btn {
  background: var(--page); color: var(--ink-2);
  border: 1px solid var(--border); border-radius: 99px;
  padding: 4px 14px; font-size: 0.8rem; cursor: pointer;
}
.tab-btn:hover { border-color: var(--accent); }
.tab-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.chart-img {
  display: block; width: 100%; height: auto; max-height: 560px;
  object-fit: contain; border-radius: 10px;
  border: 1px solid var(--border); background: #fff;
}
.chart-title { margin: 8px 0 2px; }

/* ── 播報員動畫 ────────────────────────────────────── */
.av-animated .av-body,
.av-animated .av-eyes,
.av-animated .av-trunk { transform-box: fill-box; }
.av-animated .av-body {
  transform-origin: 50% 85%;
  animation: avBreathe 3.2s ease-in-out infinite;
  animation-delay: var(--av-delay, 0s);
}
@keyframes avBreathe {
  0%, 100% { transform: scale(1, 1); }
  50%      { transform: scale(1.025, 0.965) translateY(1px); }
}
.av-animated .av-eyes {
  transform-origin: center;
  animation: avBlink 4.6s infinite;
  animation-delay: var(--av-delay, 0s);
}
@keyframes avBlink {
  0%, 91%, 97%, 100% { transform: scaleY(1); }
  94%                { transform: scaleY(0.08); }
}
.av-animated .av-trunk {
  transform-origin: 50% 0%;
  animation: avTrunk 4s ease-in-out infinite;
  animation-delay: var(--av-delay, 0s);
}
@keyframes avTrunk {
  0%, 100% { transform: rotate(-4deg); }
  50%      { transform: rotate(5deg); }
}
.announcer-tile:hover .av-body,
.announcer-tile.selected .av-body { animation: avBounce 0.55s ease-in-out infinite; }
@keyframes avBounce {
  0%, 100% { transform: translateY(0) scale(1, 1); }
  35%      { transform: translateY(-5px) scale(0.97, 1.05); }
  70%      { transform: translateY(0.5px) scale(1.04, 0.94); }
}
.ap-avatar .av-body { animation: avTalk 0.9s ease-in-out infinite; }
@keyframes avTalk {
  0%, 100% { transform: rotate(-2deg) translateY(0); }
  50%      { transform: rotate(2.5deg) translateY(-1.5px); }
}
.announcer-preview:not([hidden]) .ap-bubble { animation: bubblePop 0.3s ease-out; }
@keyframes bubblePop {
  from { opacity: 0; transform: scale(0.85); }
  to   { opacity: 1; transform: scale(1); }
}
/* 傘面輕輕搖曳 */
.av-umb-canopy {
  transform-box: fill-box; transform-origin: 50% 100%;
  animation: umbSway 3.4s ease-in-out infinite;
  animation-delay: var(--av-delay, 0s);
}
@keyframes umbSway {
  0%, 100% { transform: rotate(-2.5deg); }
  50%      { transform: rotate(2.5deg); }
}
@media (prefers-reduced-motion: reduce) { .av-umb-canopy { animation: none; } }

/* 點擊互動反應(套在 svg 根元素,不與內部動畫衝突) */
svg.av-animated { cursor: pointer; }
.av-react-jump {
  animation: avReactJump 0.65s cubic-bezier(0.3, 1.6, 0.5, 1);
  transform-origin: 50% 95%;
}
@keyframes avReactJump {
  0%, 100% { transform: none; }
  30%      { transform: translateY(-12px) scale(0.95, 1.08); }
  60%      { transform: translateY(0) scale(1.08, 0.9); }
}
.av-react-wobble {
  animation: avReactWobble 0.65s ease;
  transform-origin: 50% 80%;
}
@keyframes avReactWobble {
  0%, 100% { transform: rotate(0); }
  25%      { transform: rotate(-13deg); }
  60%      { transform: rotate(11deg); }
  85%      { transform: rotate(-5deg); }
}
.av-react-shake { animation: avReactShake 0.5s ease; }
@keyframes avReactShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px); } 40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); } 80% { transform: translateX(2px); }
}
.av-emote {
  position: fixed; z-index: 99; pointer-events: none;
  font-size: 0.95rem; font-weight: 700; color: var(--accent);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  animation: emoteRise 0.9s ease-out forwards;
}
@keyframes emoteRise {
  from { opacity: 0; transform: translate(-50%, 4px) scale(0.7); }
  25%  { opacity: 1; }
  to   { opacity: 0; transform: translate(-50%, -24px) scale(1.15); }
}

@media (prefers-reduced-motion: reduce) {
  .av-animated .av-body, .av-animated .av-eyes, .av-animated .av-trunk,
  .announcer-tile:hover .av-body, .ap-avatar .av-body,
  .av-react-jump, .av-react-wobble, .av-react-shake, .av-emote { animation: none; }
}

/* ── 🐾 桌寵模式 ───────────────────────────────────── */
#pet-layer {
  position: fixed; inset: 0;
  pointer-events: none; z-index: 40; overflow: hidden;
}
.pet {
  position: absolute; left: 0; top: 0; width: 44px; height: 58px;
  pointer-events: auto; cursor: pointer;
}
/* 全身版:走路擺腿、甩手、搖尾巴 */
.av-fullbody .av-leg, .av-fullbody .av-arm, .av-fullbody .av-tail,
.av-fullbody .av-head { transform-box: fill-box; }
.av-fullbody .av-leg { transform-origin: 50% 8%; }
.av-fullbody .av-arm { transform-origin: 50% 12%; }
.av-fullbody .av-tail { transform-origin: 15% 90%; animation: tailWag 2.4s ease-in-out infinite; }
@keyframes tailWag { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(12deg); } }
.pet.walking .av-leg-l { animation: legStep 0.5s linear infinite; }
.pet.walking .av-leg-r { animation: legStep 0.5s linear infinite; animation-delay: -0.25s; }
@keyframes legStep {
  0%, 100% { transform: rotate(10deg) translateY(-1.5px); }
  50%      { transform: rotate(-10deg) translateY(0); }
}
.pet.walking .av-arm-l { animation: armSwing 0.5s linear infinite; animation-delay: -0.25s; }
.pet.walking .av-arm-r { animation: armSwing 0.5s linear infinite; }
@keyframes armSwing {
  0%, 100% { transform: rotate(7deg); }
  50%      { transform: rotate(-7deg); }
}
.pet.walking .av-tail { animation-duration: 0.9s; }
@media (prefers-reduced-motion: reduce) {
  .av-fullbody .av-tail, .pet.walking .av-leg-l, .pet.walking .av-leg-r,
  .pet.walking .av-arm-l, .pet.walking .av-arm-r { animation: none; }
}
.pet-flip, .pet-waddle { width: 100%; height: 100%; }
.pet.walking .pet-waddle {
  animation: petWaddle 0.55s ease-in-out infinite;
  transform-origin: 50% 90%;
}
@keyframes petWaddle {
  0%, 100% { transform: rotate(-5deg) translateY(0); }
  50%      { transform: rotate(5deg) translateY(-2.5px); }
}
.pet-enter { animation: petEnter 0.5s ease-out; }
@keyframes petEnter { from { opacity: 0; transform: translateY(20px); } }
.pet-leave { animation: petLeave 0.55s ease-in forwards; }
@keyframes petLeave { to { opacity: 0; transform: translateY(24px); } }
@media (prefers-reduced-motion: reduce) {
  .pet.walking .pet-waddle, .pet-enter, .pet-leave { animation: none; }
}

/* ── 頂欄當家主播 ──────────────────────────────────── */
.topbar-announcer { display: flex; align-items: center; }
.topbar-announcer svg { display: block; }

/* ── 播報員選角網格 ────────────────────────────────── */
.announcer-grid {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px;
}
.announcer-tile {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: var(--page); border: 2px solid var(--border); border-radius: 12px;
  padding: 6px 2px 5px; cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease;
}
.announcer-tile:hover { transform: translateY(-3px) scale(1.05); border-color: var(--accent); }
.announcer-tile.selected {
  border-color: var(--accent);
  background: var(--banner-info);
}
.announcer-tile svg { display: block; }
.at-name { font-size: 0.72rem; color: var(--ink-2); }
.announcer-tile.selected .at-name { color: var(--accent); font-weight: 700; }

/* ── 播報員預覽(頭像+對話泡泡)──────────────────── */
.announcer-preview {
  margin-top: 10px; display: flex; align-items: flex-start; gap: 10px;
}
.ap-avatar { flex-shrink: 0; }
.ap-bubble {
  position: relative; flex: 1; padding: 10px 14px;
  background: var(--page); border: 1px solid var(--border); border-radius: 12px;
  font-size: 0.85rem;
}
.ap-bubble::before {
  content: ""; position: absolute; left: -7px; top: 26px;
  width: 12px; height: 12px; background: var(--page);
  border-left: 1px solid var(--border); border-bottom: 1px solid var(--border);
  transform: rotate(45deg);
}
.ap-title { font-weight: 700; margin-bottom: 2px; }
.ap-body { color: var(--ink-2); white-space: pre-line; }
.quake-cast {
  display: flex; align-items: center; gap: 8px; margin-top: 12px;
  padding-top: 10px; border-top: 1px solid var(--border);
}
.qc-avatars { display: flex; flex-shrink: 0; }

/* ── 設定面板 ──────────────────────────────────────── */
dialog {
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--border); border-radius: 14px;
  max-width: 460px; width: calc(100vw - 40px);
  max-height: 85vh; overflow-y: auto;
  padding: 20px 22px;
}
dialog::backdrop { background: rgba(0, 0, 0, 0.5); }
dialog h2 { margin: 0 0 12px; font-size: 1.1rem; }
fieldset {
  border: 1px solid var(--border); border-radius: 10px;
  margin: 0 0 14px; padding: 10px 14px 14px;
}
legend { font-size: 0.85rem; color: var(--ink-2); padding: 0 6px; }
dialog label { display: block; font-size: 0.85rem; margin-top: 8px; }
dialog input:not([type="checkbox"]), dialog select {
  width: 100%; margin-top: 3px;
  background: var(--page); color: var(--ink);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 7px 10px; font-size: 0.9rem;
}
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check { display: flex; align-items: center; gap: 8px; }
.inline-time { width: auto !important; margin-left: 8px; }
.dialog-actions { display: flex; gap: 8px; align-items: center; }
.spacer { flex: 1; }
