/* Expel Plan base styles (frontend-1): reset, app shell, tab bar, sidebar, shared components.
   Rules from iphone-look: no outlines, fills only, grouped lists, SF type, glass only on the floating bar. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0; background: var(--bg); color: var(--text); font: 400 var(--fs-body)/1.3 var(--font);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; -webkit-tap-highlight-color: transparent;
  min-height: 100vh; min-height: 100dvh;
}
h1, h2, h3, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; -webkit-user-select: none; user-select: none; touch-action: manipulation; }
button:disabled { cursor: default; }
input, textarea, select { font-size: 16px; }       /* 16 px: iOS never zooms the page on focus */
img { display: block; }
:focus { outline: none; }
:focus-visible { outline: 2px solid color-mix(in srgb, var(--accent) 70%, transparent); outline-offset: 2px; border-radius: 8px; }
[hidden] { display: none !important; }
.ico { display: inline-flex; flex: none; align-items: center; justify-content: center; }
.ico svg { display: block; }

/* ---- app shell -------------------------------------------------------------------------------------------------- */
.app { min-height: 100vh; min-height: 100dvh; }
.main {
  position: relative; min-height: 100vh; min-height: 100dvh;
  padding: calc(var(--safe-t) + 10px) calc(var(--safe-r) + var(--side)) calc(var(--safe-b) + var(--tab-h) + 48px) calc(var(--safe-l) + var(--side));
}
.view-host { width: 100%; margin: 0 auto; }
.view-host.view-in { animation: view-in var(--t-med) var(--ease-out) both; }
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.boot { position: fixed; inset: 0; display: grid; place-items: center; }
.boot-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--text-3); animation: boot 900ms ease-in-out infinite alternate; }
@keyframes boot { from { opacity: .25; transform: scale(.8); } to { opacity: 1; transform: scale(1); } }

.sidebar { display: none; }

/* ---- floating Liquid Glass tab bar (phone) --------------------------------------------------------------------- */
.tabbar {
  position: fixed; z-index: var(--z-tabbar); display: flex; padding: 4px 10px; border-radius: 999px;
  left: calc(var(--safe-l) + var(--side)); right: calc(var(--safe-r) + var(--side));
  bottom: max(12px, calc(var(--safe-b) - 13px)); height: var(--tab-h);
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(16px) saturate(160%); backdrop-filter: blur(16px) saturate(160%);
  box-shadow: var(--glass-rim);
}
.tab {
  position: relative; isolation: isolate; flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; min-height: 54px; border-radius: 999px; color: var(--tab-idle); font: 600 var(--fs-tab)/1 var(--font); letter-spacing: .01em;
  transition: color var(--t-fast) var(--ease-out), transform 100ms ease-out;
}
.tab:active { transform: scale(.95); }
.tab.active { color: var(--accent); }
.tab.active::before {
  content: ""; position: absolute; inset: 0 -4px; z-index: -1; border-radius: 999px; background: var(--glass-pill);
  animation: pill-in var(--t-med) var(--ease-out) both;
}
@keyframes pill-in { from { opacity: 0; transform: scale(.9); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-transparency: reduce) {
  .tabbar { background: var(--glass-solid); -webkit-backdrop-filter: none; backdrop-filter: none; }
}

/* scroll-edge fade behind the bar and under the status bar */
body::after {
  content: ""; position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-fade); pointer-events: none;
  height: calc(var(--safe-b) + 96px); background: linear-gradient(180deg, var(--fade-0), var(--fade-72) 45%, var(--bg) 80%);
}
body::before {
  content: ""; position: fixed; left: 0; right: 0; top: 0; z-index: var(--z-fade); pointer-events: none;
  height: calc(var(--safe-t) + 14px); background: linear-gradient(180deg, var(--bg) 0, var(--bg) calc(100% - 14px), var(--fade-0));
}
body.has-sheet::after, body.no-chrome::after { display: none; }
body.no-chrome .tabbar, body.no-chrome .sidebar { display: none; }

/* ---- desktop: quiet sidebar, centred column, room for the video panel ------------------------------------------ */
@media (min-width: 900px) {
  :root { --side: 32px; }
  .tabbar, body::after, body::before { display: none; }
  .sidebar {
    position: fixed; z-index: var(--z-tabbar); left: 0; top: 0; bottom: 0; width: var(--sidebar-w); display: flex; flex-direction: column;
    padding: 22px 14px 18px; gap: 18px; background: var(--bg);
  }
  .brand { display: flex; align-items: center; gap: 10px; padding: 0 10px; }
  .brand-mark { width: 30px; height: 30px; border-radius: 8px; }
  .brand-name { font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
  .side-nav { display: grid; gap: 2px; }
  .side-item {
    display: flex; align-items: center; gap: 11px; height: 40px; padding: 0 12px; border-radius: 12px; font-size: 15px; font-weight: 500;
    color: var(--text-2); transition: background var(--t-fast), color var(--t-fast);
  }
  .side-item:active { transform: scale(.98); }
  .side-item.active { background: var(--fill); color: var(--text); font-weight: 600; }
  .side-item.active .ico { color: var(--accent); }
  .side-foot { margin-top: auto; padding: 0 12px; }
  .side-name { font-size: 15px; font-weight: 600; }
  .side-role { font-size: 13px; color: var(--text-2); }
  .main { margin-left: var(--sidebar-w); padding: 28px var(--side) 56px; }
  .view-host { max-width: var(--col-w); }
  .view-host[data-view="plan"][data-mode="calendar"] { max-width: 1240px; }
}
@media (hover: hover) and (min-width: 900px) {
  .side-item:hover:not(.active) { background: var(--fill); }
}
@media (min-width: 1200px) {
  body.has-sheet .main { margin-right: var(--panel-w); }
}

/* ---- type -------------------------------------------------------------------------------------------------------- */
.large-title { font-size: var(--fs-title); font-weight: 700; letter-spacing: .012em; line-height: 1.12; }
.eyebrow { font-size: var(--fs-foot); font-weight: 600; letter-spacing: .02em; text-transform: uppercase; color: var(--text-2); }
.sec-title { font-size: var(--fs-section); font-weight: 700; letter-spacing: .016em; line-height: 1.2; }
.caps { font-size: var(--fs-foot); font-weight: 600; letter-spacing: .02em; text-transform: uppercase; color: var(--text-2); }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- buttons, pills, segmented control -------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 18px; border-radius: 999px;
  background: var(--fill); color: var(--text); font-size: var(--fs-sub); font-weight: 600;
  transition: transform 100ms ease-out, background var(--t-fast);
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.danger { color: var(--red); }
.pill {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 0 13px; border-radius: 999px;
  background: var(--round); box-shadow: var(--rim); color: var(--text); font-size: var(--fs-sub); font-weight: 600;
  transition: transform 100ms ease-out, opacity var(--t-fast);
}
.pill:active { transform: scale(.96); }
.pill.accent { color: var(--accent); }
.pill-group { display: inline-flex; align-items: center; background: var(--round); box-shadow: var(--rim); border-radius: 999px; padding: 0 3px; }
.pill-group .pill { background: none; box-shadow: none; min-width: 38px; padding: 0 9px; }
.pill-group .pill.on { color: var(--accent); }

.seg { position: relative; display: grid; grid-template-columns: repeat(var(--n, 2), 1fr); padding: 2px; border-radius: 999px; background: var(--fill); isolation: isolate; }
.seg::before {
  content: ""; position: absolute; z-index: -1; top: 2px; bottom: 2px; left: 2px; width: calc((100% - 4px) / var(--n, 2));
  border-radius: 999px; background: var(--seg-thumb); box-shadow: var(--seg-shadow);
  transform: translateX(calc(var(--i, 0) * 100%)); transition: transform var(--t-med) var(--ease-out);
}
.seg button { min-height: 32px; padding: 0 14px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; }
.seg button:not(.on) { color: var(--text); opacity: .72; }
.seg button.on { opacity: 1; }
.seg.seg-lg button { min-height: 36px; font-size: 15px; }
:root { --seg-thumb: #ffffff; --seg-shadow: 0 1px 3px rgba(0,0,0,.14), 0 0 0 .5px rgba(0,0,0,.04); }
@media (prefers-color-scheme: dark) { :root { --seg-thumb: #636366; --seg-shadow: 0 1px 3px rgba(0,0,0,.35); } }

/* ---- grouped lists (iOS Settings style) ---------------------------------------------------------------------- */
.group { background: var(--card); border-radius: var(--radius-card); overflow: hidden; box-shadow: var(--shadow-card); }
.group-title { padding: 0 6px 8px; }
.stack { display: grid; gap: var(--gap); }
.row { position: relative; display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 11px 16px; transition: background var(--t-fast); }
.row + .row::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; height: .5px; background: var(--sep); }
a.row, button.row, .row.tap { cursor: pointer; width: 100%; text-align: left; }
@media (hover: hover) { a.row:hover, button.row:hover, .row.tap:hover { background: var(--press); } }
a.row:active, button.row:active, .row.tap:active, .row.pressing { background: var(--press); }
.row-main { flex: 1 1 auto; min-width: 0; }
.row-title { font-size: var(--fs-body); line-height: 1.25; }
.row-sub { font-size: var(--fs-foot); color: var(--text-2); margin-top: 2px; }

/* ---- status dot, marker bar, glyphs ------------------------------------------------------------------------------ */
.dot { display: inline-block; flex: none; width: 8px; height: 8px; border-radius: 50%; }
.dot-none { background: var(--text-3); opacity: .6; }
.marker-bar { display: block; flex: none; width: 3px; border-radius: 2px; }
/* Marker colours are Axel's own (system colours, or whatever he picked). On white the bright ones wash out (yellow is 1.1:1
   to 2:1), so in light mode a bar is drawn 25% darker and marker-coloured text 45% darker. Callers set --m on the element
   (ui.js markerBar does; so does the Today block row); dark mode draws the raw colour. plan.css repeats these two rules. */
.marker-bar { background: var(--m, transparent); }
.marker-text { color: var(--m, var(--text)); }
@media (prefers-color-scheme: light) {
  .marker-bar { background: color-mix(in srgb, var(--m, transparent) 75%, #000); }
  .marker-text { color: color-mix(in srgb, var(--m, var(--text)) 55%, #000); }
}
.glyphs { display: inline-flex; align-items: center; gap: 7px; flex: none; color: var(--text-2); }
.glyph { display: inline-flex; align-items: center; justify-content: center; height: 16px; }
.glyph .ico { opacity: .85; }
.g-warn { color: var(--orange); }
.g-on { color: var(--text-2); }
.g-sponsor { color: var(--accent); font-size: 15px; font-weight: 700; line-height: 1; padding: 0 1px; }

/* ---- empty state ------------------------------------------------------------------------------------------------- */
.retry-state .btn { margin-top: 10px; min-width: 120px; }
.retry-state .btn:disabled { opacity: .6; }
/* the parked input that keeps the iPhone keyboard up while a new video's sheet opens (app.js primeKeyboard) */
.kb-prime { position: fixed; top: 0; left: 0; width: 1px; height: 1px; padding: 0; border: 0; margin: 0; opacity: 0; font-size: 16px; pointer-events: none; background: none; }
.empty { display: grid; justify-items: center; gap: 8px; padding: 56px 24px; text-align: center; }
.empty-title { font-size: var(--fs-section); font-weight: 700; }
.empty-sub { font-size: var(--fs-body); color: var(--text-2); max-width: 32ch; }
.signed-out { min-height: 100dvh; display: grid; align-content: center; justify-items: center; gap: 14px; padding: 32px; text-align: center; }
.signed-out .btn { min-width: 240px; }
.signed-out .brand-mark { border-radius: 18px; }

/* ---- toast ---------------------------------------------------------------------------------------------------------- */
.toasts { position: fixed; left: 0; right: 0; z-index: var(--z-toast); display: grid; justify-items: center; gap: 8px; pointer-events: none;
  bottom: calc(var(--safe-b) + var(--tab-h) + 28px); }
@media (min-width: 900px) { .toasts { bottom: 28px; } }
.toast {
  max-width: min(86vw, 420px); padding: 10px 16px; border-radius: 999px; font-size: 14px; font-weight: 600; text-align: center;
  background: var(--text); color: var(--bg);
  box-shadow: var(--shadow-pop); opacity: 0; transform: translateY(8px) scale(.97);
  transition: opacity var(--t-med) var(--ease-out), transform var(--t-med) var(--ease-out);
}
.toast.in { opacity: 1; transform: none; }
.toast-err { background-color: var(--red); color: #fff; }

/* ---- menu (popover) ------------------------------------------------------------------------------------------------ */
.menu-scrim { position: fixed; inset: 0; z-index: calc(var(--z-menu) - 1); }
.menu {
  position: fixed; z-index: var(--z-menu); min-width: 220px; max-width: min(320px, calc(100vw - 20px)); padding: 6px; border-radius: 22px;
  background: var(--card); box-shadow: var(--shadow-pop); opacity: 0; transform: scale(.94); transition: opacity 140ms var(--ease-out), transform 140ms var(--ease-out);
  max-height: calc(100dvh - 24px); overflow: auto;
}
@media (prefers-color-scheme: dark) { .menu { background: #2c2c2e; } }
.menu.in { opacity: 1; transform: none; }
.menu-item { display: flex; align-items: center; justify-content: space-between; gap: 14px; width: 100%; min-height: 44px; padding: 0 14px; border-radius: 16px; text-align: left; font-size: 17px; }
.menu-item:active { background: var(--press); }
@media (hover: hover) { .menu-item:hover:not(:disabled) { background: var(--press); } }
.menu-item:disabled { opacity: .4; }
.menu-item.danger { color: var(--red); }
.menu-item .ico { color: var(--text-2); }
.menu-item.danger .ico { color: var(--red); }
.menu-item.checked .menu-check { color: var(--accent); }
.menu-sep { height: .5px; margin: 6px 14px; background: var(--sep); }
.menu-head { padding: 8px 14px 4px; font-size: 13px; font-weight: 600; color: var(--text-2); }

/* ---- overlays: confirm sheet and date picker ----------------------------------------------------------------------- */
.ov { position: fixed; inset: 0; z-index: var(--z-modal); display: grid; align-items: end; justify-items: center; padding: 0 calc(var(--safe-r) + 10px) calc(var(--safe-b) + 10px) calc(var(--safe-l) + 10px); }
.ov-scrim { position: absolute; inset: 0; background: var(--scrim); opacity: 0; transition: opacity var(--t-sheet) var(--ease-out); }
.ov.in .ov-scrim { opacity: 1; }
.ov-panel { position: relative; width: 100%; max-width: 420px; display: grid; gap: 8px; transform: translateY(calc(100% + 24px)); transition: transform var(--t-sheet) var(--ease-out); }
.ov.in .ov-panel { transform: none; }
.ov-group { background: var(--card); border-radius: 26px; overflow: hidden; }
@media (prefers-color-scheme: dark) { .ov-group { background: #2c2c2e; } }
.ov-head { padding: 18px 20px 14px; text-align: center; }
.ov-title { font-size: 15px; font-weight: 600; }
.ov-msg { margin-top: 4px; font-size: 13px; color: var(--text-2); }
.ov-btn { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 56px; font-size: 20px; position: relative; }
.ov-btn + .ov-btn::before, .ov-head + .ov-btn::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: .5px; background: var(--sep); }
.ov-btn.primary { color: var(--accent); font-weight: 600; }
.ov-btn.danger { color: var(--red); }
.ov-btn.bold { font-weight: 600; }
.ov-btn:active { background: var(--press); }
@media (min-width: 600px) {
  .ov { align-items: center; padding-bottom: 10px; }
  .ov-panel { transform: scale(.96) translateY(8px); opacity: 0; transition: transform var(--t-med) var(--ease-out), opacity var(--t-med) var(--ease-out); max-width: 360px; }
  .ov.in .ov-panel { transform: none; opacity: 1; }
  .ov-btn { min-height: 48px; font-size: 17px; }
}
.dp { padding: 8px 8px 4px; }
.dp-head { padding: 8px 8px 4px; }
.dp-title { font-size: 13px; font-weight: 600; color: var(--text-2); text-align: center; margin-bottom: 6px; }
.dp-nav { display: flex; align-items: center; justify-content: space-between; }
.dp-month { font-size: 17px; font-weight: 700; padding-left: 4px; }
.dp-arrows { display: flex; gap: 2px; }
.dp-arrow { width: 40px; height: 40px; border-radius: 50%; color: var(--accent); display: grid; place-items: center; }
.dp-arrow:active { background: var(--press); }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); row-gap: 2px; padding: 4px 4px 8px; }
.dp-dow { text-align: center; font-size: 12px; font-weight: 600; color: var(--text-2); padding: 6px 0; }
.dp-day { height: 44px; display: grid; place-items: center; font-size: 19px; border-radius: 50%; position: relative; }
.dp-day span { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; transition: background var(--t-fast), color var(--t-fast), transform 100ms; }
.dp-day.out { color: var(--text-3); }
.dp-day.today { color: var(--accent); font-weight: 700; }
.dp-day.sel span, .dp-day.picked span { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.dp-day:active span { transform: scale(.92); }
.dp-day:disabled { opacity: .3; }
@media (hover: hover) { .dp-day:hover:not(:disabled):not(.sel) span { background: var(--press); } }
.dp-today { min-height: 44px; font-size: 15px; font-weight: 600; color: var(--accent); }
.dp-today::before { display: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
