/* Nayo Hub
   Rules this file follows:
   - Every colour, radius, shadow, type size, space and duration comes from a token in :root (named by what it is for).
   - No one-sided colour stripes, no gradients, no glow, no decorative motion. Frosted glass only on floating bars.
   - The logo is a lemon switch: on is light mode, off is dark mode. Dark mode only swaps tokens.
   - Colour comes from bright flat page headers (one per page), status tints and the pictures themselves. */

:root {
  /* Colour: surfaces and text (neutrals are tinted toward slate, never pure white or black) */
  --page: #F5F6F3;
  --surface: #FFFFFF;
  --surface-sunken: #E8EDEC;
  --text: #1C1E21;
  --text-muted: #5F6368;
  --text-on-dark: #F2F5F9;
  --text-muted-on-dark: #BAC3D4;
  --line: #D9E0E4;
  --line-subtle: #E6EBEE;

  /* Colour: brand and identity */
  --primary: #1771E6;
  --primary-hover: #1060C9;
  --primary-tint: #E7F0FD;
  --on-primary: #FAFCFF;
  --avatar-neutral: #65676B; --designer-solid: #0B7A8C; --logo-ink: #0A0A0B;
  --brand-on: #FFE45C; --brand-off: #EEEDEA; --brand-knob: #FFFFFF;
  --select-solid: #2D6AD6;

  /* Colour: bright page headers, one per page, the same in light and dark */
  --tint-blue: #6EA8FF;
  --tint-green: #8CE563;
  --tint-peach: #FF9C70;
  --tint-yellow: #FFE45C;
  --tint-aqua: #45E0CF;
  --tint-sky: #74D3FF;
  --on-tint: #0A0A0B;
  
  /* Colour: status (functional, each with a tint and a readable text colour) */
  --ok-solid: #1E7D5A;   --ok-tint: #D9F1E4;     --ok-text: #14664A;     --ok-dot: #2E9E73;
  --warn-tint: #FDF0B0;  --warn-text: #6B5200;   --warn-dot: #F5C400;
  --post-solid: #1771E6; --post-tint: #DCEAFD;    --post-text: #0F5BC0;
  --danger-solid: #B23A31; --danger-tint: #FAE0DC; --danger-text: #A02F27; --danger-dot: #DB5C52;
  --info-tint: #DDE9F8;  --info-text: #1161CC;   --info-dot: #3F8CF0;

  /* Type: sizes are small on purpose so nothing piles up on a phone */
  --font-head: 'Poppins', system-ui, sans-serif;
  --font-sub: 'Poppins', system-ui, sans-serif;
  --track-sub: 0.12em;
  --font-body: 'Poppins', system-ui, sans-serif;
  --fs-xs: 0.75rem; --fs-sm: 0.85rem; --fs-base: 1rem; --fs-md: 1.1rem; --fs-lg: 1.3rem; --fs-xl: 1.6rem; --fs-logo-xl: 2.6rem;
  --lh-tight: 1.15; --lh-body: 1.5;

  /* Space */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px; --s-6: 32px; --s-7: 48px;

  /* Shape */
  --r-input: 6px; --r-card: 10px; --r-modal: 14px; --r-round: 22px; --r-badge: 999px;

  /* Elevation: one subtle shadow, only for things that float */
  --elev: 0 2px 10px rgb(28 30 33 / 0.14);
  --glass: rgb(255 255 255 / 0.66); --glass-edge: rgb(255 255 255 / 0.8); --frost: blur(18px) saturate(180%);
  --glass-sheet: rgb(255 255 255 / 0.68); --glass-card: rgb(255 255 255 / 0.6);

  /* Motion */
  --t-base: 200ms; --ease: cubic-bezier(0.2, 0, 0, 1);

  /* Sizes that components share */
  --tap: 40px; --tap-sm: 32px; --tabbar: 58px; --topbar-h: 50px; --safe: env(safe-area-inset-bottom, 0px);
  --measure: 68ch; --card-h: 136px; --card-img-w: 118px;
}

/* Dark mode: the switch is off. Black page, soft white pills, lemon yellow for actions. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0A0A0B; --surface: #161719; --surface-sunken: #222427;
  --text: #F1F1EC; --text-muted: #A8ADB6; --line: #34373C; --line-subtle: #27292D;
  --primary: #FFE45C; --primary-hover: #F2D438; --primary-tint: #2A2C31; --on-primary: #121212;
  --ok-tint: #143527; --ok-text: #7FD9AF; --warn-tint: #3D330A; --warn-text: #FFE45C;
  --post-solid: #2F86FF; --post-tint: #10294D; --post-text: #9CC5FF;
  --danger-tint: #3D1D1A; --danger-text: #FF9F96; --info-tint: #17283F; --info-text: #9CC2F7;
  --elev: 0 2px 10px rgb(0 0 0 / 0.6);
  --glass: rgb(22 23 26 / 0.62); --glass-edge: rgb(255 255 255 / 0.14);
  --glass-sheet: rgb(24 25 28 / 0.66); --glass-card: rgb(255 255 255 / 0.07);
  --logo-ink: #F1F1EC;
}

*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; font-size: 14px; }
body { margin: 0; font-family: var(--font-body); font-size: var(--fs-base); line-height: var(--lh-body); font-weight: 400; color: var(--text); background: var(--page); }
body.sheet-open { overflow: hidden; }
body.is-dragging { user-select: none; -webkit-user-select: none; cursor: grabbing; }
h1, h2, h3, h4, p, ul, ol { margin: 0; }
h1, h2, h3, h4 { font-family: var(--font-head); letter-spacing: -0.01em; text-wrap: balance; }
h1 { font-size: var(--fs-xl); line-height: var(--lh-tight); font-weight: 700; }
h2 { font-size: var(--fs-md); line-height: 1.25; font-weight: 600; }
h3 { font-size: var(--fs-base); line-height: 1.3; font-weight: 500; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
[hidden] { display: none !important; }
.muted { color: var(--text-muted); } .small { font-size: var(--fs-sm); } .center-text { text-align: center; } .pad { padding: var(--s-5); } .pad-sm { padding: var(--s-3) 0; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: var(--s-3); top: -100px; z-index: 500; padding: var(--s-2) var(--s-4); background: var(--primary); color: var(--on-primary); border-radius: var(--r-input); }
.skip:focus { top: var(--s-3); }
.ico { display: inline-flex; vertical-align: middle; flex: none; }
.row { display: flex; align-items: center; } .row.wrap { flex-wrap: wrap; } .row.gap { gap: var(--s-3); } .row.center { align-items: center; }
.sp { flex: 1; } .push-right { margin-left: auto; }

/* ---------- Logo: NAY, a lemon switch as the stretched O, then HUB ---------- */
.brand { display: inline-flex; align-items: center; gap: 0.12em; flex: none; min-height: var(--tap); padding: 0; border: 0; background: none; color: var(--logo-ink); font-family: var(--font-head); font-weight: 800; font-size: var(--fs-xl); letter-spacing: -0.01em; line-height: 1; white-space: nowrap; }
.brand-o { position: relative; width: 1.7em; height: 0.92em; flex: none; border-radius: var(--r-badge); background: var(--brand-off); }
.brand-knob { position: absolute; left: 0.05em; top: 0.05em; width: 0.82em; height: 0.82em; display: grid; place-items: center; border-radius: 50%; transition: transform var(--t-base) var(--ease); }
.brand-knob img { width: 100%; height: 100%; display: block; pointer-events: none; }
.brand[aria-checked="true"] .brand-knob img { width: 90%; height: 90%; }
.brand[aria-checked="true"] .brand-o { background: var(--brand-on); }
.brand[aria-checked="true"] .brand-knob { transform: translateX(0.78em); background: var(--brand-knob); }
.brand.xl { font-size: var(--fs-logo-xl); justify-self: center; }

/* ---------- Buttons and fields ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2); min-height: var(--tap); padding: 0 var(--s-3); border-radius: var(--r-input); border: 1px solid var(--line); background: var(--surface); color: var(--text); font-weight: 600; font-size: var(--fs-sm); text-decoration: none; line-height: 1.2; white-space: nowrap; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.btn.green { background: var(--ok-solid); color: var(--text-on-dark); border-color: var(--ok-solid); }
.btn.coral { background: var(--surface); color: var(--danger-text); border-color: var(--danger-dot); }
.btn.danger { background: var(--danger-solid); color: var(--text-on-dark); border-color: var(--danger-solid); }
.btn.danger-o { color: var(--danger-text); border-color: var(--danger-dot); }
.btn.small { min-height: var(--tap-sm); padding: 0 var(--s-3); }
.btn.wide { width: 100%; } .btn.big { min-height: 46px; font-size: var(--fs-base); }
.textbtn { display: inline-flex; align-items: center; gap: var(--s-2); border: 0; background: none; padding: var(--s-2) 0; color: var(--info-text); font-weight: 600; font-size: var(--fs-sm); }
.icon-btn { position: relative; display: inline-grid; place-items: center; width: var(--tap); height: var(--tap); border-radius: var(--r-input); border: 0; background: transparent; }
.icon-btn.small { width: var(--tap-sm); height: var(--tap-sm); }
.linkish { background: none; border: 0; color: var(--text-muted); text-decoration: underline; padding: var(--s-3); margin: var(--s-2) auto 0; display: block; font-size: var(--fs-sm); }
@media (hover: hover) {
  .btn:hover { background: var(--primary-tint); }
  .btn.primary:hover { background: var(--primary-hover); }
  .btn.green:hover, .btn.danger:hover { filter: brightness(0.93); }
  .icon-btn:hover, .avatar-btn:hover { background: var(--primary-tint); }
  .linkish:hover, .textbtn:hover { color: var(--text); }
}
.field { display: grid; gap: var(--s-2); margin-bottom: var(--s-4); }
.field > span { font-size: var(--fs-sm); font-weight: 500; color: var(--text-muted); }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=datetime-local], select, textarea {
  width: 100%; min-height: var(--tap); padding: var(--s-2) var(--s-3); border: 1px solid var(--line); border-radius: var(--r-input); background: var(--surface); outline: none; font-size: var(--fs-sm); }
textarea { resize: vertical; line-height: 1.45; max-width: var(--measure); }
input:hover, select:hover, textarea:hover { border-color: var(--text-muted); }
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--primary); outline: 2px solid var(--primary); outline-offset: 0; }
textarea:disabled, input:disabled { background: var(--surface-sunken); color: var(--text-muted); cursor: not-allowed; }
::placeholder { color: var(--text-muted); opacity: 0.85; }
select.sel { width: auto; min-height: var(--tap-sm); }
.form-error { color: var(--danger-text); font-weight: 500; min-height: 1.2em; margin-bottom: var(--s-3); font-size: var(--fs-sm); }
.seg { display: inline-flex; padding: 3px; background: var(--surface); border-radius: var(--r-input); gap: 2px; }
.seg button { border: 0; background: transparent; min-height: 28px; padding: 0 var(--s-3); border-radius: 4px; font-weight: 500; font-size: var(--fs-sm); color: var(--text-muted); white-space: nowrap; }
.seg button.on { background: var(--primary); color: var(--on-primary); font-weight: 600; }
.seg button:disabled { opacity: 0.5; cursor: not-allowed; }
@media (hover: hover) { .seg button:not(.on):not(:disabled):hover { color: var(--text); background: var(--primary-tint); } }

/* ---------- Status ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 1px 9px 1px 7px; border-radius: var(--r-badge); font-size: var(--fs-xs); font-weight: 600; white-space: nowrap; }
.pill .dot { width: 7px; height: 7px; border-radius: 50%; }
.st-draft { background: var(--surface-sunken); color: var(--text-muted); } .st-draft .dot, .dot.st-draft { background: var(--text-muted); }
.st-posted { background: var(--post-tint); color: var(--post-text); } .st-posted .dot, .dot.st-posted { background: var(--post-solid); }
.st-waiting { background: var(--warn-tint); color: var(--warn-text); } .st-waiting .dot, .dot.st-waiting { background: var(--warn-dot); }
.st-changes { background: var(--danger-tint); color: var(--danger-text); } .st-changes .dot, .dot.st-changes { background: var(--danger-dot); }
.st-approved { background: var(--ok-tint); color: var(--ok-text); } .st-approved .dot, .dot.st-approved { background: var(--ok-dot); }
.st-locked { background: var(--surface-sunken); color: var(--text-muted); }
i.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; display: inline-block; }
.tag { font-style: normal; font-size: 0.68rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; padding: 1px 6px; border-radius: 4px; background: var(--surface-sunken); color: var(--text-muted); }
.count { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: var(--s-2); border-radius: var(--r-badge); background: var(--surface-sunken); font-size: var(--fs-xs); font-weight: 600; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.nbadge { position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: var(--r-badge); background: var(--primary); color: var(--on-primary); font: 600 0.68rem/16px var(--font-body); text-align: center; font-style: normal; }
.avatar { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; font-family: var(--font-head); font-weight: 700; font-size: var(--fs-sm); color: var(--text-on-dark); background: var(--avatar-neutral); flex: none; }
.avatar.sm { width: 26px; height: 26px; font-size: var(--fs-xs); } .avatar.lg { width: 48px; height: 48px; font-size: var(--fs-lg); }
.avatar.r-admin, .avatar.r-coordinator { background: var(--primary); color: var(--on-primary); } .avatar.r-manager { background: var(--ok-solid); } .avatar.r-designer { background: var(--designer-solid); }
.avatar-btn { border: 0; background: none; padding: var(--s-1); border-radius: 50%; }
.empty-state { padding: var(--s-6) var(--s-2); color: var(--text-muted); max-width: 44ch; font-size: var(--fs-sm); }
.empty-state strong { display: block; font-family: var(--font-head); font-size: var(--fs-md); font-weight: 600; color: var(--text); margin-bottom: var(--s-1); }
.empty-state .btn, .empty-state .row { margin-top: var(--s-4); }

/* ---------- Sign in and loading ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: var(--s-4); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-modal); padding: var(--s-6) var(--s-5) var(--s-5); display: grid; gap: var(--s-4); }
.auth-form { margin-top: var(--s-2); }
.demo-box { margin-top: var(--s-2); padding-top: var(--s-4); border-top: 1px solid var(--line-subtle); }
.demo-btns { display: grid; gap: var(--s-2); margin-top: var(--s-3); }
.boot { padding: var(--s-5) var(--s-4); display: grid; gap: var(--s-4); max-width: 520px; margin: 0 auto; }
.boot i { display: block; height: 18px; border-radius: var(--r-input); background: var(--surface-sunken); } .boot i.w1 { width: 40%; height: 26px; } .boot i.w2 { width: 90%; height: 84px; } .boot i.w3 { width: 70%; }

/* ---------- Shell: phone first ---------- */
.shell { min-height: 100vh; padding-bottom: calc(var(--tabbar) + var(--safe) + 84px); }
.sidebar { display: none; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: var(--s-1) var(--s-2) var(--s-1) var(--s-4); background: var(--surface); border-bottom: 1px solid var(--line); min-height: var(--topbar-h); }
.top-title { display: none; font-family: var(--font-head); font-weight: 600; color: var(--text-muted); }
.demo-strip { text-align: center; background: var(--surface-sunken); color: var(--text-muted); font-size: var(--fs-xs); font-weight: 500; padding: 2px var(--s-3); }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: flex; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: var(--safe); }
.tab { position: relative; flex: 1; display: grid; justify-items: center; align-content: center; gap: 1px; min-height: var(--tabbar); text-decoration: none; color: var(--text-muted); font-size: var(--fs-xs); font-weight: 500; }
.tab .ico { padding: 2px 14px; border-radius: var(--r-input); }
.tab.on { color: var(--text); font-weight: 600; } .tab.on .ico { background: var(--primary-tint); }
.tab .nbadge { top: 5px; right: calc(50% - 24px); }
@media (hover: hover) { .tab:not(.on):hover { color: var(--text); } }
.fab { position: fixed; right: var(--s-4); bottom: calc(var(--tabbar) + var(--safe) + var(--s-3)); z-index: 45; display: grid; place-items: center; width: 52px; height: 52px; padding: 0; border: 0; border-radius: var(--r-card); background: var(--primary); color: var(--on-primary); box-shadow: var(--elev); }
.fab:active { transform: translateY(1px); }
@media (hover: hover) { .fab:hover { background: var(--primary-hover); } }
.view-pad { padding: var(--s-4) var(--s-4) var(--s-5); max-width: 1100px; margin: 0 auto; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-3) var(--s-4); margin-bottom: var(--s-4); }
.chips { display: flex; gap: var(--s-2); overflow-x: auto; padding: 2px 0 var(--s-1); scrollbar-width: none; max-width: 100%; margin-bottom: var(--s-3); }
.chips::-webkit-scrollbar { display: none; }
.chip-filter { flex: none; display: inline-flex; align-items: center; min-height: var(--tap-sm); padding: 0 var(--s-3); border-radius: var(--r-input); border: 1px solid var(--line); background: var(--surface); font-weight: 500; font-size: var(--fs-sm); color: var(--text-muted); white-space: nowrap; }
.chip-filter.on { background: var(--primary); color: var(--on-primary); border-color: var(--primary); font-weight: 600; } .chip-filter.on .count { background: var(--primary-hover); color: var(--on-primary); }
@media (hover: hover) { .chip-filter:not(.on):hover { background: var(--primary-tint); color: var(--text); } }

/* ---------- Soft coloured page headers ---------- */
.band { padding: var(--s-4) var(--s-4) var(--s-5); border-radius: 0 0 var(--r-round) var(--r-round); background: var(--tint, var(--tint-sky)); }
.band-in { max-width: 1100px; margin: 0 auto; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-3); }
.band-title { font-size: var(--fs-xl); }
.band-controls { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
.tone-blue { --tint: var(--tint-blue); } .tone-green { --tint: var(--tint-green); } .tone-peach { --tint: var(--tint-peach); }
.tone-yellow { --tint: var(--tint-yellow); } .tone-aqua { --tint: var(--tint-aqua); } .tone-sky { --tint: var(--tint-sky); }
.period-btn { display: inline-flex; align-items: center; gap: var(--s-2); min-height: var(--tap-sm); padding: 0 var(--s-3); border: 0; border-radius: var(--r-input); background: var(--surface); font-weight: 600; font-size: var(--fs-sm); white-space: nowrap; }
@media (hover: hover) { .period-btn:hover { background: var(--primary-tint); } }
.tabs-u { display: flex; gap: var(--s-4); overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); margin-bottom: var(--s-3); }
.tabs-u::-webkit-scrollbar { display: none; }
.tab-u { flex: none; display: inline-flex; align-items: center; min-height: 38px; padding: 0 2px; border: 0; border-bottom: 2px solid transparent; background: none; font-weight: 500; font-size: var(--fs-sm); color: var(--text-muted); white-space: nowrap; margin-bottom: -1px; }
.tab-u.on { color: var(--text); font-weight: 600; border-bottom-color: var(--primary); }
@media (hover: hover) { .tab-u:not(.on):hover { color: var(--text); } }

/* ---------- Start screen (admin) ---------- */
.choose { min-height: 100vh; }
.choose-top { display: flex; align-items: center; justify-content: space-between; padding: var(--s-2) var(--s-4); }
.choose-body { max-width: 640px; margin: 0 auto; padding: var(--s-4) var(--s-4) var(--s-7); display: grid; gap: var(--s-3); }
.choose-list { display: grid; border-radius: var(--r-card); overflow: hidden; margin-top: var(--s-2); background: var(--surface); }
.choose-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-1) var(--s-4); padding: var(--s-4); text-decoration: none; }
.choose-row:nth-child(1) { background: var(--tint-blue); } .choose-row:nth-child(2) { background: var(--tint-green); }
.choose-row .t { display: grid; flex: 1 1 100%; gap: 2px; font-size: var(--fs-sm); } .choose-row .n { flex: 1; }
.choose-row strong { font-family: var(--font-head); font-size: var(--fs-md); font-weight: 600; letter-spacing: -0.01em; }
.choose-row .n { font-size: var(--fs-sm); font-weight: 600; color: var(--warn-text); white-space: nowrap; } .choose-row .n.clear { color: var(--text-muted); font-weight: 500; }
@media (min-width: 600px) { .choose-row .t { flex: 1 1 0; } .choose-row .n { flex: none; } }
@media (hover: hover) { .choose-row:hover { filter: brightness(0.96); } }
.choose-more { margin-top: var(--s-2); }
/* the page colours are bright in both modes, so what sits on them is written in black */
.band, .choose-row, .choose-row .muted, .choose-row .n, .choose-row .n.clear { color: var(--on-tint); }
.band :is(.period-btn, select, .btn) { color: var(--text); }
:root[data-theme="dark"] .band :is(.period-btn, select, .btn) { background: var(--surface); border-color: var(--surface); color: var(--text); }
:root[data-theme="dark"] .band .icon-pill.active { background: var(--surface); color: var(--primary); }

/* ---------- Pictures ---------- */
.media { position: relative; width: 100%; height: 100%; overflow: hidden; background: var(--surface-sunken); display: block; }
.media img { width: 100%; height: 100%; object-fit: cover; display: block; user-select: none; -webkit-user-drag: none; pointer-events: none; }
.media.empty, .media.doc, .media.linkmedia { display: grid; place-content: center; justify-items: center; gap: var(--s-1); color: var(--text-muted); font-size: var(--fs-xs); font-weight: 500; text-align: center; padding: var(--s-1); }
.media.linkmedia { background: var(--info-tint); color: var(--info-text); }
.playbadge { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--surface); }
.host { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Drag and drop ---------- */
.draggable { touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.dragging { opacity: 0.35; }
.drag-ghost { box-shadow: var(--elev); border-radius: var(--r-input); opacity: 0.95; }
.drop-hover { outline: 2px dashed var(--ok-dot); outline-offset: -2px; background: var(--ok-tint) !important; }
/* while dragging out of the day pop-up, tuck it away so the whole calendar is reachable */
body.is-dragging .sheet-back.peek { background: transparent; pointer-events: none; }
body.is-dragging .sheet-back.peek .sheet { transform: translateY(110%); pointer-events: none; }

/* ---------- Round calendar ---------- */
.mcal-wrap { max-width: 440px; margin: 0 auto; }
.rcal { background: var(--surface); border-radius: var(--r-round); padding: var(--s-4) var(--s-3) var(--s-3); }
.rcal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--s-3); }
.rcal-title { font-family: var(--font-head); font-weight: 600; font-size: var(--fs-md); }
.rcal-dow { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; font-size: 0.68rem; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); margin-bottom: var(--s-2); }
.rcal-grid { display: grid; grid-template-columns: repeat(7, 1fr); row-gap: var(--s-1); justify-items: center; }
.rday { width: 40px; height: 44px; display: grid; justify-items: center; align-content: center; gap: 2px; padding: 0; border: 0; border-radius: 50%; background: none; font-size: var(--fs-sm); font-weight: 500; color: var(--text); }
.rday.dim { color: var(--text-muted); opacity: 0.55; } .rday.past { color: var(--text-muted); }
.rday.today { box-shadow: inset 0 0 0 1.5px var(--select-solid); }
.rday.inrange { background: var(--info-tint); }
.rday.sel { background: var(--select-solid); color: var(--text-on-dark); font-weight: 600; }
.rday .rdots { display: flex; gap: 2px; height: 6px; align-items: center; } .rday .rdots .dot { width: 5px; height: 5px; }
.rday.sel .rdots .dot { background: var(--text-on-dark); }
@media (hover: hover) { .rday:not(.sel):hover { background: var(--primary-tint); } }
.legend { list-style: none; margin: var(--s-4) 0 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s-2) var(--s-4); font-size: var(--fs-xs); color: var(--text-muted); }
.legend li { display: inline-flex; align-items: center; gap: var(--s-2); }
.period-sum { margin-top: var(--s-3); text-align: center; }
.preset-row { margin-bottom: var(--s-3); }

/* ---------- Rows in week view, day view and the day pop-up ---------- */

/* ---------- Feed: a list on a soft green page ---------- */
.fav.sm { width: 20px; height: 20px; font-size: 0.68rem; }

/* ---------- Grid: a plain wall of pictures ---------- */
.gtiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; max-width: 640px; margin: 0 auto; }
.gtile { position: relative; aspect-ratio: 4 / 5; padding: 0; border: 0; background: var(--surface-sunken); overflow: hidden; border-radius: 4px; }
.gtile.past { opacity: 0.75; }
@media (hover: hover) { .gtile:hover { outline: 2px solid var(--primary); outline-offset: -2px; } }
.gicons { position: absolute; right: 6px; bottom: 6px; display: flex; gap: 4px; color: var(--text-on-dark); filter: drop-shadow(0 1px 2px rgb(28 30 33 / 0.5)); }

/* ---------- Review: plain sections on the page ---------- */

/* ---------- Sheets and dialogs (these float, so they get the one shadow) ---------- */
.sheet-back { position: fixed; inset: 0; z-index: 100; background: rgb(28 30 33 / 0.4); opacity: 0; transition: opacity var(--t-base) var(--ease); }
.sheet-back.in { opacity: 1; } .sheet-back.leaving { opacity: 0; }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; top: var(--s-5); background: var(--surface); border-radius: var(--r-modal) var(--r-modal) 0 0; overflow-y: auto; overscroll-behavior: contain; transform: translateY(32px); transition: transform var(--t-base) var(--ease); -webkit-overflow-scrolling: touch; box-shadow: var(--elev); }
.sheet.compact { top: auto; max-height: 92vh; }
.sheet-back.in .sheet { transform: none; }
.sheet-head { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; gap: var(--s-2); padding: var(--s-1) var(--s-3); background: var(--surface); border-bottom: 1px solid var(--line-subtle); }
.sheet-head h2 { flex: 1; font-size: var(--fs-md); } .sheet-head-right { display: flex; gap: var(--s-2); align-items: center; min-width: var(--tap); justify-content: flex-end; }
.sheet-body { padding: var(--s-3) var(--s-4) var(--s-5); display: grid; gap: 0; }
.sheet-bar { position: sticky; bottom: 0; z-index: 3; display: flex; gap: var(--s-3); justify-content: space-between; align-items: center; padding: var(--s-3) var(--s-4) calc(var(--s-3) + var(--safe)); background: var(--surface); border-top: 1px solid var(--line-subtle); }
.sheet-bar .btn { flex: 1; }
.card { padding: var(--s-4) 0; display: grid; gap: var(--s-3); border-top: 1px solid var(--line-subtle); }
.sheet-body > .card:first-child { border-top: 0; padding-top: var(--s-1); }
.auth-card .card, .dialog .card { border: 0; padding: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); min-height: 24px; }
.card-head h3 { font-weight: 600; }
.fold { padding: var(--s-3) 0; border-top: 1px solid var(--line-subtle); }
.fold summary { cursor: pointer; font-family: var(--font-head); font-weight: 600; font-size: var(--fs-sm); min-height: 24px; } .fold[open] summary { margin-bottom: var(--s-3); }
.preview { width: 100%; max-width: 360px; border-radius: var(--r-input); overflow: hidden; background: var(--surface-sunken); }
.preview.post, .preview.design { aspect-ratio: 4 / 5; } .preview.story { aspect-ratio: 9 / 16; max-width: 250px; }
.link-open { display: inline-flex; align-items: center; gap: var(--s-2); font-weight: 600; font-size: var(--fs-sm); color: var(--info-text); word-break: break-all; padding: var(--s-1) 0; }
/* compact post screen */
.ed-body { gap: var(--s-2); padding-top: var(--s-3); }
.ed-top { display: flex; gap: var(--s-3); align-items: flex-start; }
.ed-thumb { position: relative; width: 88px; height: 110px; padding: 0; border: 1px solid var(--line); border-radius: var(--r-input); overflow: hidden; flex: none; background: var(--surface-sunken); }
.ed-thumb.story { width: 66px; height: 117px; }
.ed-thumb:disabled { cursor: default; }
.ed-thumb-add { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: center; gap: var(--s-1); padding: 3px 0; background: var(--primary); color: var(--on-primary); font-size: var(--fs-xs); font-weight: 600; }
.ed-side { display: grid; gap: var(--s-3); flex: 1; min-width: 0; align-content: start; }
.datebtn { position: relative; display: inline-flex; align-items: center; gap: var(--s-2); min-height: var(--tap); padding: 0 var(--s-3); border: 1px solid var(--line); border-radius: var(--r-input); background: var(--surface); font-size: var(--fs-sm); font-weight: 500; overflow: hidden; }
.datebtn input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; padding: 0; }
.datebtn.off { opacity: 0.6; }
.points { display: grid; gap: var(--s-2); } .points h3 { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); font-family: var(--font-body); font-weight: 600; }
.ind { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); font-size: var(--fs-sm); }
.ind-l { font-weight: 500; }
.linkrow input { flex: 1; min-width: 0; }
.ed-caption { display: grid; gap: var(--s-2); margin-top: var(--s-2); }
.ed-caption textarea { min-height: 0; }
.ed-caption textarea[readonly] { background: var(--surface-sunken); cursor: copy; color: var(--text); }
.ed-note { margin: var(--s-2) 0 0; }
.cp { display: flex; align-items: center; gap: var(--s-3); }
.done-note { display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2); width: 100%; min-height: var(--tap); font-weight: 600; font-size: var(--fs-sm); color: var(--ok-text); } .done-note.wait { color: var(--warn-text); }
.change-card { margin: 0 0 var(--s-2); padding: var(--s-3); background: var(--warn-tint); border: 1px solid var(--warn-dot); border-radius: var(--r-input); display: grid; gap: var(--s-2); font-size: var(--fs-sm); }
.change-card h3 { display: flex; align-items: center; gap: var(--s-2); font-weight: 600; }
.from-card { margin: 0 0 var(--s-2); padding: var(--s-3); background: var(--info-tint); border-radius: var(--r-input); display: grid; gap: var(--s-1); font-size: var(--fs-sm); }
.from-card h3 { display: flex; align-items: center; gap: var(--s-2); font-weight: 600; }
.done-note.stack { flex-direction: column; gap: 0; text-align: center; }
.diff { line-height: 1.7; max-width: var(--measure); } .diff ins { background: var(--ok-tint); color: var(--ok-text); text-decoration: none; border-radius: 3px; padding: 0 2px; font-weight: 600; } .diff del { background: var(--danger-tint); color: var(--danger-text); border-radius: 3px; padding: 0 2px; }
.change { padding: var(--s-3) 0; border-top: 1px solid var(--line-subtle); }
.thread { display: grid; gap: var(--s-3); margin-bottom: var(--s-3); }
.msg { display: flex; gap: var(--s-3); align-items: flex-start; } .msg .bubble { flex: 1; min-width: 0; max-width: var(--measure); font-size: var(--fs-sm); }
.who { font-size: var(--fs-sm); } .bubble p { word-break: break-word; }
.hist { margin: 0; padding-left: var(--s-5); display: grid; gap: var(--s-2); font-size: var(--fs-sm); }
.voice { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s-2); margin: var(--s-1) 0; }
.btn.recording { background: var(--danger-solid); color: var(--text-on-dark); border-color: var(--danger-solid); }
.drop-file { display: grid; justify-items: start; gap: var(--s-1); padding: var(--s-4); border: 1px dashed var(--text-muted); border-radius: var(--r-input); background: var(--surface); color: var(--text-muted); text-align: left; font-size: var(--fs-sm); }
.drop-file strong { color: var(--text); }
@media (hover: hover) { .drop-file:hover { background: var(--primary-tint); } }
.dialog-back { position: fixed; inset: 0; z-index: 200; background: rgb(28 30 33 / 0.5); display: grid; place-items: center; padding: var(--s-4); }
.dialog { width: 100%; max-width: 380px; background: var(--surface); border-radius: var(--r-modal); padding: var(--s-5); display: grid; gap: var(--s-3); box-shadow: var(--elev); font-size: var(--fs-sm); }
.dialog h3 { font-size: var(--fs-md); font-weight: 600; }
.dialog-actions { display: flex; gap: var(--s-3); justify-content: flex-end; }
#toast-root { position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar) + var(--safe) + 72px); z-index: 300; display: grid; justify-items: center; gap: var(--s-2); pointer-events: none; padding: 0 var(--s-3); }
.toast { background: var(--primary); color: var(--on-primary); padding: var(--s-2) var(--s-4); border-radius: var(--r-card); font-weight: 500; font-size: var(--fs-sm); max-width: min(92vw, 420px); box-shadow: var(--elev); animation: toast-in var(--t-base) var(--ease); }
.toast.out { opacity: 0; transition: opacity var(--t-base) var(--ease); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }
.notes { list-style: none; margin: 0; padding: 0; }
.notes li + li { border-top: 1px solid var(--line-subtle); }
.notes button { width: 100%; display: grid; gap: 2px; text-align: left; padding: var(--s-3) var(--s-1); border: 0; background: none; color: var(--text-muted); font-size: var(--fs-sm); }
.notes .unread button { color: var(--text); font-weight: 600; }
.notes .unread button::before { content: 'New'; font-size: 0.68rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--info-text); font-weight: 600; }
@media (hover: hover) { .notes button:hover { background: var(--primary-tint); } }
.menu-list { padding: var(--s-2) 0; gap: 0; } .menu-list a, .menu-list button { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--s-2); border: 0; background: none; border-radius: var(--r-input); text-decoration: none; font-weight: 500; font-size: var(--fs-base); text-align: left; }
@media (hover: hover) { .menu-list a:hover, .menu-list button:hover { background: var(--primary-tint); } }

/* ---------- Options: choose one of several visuals ---------- */
.opts { display: grid; gap: var(--s-2); margin-top: var(--s-2); }
.opt-row { display: flex; gap: var(--s-2); overflow-x: auto; margin: 0; padding: var(--s-1) var(--s-1) var(--s-2); list-style: none; }
.opt { flex: none; display: grid; gap: var(--s-1); justify-items: center; }
.opt-pic { position: relative; width: 72px; height: 90px; padding: 0; border: 1px solid var(--line); border-radius: var(--r-input); overflow: hidden; background: var(--surface-sunken); }
.opt.on .opt-pic { outline: 3px solid var(--ok-solid); outline-offset: 1px; }
.opt-pic .media.empty span, .opt-pic .media.linkmedia .host { display: none; }
.opt-tick { position: absolute; top: 4px; right: 4px; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--ok-solid); color: var(--text-on-dark); }
.opt-foot { display: flex; align-items: center; gap: var(--s-2); font-size: var(--fs-xs); color: var(--text-muted); }
.opt-x { padding: var(--s-1); border: 0; background: none; color: var(--danger-text); font-size: var(--fs-xs); text-decoration: underline; }

/* ---------- First visit: an arrow to the light switch ---------- */
.light-tip { position: fixed; z-index: 250; max-width: min(80vw, 240px); padding: var(--s-2) var(--s-3); border-radius: var(--r-card); background: var(--primary); color: var(--on-primary); font-size: var(--fs-sm); font-weight: 600; line-height: 1.35; box-shadow: var(--elev); pointer-events: none; animation: toast-in var(--t-base) var(--ease); }
.light-tip::before { content: ''; position: absolute; bottom: 100%; left: var(--arrow-x, 50%); transform: translateX(-50%); border: 8px solid transparent; border-bottom-color: var(--primary); }
.light-tip.out { opacity: 0; transition: opacity var(--t-base) var(--ease); }

/* ---------- Video links: a picture of the video where one can be had ---------- */
.media.linkmedia { position: relative; }
.media.linkmedia :is(img, video) { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.media.linkmedia .playbadge { position: relative; z-index: 1; color: var(--text); }
.media.linkmedia.has-preview .host { display: none; }
.embed { border: 0; border-radius: var(--r-card); width: 100%; max-width: 360px; justify-self: center; aspect-ratio: 4 / 5; background: var(--surface-sunken); }
.embed.tall { aspect-ratio: 9 / 16; max-width: 290px; }
.embed.wide { aspect-ratio: 16 / 9; max-width: none; }

/* ---------- Design board: a list ---------- */
.vnote { color: var(--text-muted); max-width: var(--measure); font-size: var(--fs-sm); }
.ver { display: flex; gap: var(--s-3); align-items: center; padding: var(--s-2) 0; border-top: 1px solid var(--line-subtle); font-size: var(--fs-sm); } .vthumb { width: 40px; height: 50px; border-radius: 4px; overflow: hidden; flex: none; }

/* ---------- Admin and history ---------- */
.people { display: grid; margin-top: var(--s-4); border-top: 1px solid var(--line-subtle); }
.person { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; padding: var(--s-3) var(--s-1); border-bottom: 1px solid var(--line-subtle); font-size: var(--fs-sm); } .person.off { opacity: 0.65; }
.pinfo { display: grid; flex: 1; min-width: 180px; }
.invite { white-space: pre-wrap; word-break: break-word; margin: 0; padding: var(--s-4); background: var(--surface-sunken); border-radius: var(--r-input); font: inherit; font-size: var(--fs-sm); max-width: var(--measure); }
.timeline { list-style: none; margin: var(--s-4) 0 0; padding: 0; border-top: 1px solid var(--line-subtle); }
.timeline li { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--s-1); border-bottom: 1px solid var(--line-subtle); font-size: var(--fs-sm); } .tl-body { flex: 1; min-width: 0; }


/* ---------- Header icon buttons ---------- */
.icon-pill { position: relative; display: inline-grid; place-items: center; width: var(--tap); height: var(--tap); padding: 0; border: 0; border-radius: 50%; background: var(--surface); color: var(--text); }
.icon-pill.active { background: var(--primary); color: var(--on-primary); }
.pdot { position: absolute; top: 7px; right: 7px; width: 9px; height: 9px; border-radius: 50%; background: var(--select-solid); border: 2px solid var(--surface); }
@media (hover: hover) { .icon-pill:not(.active):hover { background: var(--primary-tint); } }

/* ---------- Big-picture cards (Feed, Review, day pop-up, Design board) ---------- */
.feed-list { max-width: 600px; padding-left: var(--s-2); padding-right: var(--s-2); }
.feed-list .tabs-u { margin-left: var(--s-2); margin-right: var(--s-2); }
.fday { font-family: var(--font-head); font-size: var(--fs-base); font-weight: 600; margin: var(--s-4) var(--s-2) var(--s-2); }
.fsec { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); font-weight: 600; font-family: var(--font-body); margin: var(--s-5) var(--s-2) var(--s-1); }
.rsec { margin-bottom: var(--s-5); }
.rhead { display: flex; align-items: center; font-size: var(--fs-md); margin: var(--s-3) var(--s-2) var(--s-2); }
.rempty { padding: var(--s-2); }
.pcards { display: grid; gap: var(--s-2); }
.pcard { position: relative; background: var(--surface); border-radius: var(--r-card); overflow: hidden; margin-bottom: var(--s-2); height: var(--card-h); }
.pcards .pcard { margin-bottom: 0; }
.sheet .pcard { border: 1px solid var(--line-subtle); }
.pcard-row { display: flex; align-items: stretch; width: 100%; height: 100%; }
.pcard-main { width: 100%; } /* the card always fills its row, however short the text is */
.pcard-main { display: flex; align-items: stretch; gap: 0; flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; background: none; text-align: left; }
@media (hover: hover) { .pcard-main:hover { background: var(--primary-tint); } }
.pcard-text { display: flex; flex-direction: column; gap: var(--s-3); flex: 1; min-width: 0; padding: var(--s-3); overflow: hidden; }
.pcard-top { display: flex; align-items: center; gap: var(--s-2); font-size: var(--fs-xs); color: var(--text-muted); min-width: 0; }
.pcard-handle { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.pcard-time { margin-left: auto; font-size: 0.7rem; color: var(--text-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.pcard-cap { font-size: var(--fs-base); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.pcard-title { font-family: var(--font-head); font-size: var(--fs-md); font-weight: 600; line-height: 1.25; }
.pcard-img { width: var(--card-img-w); flex: none; align-self: stretch; overflow: hidden; background: var(--surface-sunken); }
.pcard-img .media.empty span, .pcard-img .media.linkmedia .host, .wthumb .media.empty span, .wthumb .media.empty .ico, .wthumb .media.linkmedia .host, .wthumb .playbadge { display: none; }
.fav { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--warn-tint); color: var(--warn-text); font-family: var(--font-head); font-weight: 700; flex: none; }
.fav.sm { width: 20px; height: 20px; font-size: 0.68rem; }

/* ---------- Week: rows of date circles ---------- */
.weeks { display: grid; }
.weekone { max-width: 640px; margin: 0 auto; }
.wk-scroll { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; background: var(--surface); border-radius: var(--r-card); overscroll-behavior-x: contain; }
.wk-scroll::-webkit-scrollbar { display: none; }
.wk-page { flex: 0 0 100%; scroll-snap-align: start; scroll-snap-stop: always; display: grid; grid-template-columns: repeat(7, 1fr); gap: var(--s-1); padding: var(--s-3) var(--s-1); }
.wk-dow { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; font-size: 0.68rem; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); padding: 0 0 var(--s-2); }
.wk-list { margin-top: var(--s-4); }
.wk-day { font-size: var(--fs-md); margin: 0 var(--s-1) var(--s-1); }
.wk-month { font-family: var(--font-head); font-size: var(--fs-md); font-weight: 600; padding: var(--s-4) var(--s-2) var(--s-1); }
.wcell { display: flex; flex-direction: column; align-items: center; gap: var(--s-2); min-height: 96px; border-radius: var(--r-input); }
.wcell.past .wthumb { opacity: 0.65; }
.wthumb { position: relative; width: 46px; height: 58px; padding: 0; border: 0; border-radius: var(--r-card); overflow: hidden; background: var(--surface-sunken); flex: none; }
.wthumb.story { width: 36px; height: 64px; }
.wthumb.selected { outline: 2px solid var(--primary); outline-offset: 1px; }
.wmore { position: absolute; right: 2px; bottom: 2px; padding: 0 5px; border-radius: var(--r-badge); background: var(--primary); color: var(--on-primary); font-size: 0.65rem; font-weight: 600; }


/* ---------- Feed: small cards, four to a phone screen, as a list or a grid ---------- */
.feed-bar { display: flex; align-items: center; gap: var(--s-3); border-bottom: 1px solid var(--line); margin: 0 var(--s-2) var(--s-4); }
.feed-bar .tabs-u { flex: 1; min-width: 0; margin: 0; border-bottom: 0; }
.scards { display: grid; gap: var(--s-4); margin: 0 var(--s-2) var(--s-4); }
.tcards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-4); margin: 0 var(--s-2) var(--s-4); }
.scard, .tcard { background: var(--surface); border-radius: var(--r-card); overflow: hidden; }
.scard-main { display: flex; width: 100%; height: 100%; padding: 0; border: 0; background: none; text-align: left; }
.scard { height: 104px; }
.scard .scard-img { order: 2; width: 92px; flex: none; }
.tcard .scard-main { flex-direction: column; }
.tcard .scard-img { width: 100%; aspect-ratio: 1; flex: none; }
.scard-img { display: block; overflow: hidden; background: var(--surface-sunken); }
.scard-img .media.empty span, .scard-img .media.linkmedia .host { display: none; }
.scard-text { display: flex; flex-direction: column; gap: var(--s-2); flex: 1; min-width: 0; padding: var(--s-3); overflow: hidden; }
.scard-date { font-size: var(--fs-xs); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scard-date span { font-weight: 400; color: var(--text-muted); }
.scard-cap { font-size: var(--fs-sm); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tcard .scard-cap { -webkit-line-clamp: 1; }
.scard-note { font-size: var(--fs-xs); color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (hover: hover) { .scard-main:hover { background: var(--primary-tint); } }
@media (min-width: 900px) { .feed-list.as-grid { max-width: 960px; } .tcards { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* ---------- Caption choices ---------- */
.cap-opt { display: grid; gap: var(--s-2); padding: var(--s-2); border: 1px solid var(--line); border-radius: var(--r-card); }
.cap-opt.on { border-color: var(--ok-solid); outline: 2px solid var(--ok-solid); outline-offset: -2px; }
.cap-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); min-height: var(--tap-sm); font-size: var(--fs-sm); }
.cap-chosen { display: inline-flex; align-items: center; gap: var(--s-1); color: var(--ok-text); font-weight: 600; }
.cap-head strong { margin-right: auto; }

/* ---------- Time of day marks ---------- */
.tod { display: inline-flex; vertical-align: -2px; margin-right: var(--s-1); flex: none; }
.tod.sun { color: var(--warn-dot); }
.tod.moon { color: var(--text); }
.datebtn .tod { margin: 0; }

/* ---------- The week at a glance: two posts a day ---------- */
.tracker { background: var(--surface); border-radius: var(--r-card); padding: var(--s-1) var(--s-2) var(--s-2); margin: 0 var(--s-2) var(--s-2); }
.tracker-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-1); }
.tracker-title { display: grid; text-align: center; font-size: var(--fs-xs); line-height: 1.4; min-width: 0; }
.tracker-title span { color: var(--text-muted); }
.verdict { font-style: normal; font-weight: 600; } .verdict.good { color: var(--ok-text); } .verdict.bad { color: var(--danger-text); }
.tracker-bar { height: 6px; margin: var(--s-1) var(--s-1) 0; border-radius: var(--r-badge); background: var(--surface-sunken); overflow: hidden; }
.tracker-bar i { display: block; height: 100%; border-radius: var(--r-badge); background: var(--post-solid); }
.wk-cols { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; margin-top: var(--s-1); }
.wk-col { display: grid; justify-items: center; gap: 3px; padding: 3px 0; border: 1px solid transparent; border-radius: var(--r-input); background: none; font-size: var(--fs-xs); }
.wk-col.today { border-color: var(--primary); }
.wk-col.full { background: var(--post-tint); }
.wk-name { font-weight: 600; line-height: 1.2; }
.wk-slots { display: flex; gap: 3px; }
.slot { display: inline-grid; place-items: center; width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid var(--line); flex: none; }
.slot.approved { background: var(--ok-dot); border-color: var(--ok-dot); }
.slot.review { background: var(--warn-dot); border-color: var(--warn-dot); }
.slot.draft { background: var(--text-muted); border-color: var(--text-muted); }
.slot.missed { border-color: var(--danger-dot); }
.slot.empty { border-style: dashed; border-color: var(--text-muted); }
.tracker-key { display: flex; justify-content: center; gap: var(--s-3); margin-top: var(--s-1); font-size: 0.68rem; color: var(--text-muted); }
.tracker-key span { display: inline-flex; align-items: center; gap: var(--s-1); }
.tracker-key .slot { width: 7px; height: 7px; border-width: 0; }
@media (hover: hover) { .wk-col:hover { background: var(--primary-tint); } }

/* ---------- Voice notes: equalizer bars, a player, and cropping on one line ---------- */
.voice-draft { display: grid; gap: var(--s-2); width: 100%; padding: var(--s-3); border: 1px solid var(--line); border-radius: var(--r-card); font-size: var(--fs-sm); }
.eq { display: flex; align-items: center; gap: 1px; height: 16px; min-width: 0; flex: 1; }
.eq i { flex: 1; min-width: 1px; max-width: 2px; height: 100%; border-radius: var(--r-badge); background: var(--line); transition: transform 90ms linear; }
.eq i.on { background: var(--primary); }
.eq.live i { background: var(--danger-dot); }
.eq.wide i { max-width: 3px; }
.vp { display: flex; align-items: center; gap: var(--s-2); width: 100%; max-width: 200px; }
.vp-play { display: grid; place-items: center; width: 32px; height: 32px; flex: none; padding: 0; border: 0; border-radius: 50%; background: var(--primary); color: var(--on-primary); }
.vp-time { font-size: var(--fs-xs); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.vp audio { display: none; }
.rec-live { display: grid; gap: var(--s-1); width: 100%; }
.crop { position: relative; height: 34px; max-width: 280px; margin: 0 var(--s-3); }
.crop .eq { height: 100%; padding: var(--s-2) 0; justify-content: space-between; }
.crop-keep { position: absolute; top: 0; bottom: 0; border-top: 2px solid var(--primary); border-bottom: 2px solid var(--primary); pointer-events: none; }
.crop-h { position: absolute; top: 0; width: 16px; height: 100%; margin-left: -8px; padding: 0; border: 0; border-radius: var(--r-input); background: var(--primary); touch-action: none; cursor: ew-resize; }
.crop-h::after { content: ''; position: absolute; top: 10px; bottom: 10px; left: 7px; width: 2px; border-radius: var(--r-badge); background: var(--on-primary); }
.sheet-bar.wrap-bar { flex-wrap: wrap; gap: var(--s-2); }
.sheet-bar .done-note { width: auto; flex: 1 1 0; min-width: 0; }
.sheet-bar .done-note.full { flex-basis: 100%; min-height: 24px; }
.sheet-bar .done-note.stack { flex-basis: 100%; }
.slot.done { background: var(--post-solid); border-color: var(--post-solid); color: var(--text-on-dark); }

/* ---------- Compact button rows: side by side on a phone ---------- */
.fb-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); }
.fb-row .btn.small { padding: 0 var(--s-3); gap: var(--s-1); font-size: var(--fs-xs); }
.fb-row .voice-ctl { display: contents; }
.fb-row .rec-live, .fb-row .voice-draft { flex-basis: 100%; }
.tool-row { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.tool-row .btn { padding: 0 var(--s-2); gap: var(--s-1); }
.tool-row:empty { display: none; }

/* ---------- Posted table ---------- */
.ptable { width: calc(100% - 2 * var(--s-2)); margin: 0 var(--s-2); border-collapse: collapse; background: var(--surface); border-radius: var(--r-card); overflow: hidden; font-size: var(--fs-sm); table-layout: fixed; }
.ptable th { text-align: left; font-size: var(--fs-xs); color: var(--text-muted); font-weight: 600; padding: var(--s-2); }
.ptable th:first-child { width: 88px; } .ptable th:last-child { width: 92px; }
.ptable td { padding: var(--s-2); border-top: 1px solid var(--line-subtle); vertical-align: middle; }
.pdate { font-size: var(--fs-xs); } .pdate strong, .pdate span { display: block; } .pdate span { color: var(--text-muted); }
.prow { display: flex; align-items: center; gap: var(--s-2); width: 100%; min-width: 0; padding: 0; border: 0; background: none; text-align: left; font-size: var(--fs-xs); }
.pthumb { width: 36px; height: 45px; flex: none; border-radius: var(--r-input); overflow: hidden; }
.pthumb .media.empty span, .pthumb .media.linkmedia .host, .pthumb .playbadge { display: none; }
.pcap { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-width: 0; }

/* ---------- Grid: changes wait for Save ---------- */
.grid-bar { position: sticky; top: calc(var(--topbar-h) + var(--s-2)); z-index: 20; display: flex; align-items: center; gap: var(--s-2); max-width: 640px; margin: 0 auto var(--s-3); padding: var(--s-2) var(--s-3); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--elev); font-size: var(--fs-sm); font-weight: 600; }
.grid-bar span { margin-right: auto; color: var(--warn-text); }
.gtile.moved { outline: 3px solid var(--warn-dot); outline-offset: -3px; }

/* ---------- List or grid, on every page that lists things ---------- */
.feed-bar .sp { min-height: 38px; }
.day-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); margin-bottom: var(--s-2); }
.rsec .scards, .rsec .tcards { margin-bottom: 0; }
.pdate .tod { margin-right: 2px; }

.done-note.posted { color: var(--post-text); }

/* ---------- Phones: readable text, easy taps, and no zoom when a box is tapped ---------- */
@media (pointer: coarse), (max-width: 899px) {
  html { font-size: 15px; }
  :root { --tap: 44px; --tap-sm: 36px; --tabbar: 62px; }
  input[type=text], input[type=email], input[type=password], input[type=url], input[type=datetime-local], input[type=time], select, textarea { font-size: 16px; }
  .tab, .scard-note { font-size: var(--fs-sm); }
  .sheet.compact { max-height: 92dvh; }
}
.btn, .scard-main, .tab, .tab-u, .wk-col, .rday, .gtile { transition: transform 100ms ease-out; }
.btn:active, .tab:active, .tab-u:active, .wk-col:active { transform: scale(0.96); }
.scard-main:active, .gtile:active { transform: scale(0.985); }

@media (max-width: 899px) {
  .sheet-head { touch-action: none; cursor: grab; padding-top: var(--s-3); }
  .sheet-head::before { content: ''; position: absolute; top: 5px; left: 50%; width: 38px; height: 4px; margin-left: -19px; border-radius: var(--r-badge); background: var(--line); }
  .sheet { transition: transform 320ms cubic-bezier(0.2, 0.9, 0.25, 1); }
}

/* ---------- Answer from the card, with Undo ---------- */
.scard.has-quick { height: auto; }
.scard.has-quick .scard-main { height: 104px; }
.quick { display: grid; grid-template-columns: 1fr 1.5fr; gap: var(--s-2); padding: 0 var(--s-2) var(--s-2); }
.toast.act { display: flex; align-items: center; gap: var(--s-3); pointer-events: auto; }
.toast.act button { min-height: var(--tap-sm); padding: 0 var(--s-2); border: 0; background: none; color: inherit; font-weight: 700; text-decoration: underline; }

/* ---------- A round X on each picture ---------- */
.opt { position: relative; }
.opt-del { position: absolute; top: -6px; right: -6px; z-index: 2; display: grid; place-items: center; width: 24px; height: 24px; padding: 0; border: 2px solid var(--surface); border-radius: 50%; background: var(--danger-solid); color: var(--text-on-dark); }
.opt-del::after { content: ''; position: absolute; inset: -8px; }
.opt-row { padding-top: var(--s-2); }
.opt-tick { top: auto; bottom: 4px; }
.fb { display: grid; gap: var(--s-2); margin-top: var(--s-3); }
.fb .pick-h { margin: 0; }

/* ---------- Tabs: small, the number beside the word, every one in view ---------- */
.tabs-u { gap: var(--s-1); overflow: visible; justify-content: space-between; }
.tab-u { flex: 0 1 auto; min-width: 0; justify-content: center; gap: 3px; padding: 0 1px; font-size: 0.7rem; white-space: nowrap; }
.tab-u .count { min-width: 0; height: auto; margin: 0; padding: 0; background: none; font-size: inherit; }
.feed-bar { gap: var(--s-2); }
.feed-bar .view-toggle { width: 28px; height: var(--tap-sm); flex: none; }

/* ---------- Month view: slide sideways, one month a page ---------- */
.mo-page { flex: 0 0 100%; scroll-snap-align: start; scroll-snap-stop: always; align-content: start; display: grid; padding: var(--s-4) var(--s-2) var(--s-3); }
.mo-page .rcal-title { text-align: center; margin-bottom: var(--s-3); }
.mo-page .rcal-grid { row-gap: var(--s-2); }
.view-seg { background: var(--surface-sunken); justify-self: start; }
.hist-range { margin: 0 var(--s-2) var(--s-2); }

/* ---------- History: rows grouped by day, with the picture on the right ---------- */
.hist-list { display: grid; gap: var(--s-2); }
.hrow { display: flex; align-items: center; gap: var(--s-3); width: 100%; padding: var(--s-3); border: 0; border-radius: var(--r-card); background: var(--surface); text-align: left; font-size: var(--fs-sm); }
.hrow-text { display: grid; gap: 2px; flex: 1; min-width: 0; }
.hrow-line { overflow-wrap: anywhere; }
.hrow-img { width: 48px; height: 60px; flex: none; border-radius: var(--r-input); overflow: hidden; background: var(--surface-sunken); }
.hrow-img .media.empty span, .hrow-img .media.linkmedia .host { display: none; }
.hrow-img .playbadge { width: 28px; height: 28px; }
@media (hover: hover) { button.hrow:hover { background: var(--primary-tint); } }

/* ---------- Design detail ---------- */
.dtitle { font-family: var(--font-head); font-size: var(--fs-md); font-weight: 600; line-height: 1.25; }
.ed-feedback { display: grid; gap: var(--s-2); padding-top: var(--s-4); margin-top: var(--s-3); border-top: 1px solid var(--line-subtle); }

/* ---------- Date and time picker ---------- */
.pick-h { margin: var(--s-4) 0 var(--s-2); font-size: var(--fs-sm); font-weight: 600; }
.wrapchips { flex-wrap: wrap; overflow: visible; }

/* ---------- Subheadings: the second typeface, in spaced capitals ---------- */
.fday, .fsec, .rhead, .wk-day, .wk-month, .card-head h3, .points h3, .pick-h, .fold summary, .auth-card > p.muted { font-family: var(--font-sub); font-size: var(--fs-xs); font-weight: 600; letter-spacing: var(--track-sub); text-transform: uppercase; }
.auth-card > p.muted { text-align: center; line-height: 1.7; }

/* ---------- Frosted glass: only the bars that float above the content ---------- */
.topbar, .sheet-head, .sheet-bar, .toast.act { background: var(--glass); -webkit-backdrop-filter: var(--frost); backdrop-filter: var(--frost); }
.topbar, .sheet-head { border-bottom-color: var(--glass-edge); }
.sheet-bar { border-top-color: var(--glass-edge); }
.toast.act { color: var(--text); border: 1px solid var(--glass-edge); }
@media (max-width: 899px) {
  .tabbar { left: 10px; right: 10px; bottom: calc(10px + var(--safe)); padding: 0 4px; border: 1px solid var(--glass-edge); border-radius: 26px; background: var(--glass); -webkit-backdrop-filter: var(--frost); backdrop-filter: var(--frost); box-shadow: var(--elev); }
  .tab { z-index: 1; min-height: calc(var(--tabbar) - 4px); }
  .tab.on .ico { background: none; }
  .tab-blob { position: absolute; top: 4px; bottom: 4px; left: 4px; border-radius: 22px; background: var(--primary-tint); opacity: 0.75; transition: transform 320ms cubic-bezier(0.2, 0.9, 0.25, 1.1); }
  .shell { padding-bottom: calc(var(--tabbar) + var(--safe) + 100px); }
  .fab { bottom: calc(var(--tabbar) + var(--safe) + 22px); }
  #toast-root { bottom: calc(var(--tabbar) + var(--safe) + 84px); }
}
/* ---------- Calendar pop-ups: one pane of frosted glass over the page ---------- */
.sheet-back.frosted { background: rgb(28 30 33 / 0.22); }
.frosted .sheet { background: var(--glass-sheet); -webkit-backdrop-filter: var(--frost); backdrop-filter: var(--frost); border: 1px solid var(--glass-edge); }
.frosted .sheet-head, .frosted .sheet-bar { background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; }
.frosted .rcal { background: var(--glass-card); border: 1px solid var(--glass-edge); border-radius: var(--r-round); box-shadow: var(--elev); }
.frosted .chip-filter:not(.on), .frosted .seg { background: var(--glass-card); border-color: var(--glass-edge); }
@media (prefers-reduced-transparency: reduce), (prefers-contrast: more) {
  .frosted .sheet { background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .topbar, .sheet-head, .sheet-bar, .toast.act, .tabbar { background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none; }
}

/* ---------- Laptop ---------- */
@media (min-width: 900px) {
  .shell { display: grid; grid-template-columns: 240px 1fr; padding-bottom: var(--s-7); }
  .sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: var(--s-1); padding: var(--s-5) var(--s-3); background: var(--surface); border-right: 1px solid var(--line); }
  .side-logo { padding: var(--s-1) var(--s-3) var(--s-5); text-decoration: none; }
  .side-link { position: relative; display: flex; align-items: center; gap: var(--s-3); padding: var(--s-2) var(--s-3); border-radius: var(--r-input); text-decoration: none; font-weight: 500; font-size: var(--fs-sm); color: var(--text-muted); }
  .side-link:hover { background: var(--primary-tint); color: var(--text); } .side-link.on { background: var(--primary-tint); color: var(--text); font-weight: 600; }
  .side-link .nbadge { position: static; margin-left: auto; }
  .side-spaces { margin-top: var(--s-5); padding-top: var(--s-4); border-top: 1px solid var(--line-subtle); display: grid; gap: 2px; } .side-spaces > span { padding: 0 var(--s-3) var(--s-2); }
  .side-user { margin-top: auto; display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3); border: 0; background: none; border-radius: var(--r-input); text-align: left; font-size: var(--fs-sm); } .side-user span { display: grid; }
  .side-user:hover { background: var(--primary-tint); }
  .tabbar { display: none; }
  .top-logo { display: none; } .top-title { display: block; }
  .topbar { padding: var(--s-2) var(--s-5); } .view-pad { padding: var(--s-5) var(--s-6) var(--s-7); } .band { padding: var(--s-5) var(--s-6) var(--s-6); }
  .fab { bottom: var(--s-6); right: var(--s-6); } .bulkbar { left: 260px; right: var(--s-5); bottom: var(--s-5); max-width: 760px; margin: 0 auto; }
  #toast-root { bottom: var(--s-6); }
  .sheet-back { display: flex; justify-content: flex-end; }
  .sheet, .sheet.compact { position: relative; top: 0; width: 100%; max-width: 520px; max-height: none; border-radius: 0; transform: translateX(32px); }
  .sheet-back.in .sheet { transform: none; }
  .sheet-back.peek { justify-content: center; align-items: center; }
  .sheet-back.peek .sheet { height: auto; max-height: 80vh; border-radius: var(--r-modal); max-width: 460px; transform: none; }
  .gtiles { gap: var(--s-2); } .gtile { border-radius: var(--r-input); }
  .auth-card { padding: var(--s-7) var(--s-6) var(--s-6); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
