/* Domaselo admin — tokens (dark + light), base, glass, dock, panes, divider, drag, headers, shared controls.
   Spec § 1.4: these tokens are the only colours. App CSS (css/*.css) uses only its prefix + these tokens. */

/* ================= tokens: dark (the demo's look) ================= */
:root {
  color-scheme: dark;
  --bg: #1E1E1E;
  --bar: rgba(37, 37, 37, 0.72);
  --bar-solid: #252525;
  --card: rgba(118, 118, 128, 0.24);
  --fill: rgba(118, 118, 128, 0.24);
  --fill-strong: rgba(118, 118, 128, 0.36);
  --fill-subtle: rgba(118, 118, 128, 0.12);
  --sep: rgba(84, 84, 88, 0.65);
  --line: rgba(255, 255, 255, 0.08);
  --line2: rgba(255, 255, 255, 0.05);
  --edge: rgba(255, 255, 255, 0.22);
  --label: #FFFFFF;
  --label-2: rgba(235, 235, 245, 0.6);
  --label-3: rgba(235, 235, 245, 0.3);
  --label-4: rgba(235, 235, 245, 0.16);
  --accent: #FF4101;
  --accent-text: #FF4101;
  --green: #30D158; --red: #FF453A; --orange: #FF9F0A; --yellow: #FFD60A;
  --blue: #0A84FF; --purple: #BF5AF2; --indigo: #5E5CE6; --teal: #64D2FF; --pink: #FF375F; --gray: #8E8E93;
  --now-text: #30D158; --now-wash: rgba(48, 209, 88, 0.16);
  --mention-wash: rgba(255, 65, 1, 0.16);
  --glass-fill: linear-gradient(180deg, rgba(255,255,255,0.13) 0%, rgba(255,255,255,0.05) 46%, rgba(255,255,255,0.03) 100%), rgba(84, 84, 90, 0.30);
  --glass-rim: inset 0 0.5px 0 0 rgba(255,255,255,0.55), inset 0 -0.5px 0 0 rgba(255,255,255,0.14), inset 0 0 0 1px rgba(255,255,255,0.10);
  --glass-blur: blur(20px) saturate(180%);
  --glass-sheen: rgba(255, 255, 255, 0.20);
  --pop-fill: linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0.02)), rgba(40, 40, 44, 0.70);
  --pop-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  --glass-line: rgba(255, 255, 255, 0.16);
  --glass-track: rgba(255, 255, 255, 0.12);
  --icon: var(--label);
  --on-accent: #FFFFFF;
  --scrim: rgba(0, 0, 0, 0.45);
  --stripe: rgba(255, 255, 255, 0.10);
  --shimmer: rgba(255, 255, 255, 0.06);
  --ind: #FFFFFF; --ind-glow: rgba(255, 255, 255, 0.5);
  --select: rgba(255, 65, 1, 0.35);
  /* shell-internal tokens (both themes) */
  --thumb: rgba(255, 255, 255, 0.16);
  --thumb-rim: inset 0 0.5px 0 rgba(255,255,255,0.4), 0 1px 6px rgba(0,0,0,0.18);
  --hover: rgba(255, 255, 255, 0.10);
  --hover-subtle: rgba(255, 255, 255, 0.05);
  /* Sign in with Google (Google's branding: dark button) */
  --gsi-fill: #131314; --gsi-line: #8E918F; --gsi-text: #E3E3E3;

  /* Apple-like springs (audit 1.11: keep exactly) */
  --spring: cubic-bezier(0.32, 0.72, 0, 1);
  --spring-pop: cubic-bezier(0.34, 1.36, 0.64, 1);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Inter", system-ui, sans-serif;
}
/* ================= tokens: light (the iOS light palette) ================= */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #F2F2F7;
  --bar: rgba(249, 249, 249, 0.78);
  --bar-solid: #FFFFFF;
  --card: #FFFFFF;
  --fill: rgba(118, 118, 128, 0.12);
  --fill-strong: rgba(118, 118, 128, 0.20);
  --fill-subtle: rgba(118, 118, 128, 0.08);
  --sep: rgba(60, 60, 67, 0.29);
  --line: rgba(0, 0, 0, 0.10);
  --line2: rgba(0, 0, 0, 0.06);
  --edge: rgba(0, 0, 0, 0.12);
  --label: #000000;
  --label-2: rgba(60, 60, 67, 0.6);
  --label-3: rgba(60, 60, 67, 0.3);
  --label-4: rgba(60, 60, 67, 0.18);
  --accent-text: #E03A00;
  --green: #34C759; --red: #FF3B30; --orange: #FF9500; --yellow: #FFCC00;
  --blue: #007AFF; --purple: #AF52DE; --indigo: #5856D6; --teal: #30B0C7; --pink: #FF2D55; --gray: #8E8E93;
  --now-text: #248A3D; --now-wash: rgba(52, 199, 89, 0.16);
  --mention-wash: rgba(255, 65, 1, 0.12);
  --glass-fill: linear-gradient(180deg, rgba(255,255,255,0.75), rgba(255,255,255,0.55)), rgba(255, 255, 255, 0.40);
  --glass-rim: inset 0 0.5px 0 rgba(255,255,255,0.95), inset 0 -0.5px 0 rgba(0,0,0,0.06), inset 0 0 0 1px rgba(0,0,0,0.06);
  --glass-sheen: rgba(255, 255, 255, 0.55);
  --pop-fill: linear-gradient(180deg, rgba(255,255,255,0.92), rgba(255,255,255,0.82)), rgba(250, 250, 252, 0.80);
  --pop-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
  --glass-line: rgba(0, 0, 0, 0.11);
  --glass-track: rgba(0, 0, 0, 0.085);
  --scrim: rgba(0, 0, 0, 0.22);
  --stripe: rgba(0, 0, 0, 0.07);
  --shimmer: rgba(255, 255, 255, 0.65);
  --ind: #000000; --ind-glow: rgba(0, 0, 0, 0.18);
  --select: rgba(255, 65, 1, 0.22);
  --thumb: #FFFFFF;
  --thumb-rim: 0 1px 3px rgba(0,0,0,0.14), 0 0 0 0.5px rgba(0,0,0,0.05);
  --hover: rgba(0, 0, 0, 0.06);
  --hover-subtle: rgba(0, 0, 0, 0.035);
  --gsi-fill: #FFFFFF; --gsi-line: #747775; --gsi-text: #1F1F1F;
}

/* ================= avatar tints (AvatarTint → --tint-bg / --tint-fg) ================= */
[data-tint] { --tint-bg: rgba(118,118,128,0.24); --tint-fg: #FFFFFF; }
[data-tint="green"] { --tint-bg: rgba(48,209,88,0.18); --tint-fg: #30D158; }
[data-tint="blue"] { --tint-bg: rgba(10,132,255,0.22); --tint-fg: #409CFF; }
[data-tint="purple"] { --tint-bg: rgba(191,90,242,0.20); --tint-fg: #DA8FFF; }
[data-tint="teal"] { --tint-bg: rgba(100,210,255,0.18); --tint-fg: #64D2FF; }
[data-tint="orange"] { --tint-bg: rgba(255,65,1,0.18); --tint-fg: #FF4101; }
[data-tint="grey"] { --tint-bg: rgba(118,118,128,0.24); --tint-fg: #FFFFFF; }
[data-tint="pink"] { --tint-bg: rgba(255,55,95,0.20); --tint-fg: #FF6482; }
[data-tint="yellow"] { --tint-bg: rgba(255,214,10,0.18); --tint-fg: #FFD60A; }
[data-tint="indigo"] { --tint-bg: rgba(94,92,230,0.26); --tint-fg: #8E8BFF; }
[data-tint="me"] { --tint-bg: var(--accent); --tint-fg: var(--on-accent); }
:root[data-theme="light"] [data-tint] { --tint-bg: rgba(118,118,128,0.16); --tint-fg: #3C3C43; }
:root[data-theme="light"] [data-tint="green"] { --tint-bg: rgba(52,199,89,0.18); --tint-fg: #1E7B34; }
:root[data-theme="light"] [data-tint="blue"] { --tint-bg: rgba(0,122,255,0.14); --tint-fg: #0060C7; }
:root[data-theme="light"] [data-tint="purple"] { --tint-bg: rgba(175,82,222,0.16); --tint-fg: #8131B0; }
:root[data-theme="light"] [data-tint="teal"] { --tint-bg: rgba(48,176,199,0.16); --tint-fg: #0B7285; }
:root[data-theme="light"] [data-tint="orange"] { --tint-bg: rgba(255,65,1,0.14); --tint-fg: #D33500; }
:root[data-theme="light"] [data-tint="grey"] { --tint-bg: rgba(118,118,128,0.16); --tint-fg: #3C3C43; }
:root[data-theme="light"] [data-tint="pink"] { --tint-bg: rgba(255,45,85,0.14); --tint-fg: #C41E46; }
:root[data-theme="light"] [data-tint="yellow"] { --tint-bg: rgba(255,204,0,0.22); --tint-fg: #8A6500; }
:root[data-theme="light"] [data-tint="indigo"] { --tint-bg: rgba(88,86,214,0.15); --tint-fg: #4542B8; }
:root[data-theme="light"] [data-tint="me"] { --tint-bg: var(--accent); --tint-fg: var(--on-accent); }

/* ================= base ================= */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--label); font: 13px/1.35 var(--font); -webkit-font-smoothing: antialiased; overflow: hidden; }
body.hscroll { overflow-x: auto; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:disabled, button[aria-disabled="true"] { cursor: default; }
input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-text); }
svg { flex: none; }
::selection { background: var(--select); }
.num, .tab { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ell { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

#app { display: flex; height: 100%; transform-origin: 0 0; position: relative; }
body.dragging, body.dragging * { cursor: grabbing !important; user-select: none; -webkit-user-select: none; }

/* the scaled overlay roots (shell.js gives them the app's size and scale) */
#layer, #toasts { position: fixed; left: 0; top: 0; width: 100%; height: 100%; transform-origin: 0 0; pointer-events: none; }
#layer { z-index: 50; }
#toasts { z-index: 80; }
.lyr-sheets, .lyr-pop, .lyr-menus, .lyr-confirm, .lyr-drag { position: absolute; inset: 0; pointer-events: none; }
.lyr-scrim { position: absolute; inset: 0; pointer-events: auto; }
.lyr-scrim.dim { background: var(--scrim); }
.lyr-scrim.dim.enter { animation: fadeIn 260ms ease both; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* focus (audit 3.9) */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--accent); }

/* one scrollbar style for every scroller (audit 3.12) */
.scroll, .ch-msgs, .ch-list, .ts-scroll, .sc-scroll, .pf-body, .sheet-body, .menu { scrollbar-width: thin; scrollbar-color: var(--fill-strong) transparent; }
.scroll::-webkit-scrollbar, .ch-msgs::-webkit-scrollbar, .ch-list::-webkit-scrollbar, .ts-scroll::-webkit-scrollbar, .sc-scroll::-webkit-scrollbar, .pf-body::-webkit-scrollbar, .sheet-body::-webkit-scrollbar { width: 10px; height: 10px; }
.scroll::-webkit-scrollbar-thumb, .ch-msgs::-webkit-scrollbar-thumb, .ch-list::-webkit-scrollbar-thumb, .ts-scroll::-webkit-scrollbar-thumb, .sc-scroll::-webkit-scrollbar-thumb, .pf-body::-webkit-scrollbar-thumb, .sheet-body::-webkit-scrollbar-thumb { background: var(--fill-strong); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }

/* ================= glass primitives ================= */
.glass {
  position: relative;
  background: var(--glass-fill);
  box-shadow: var(--glass-rim);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  isolation: isolate;
}
.glass::after { /* specular sheen */
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(120% 70% at 22% -10%, var(--glass-sheen), transparent 55%);
  mix-blend-mode: screen; opacity: 0.9;
}
.press { transition: transform 420ms var(--spring), background-color 200ms ease, filter 200ms ease, opacity 200ms ease; }
.press:hover { filter: brightness(1.14); }
:root[data-theme="light"] .press:hover { filter: brightness(0.97); }
.press:active { transform: scale(0.95); transition-duration: 120ms; }
.press:disabled, .press[aria-disabled="true"] { filter: none; transform: none; }

/* ================= dock ================= */
.dock {
  position: relative; flex: none; width: 70px; height: 100%;
  background: var(--bar-solid);
  box-shadow: inset -1px 0 0 0 var(--edge);
  z-index: 5;
}
.dock-tile {
  position: absolute; left: 10px; width: 50px; height: 50px; border-radius: 12px;
  display: grid; place-items: center; color: var(--icon);
}
.dock-tile > svg { width: 26px; height: 26px; position: relative; z-index: 1; }
.dock-tile.lifted, .dock-tile[data-lifted] { opacity: 0.3; }
.dock-me .dock-ini {
  position: absolute; inset: 0; border-radius: inherit; display: grid; place-items: center;
  font-size: 17px; font-weight: 600; letter-spacing: 0.3px; background: var(--tint-bg); color: var(--tint-fg);
}
.dock-shield {
  position: absolute; right: -4px; bottom: -4px; z-index: 2; width: 19px; height: 19px; border-radius: 50%;
  display: grid; place-items: center; color: var(--on-accent); box-shadow: 0 0 0 2px var(--bar-solid);
}
.dock-shield svg { width: 11px; height: 11px; }
.dock-shield.admin { background: var(--accent); }
.dock-shield.owner { background: var(--purple); }
.dock .sep { position: absolute; left: 18px; top: 75px; width: 34px; height: 2px; border-radius: 1px; background: var(--label-4); }
.dock .ind {
  position: absolute; width: 3px; height: 16px; border-radius: 2px; background: var(--ind);
  transition: top 560ms var(--spring), opacity 260ms ease, transform 560ms var(--spring);
  box-shadow: 0 0 10px var(--ind-glow);
}
.dock .ind.l { left: 3px; }
.dock .ind.r { left: 64px; }
.dock-tile .tip {
  position: absolute; left: 62px; top: 50%; translate: 0 -50%; white-space: nowrap; z-index: 3;
  padding: 6px 10px; border-radius: 10px; font-size: 12px; font-weight: 600; color: var(--label);
  background: var(--pop-fill); box-shadow: var(--glass-rim); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  opacity: 0; scale: 0.9; transform-origin: left center; pointer-events: none;
  transition: opacity 180ms ease, scale 380ms var(--spring-pop);
}
.dock-tile .tip-kbd { margin-left: 8px; color: var(--label-2); font-weight: 500; }
.dock-tile:hover .tip, .dock-tile:focus-visible .tip { opacity: 1; scale: 1; transition-delay: 350ms; }
body.dragging .dock-tile .tip { opacity: 0; }

/* ================= panes ================= */
.panes { position: relative; flex: 1; display: flex; min-width: 0; }
.pane { position: relative; display: flex; flex-direction: column; min-width: 0; height: 100%; overflow: hidden; }
.pane.enter { animation: paneIn 520ms var(--spring) both; }
.pane.closing { opacity: 0.45; transition: opacity 200ms ease; }
@keyframes paneIn { from { opacity: 0; transform: scale(0.985) translateY(6px); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }
.split-div { position: relative; flex: none; width: 1px; background: var(--edge); z-index: 4; }
.split-div .handle {
  position: absolute; left: -4px; top: 50%; width: 9px; height: 48px; translate: 0 -50%; border-radius: 5px;
  cursor: col-resize; transition: height 420ms var(--spring), background 200ms;
}
.split-div .handle:hover, .split-div.drag .handle, .split-div .handle:focus-visible { height: 72px; }
.split-div .handle::before { content: ""; position: absolute; inset: 0 -14px; } /* a wider grip */
.pane-close {
  position: absolute; top: 5px; right: 5px; z-index: 6; width: 22px; height: 22px; border-radius: 11px;
  display: grid; place-items: center; color: var(--label-2); opacity: 0.75;
}
.pane-close svg { width: 10px; height: 10px; position: relative; z-index: 1; }
.pane-close:hover, .pane-close:focus-visible { opacity: 1; color: var(--label); }
.net-banner {
  position: absolute; top: 86px; left: 50%; translate: -50% 0; z-index: 4; padding: 8px 16px; border-radius: 18px;
  font-size: 13px; font-weight: 600; white-space: nowrap; animation: toastIn 560ms var(--spring-pop) both;
}

/* dragging an app in from the dock */
.drop-slot { flex: none; height: 100%; background: var(--fill); box-shadow: inset 0 0 0 1px var(--line); }
.drop-target {
  position: absolute; top: 0; bottom: 0; z-index: 6; pointer-events: none; opacity: 0;
  background: color-mix(in srgb, var(--label) 8%, transparent); box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--label) 35%, transparent);
  transition: left 300ms var(--spring), width 300ms var(--spring), opacity 200ms ease;
}
.drop-target.on { opacity: 1; }
.drop-target.blink { animation: dropBlink 500ms var(--ease-out); }
@keyframes dropBlink { 30% { background: color-mix(in srgb, var(--label) 28%, transparent); box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--label) 70%, transparent); } }
.drag-ghost {
  position: absolute; width: 54px; height: 54px; border-radius: 13px; display: grid; place-items: center; pointer-events: none; color: var(--icon);
  scale: 1.08; box-shadow: var(--glass-rim), var(--pop-shadow);
  transition: scale 250ms var(--spring-pop), opacity 250ms ease;
}
.drag-ghost svg { width: 52%; height: 52%; position: relative; z-index: 1; }
.drag-ghost.drop { scale: 0.6; opacity: 0; transition: left 300ms var(--ease-out), top 300ms var(--ease-out), scale 300ms var(--ease-out), opacity 300ms var(--ease-out); }
.drag-ghost.home {
  scale: 0.926; box-shadow: var(--glass-rim);
  transition: left 380ms cubic-bezier(0.25, 0.9, 0.3, 1), top 380ms cubic-bezier(0.25, 0.9, 0.3, 1), scale 380ms cubic-bezier(0.25, 0.9, 0.3, 1), box-shadow 380ms ease;
}
.drag-ghost.home.gone { opacity: 0; transition: opacity 160ms ease; }

/* a narrow pane: a tighter week picker so the header fits */
.pane.cmp .wk { padding: 0 4px; }
.pane.cmp .wk .arr { width: 28px; height: 28px; }
.pane.cmp .wk .d { width: 32px; }
.pane.cmp .hdr { gap: 10px; padding: 0 12px; }

/* ================= headers and scrollers ================= */
.hdr {
  position: absolute; left: 0; right: 0; top: 0; height: 76px; z-index: 3;
  display: flex; align-items: center; gap: 12px; padding: 0 16px;
  background: var(--bar);
  -webkit-backdrop-filter: blur(30px) saturate(180%); backdrop-filter: blur(30px) saturate(180%);
  box-shadow: inset 0 -1px 0 0 var(--edge);
}
.hdr .spacer { flex: 1; }
.hdr-title { margin: 0; font-size: 20px; font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scroll { position: absolute; inset: 0; overflow: auto; padding-top: 76px; scroll-padding-top: 76px; }
.title-block { display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.title-block .tb-1 { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.title-block .tb-2 { font-size: 12px; color: var(--label-2); margin-top: 1px; white-space: nowrap; }

/* ================= controls ================= */
.pill { height: 44px; border-radius: 22px; padding: 0 18px; display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; white-space: nowrap; flex: none; }
.pill.sm { height: 34px; border-radius: 17px; padding: 0 14px; font-size: 13px; }
.pill .chev { width: 11px; height: 11px; opacity: 0.6; position: relative; z-index: 1; }
.pill > span, .pill > svg { position: relative; z-index: 1; }
.loc-pill .pill-tx { max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.btn-primary { background: var(--accent); color: var(--on-accent); box-shadow: inset 0 0.5px 0 rgba(255,255,255,0.35); }
.btn-primary.muted, .btn-primary[aria-disabled="true"], .btn-primary:disabled { background: var(--fill); color: var(--label-2); box-shadow: none; cursor: default; }
.btn-primary.muted:active, .btn-primary:disabled:active { transform: none; }
.btn { height: 36px; border-radius: 18px; padding: 0 16px; font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn-sec { background: var(--fill); }
.btn-danger { background: color-mix(in srgb, var(--red) 16%, transparent); color: var(--red); }
.btn-danger.solid { background: var(--red); color: var(--on-accent); }
.today-pill { padding: 0 16px; }
.fchip { height: 28px; border-radius: 14px; padding: 0 8px 0 11px; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; background: var(--fill); flex: none; max-width: 160px; }
.fchip .fchip-tx { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fchip svg { width: 10px; height: 10px; color: var(--label-2); }
.fchip:hover { background: var(--fill-strong); }

.wk { height: 44px; border-radius: 22px; display: flex; align-items: center; padding: 0 6px; gap: 0; flex: none; }
.wk .arr { width: 32px; height: 32px; border-radius: 16px; display: grid; place-items: center; flex: none; color: var(--icon); }
.wk .arr svg { width: 13px; height: 13px; position: relative; z-index: 1; }
.wk .arr:disabled { opacity: 0.35; }
.wk .days { position: relative; display: flex; margin: 0 4px; }
.wk .d { position: relative; z-index: 1; width: 40px; height: 44px; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 12px; transition: color 200ms, background-color 200ms; }
.wk .d:hover { background: var(--hover-subtle); }
.wk .d .n { font-size: 10px; font-weight: 500; color: var(--label-2); line-height: 12px; }
.wk .d .dt { font-size: 15px; font-weight: 600; line-height: 18px; margin-top: 2px; }
.wk .d.today .dt { color: var(--accent-text); }
.wk .d.today::after { content: ""; position: absolute; bottom: 4px; left: 50%; width: 4px; height: 4px; margin-left: -2px; border-radius: 2px; background: var(--accent); }
.wk .thumb { position: absolute; top: 4px; height: 36px; width: 38px; border-radius: 12px; background: var(--thumb); box-shadow: var(--thumb-rim); }

.seg { position: relative; height: 44px; border-radius: 22px; display: flex; padding: 2px; flex: none; }
.seg button { position: relative; z-index: 1; height: 40px; border-radius: 20px; padding: 0 20px; font-size: 14px; font-weight: 600; color: var(--label-2); transition: color 240ms ease, background-color 200ms ease; }
.seg button:hover { color: var(--label); }
.seg button.on { color: var(--label); }
.seg .thumb { position: absolute; top: 2px; height: 40px; border-radius: 20px; background: var(--thumb); box-shadow: var(--thumb-rim); }
.seg.sm { height: 34px; border-radius: 17px; }
.seg.sm button { height: 30px; border-radius: 15px; padding: 0 14px; font-size: 13px; }
.seg.sm .thumb { height: 30px; border-radius: 15px; }

.round { width: 44px; height: 44px; border-radius: 22px; display: grid; place-items: center; flex: none; color: var(--icon); }
.round svg { width: 18px; height: 18px; position: relative; z-index: 1; }
.round.md { width: 34px; height: 34px; border-radius: 17px; }
.round.md svg { width: 15px; height: 15px; }
.round.sm { width: 30px; height: 30px; border-radius: 15px; background: var(--fill); }
.round.sm svg { width: 12px; height: 12px; }
.round.xs { width: 22px; height: 22px; border-radius: 11px; }
.round.xs svg { width: 10px; height: 10px; }

.mini { height: 26px; padding: 0 12px; border-radius: 13px; font-size: 11px; font-weight: 600; background: var(--fill); transition: background-color 200ms ease; }
.mini:hover { background: var(--fill-strong); }
.mini.pri { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent-text); }
.mini.pri:hover { background: color-mix(in srgb, var(--accent) 26%, transparent); }
.mini:disabled { opacity: 0.45; }
.link { color: var(--accent-text); font-weight: 600; }
.link:hover { text-decoration: underline; }
.chev-i { width: 12px; height: 12px; color: var(--label-2); transition: transform 420ms var(--spring); flex: none; }
.chev-i.open { transform: rotate(90deg); }
.collapse { display: grid; grid-template-rows: 1fr; transition: grid-template-rows 480ms var(--spring), opacity 300ms ease; }
.collapse > div { overflow: hidden; }
.collapse.shut { grid-template-rows: 0fr; opacity: 0; }
.live-dot { display: inline-block; width: 6px; height: 6px; border-radius: 3px; background: var(--green); margin-right: 6px; animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--green) 55%, transparent); } 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.st { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 500; }
.st i { width: 6px; height: 6px; border-radius: 3px; background: currentColor; }
.kbd { margin-left: auto; padding-left: 16px; color: var(--label-2); font-size: 12px; }

/* chips (toggle chips, e.g. "Repeat on") */
.chips { display: flex; gap: 4px; margin-top: 8px; flex-wrap: wrap; }
.chip { flex: 1; min-width: 34px; height: 30px; border-radius: 9px; font-size: 11px; font-weight: 600; color: var(--label-2); background: var(--fill); transition: background 220ms, color 220ms, box-shadow 220ms, transform 380ms var(--spring); }
.chip:hover { background: var(--fill-strong); }
.chip.on { color: var(--label); background: color-mix(in srgb, var(--accent) 22%, transparent); box-shadow: inset 0 0 0 1.5px var(--accent); }
.chip:active { transform: scale(0.9); }
.chip:disabled { opacity: 0.4; }

/* switch (iOS) */
.switch { position: relative; width: 51px; height: 31px; border-radius: 16px; background: var(--fill-strong); flex: none; transition: background-color 260ms ease; }
.switch .knob { position: absolute; left: 2px; top: 2px; width: 27px; height: 27px; border-radius: 50%; background: #FFFFFF; box-shadow: 0 3px 8px rgba(0,0,0,0.15), 0 1px 1px rgba(0,0,0,0.16); transition: transform 360ms var(--spring); }
.switch.on { background: var(--green); }
.switch.on .knob { transform: translateX(20px); }
.switch:disabled { opacity: 0.45; }

/* form fields */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: 13px; font-weight: 600; color: var(--label-2); }
.field-input {
  width: 100%; min-height: 40px; border-radius: 12px; border: 0; padding: 0 12px; font-size: 15px;
  background: var(--fill); color: var(--label); appearance: none; -webkit-appearance: none;
}
textarea.field-input { padding: 10px 12px; resize: none; line-height: 20px; }
.field-input::placeholder { color: var(--label-2); }
.field-input:disabled { opacity: 0.55; }
.field-input[aria-invalid="true"] { box-shadow: inset 0 0 0 1.5px var(--red); }
.select-wrap { position: relative; display: block; }
.select-wrap select { padding-right: 32px; cursor: pointer; }
.select-wrap .select-chev { position: absolute; right: 12px; top: 50%; width: 12px; height: 12px; margin-top: -6px; color: var(--label-2); pointer-events: none; }
.field-hint { font-size: 13px; color: var(--label-2); }
.field-hint.error { color: var(--red); }

/* avatars, badges, icon tiles */
.av { position: relative; flex: none; width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center; font-size: 11px; font-weight: 600; letter-spacing: 0.3px; background: var(--tint-bg, var(--fill)); color: var(--tint-fg, var(--label)); }
.av-16 { width: 16px; height: 16px; border-radius: 4px; font-size: 7px; }
.av-20 { width: 20px; height: 20px; border-radius: 5px; font-size: 8px; }
.av-36 { width: 36px; height: 36px; border-radius: 8px; font-size: 13px; }
.av-38 { width: 38px; height: 38px; border-radius: 9px; font-size: 14px; }
.av-40 { width: 40px; height: 40px; border-radius: 9.5px; font-size: 17px; }
.av-50 { width: 50px; height: 50px; border-radius: 12px; font-size: 18px; }
.av-76 { width: 76px; height: 76px; border-radius: 18px; font-size: 28px; }
.av.round { border-radius: 50%; }
.av-img { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: cover; border-radius: inherit; background: var(--fill); }
.av.has-photo { color: transparent; }
.av-shield { position: absolute; right: -5px; bottom: -5px; width: 19px; height: 19px; border-radius: 50%; display: grid; place-items: center; color: var(--on-accent); box-shadow: 0 0 0 2px var(--bg); }
.av-shield svg { width: 11px; height: 11px; }
.av-shield.admin { background: var(--accent); }
.av-shield.owner { background: var(--purple); }
.av-16 .av-shield, .av-20 .av-shield, .av-28 .av-shield { width: 13px; height: 13px; right: -4px; bottom: -4px; }
.av-16 .av-shield svg, .av-20 .av-shield svg, .av-28 .av-shield svg { width: 8px; height: 8px; }
.av-dot { position: absolute; right: -2px; bottom: -2px; width: 8px; height: 8px; border-radius: 4px; background: var(--green); box-shadow: 0 0 0 2px var(--bar-solid); }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: var(--on-accent); font-size: 12px; font-weight: 600; display: inline-grid; place-items: center; flex: none; font-variant-numeric: tabular-nums; }
.badge.green { background: var(--green); }
.badge.dot { min-width: 0; width: 8px; height: 8px; padding: 0; border-radius: 4px; }
.itile { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex: none; background: var(--c, var(--gray)); color: var(--on-accent); }
.itile svg { width: 18px; height: 18px; }
.itile-56 { width: 56px; height: 56px; border-radius: 14px; }
.itile-56 svg { width: 28px; height: 28px; }

/* ================= pops and menus ================= */
.pop {
  position: absolute; z-index: 60; border-radius: 18px; padding: 6px; pointer-events: auto; color: var(--label);
  background: var(--pop-fill); box-shadow: var(--glass-rim), var(--pop-shadow);
  -webkit-backdrop-filter: blur(40px) saturate(190%); backdrop-filter: blur(40px) saturate(190%);
  transform-origin: var(--ox, 50%) var(--oy, 0%);
}
.pop.enter { animation: popIn 460ms var(--spring-pop) both; }
@keyframes popIn { from { opacity: 0; transform: scale(0.86); filter: blur(10px); } 60% { filter: blur(0); } to { opacity: 1; transform: none; filter: none; } }
.pop.panel { padding: 16px; max-height: calc(100% - 24px); overflow: auto; }
.menu { min-width: 220px; max-width: 340px; max-height: calc(100% - 24px); overflow-y: auto; }
.pop .it { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 12px; font-size: 13px; text-align: left; transition: background 160ms; }
.pop .it:hover, .pop .it:focus-visible { background: var(--hover); outline: none; }
.pop .it:disabled { opacity: 0.4; }
.pop .it.danger { color: var(--red); }
.pop .it .it-ic { width: 18px; height: 18px; display: grid; place-items: center; flex: none; }
.pop .it .it-ic svg { width: 16px; height: 16px; }
.pop .it .it-tx { flex: 1; min-width: 0; }
.pop .it .ck { margin-left: auto; width: 14px; height: 14px; color: var(--accent-text); }
.pop .it .it-more { margin-left: auto; width: 11px; height: 11px; color: var(--label-2); }
.pop .it .sub { display: block; color: var(--label-2); font-size: 12px; margin-top: 1px; }
.pop .sep { height: 1px; margin: 4px 8px; background: var(--line); }
.pop .lbl { padding: 8px 12px 4px; font-size: 12px; color: var(--label-2); font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; }
.pop .lbl.menu-title { text-transform: none; letter-spacing: 0; font-size: 13px; }

/* ================= sheets ================= */
.sheet-wrap { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.sheet-wrap.anchored { display: block; }
.sheet {
  position: relative; pointer-events: auto; display: flex; flex-direction: column; overflow: hidden; color: var(--label);
  width: 480px; max-width: calc(100% - 32px); max-height: min(760px, calc(100% - 32px)); border-radius: 28px;
  background: var(--pop-fill); box-shadow: var(--glass-rim), var(--pop-shadow);
  -webkit-backdrop-filter: blur(40px) saturate(190%); backdrop-filter: blur(40px) saturate(190%);
  transform-origin: var(--ox, 50%) var(--oy, 50%);
}
.sheet-wrap.anchored .sheet { position: absolute; }
.sheet.enter { animation: popIn 460ms var(--spring-pop) both; }
.sheet.w-400 { width: 400px; } .sheet.w-480 { width: 480px; } .sheet.w-720 { width: 720px; } .sheet.w-860 { width: 860px; }
.sheet-page { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.sheet-page.slide-in { animation: pageIn 460ms var(--spring) both; }
.sheet-page.slide-back { animation: pageBack 460ms var(--spring) both; }
@keyframes pageIn { from { opacity: 0; transform: translateX(48px); } to { opacity: 1; transform: none; } }
@keyframes pageBack { from { opacity: 0; transform: translateX(-48px); } to { opacity: 1; transform: none; } }
.sheet-hdr { flex: none; display: flex; align-items: center; gap: 10px; padding: 14px 14px 8px; min-height: 58px; }
.sheet-hdr-pad { width: 30px; flex: none; }
.sheet-title { flex: 1; margin: 0; text-align: center; font-size: 17px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-hdr-r { display: flex; align-items: center; gap: 8px; flex: none; min-width: 30px; justify-content: flex-end; }
.sheet-body { flex: 1; min-height: 0; overflow: auto; padding: 4px 16px 20px; }

/* ================= confirm ================= */
.confirm {
  position: absolute; left: 50%; top: 50%; translate: -50% -50%; width: 320px; padding: 22px 20px 16px; border-radius: 22px; pointer-events: auto; text-align: center; color: var(--label);
  background: var(--pop-fill); box-shadow: var(--glass-rim), var(--pop-shadow);
  -webkit-backdrop-filter: blur(40px) saturate(190%); backdrop-filter: blur(40px) saturate(190%);
}
.confirm.enter { animation: popIn 460ms var(--spring-pop) both; }
.confirm-title { margin: 0; font-size: 17px; font-weight: 600; }
.confirm-msg { margin: 8px 0 0; font-size: 13px; line-height: 18px; color: var(--label-2); white-space: pre-line; }
.confirm-acts { display: flex; gap: 8px; margin-top: 18px; }
.confirm-acts .btn { flex: 1; }

/* ================= toast ================= */
.toast {
  position: absolute; left: 50%; bottom: 28px; translate: -50% 0; z-index: 80; padding: 12px 18px; border-radius: 22px; font-size: 13px; font-weight: 600;
  display: flex; align-items: center; gap: 10px; max-width: min(560px, calc(100% - 48px)); pointer-events: auto; color: var(--label);
  background: var(--pop-fill); box-shadow: var(--glass-rim), var(--pop-shadow); -webkit-backdrop-filter: blur(40px) saturate(190%); backdrop-filter: blur(40px) saturate(190%);
  animation: toastIn 560ms var(--spring-pop) both;
}
.toast .t-ic { width: 16px; height: 16px; flex: none; }
.toast.ok .t-ic { color: var(--green); }
.toast.error .t-ic { color: var(--red); }
.toast .t-act { color: var(--accent-text); font-weight: 600; margin-left: 4px; }
.toast.out { animation: toastOut 320ms var(--ease-out) both; }
@keyframes toastIn { from { opacity: 0; transform: translateY(24px) scale(0.92); filter: blur(8px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(12px) scale(0.96); filter: blur(6px); } }

/* ================= empty / loading / error ================= */
.empty { padding: 72px 24px; text-align: center; color: var(--label-2); font-size: 15px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty-ic { color: var(--label-2); }
.empty-ic svg { width: 30px; height: 30px; }
.empty-title { font-size: 17px; font-weight: 600; color: var(--label); }
.empty-body { max-width: 380px; line-height: 20px; }
.empty-acts { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; justify-content: center; }
.skel { padding: 8px 0; }
.skel-row { display: flex; align-items: center; gap: 12px; padding: 12px 18px; }
.skel-c { width: 36px; height: 36px; border-radius: 9px; background: var(--fill-subtle); flex: none; }
.skel-lines { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.skel-b { display: block; height: 12px; border-radius: 6px; background: var(--fill-subtle); }
.skel-b.sm { height: 10px; }
.skel-b.w30 { width: 30%; } .skel-b.w40 { width: 40%; } .skel-b.w50 { width: 50%; } .skel-b.w60 { width: 60%; } .skel-b.w70 { width: 70%; } .skel-b.w80 { width: 80%; } .skel-b.w90 { width: 90%; }
.skel-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; padding: 16px; }
.skel-cell { height: 56px; border-radius: 12px; background: var(--fill-subtle); }
.skel-card { display: flex; flex-direction: column; gap: 10px; padding: 18px; border-radius: 20px; background: var(--fill-subtle); margin-bottom: 12px; }
.skel-c, .skel-b, .skel-cell { background-image: linear-gradient(90deg, transparent 0%, var(--shimmer) 50%, transparent 100%); background-size: 200% 100%; background-repeat: no-repeat; animation: shimmer 1.4s ease-in-out infinite; }
@keyframes shimmer { from { background-position: 150% 0; } to { background-position: -50% 0; } }
.err { display: flex; align-items: center; gap: 10px; padding: 14px 18px; color: var(--label-2); font-size: 15px; }
.err-ic { color: var(--red); display: grid; place-items: center; }
.err-ic svg { width: 18px; height: 18px; }
.err .link { margin-left: auto; }

/* ================= placeholder app / phone gate ================= */
.app-placeholder { position: absolute; inset: 0; }
.phone-gate { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.phone-card { width: min(420px, 100%); border-radius: 28px; padding: 28px; display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; }
.phone-card > * { position: relative; z-index: 1; }
.phone-msg { margin: 0; font-size: 17px; line-height: 24px; font-weight: 600; }

/* ================= reduced motion ================= */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; transition-delay: 0ms !important; }
  .skel-c, .skel-b, .skel-cell { animation: none; background-image: none; }
}
