/* ============================================================
   TEMPO — Design tokens & styles
   ============================================================ */
:root {
  --font-body: 'Switzer', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --text-2xs: 0.6875rem;
  --text-xs: 0.75rem;
  --text-sm: 0.8125rem;
  --text-base: 0.875rem;
  --text-lg: 1rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;

  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 20px; --space-6: 24px; --space-8: 32px;

  --accent: #E63946;
  --accent-hover: #D32F3F;
  --accent-light: rgba(230, 57, 70, 0.12);
  --accent-lighter: rgba(230, 57, 70, 0.06);
  --blue: #3B82F6;

  --radius-sm: 4px; --radius-md: 6px; --radius-lg: 10px; --radius-xl: 14px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --transition: 180ms var(--ease);
  --sidebar-w: 256px;
  --topbar-h: 56px;
  --ticker-h: 56px;
  --toolbar-h: 56px;
  --mnav-h: 60px;
}
:root, [data-theme="light"] {
  --color-bg: #FAFAFA;
  --color-surface: #FFFFFF;
  --color-surface-2: #F4F4F5;
  --color-surface-3: #EBEBED;
  --color-border: #E4E4E7;
  --color-border-light: #F0F0F1;
  --color-text: #18181B;
  --color-text-muted: #6B6B73;
  --color-text-faint: #9C9CA3;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 14px rgba(0,0,0,0.08);
  --shadow-lg: 0 16px 48px rgba(0,0,0,0.16);
  --grid-line: #EFEFF1;
  --today-bg: rgba(230, 57, 70, 0.035);
  --hour-text: #A1A1AA;
  --ev-text-mix: 52%;
  --map-bg: #EEF0E8; --map-road: #FFFFFF; --map-park: #CFE6C4; --map-block: #E2E2DA; --map-water: #BFD9EE;
  color-scheme: light;
}
[data-theme="dark"] {
  --color-bg: #0F0F11;
  --color-surface: #18181B;
  --color-surface-2: #222226;
  --color-surface-3: #2C2C31;
  --color-border: #2E2E33;
  --color-border-light: #26262B;
  --color-text: #EDEDEF;
  --color-text-muted: #A0A0A8;
  --color-text-faint: #6E6E76;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 14px rgba(0,0,0,0.45);
  --shadow-lg: 0 16px 48px rgba(0,0,0,0.6);
  --grid-line: #232327;
  --today-bg: rgba(230, 57, 70, 0.07);
  --hour-text: #66666E;
  --accent-light: rgba(230, 57, 70, 0.2);
  --accent-lighter: rgba(230, 57, 70, 0.1);
  --ev-text-mix: 100%;
  --map-bg: #22252A; --map-road: #33373D; --map-park: #24382A; --map-block: #2B2E33; --map-water: #1E3247;
  color-scheme: dark;
}

body { background: var(--color-bg); font-size: var(--text-base); }
button { color: inherit; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--color-text-muted); }
.small { font-size: var(--text-xs); }
.center { text-align: center; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
kbd { font: 600 10px/1 var(--font-body); padding: 3px 5px; border-radius: 4px; border: 1px solid var(--color-border); background: var(--color-surface-2); color: var(--color-text-muted); }

/* ---------- Buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: var(--radius-md);
  font-size: var(--text-sm); font-weight: 600; white-space: nowrap;
  border: 1px solid transparent;
}
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn.sm { height: 30px; padding: 0 10px; font-size: var(--text-xs); }
.btn.sm svg { width: 14px; height: 14px; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: .7; cursor: progress; }
.btn-blue { background: var(--blue); color: #fff; }
.btn-blue:hover { background: #2F6FDB; }
.btn-ghost { background: var(--color-surface); border-color: var(--color-border); color: var(--color-text); }
.btn-ghost:hover { background: var(--color-surface-2); border-color: var(--color-text-faint); }
.btn-ghost.danger, .danger { color: var(--accent); }
.btn-ghost.danger:hover { background: var(--accent-lighter); border-color: var(--accent); }
.btn-block { width: 100%; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 36px; height: 36px; border-radius: var(--radius-md); color: var(--color-text-muted);
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { background: var(--color-surface-2); color: var(--color-text); }
.icon-btn.sm { width: 30px; height: 30px; }
.icon-btn.sm svg { width: 16px; height: 16px; }
.link-btn { display: inline-flex; align-items: center; gap: 4px; font-size: var(--text-xs); font-weight: 600; color: var(--color-text-muted); padding: 6px 0; }
.link-btn svg { width: 14px; height: 14px; }
.link-btn:hover { color: var(--accent); }
.input {
  width: 100%; height: 36px; padding: 0 10px; border-radius: var(--radius-md);
  border: 1px solid var(--color-border); background: var(--color-surface); color: var(--color-text);
  font-size: var(--text-sm);
}
textarea.input { height: auto; padding: 8px 10px; resize: vertical; line-height: 1.5; }
select.input { padding-right: 28px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239C9CA3' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 9px center; }
.input:hover { border-color: var(--color-text-faint); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
.input.lg { height: 44px; font-size: var(--text-lg); font-weight: 600; }
.input.sm { height: 30px; font-size: var(--text-xs); }
.input.invalid { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--space-4); min-width: 0; }
.field > span { font-size: var(--text-xs); font-weight: 600; color: var(--color-text-muted); }
.field > span em { font-style: normal; font-weight: 400; color: var(--color-text-faint); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.form-err { color: var(--accent); font-size: var(--text-xs); font-weight: 600; margin: -4px 0 var(--space-3); }
.seg { display: flex; background: var(--color-surface-2); border-radius: var(--radius-md); padding: 3px; gap: 3px; }
.seg-btn { flex: 1; height: 30px; border-radius: 4px; font-size: var(--text-xs); font-weight: 600; color: var(--color-text-muted); padding: 0 8px; white-space: nowrap; }
.seg-btn:hover { color: var(--color-text); }
.seg-btn.active { background: var(--color-surface); color: var(--color-text); box-shadow: var(--shadow-sm); }
.switch { width: 40px; height: 24px; border-radius: 12px; background: var(--color-surface-3); position: relative; flex-shrink: 0; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform var(--transition); }
.switch.on { background: var(--accent); }
.switch.on::after { transform: translateX(16px); }
.toggle-row { display: flex; align-items: center; gap: var(--space-3); justify-content: space-between; padding: var(--space-2) 0; margin-bottom: var(--space-2); }
.toggle-row > span { display: flex; flex-direction: column; min-width: 0; }
.toggle-row b { font-size: var(--text-sm); font-weight: 600; }
.toggle-row small { font-size: var(--text-xs); color: var(--color-text-muted); }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips.wrap { flex-wrap: wrap; overflow: visible; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 16px; border: 1px solid var(--color-border); background: var(--color-surface); font-size: var(--text-xs); font-weight: 600; color: var(--color-text-muted); white-space: nowrap; flex-shrink: 0; }
.chip span { font-weight: 500; color: var(--color-text-faint); }
.chip:hover { border-color: var(--color-text-faint); color: var(--color-text); }
.chip.active { background: var(--accent-light); border-color: var(--accent); color: var(--accent); }
.chip.active span { color: var(--accent); opacity: .8; }
.tag { font-size: var(--text-2xs); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 3px 8px; border-radius: 10px; background: var(--color-surface-2); color: var(--color-text-muted); }
.spinner { width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty-note { font-size: var(--text-sm); color: var(--color-text-muted); padding: var(--space-3) 0; }
.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 48px 16px; color: var(--color-text-muted); }
.empty-state svg { width: 32px; height: 32px; color: var(--color-text-faint); margin-bottom: 4px; }
.empty-state b { color: var(--color-text); font-size: var(--text-lg); }
.empty-state.small { padding: 28px 16px; }

/* ---------- App shell ---------- */
.app-shell { display: flex; flex-direction: column; overflow: hidden; background: var(--color-bg); }
.top-bar {
  display: flex; align-items: center; gap: var(--space-3);
  height: var(--topbar-h); padding: 0 var(--space-4); flex-shrink: 0;
  background: var(--color-surface); border-bottom: 1px solid var(--color-border); z-index: 30; position: relative;
}
.logo { display: flex; align-items: center; gap: var(--space-2); text-decoration: none; color: var(--color-text); flex-shrink: 0; border-radius: var(--radius-md); }
.logo-text { font-size: 1.125rem; font-weight: 700; letter-spacing: -0.02em; }
.top-bar-right { display: flex; align-items: center; gap: var(--space-2); flex-shrink: 0; margin-left: auto; }
.view-switcher { display: flex; background: var(--color-surface-2); border-radius: var(--radius-md); padding: 3px; gap: 2px; margin-right: var(--space-2); }
.view-btn { font-size: var(--text-xs); font-weight: 600; height: 30px; padding: 0 12px; border-radius: 4px; color: var(--color-text-muted); white-space: nowrap; }
.view-btn:hover { color: var(--color-text); }
.view-btn.active { background: var(--color-surface); color: var(--color-text); box-shadow: var(--shadow-sm); }

/* Plain-English bar */
.nlp-bar {
  flex: 1; min-width: 0; max-width: 560px; position: relative;
  display: flex; align-items: center; gap: var(--space-2);
  height: 38px; padding: 0 var(--space-3);
  background: var(--color-surface-2); border: 1px solid var(--color-border); border-radius: var(--radius-lg);
}
.nlp-bar:focus-within, .nlp-bar.open { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); background: var(--color-surface); }
.nlp-icon { color: var(--accent); flex-shrink: 0; }
.nlp-input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: var(--text-sm); color: var(--color-text); height: 100%; }
.nlp-input::placeholder { color: var(--color-text-faint); }
.nlp-kbd { flex-shrink: 0; opacity: 0; transition: opacity var(--transition); }
.nlp-bar:focus-within .nlp-kbd { opacity: 1; }
.nlp-pop {
  display: none; position: absolute; top: calc(100% + 8px); left: 0; right: 0; min-width: 380px;
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg); padding: var(--space-4); z-index: 120; animation: drop 180ms var(--ease);
}
.nlp-pop.visible { display: block; }
@keyframes drop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.nlp-parsed { font-size: var(--text-base); line-height: 1.9; margin-bottom: var(--space-3); color: var(--color-text-muted); word-break: break-word; }
.nlp-parsed mark { background: none; color: inherit; font-weight: 600; padding: 2px 6px; border-radius: 4px; }
.hl-time, .hl-dur { color: var(--accent) !important; background: var(--accent-lighter) !important; }
.hl-date { color: #2563EB !important; background: rgba(59,130,246,.1) !important; }
.hl-loc { color: #15803D !important; background: rgba(34,197,94,.12) !important; }
.hl-repeat { color: #7C3AED !important; background: rgba(139,92,246,.12) !important; }
.hl-tag, .hl-video { color: #0E7490 !important; background: rgba(6,182,212,.12) !important; }
[data-theme="dark"] .hl-date { color: #7FB0FF !important; } [data-theme="dark"] .hl-loc { color: #6EE79B !important; } [data-theme="dark"] .hl-repeat { color: #B9A0FF !important; } [data-theme="dark"] .hl-tag, [data-theme="dark"] .hl-video { color: #67D8EE !important; }
.nlp-card { display: flex; gap: var(--space-3); padding: var(--space-3); border-radius: var(--radius-lg); background: var(--color-surface-2); border-left: 4px solid var(--c); }
.nlp-dot { display: none; }
.nlp-info { flex: 1; min-width: 0; }
.nlp-title { font-weight: 700; font-size: var(--text-lg); margin-bottom: 4px; }
.nlp-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: var(--text-xs); color: var(--color-text-muted); }
.nlp-meta span { display: inline-flex; align-items: center; gap: 5px; }
.nlp-meta svg { width: 13px; height: 13px; }
.nlp-cal { display: flex; align-items: center; gap: var(--space-2); margin-top: var(--space-3); font-size: var(--text-xs); color: var(--color-text-muted); font-weight: 600; }
.nlp-cal .input { width: auto; min-width: 150px; }
.nlp-hint { font-size: var(--text-xs); color: var(--color-text-muted); margin-top: var(--space-2); }
.nlp-actions { display: flex; justify-content: flex-end; gap: var(--space-2); margin-top: var(--space-3); }
.nlp-actions kbd { background: rgba(255,255,255,.2); border-color: rgba(255,255,255,.35); color: #fff; }
.nlp-ex { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.nlp-ex .side-label { padding: 0 0 6px; }
.nlp-ex-btn { width: 100%; text-align: left; padding: 9px 10px; border-radius: var(--radius-md); font-size: var(--text-sm); color: var(--color-text); }
.nlp-ex-btn::before { content: '“'; color: var(--color-text-faint); }
.nlp-ex-btn::after { content: '”'; color: var(--color-text-faint); }
.nlp-ex-btn:hover { background: var(--color-surface-2); }
.quick-pill { display: none; }

/* ---------- Day ticker ---------- */
.day-ticker {
  display: flex; align-items: center; gap: 2px; flex-shrink: 0;
  height: var(--ticker-h); padding: 0 var(--space-4); overflow-x: auto; scrollbar-width: none;
  background: var(--color-surface); border-bottom: 1px solid var(--color-border);
}
.day-ticker::-webkit-scrollbar { display: none; }
body[data-view="month"] .day-ticker, body[data-view="tasks"] .day-ticker, body[data-view="openings"] .day-ticker { display: none; }
.ticker-day { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; flex-shrink: 0; min-width: 48px; height: 46px; padding: 0 8px; border-radius: var(--radius-md); }
.ticker-day:hover { background: var(--color-surface-2); }
.ticker-weekday { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--color-text-muted); }
.ticker-date { font-size: var(--text-sm); font-weight: 700; line-height: 1.2; }
.ticker-dots { display: flex; gap: 2px; height: 4px; }
.ticker-dots i { width: 4px; height: 4px; border-radius: 50%; }
.ticker-day.selected { background: var(--accent-light); }
.ticker-day.selected .ticker-date { color: var(--accent); }
.ticker-day.today { background: var(--accent); }
.ticker-day.today .ticker-weekday, .ticker-day.today .ticker-date { color: #fff; }
.ticker-day.today .ticker-dots i { background: rgba(255,255,255,.85) !important; }

/* ---------- Main ---------- */
.main-content { display: flex; flex: 1; min-height: 0; position: relative; }
.views { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; }
.view-toolbar {
  display: flex; align-items: center; gap: var(--space-3); flex-shrink: 0;
  height: var(--toolbar-h); padding: 0 var(--space-5);
  border-bottom: 1px solid var(--color-border); background: var(--color-bg);
}
.tb-nav { display: flex; align-items: center; gap: 2px; }
.tb-nav .btn { margin-left: var(--space-2); }
.tb-title { font-size: var(--text-xl); font-weight: 700; letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.tb-sub { font-weight: 500; color: var(--color-text-faint); margin-left: 4px; }
.tb-right { margin-left: auto; display: flex; align-items: center; gap: var(--space-2); flex-shrink: 0; }
.legend { font-size: var(--text-xs); font-weight: 600; color: var(--color-text-muted); padding: 6px 10px; border-radius: 16px; background: var(--color-surface-2); }
.legend:hover { color: var(--color-text); }
.view-panel { display: none; flex: 1; min-height: 0; overflow: auto; position: relative; }
.view-panel.active { display: block; animation: fade 200ms ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; overflow-y: auto;
  background: var(--color-surface); border-right: 1px solid var(--color-border);
  padding: var(--space-4) var(--space-3) var(--space-6);
  transition: margin-left 240ms var(--ease), opacity 200ms ease;
}
.app-shell.side-collapsed .sidebar { margin-left: calc(-1 * var(--sidebar-w)); opacity: 0; pointer-events: none; }
.drawer-head, .drawer-links { display: none; }
.side-sec { margin-top: var(--space-5); }
.side-label { display: flex; align-items: center; justify-content: space-between; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--color-text-faint); margin-bottom: var(--space-2); padding: 0 var(--space-2); }
.side-add { width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; border-radius: 4px; color: var(--color-text-muted); }
.side-add svg { width: 14px; height: 14px; }
.side-add:hover { background: var(--color-surface-2); color: var(--accent); }
.sidebar > .btn-primary { display: none; margin-bottom: var(--space-4); height: 44px; }
.mini { background: var(--color-surface-2); border-radius: var(--radius-lg); padding: var(--space-3); }
.mini-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-2); padding-left: 4px; }
.mini-title { font-size: var(--text-sm); font-weight: 700; }
.mini-nav { display: flex; gap: 2px; }
.mini-nav button { width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; border-radius: 4px; color: var(--color-text-muted); }
.mini-nav button svg { width: 14px; height: 14px; }
.mini-nav button:hover { background: var(--color-surface); color: var(--color-text); }
.mini-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; text-align: center; }
.mini-dow { font-size: 9px; font-weight: 700; text-transform: uppercase; color: var(--color-text-faint); padding: 4px 0; }
.mini-day { position: relative; aspect-ratio: 1; border-radius: 50%; font-size: 11px; font-weight: 500; display: flex; align-items: center; justify-content: center; }
.mini-day:hover { background: var(--color-surface); }
.mini-day.other { color: var(--color-text-faint); }
.mini-day.has::after { content: ''; position: absolute; bottom: 2px; width: 3px; height: 3px; border-radius: 50%; background: var(--color-text-faint); }
.mini-day.selected { background: var(--accent-light); color: var(--accent); font-weight: 700; }
.mini-day.today { background: var(--accent); color: #fff; font-weight: 700; }
.mini-day.today::after { background: #fff; }
.set-list, .cal-list, .upnext { display: flex; flex-direction: column; gap: 2px; }
.set-list.flash { animation: flash 1.4s ease; border-radius: var(--radius-md); }
.set-btn, .cal-item, .up-item { display: flex; align-items: center; gap: var(--space-2); width: 100%; text-align: left; padding: 7px var(--space-2); border-radius: var(--radius-md); font-size: var(--text-sm); color: var(--color-text); }
.set-btn:hover, .cal-item:hover, .up-item:hover { background: var(--color-surface-2); }
.set-btn .count { font-size: var(--text-2xs); color: var(--color-text-faint); font-weight: 600; }
.set-btn.active { background: var(--accent-light); color: var(--accent); font-weight: 700; }
.set-btn.active .count { color: var(--accent); }
.cal-box { width: 16px; height: 16px; border-radius: 4px; border: 2px solid var(--color-border); display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: #fff; }
.cal-box.on { background: var(--c); border-color: var(--c); }
.cal-box svg { width: 10px; height: 10px; }
.up-item { align-items: stretch; }
.up-item .bar { width: 3px; border-radius: 2px; flex-shrink: 0; }
.up-item .grow { display: flex; flex-direction: column; }
.up-title { font-weight: 600; font-size: var(--text-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.up-meta { font-size: var(--text-xs); color: var(--color-text-muted); }
.add-cal { background: var(--color-surface-2); border-radius: var(--radius-lg); padding: var(--space-3); margin-bottom: var(--space-2); display: flex; flex-direction: column; gap: var(--space-2); }
.add-cal[hidden] { display: none; }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatch input { position: absolute; opacity: 0; pointer-events: none; }
.swatch span { display: block; width: 20px; height: 20px; border-radius: 50%; cursor: pointer; box-shadow: inset 0 0 0 2px rgba(255,255,255,.0); }
.swatch input:checked + span { box-shadow: 0 0 0 2px var(--color-surface-2), 0 0 0 4px var(--color-text); }
.swatch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 3px; }
.add-cal-row { display: flex; gap: var(--space-2); }
.drawer-scrim { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 60; animation: fade 160ms ease; }
.drawer-scrim[hidden] { display: none; }

/* ---------- Week ---------- */
.wk-scroll { height: 100%; overflow: auto; }
.wk { min-width: 0; }
.wk-head, .wk-body { display: grid; grid-template-columns: 56px repeat(var(--cols), minmax(0, 1fr)); }
.wk-head { position: sticky; top: 0; z-index: 6; background: var(--color-surface); border-bottom: 1px solid var(--color-border); }
.wk-corner { display: flex; align-items: flex-end; justify-content: center; padding-bottom: 8px; }
.wk-tz { font-size: 9px; color: var(--color-text-faint); font-weight: 600; }
.wk-head-day { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 8px 0 7px; border-left: 1px solid var(--grid-line); border-bottom: 3px solid transparent; margin-bottom: -1px; }
.wk-head-day:hover { background: var(--color-surface-2); }
.wk-dow { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--color-text-muted); }
.wk-num { font-size: 1.25rem; font-weight: 700; line-height: 1.15; }
.wk-weather { font-size: 10px; color: var(--color-text-faint); }
.wk-head-day.today { border-bottom-color: var(--accent); }
.wk-head-day.today .wk-num, .wk-head-day.today .wk-dow { color: var(--accent); }
.wk-head-day.sel { background: var(--color-surface-2); }
.wk-times { position: relative; }
.wk-hour { height: 56px; position: relative; }
.wk-hour span, .dy-hour span { position: absolute; top: -7px; right: 8px; font-size: 10px; font-weight: 500; color: var(--hour-text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.wk-col {
  position: relative; border-left: 1px solid var(--grid-line); cursor: copy;
  background-image: linear-gradient(var(--grid-line) 1px, transparent 1px), linear-gradient(transparent 27px, var(--color-border-light) 27px, var(--color-border-light) 28px, transparent 28px);
  background-size: 100% 56px, 100% 56px;
}
.wk-col.today { background-color: var(--today-bg); }
.ev {
  position: absolute; display: flex; flex-direction: column; align-items: flex-start; text-align: left; overflow: hidden;
  padding: 3px 6px; border-radius: var(--radius-sm); border-left: 3px solid var(--c);
  background: color-mix(in srgb, var(--c) 14%, var(--color-surface));
  color: color-mix(in srgb, var(--c) var(--ev-text-mix), var(--color-text));
  font-size: 11px; line-height: 1.3; z-index: 2; cursor: pointer;
  transition: box-shadow var(--transition), transform var(--transition);
}
.ev:hover { box-shadow: var(--shadow-md); z-index: 4; transform: translateY(-1px); }
.ev:focus-visible { z-index: 5; }
.ev-title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.ev-time { font-size: 10px; opacity: .85; white-space: nowrap; }
.ev-loc { display: flex; align-items: center; gap: 3px; font-size: 10px; opacity: .75; margin-top: 2px; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-loc svg { width: 10px; height: 10px; flex-shrink: 0; }
.ev.tiny { flex-direction: row; gap: 6px; align-items: center; padding-top: 1px; padding-bottom: 1px; }
.ev.tiny .ev-time { display: none; }
.ev-travel { position: absolute; border-radius: var(--radius-sm); background: repeating-linear-gradient(135deg, var(--color-border-light) 0 4px, transparent 4px 8px); border: 1px dashed var(--color-border); z-index: 1; display: flex; align-items: center; padding-left: 6px; font-size: 10px; color: var(--color-text-faint); overflow: hidden; pointer-events: none; }
.ev-travel span { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.ev-travel svg { width: 11px; height: 11px; }
.now-line { position: absolute; left: 0; right: 0; height: 2px; background: var(--accent); z-index: 5; pointer-events: none; }
.now-line::before { content: ''; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.now-line span { position: absolute; right: 4px; top: -18px; font-size: 10px; font-weight: 700; color: var(--accent); background: var(--color-surface); padding: 0 4px; border-radius: 3px; }

/* Week as an agenda on phones */
.agenda { padding: var(--space-2) var(--space-3) var(--space-6); }
.ag-day { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); margin-bottom: var(--space-2); overflow: hidden; }
.ag-day.today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent-light); }
.ag-head { display: flex; align-items: center; gap: var(--space-3); padding: 6px 6px 6px var(--space-2); }
.ag-date { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 48px; height: 48px; border-radius: var(--radius-md); flex-shrink: 0; }
.ag-date:hover { background: var(--color-surface-2); }
.ag-dow { font-size: 10px; font-weight: 700; text-transform: uppercase; color: var(--color-text-muted); letter-spacing: .05em; }
.ag-num { font-size: 1.25rem; font-weight: 700; line-height: 1.1; }
.ag-day.today .ag-date { background: var(--accent); }
.ag-day.today .ag-dow, .ag-day.today .ag-num { color: #fff; }
.ag-sum { flex: 1; font-size: var(--text-sm); color: var(--color-text-muted); min-width: 0; }
.ag-sum b { color: var(--color-text); }
.ag-list { border-top: 1px solid var(--color-border-light); }
.ag-row { display: flex; align-items: stretch; gap: var(--space-3); width: 100%; text-align: left; padding: 10px var(--space-3); min-height: 56px; border-bottom: 1px solid var(--color-border-light); }
.ag-row:last-child { border-bottom: 0; }
.ag-row:hover { background: var(--color-surface-2); }
.ag-time { width: 64px; flex-shrink: 0; display: flex; flex-direction: column; font-size: var(--text-sm); }
.ag-time small { font-size: var(--text-2xs); color: var(--color-text-faint); }
.ag-bar { width: 4px; border-radius: 2px; background: var(--c); flex-shrink: 0; }
.ag-main { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.ag-title { font-weight: 700; font-size: var(--text-base); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ag-meta { display: flex; align-items: center; gap: 4px; font-size: var(--text-xs); color: var(--color-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ag-meta svg { width: 12px; height: 12px; flex-shrink: 0; }

/* ---------- Day ---------- */
.dy { display: grid; grid-template-columns: minmax(0, 1fr) 320px; height: 100%; }
.dy-scroll { overflow-y: auto; min-height: 0; padding: var(--space-4) var(--space-5) var(--space-8); }
.dy-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: var(--space-2); margin-bottom: var(--space-4); }
.dy-summary.in-main { display: none; }
.dy-summary.in-rail { grid-template-columns: 1fr 1fr; margin-bottom: var(--space-5); }
.dy-summary.in-rail .stat { background: var(--color-surface-2); border-color: transparent; }
.dy-summary.in-rail .stat.wx { grid-column: auto; }
.stat { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 10px 12px; display: flex; flex-direction: column; min-width: 0; }
.stat-k { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--color-text-faint); }
.stat-v { font-size: 1.125rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-v.sm { font-size: var(--text-base); padding-top: 3px; }
.stat-s { font-size: var(--text-xs); color: var(--color-text-muted); }
.empty-day { display: flex; gap: var(--space-3); align-items: center; padding: var(--space-3) var(--space-4); border: 1px dashed var(--color-border); border-radius: var(--radius-lg); color: var(--color-text-muted); margin-bottom: var(--space-4); font-size: var(--text-sm); }
.empty-day svg { width: 22px; height: 22px; color: var(--accent); flex-shrink: 0; }
.empty-day b { color: var(--color-text); }
.dy-grid { display: grid; grid-template-columns: 56px minmax(0, 1fr); position: relative; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding-top: 0; }
.dy-hour { height: 64px; position: relative; }
.dy-col {
  position: relative; border-left: 1px solid var(--grid-line); cursor: copy;
  background-image: linear-gradient(var(--grid-line) 1px, transparent 1px), linear-gradient(transparent 31px, var(--color-border-light) 31px, var(--color-border-light) 32px, transparent 32px);
  background-size: 100% 64px, 100% 64px;
}
.dev {
  position: absolute; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; overflow: hidden;
  padding: 6px 10px; border-radius: var(--radius-md); border-left: 4px solid var(--c);
  background: color-mix(in srgb, var(--c) 13%, var(--color-surface));
  color: color-mix(in srgb, var(--c) var(--ev-text-mix), var(--color-text)); z-index: 2;
  transition: box-shadow var(--transition);
}
.dev:hover { box-shadow: var(--shadow-md); z-index: 4; }
.dev-hit { position: absolute; inset: 0; z-index: 0; border-radius: inherit; }
.dev > :not(.dev-hit) { position: relative; z-index: 1; pointer-events: none; }
.dev > .join { pointer-events: auto; }
.dev-title { font-weight: 700; font-size: var(--text-sm); color: var(--color-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.dev-time { font-size: var(--text-xs); display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.dev-time svg { width: 11px; height: 11px; }
.dev-loc { display: flex; align-items: center; gap: 4px; font-size: var(--text-xs); opacity: .8; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dev-loc svg { width: 12px; height: 12px; flex-shrink: 0; }
.dev.tiny { flex-direction: row; align-items: center; gap: 8px; padding-top: 2px; padding-bottom: 2px; }
.avs { display: flex; margin-top: 2px; }
.avs i { width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-style: normal; font-size: 9px; font-weight: 700; color: #fff; border: 2px solid var(--color-surface); margin-left: -6px; }
.avs i:first-child { margin-left: 0; }
.avs i.more { background: var(--color-text-faint); }
.join { display: inline-flex; align-items: center; gap: 5px; margin-top: 2px; height: 26px; padding: 0 10px; border-radius: 13px; background: var(--blue); color: #fff; font-size: 11px; font-weight: 700; }
.join svg { width: 12px; height: 12px; }
.join:hover { background: #2F6FDB; }
.dy-rail { border-left: 1px solid var(--color-border); background: var(--color-surface); overflow-y: auto; padding: var(--space-4); }
.rail-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: var(--space-4); margin-bottom: var(--space-3); }
.dy-rail .rail-card { border: 0; padding: 0; }
.rail-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-2); margin-bottom: var(--space-2); }
.rail-head h2, .rail-h { font-size: var(--text-base); font-weight: 700; }
.rail-h { margin-bottom: var(--space-3); }
.progress { height: 6px; border-radius: 3px; background: var(--color-surface-2); overflow: hidden; margin-bottom: var(--space-3); }
.progress i { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width 300ms var(--ease); }
.quick-task { display: flex; gap: var(--space-2); margin-bottom: var(--space-2); }
.quick-task .btn { width: 36px; padding: 0; flex-shrink: 0; }
.task-list { margin-bottom: var(--space-3); }

/* ---------- Tasks ---------- */
.task { display: flex; align-items: center; gap: var(--space-3); padding: 10px var(--space-2); border-bottom: 1px solid var(--color-border-light); border-radius: var(--radius-md); }
.task:hover { background: var(--color-surface-2); }
.task.flash { animation: flash 1.6s ease; }
@keyframes flash { 0%, 40% { background: var(--accent-light); } 100% { background: transparent; } }
.task-check { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--color-border); flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: #fff; }
.task-check svg { width: 12px; height: 12px; }
.task-check:hover { border-color: var(--accent); background: var(--accent-lighter); }
.task.done .task-check { background: var(--accent); border-color: var(--accent); }
.task-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.task-text { font-size: var(--text-sm); font-weight: 500; }
.task.done .task-text { text-decoration: line-through; color: var(--color-text-faint); }
.task-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 5px; font-size: var(--text-xs); color: var(--color-text-muted); }
.task-meta .dot { width: 6px; height: 6px; }
.task-meta .overdue { color: var(--accent); font-weight: 600; }
.task-meta > span { white-space: nowrap; }
.task-act { display: inline-flex; align-items: center; gap: 4px; height: 30px; padding: 0 8px; border-radius: var(--radius-md); font-size: var(--text-xs); font-weight: 600; color: var(--color-text-muted); flex-shrink: 0; opacity: .0; }
.task-act svg { width: 15px; height: 15px; }
.task:hover .task-act, .task:focus-within .task-act { opacity: 1; }
.task-act:hover { background: var(--color-surface); color: var(--color-text); box-shadow: var(--shadow-sm); }
.task-act.del:hover { color: var(--accent); }
.task.compact { padding: 8px 4px; position: relative; }
.task.compact .task-act span { display: none; }
@media (hover: hover) {
  .task.compact .task-act { position: absolute; top: 50%; transform: translateY(-50%); background: var(--color-surface); box-shadow: var(--shadow-sm); border: 1px solid var(--color-border); }
  .task.compact .task-act.del { right: 4px; }
  .task.compact .task-act:not(.del) { right: 42px; }
}
@media (hover: none) { .task-act { opacity: 1; } }
.tk-main, .tk-side { min-width: 0; }
.tk { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: var(--space-6); max-width: 1180px; margin: 0 auto; padding: var(--space-5) var(--space-5) var(--space-8); }
.task-add { display: flex; gap: var(--space-2); padding: var(--space-3); background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); margin-bottom: var(--space-4); }
.task-add select.input { width: auto; flex-shrink: 0; }
.tk .chips { margin-bottom: var(--space-4); }
.tgroup { margin-bottom: var(--space-5); }
.tgroup-h { font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--color-text-muted); padding: 0 var(--space-2) var(--space-2); border-bottom: 1px solid var(--color-border); }
.tgroup-h span { color: var(--color-text-faint); margin-left: 4px; }
.tgroup-h.overdue { color: var(--accent); }
.tk-side .rail-card { margin-bottom: var(--space-3); }
.ring { --p: 0; width: 132px; height: 132px; margin: 4px auto var(--space-3); border-radius: 50%; background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--color-surface-2) 0); display: flex; align-items: center; justify-content: center; }
.ring > div { width: 104px; height: 104px; border-radius: 50%; background: var(--color-surface); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring b { font-size: 1.5rem; }
.ring span { font-size: var(--text-xs); color: var(--color-text-muted); }
.bylist-row { display: flex; align-items: center; gap: var(--space-2); padding: 6px 0; font-size: var(--text-sm); border-bottom: 1px solid var(--color-border-light); }
.bylist-row:last-child { border: 0; }
.tip { background: var(--accent-lighter); border-color: transparent; }
.tip b { display: flex; align-items: center; gap: 6px; font-size: var(--text-sm); margin-bottom: 4px; }
.tip b svg { width: 16px; height: 16px; color: var(--accent); }
.tip p { font-size: var(--text-xs); color: var(--color-text-muted); }
.tip em { font-style: normal; font-weight: 700; color: var(--color-text); }

/* ---------- Month ---------- */
.mo { display: flex; flex-direction: column; height: 100%; min-height: 560px; }
.mo-head { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--color-surface); border-bottom: 1px solid var(--color-border); position: sticky; top: 0; z-index: 3; }
.mo-head span { text-align: center; padding: 8px 0; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--color-text-muted); }
.mo-grid { flex: 1; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-template-rows: repeat(var(--rows), minmax(96px, 1fr)); }
.mc { border-right: 1px solid var(--grid-line); border-bottom: 1px solid var(--grid-line); padding: 6px; display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow: hidden; cursor: pointer; background: var(--color-surface); text-align: left; }
.mc:nth-child(7n) { border-right: 0; }
.mc:hover { background: var(--color-surface-2); }
.mc.other { background: var(--color-bg); }
.mc.other .mc-num { color: var(--color-text-faint); }
.mc.today { background: var(--today-bg); }
.mc-num { font-size: var(--text-xs); font-weight: 700; width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.mc.today .mc-num { background: var(--accent); color: #fff; }
.mc-ev { display: flex; align-items: center; gap: 5px; width: 100%; text-align: left; font-size: 11px; font-weight: 600; padding: 2px 6px; border-radius: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--color-text); }
.mc-ev i { width: 6px; height: 6px; border-radius: 50%; background: var(--c); flex-shrink: 0; }
.mc-ev .t { color: var(--color-text-muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.mc-ev:hover { background: color-mix(in srgb, var(--c) 16%, transparent); }
.mc-more { font-size: 11px; font-weight: 700; color: var(--color-text-muted); padding: 2px 6px; text-align: left; border-radius: 4px; }
.mc-more:hover { color: var(--accent); background: var(--accent-lighter); }
.mo.phone { min-height: 0; height: auto; }
.mo.phone .mo-grid { grid-template-rows: repeat(var(--rows), 52px); flex: none; }
.mo.phone .mc { align-items: center; justify-content: center; padding: 4px 0; gap: 3px; }
.mo.phone .mc-num { font-size: var(--text-sm); width: 30px; height: 30px; }
.mo.phone .mc.sel:not(.today) .mc-num { background: var(--color-text); color: var(--color-surface); }
.mc-dots { display: flex; gap: 3px; height: 5px; }
.mc-dots i { width: 5px; height: 5px; border-radius: 50%; }
.mo-agenda { padding: var(--space-3); }
.mo-agenda .ag-head { padding: 0 0 var(--space-2); }
.mo-agenda .ag-list { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); overflow: hidden; }

/* ---------- Openings ---------- */
.op { display: grid; grid-template-columns: 340px minmax(0, 1fr) 360px; gap: var(--space-4); padding: var(--space-5); align-items: start; max-width: 1640px; margin: 0 auto; }
.op-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-xl); padding: var(--space-5); min-width: 0; }
.card-h { font-size: var(--text-lg); font-weight: 700; margin-bottom: var(--space-4); }
.card-h-row { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-2); margin-bottom: var(--space-2); }
.card-h-row .card-h { margin-bottom: 0; }
.card-sub { font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--color-text-faint); margin: var(--space-5) 0 var(--space-3); }
.link-box { display: flex; align-items: center; gap: var(--space-2); padding: 4px 4px 4px 10px; border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface-2); }
.link-text { flex: 1; min-width: 0; font: 500 var(--text-xs)/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--color-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bookings { display: flex; flex-direction: column; gap: var(--space-2); }
.booking { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2); padding: var(--space-2) var(--space-3); border: 1px solid var(--color-border-light); border-radius: var(--radius-md); }
.booking .grow { min-width: 140px; }
.booking-acts { display: flex; gap: 6px; margin-left: auto; }
.booking b { display: block; font-size: var(--text-sm); }
.booking small { font-size: var(--text-xs); color: var(--color-text-muted); }
.av { width: 32px; height: 32px; border-radius: 50%; color: #fff; font-size: var(--text-2xs); font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.av.lg { width: 44px; height: 44px; font-size: var(--text-sm); }
.av-tools { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: var(--space-3) 0; }
.av-grid { display: grid; grid-template-columns: 56px repeat(5, minmax(0, 1fr)); gap: 4px; user-select: none; }
.av-day { text-align: center; font-size: var(--text-xs); font-weight: 700; color: var(--color-text-muted); padding-bottom: 4px; }
.av-time { font-size: 10px; color: var(--hour-text); text-align: right; padding-right: 6px; display: flex; align-items: center; justify-content: flex-end; font-variant-numeric: tabular-nums; }
.av-slot { height: 40px; border-radius: var(--radius-md); background: var(--color-surface-2); border: 1px dashed transparent; font-size: 10px; font-weight: 700; color: #15803D; }
.av-slot:hover { border-color: var(--color-text-faint); }
.av-slot.on { background: rgba(34,197,94,.14); border: 1px solid rgba(34,197,94,.45); }
[data-theme="dark"] .av-slot { color: #6EE79B; }
.g-head { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3); border-radius: var(--radius-lg); background: var(--color-surface-2); margin-bottom: var(--space-4); }
.g-head b { display: block; font-size: var(--text-base); }
.g-head small { display: block; font-size: var(--text-xs); color: var(--color-text-muted); }
.g-days { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin-bottom: var(--space-3); }
.g-day { display: flex; flex-direction: column; align-items: center; padding: 8px 2px; border: 1px solid var(--color-border); border-radius: var(--radius-md); min-height: 64px; }
.g-day span { font-size: 10px; font-weight: 700; text-transform: uppercase; color: var(--color-text-muted); }
.g-day b { font-size: var(--text-lg); line-height: 1.2; }
.g-day small { font-size: 10px; color: #15803D; font-weight: 600; }
.g-day[aria-disabled="true"] { opacity: .5; }
.g-day[aria-disabled="true"] small { color: var(--color-text-faint); }
.g-day:hover { border-color: var(--accent); }
.g-day.active { border-color: var(--accent); background: var(--accent-lighter); box-shadow: inset 0 0 0 1px var(--accent); }
.g-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; margin-bottom: var(--space-3); }
.g-slot { height: 40px; border: 1px solid var(--color-border); border-radius: var(--radius-md); font-size: var(--text-sm); font-weight: 600; color: var(--accent); }
.g-slot:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.g-picked { display: flex; gap: var(--space-3); align-items: center; padding: var(--space-3); border-radius: var(--radius-md); background: var(--accent-lighter); margin: var(--space-2) 0 var(--space-4); font-size: var(--text-sm); }
.g-picked svg { width: 20px; height: 20px; color: var(--accent); flex-shrink: 0; }
.g-done { text-align: center; padding: var(--space-4) 0; }
.g-done > svg { width: 44px; height: 44px; padding: 10px; border-radius: 50%; background: rgba(34,197,94,.15); color: #16A34A; margin: 0 auto var(--space-3); }
.g-done h3 { font-size: var(--text-xl); margin-bottom: var(--space-2); }
.g-done p { font-size: var(--text-sm); color: var(--color-text-muted); margin: 0 auto var(--space-3); }
.demo-note { font-size: var(--text-xs) !important; padding: 6px 10px; border-radius: var(--radius-md); background: var(--color-surface-2); display: inline-block; }

/* ---------- Modal ---------- */
.modal-root { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; padding: var(--space-4); }
.modal-root[hidden] { display: none; }
.modal-scrim { position: absolute; inset: 0; background: rgba(10,10,12,.45); animation: fade 160ms ease; }
.modal { position: relative; width: 480px; max-width: 100%; max-height: calc(100dvh - var(--lab-bar-h, 0px) - 32px); margin-top: var(--lab-bar-h, 0px); display: flex; flex-direction: column; background: var(--color-surface); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); animation: pop 220ms var(--ease); overflow: hidden; }
.modal > form { display: flex; flex-direction: column; min-height: 0; flex: 1; }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
.md-editor, .md-settings { width: 560px; }
.md-search { width: 600px; align-self: flex-start; margin-top: calc(var(--lab-bar-h, 0px) + 8vh); }
.md-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); padding: var(--space-3) var(--space-3) var(--space-3) var(--space-5); border-bottom: 1px solid var(--color-border-light); flex-shrink: 0; }
.md-cal { display: flex; align-items: center; gap: 8px; font-size: var(--text-xs); font-weight: 700; color: var(--color-text-muted); }
.md-cal i { width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.md-body { padding: var(--space-5); overflow-y: auto; flex: 1; min-height: 0; }
.md-title { font-size: var(--text-2xl); font-weight: 700; letter-spacing: -0.02em; margin-bottom: var(--space-4); line-height: 1.2; }
.md-row { display: flex; gap: var(--space-3); padding: var(--space-2) 0; }
.md-row > svg { width: 18px; height: 18px; color: var(--color-text-muted); flex-shrink: 0; margin-top: 2px; }
.md-row > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; align-items: flex-start; }
.md-row b { font-size: var(--text-base); font-weight: 600; }
.md-row span { font-size: var(--text-sm); color: var(--color-text-muted); }
.md-row .quote { font-style: italic; }
.map { width: 100%; height: 110px; border-radius: var(--radius-md); overflow: hidden; margin: 6px 0; border: 1px solid var(--color-border-light); }
.map svg { width: 100%; height: 100%; }
.btn-row { display: flex; gap: var(--space-2); margin-top: 6px; flex-wrap: wrap; }
.people { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.person { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 3px; border-radius: 16px; background: var(--color-surface-2); font-size: var(--text-xs); font-weight: 600; color: var(--color-text) !important; }
.person i { width: 22px; height: 22px; border-radius: 50%; color: #fff; font-style: normal; font-size: 9px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.person em { font-style: normal; color: var(--color-text-faint); font-weight: 500; }
.md-divider { height: 1px; background: var(--color-border-light); margin: var(--space-3) 0 var(--space-4); }
.md-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 var(--space-3); }
.md-grid.three { grid-template-columns: 1.3fr 1fr 1fr; }
.md-foot { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-3) var(--space-5); border-top: 1px solid var(--color-border-light); background: var(--color-surface); flex-shrink: 0; flex-wrap: wrap; }
.settings .seg { max-width: 360px; }
.kbd-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; font-size: var(--text-xs); color: var(--color-text-muted); }
.kbd-list span { display: flex; align-items: center; gap: 4px; }
.search-box { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-2) var(--space-2) var(--space-4); border-bottom: 1px solid var(--color-border-light); }
.search-box > svg { width: 18px; height: 18px; color: var(--color-text-faint); flex-shrink: 0; }
.search-box .input { border: 0; box-shadow: none; height: 44px; font-size: var(--text-lg); padding: 0 4px; background: none; }
.search-results { overflow-y: auto; padding: var(--space-2) var(--space-3) var(--space-4); max-height: 60vh; }
.sr-group h4 { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--color-text-faint); padding: var(--space-3) var(--space-2) var(--space-2); }
.sr-group .chips { padding: 0 var(--space-2); }
.sr-item { display: flex; align-items: stretch; gap: var(--space-3); width: 100%; text-align: left; padding: 10px var(--space-2); border-radius: var(--radius-md); }
.sr-item:hover, .sr-item:focus-visible { background: var(--color-surface-2); }
.sr-item .bar { width: 4px; border-radius: 2px; flex-shrink: 0; }
.sr-item .grow { display: flex; flex-direction: column; }
.sr-item b { font-size: var(--text-sm); }
.sr-item b.strike { text-decoration: line-through; color: var(--color-text-faint); }
.sr-item small { font-size: var(--text-xs); color: var(--color-text-muted); }
.sheet-input { margin-bottom: var(--space-3); }

/* ---------- Toasts ---------- */
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: center; width: max-content; max-width: calc(100vw - 24px); pointer-events: none; }
.toast { display: flex; align-items: center; gap: 4px; padding: 6px 6px 6px 14px; min-height: 44px; border-radius: var(--radius-lg); background: #18181B; color: #F4F4F5; box-shadow: var(--shadow-lg); font-size: var(--text-sm); pointer-events: auto; animation: toastIn 220ms var(--ease); max-width: 100%; }
[data-theme="dark"] .toast { background: #F4F4F5; color: #18181B; }
.toast.out { opacity: 0; transform: translateY(6px); transition: opacity 300ms, transform 300ms; }
.toast-msg { flex: 1; min-width: 0; padding-right: 6px; }
.toast-btn { height: 32px; padding: 0 10px; border-radius: var(--radius-md); font-weight: 700; font-size: var(--text-sm); color: #FF8A93; white-space: nowrap; }
[data-theme="dark"] .toast-btn { color: var(--accent); }
.toast-btn:hover { background: rgba(255,255,255,.1); }
.toast-x { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-md); opacity: .6; flex-shrink: 0; }
.toast-x svg { width: 14px; height: 14px; }
.toast-x:hover { opacity: 1; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- Mobile nav & FAB ---------- */
.mobile-nav { display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: var(--color-surface); border-top: 1px solid var(--color-border); padding-bottom: env(safe-area-inset-bottom, 0); }
.mobile-nav-btn { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; height: var(--mnav-h); font-size: 10.5px; font-weight: 600; color: var(--color-text-muted); min-width: 0; }
.mobile-nav-btn.active { color: var(--accent); }
.mobile-fab { display: none; position: fixed; right: 16px; bottom: calc(var(--mnav-h) + 16px + env(safe-area-inset-bottom, 0px)); width: 56px; height: 56px; border-radius: 50%; background: var(--accent); color: #fff; align-items: center; justify-content: center; box-shadow: 0 8px 24px rgba(230,57,70,.4); z-index: 45; }
.mobile-fab:hover { background: var(--accent-hover); }
body[data-view="tasks"] .mobile-fab, body[data-view="openings"] .mobile-fab { display: none !important; }

/* ============================================================
   Responsive
   ============================================================ */
@media (min-width: 1600px) {
  :root { --sidebar-w: 280px; }
  .dy { grid-template-columns: minmax(0, 1fr) 380px; }
  .dy-scroll { padding-left: var(--space-8); padding-right: var(--space-8); }
  .wk-head, .wk-body { grid-template-columns: 64px repeat(var(--cols), minmax(0, 1fr)); }
}
@media (max-width: 1360px) {
  .op { grid-template-columns: 320px minmax(0, 1fr); }
  .op-guest { grid-column: 2; }
  .op-settings { grid-row: span 2; }
}
@media (max-width: 1180px) {
  .logo-text { display: none; }
  .tk { grid-template-columns: minmax(0, 1fr) 260px; }
}
@media (max-width: 1024px) {
  .sidebar { position: fixed; top: var(--lab-bar-h, 0px); left: 0; bottom: 0; z-index: 70; width: min(320px, 88vw); transform: translateX(-102%); transition: transform 240ms var(--ease); box-shadow: var(--shadow-lg); margin-left: 0 !important; opacity: 1 !important; pointer-events: auto !important; }
  .sidebar > .btn-primary { display: flex; }
  .sidebar { visibility: hidden; transition: transform 240ms var(--ease), visibility 0s linear 240ms; }
  .sidebar.open { transform: none; visibility: visible; transition: transform 240ms var(--ease); }
  .drawer-head { display: flex; align-items: center; justify-content: space-between; margin: -4px 0 var(--space-3); }
  .drawer-title { font-weight: 700; font-size: var(--text-lg); padding-left: var(--space-2); }
  .dy { grid-template-columns: minmax(0, 1fr); height: auto; }
  .dy-scroll, .dy-rail { min-width: 0; }
  .dy-summary.in-main { display: grid; }
  .dy-summary.in-rail { display: none; }
  .dy-scroll { overflow: visible; }
  .view-panel[data-panel="day"] { overflow-y: auto; }
  .dy-rail { border-left: 0; border-top: 1px solid var(--color-border); padding: var(--space-5); }
  .dy-rail .rail-card { max-width: 720px; }
  .tk { grid-template-columns: 1fr; }
  .tk-side { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--space-3); }
  .tk-side .rail-card { margin: 0; }
  .op { grid-template-columns: 1fr 1fr; }
  .op-settings { grid-row: auto; }
  .op-avail { grid-column: 1 / -1; grid-row: 1; }
  .op-guest { grid-column: auto; }
  .view-btn { padding: 0 9px; }
}
@media (max-width: 768px) {
  :root { --toolbar-h: 52px; }
  .app-shell { padding-bottom: calc(var(--mnav-h) + env(safe-area-inset-bottom, 0px)); }
  .top-bar { padding: 0 var(--space-2); gap: var(--space-2); }
  .view-switcher { display: none; }
  .mobile-nav { display: flex; }
  .mobile-fab { display: flex; }
  .toasts { bottom: calc(var(--mnav-h) + 16px); }
  .view-toolbar { padding: 0 var(--space-3); gap: var(--space-2); }
  .tb-title { font-size: var(--text-lg); }
  .tb-right .legend { display: none; }
  .op { grid-template-columns: 1fr; padding: var(--space-3); gap: var(--space-3); }
  .op-avail, .op-guest, .op-settings { grid-column: auto; grid-row: auto; }
  .op-settings { order: 1; } .op-avail { order: 2; } .op-guest { order: 3; }
  .tk { padding: var(--space-3) var(--space-3) var(--space-8); }
  .task-add { display: grid; grid-template-columns: 1fr 1fr; }
  .task-add .grow { grid-column: 1 / -1; }
  .task-add select.input { width: 100%; min-width: 0; }
  .task-add .btn { grid-column: 1 / -1; }
  .md-grid.three { grid-template-columns: 1fr 1fr; }
  .md-grid.three .field:first-child { grid-column: 1 / -1; }
  .hide-phone { display: none !important; }
  .drawer-links { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--space-2); margin-bottom: var(--space-4); }
  .drawer-link { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 64px; border-radius: var(--radius-lg); background: var(--color-surface-2); font-size: var(--text-xs); font-weight: 600; }
  .drawer-link svg { width: 20px; height: 20px; }
  .drawer-link:hover { color: var(--accent); }
  /* Touch targets */
  .icon-btn, .icon-btn.sm { width: 44px; height: 44px; }
  .btn, .btn.sm { height: 44px; }
  .input, .input.sm, select.input { height: 44px; font-size: 16px; }
  textarea.input { font-size: 16px; }
  .chip { height: 44px; padding: 0 14px; }
  .seg-btn { height: 40px; }
  .seg { padding: 2px; }
  .switch { width: 52px; height: 32px; border-radius: 16px; }
  .switch::after { width: 26px; height: 26px; }
  .switch.on::after { transform: translateX(20px); }
  .set-btn, .cal-item, .up-item { min-height: 44px; }
  .mini-nav button { width: 44px; height: 44px; }
  .side-add { width: 44px; height: 44px; }
  .swatch span { width: 32px; height: 32px; }
  .swatches { gap: 8px; }
  .task { min-height: 56px; }
  .task-check { width: 44px; height: 44px; border: 0; background: none !important; position: relative; margin: -8px -6px -8px -10px; }
  .task-check::before { content: ''; position: absolute; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--color-border); box-sizing: border-box; }
  .task.done .task-check::before { background: var(--accent); border-color: var(--accent); }
  .task-check svg { position: relative; z-index: 1; }
  .task-act { height: 44px; min-width: 44px; justify-content: center; }
  .quick-task .btn { width: 44px; }
  .task-act span { display: none; }
  .ticker-day { min-width: 46px; height: 48px; }
  .av-slot { height: 44px; }
  .g-slot { height: 44px; }
  .join { height: 32px; }
  .link-btn { min-height: 44px; }
  .mc-more, .mc-ev { min-height: 24px; }
  .nlp-ex-btn { min-height: 44px; }
  .toast-btn, .toast-x { height: 44px; min-width: 44px; }
  .toast { padding-left: 14px; }
  .md-foot .btn { flex: 1; }
  .md-foot .grow { display: none; }
}
@media (max-width: 640px) {
  :root { --topbar-h: 56px; --ticker-h: 56px; }
  .logo { display: none; }
  .nlp-bar { display: none; }
  .quick-pill { display: flex; flex: 1; min-width: 0; align-items: center; gap: var(--space-2); height: 44px; padding: 0 var(--space-3); border-radius: var(--radius-lg); background: var(--color-surface-2); border: 1px solid var(--color-border); color: var(--color-text-faint); font-size: var(--text-sm); text-align: left; }
  .quick-pill svg { color: var(--accent); flex-shrink: 0; }
  .quick-pill span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .sidebar { width: 100vw; }
  .mini-day { min-height: 44px; aspect-ratio: auto; border-radius: var(--radius-md); font-size: var(--text-sm); }
  .day-ticker { padding: 0 var(--space-2); }
  .dy-scroll { padding: var(--space-3) var(--space-3) var(--space-5); }
  .dy-summary.in-main { display: flex; overflow-x: auto; scrollbar-width: none; gap: 6px; margin: 0 calc(-1 * var(--space-3)) var(--space-3); padding: 0 var(--space-3); }
  .dy-summary::-webkit-scrollbar { display: none; }
  .dy-summary .stat { flex: 0 0 auto; min-width: 112px; max-width: 170px; padding: 8px 10px; }
  .stat-v { font-size: var(--text-base); }
  .dy-grid { grid-template-columns: 48px minmax(0, 1fr); }
  .dy-rail { padding: var(--space-3); }
  .modal-root { padding: 0; align-items: flex-end; }
  .modal, .md-editor, .md-settings, .md-search { width: 100%; max-height: calc(100dvh - var(--lab-bar-h, 0px) - 12px); border-radius: var(--radius-xl) var(--radius-xl) 0 0; margin: 0; animation: sheetUp 260ms var(--ease); }
  .md-search { align-self: flex-end; height: calc(100dvh - var(--lab-bar-h, 0px) - 12px); }
  .search-results { max-height: none; flex: 1; }
  @keyframes sheetUp { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
  .md-body { padding: var(--space-4); }
  .md-head { padding-left: var(--space-4); }
  .md-foot { padding: var(--space-3) var(--space-4) calc(var(--space-3) + env(safe-area-inset-bottom, 0px)); }
  .md-grid { grid-template-columns: 1fr; }
  .md-grid.three { grid-template-columns: 1fr 1fr; }
  .md-title { font-size: var(--text-xl); }
  .kbd-list { grid-template-columns: 1fr; }
  .nlp-actions { flex-direction: column-reverse; }
  .nlp-actions .btn { width: 100%; }
  .nlp-cal .input { flex: 1; min-width: 0; }
  .op-card { padding: var(--space-4); }
  .av-grid { grid-template-columns: 44px repeat(5, minmax(0, 1fr)); }
  .g-slots { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .view-toolbar { gap: 4px; }
  .tb-nav .btn { margin-left: 2px; padding: 0 10px; }
  .tb-sub { display: none; }
  .tk-side { grid-template-columns: 1fr; }
}
@media (max-width: 380px) {
  .tb-title { font-size: var(--text-base); }
  .mobile-nav-btn { font-size: 10px; }
  .g-days { gap: 4px; }
}
@media print { .lab-bar, .mobile-nav, .mobile-fab, .top-bar, .day-ticker { display: none !important; } }
