/* =====================================================================
   Admin design system — Fernly's design language on the survey palette.
   Layers: page → panel (sidebar, topbar, board) → card. Pill buttons,
   26/20px radii, Plus Jakarta Sans, tabular numbers, soft shadows.
   ===================================================================== */

/* ---- Tokens (indigo + slate, mapped onto Fernly's scale) ---- */
:root {
  --page: #e9ebf0; --panel: #f5f6f9; --card: #fdfdfe; --hair: #e2e6ee;
  --ink: #121624; --muted: #616a7e; --faint: #677085;
  --g-950: #1f2360; --g-800: #2f3587; --g-700: #3a40a8; --g-600: #4a53bf; --g-400: #7f88d6; --g-100: #e6e8f8;
  --on-dark: #f2f3fc; --on-dark-soft: #c3c8f2;
  --hatch: #8f97ab;
  --deep: color-mix(in srgb, var(--g-950) 60%, #000);
  --swirl: color-mix(in srgb, var(--g-400) 22%, transparent);
  --amber: #a8650a; --amber-bg: #fdf3e2; --rose: #c23b3b; --rose-bg: #fdeceb; --mint: #1f8a5b; --mint-bg: #e3f4ea;
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --r-lg: 26px; --r-md: 20px; --gap: 16px;
  --shadow: 0 1px 2px #1216240a, 0 8px 24px -12px #1216241a;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --focus: 0 0 0 3px var(--card), 0 0 0 5px var(--g-600);
}

/* ---- Base ---- */
*, ::before, ::after { box-sizing: border-box; }
[hidden], [x-cloak] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { background: var(--page); min-height: 100dvh; color: var(--ink); font: 400 16px/1.5 var(--font); -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums; margin: 0; }
h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
svg { fill: none; stroke: currentColor; stroke-width: 1.7px; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; width: 20px; height: 20px; }
table { border-collapse: collapse; }
:where(a, button, input, select, textarea, summary, label.btn):focus-visible { box-shadow: var(--focus); outline: none; }
.sr-only { clip-path: inset(50%); white-space: nowrap; width: 1px; height: 1px; margin: -1px; padding: 0; position: absolute; overflow: hidden; }
.skip { z-index: 100; color: var(--on-dark); background: var(--g-950); border-radius: 10px; padding: 10px 16px; position: fixed; top: 12px; left: 16px; transform: translateY(-160%); }
.skip:focus { transform: none; }
mark { color: inherit; background: #dfe2f7; border-radius: 3px; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; }

/* ---- App shell ---- */
.app { display: grid; grid-template-columns: 252px minmax(0, 1fr); gap: 14px; max-width: 1680px; min-height: 100dvh; margin: 0 auto; padding: 14px; }
.shell { display: grid; grid-template-rows: auto 1fr; gap: 14px; min-width: 0; }

/* Sidebar */
.sidebar { background: var(--panel); border-radius: var(--r-lg); display: flex; flex-direction: column; height: calc(100dvh - 28px); padding: 26px 0 18px; position: sticky; top: 14px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; }
.sidebar::-webkit-scrollbar { display: none; }
.sidebar__top { display: flex; justify-content: space-between; align-items: center; padding: 0 22px 0 26px; }
.icon-btn.sidebar__close { display: none; }
.brand { display: inline-flex; align-items: center; gap: 12px; min-width: 0; }
.brand__mark { width: 40px; height: 40px; color: var(--g-700); stroke-width: 3.2px; }
.brand__name { letter-spacing: -.03em; font-size: 21px; font-weight: 600; line-height: 1.15; }
.brand__logo { display: block; width: 172px; max-width: 100%; height: auto; transform-origin: 0 50%; }
.auth__logo { display: block; width: min(320px, 100%); height: auto; margin-bottom: 22px; }
@media (max-width: 1360px) { .brand__logo { width: 156px; } }
@media (min-width: 1181px) and (max-height: 860px) { .brand__logo { width: 136px; } }
.sidebar__navs { position: relative; }
.nav { margin-top: 34px; }
.nav + .nav { margin-top: 30px; }
.nav__label { letter-spacing: .06em; text-transform: uppercase; color: var(--faint); padding: 0 28px 12px; font-size: 12px; font-weight: 500; }
.nav__link { display: flex; align-items: center; gap: 14px; width: 100%; padding: 11px 28px; color: var(--muted); font-size: 16px; text-align: left; transition: color .2s; position: relative; }
.nav__link svg { width: 22px; height: 22px; transition: color .2s; }
.nav__link:hover { color: var(--ink); }
.nav__link[aria-current="page"] { color: var(--ink); font-weight: 600; }
.nav__link[aria-current="page"] svg { color: var(--g-700); }
.nav__link:focus-visible { box-shadow: inset 0 0 0 2px var(--g-600); }
.nav__rail { z-index: 1; background: var(--g-700); transform-origin: 50% 0; opacity: 0; pointer-events: none; border-radius: 0 6px 6px 0; width: 5px; height: 40px; position: absolute; top: 0; left: 0; }
.nav__badge { margin-left: auto; color: var(--on-dark); background: var(--g-950); border-radius: 6px; padding: 2px 7px; font-size: 10.5px; font-weight: 600; }

/* Sidebar promo (live survey) */
.promo { isolation: isolate; position: relative; overflow: hidden; margin: auto 18px 0; padding: 18px 16px 16px; border-radius: var(--r-md); color: var(--on-dark); background: var(--deep); }
.sidebar__navs + .promo { margin-top: 28px; }
.promo::before { content: ""; z-index: -1; position: absolute; inset: -40%; background: repeating-radial-gradient(circle at 78% 70%, transparent 0 14px, var(--swirl) 15px 16px), radial-gradient(70% 60% at 85% 85%, var(--g-700), transparent 70%), radial-gradient(60% 50% at 10% 0%, var(--g-950), transparent 70%); }
.promo__icon { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; color: var(--g-950); background: var(--on-dark); }
.promo__icon svg { width: 15px; height: 15px; }
.promo__eyebrow { margin-top: 12px; color: var(--on-dark-soft); font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; display: flex; align-items: center; gap: 6px; }
.promo__live { width: 7px; height: 7px; border-radius: 50%; background: #5ee39a; box-shadow: 0 0 0 3px #5ee39a33; }
.promo__title { letter-spacing: -.02em; max-width: 11em; margin-top: 6px; font-size: 18px; line-height: 1.2; }
.promo__sub { color: var(--on-dark-soft); margin-top: 6px; font-size: 12px; }
.promo__btn { display: block; width: 100%; margin-top: 22px; padding: 10px; border-radius: 999px; color: inherit; text-align: center; background: var(--g-800); font-size: 13.5px; font-weight: 600; transition: background .2s; }
.promo__btn:hover { background: var(--g-700); }

/* Topbar */
.topbar { display: flex; align-items: center; gap: 14px; padding: 14px 18px; background: var(--panel); border-radius: var(--r-lg); }
.icon-btn.topbar__menu { display: none; }
.search { position: relative; flex: 0 1 380px; margin: 0; }
.search input { width: 100%; height: 50px; padding: 0 64px 0 50px; border: 0; border-radius: 999px; outline: none; background: var(--card); font-size: 15px; }
.search input::placeholder { color: var(--faint); }
.search input::-webkit-search-cancel-button { display: none; }
.search__icon { position: absolute; top: 50%; left: 18px; translate: 0 -50%; width: 22px; height: 22px; color: var(--ink); pointer-events: none; }
.search__kbd { position: absolute; top: 50%; right: 12px; translate: 0 -50%; display: inline-flex; align-items: center; gap: 3px; padding: 3px 8px; border-radius: 7px; background: var(--panel); color: var(--ink); font: 500 12px var(--font); pointer-events: none; }
.topbar__actions { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.icon-btn { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; color: var(--ink); }
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn--round { position: relative; width: 52px; height: 52px; border-radius: 50%; background: var(--card); transition: transform .25s var(--ease); }
.icon-btn--round:hover { transform: translateY(-2px); }
.icon-btn--soft { width: 40px; height: 40px; border-radius: 50%; background: var(--panel); transition: background .2s, color .2s; }
.icon-btn--soft:hover { background: var(--g-100); }
.icon-btn--soft svg { width: 18px; height: 18px; }
.icon-btn--danger:hover { background: var(--rose-bg); color: var(--rose); }
.dot { position: absolute; top: 13px; right: 14px; width: 8px; height: 8px; border-radius: 50%; background: var(--rose); box-shadow: 0 0 0 2px var(--card); }
.profile { display: flex; align-items: center; gap: 12px; padding: 2px 6px 2px 2px; border-radius: 999px; text-align: left; }
.profile__text { display: grid; }
.profile__name { font-size: 16px; font-weight: 500; line-height: 1.3; }
.profile__mail { color: var(--muted); font-size: 13.5px; }

/* Tray (latest responses) */
.tray-wrap { position: relative; }
.tray { position: absolute; z-index: 45; top: calc(100% + 12px); right: -8px; width: min(360px, calc(100vw - 24px)); padding: 16px; border-radius: 20px; background: var(--card); box-shadow: 0 0 0 1px var(--hair), 0 24px 60px -20px #12162459; transform-origin: 90% 0; }
.tray__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.tray__title { font-weight: 600; }
.tray__list { display: grid; gap: 4px; }
.tray__list li > a, .tray__list li > div { display: flex; align-items: flex-start; gap: 12px; padding: 10px; border-radius: 14px; color: var(--muted); font-size: 13.5px; line-height: 1.4; }
.tray__list li > a:hover { background: var(--panel); }
.tray__list li.is-unread > a { background: var(--g-100); }
.tray__list b { color: var(--ink); font-weight: 600; }
.tray__list .avatar { width: 36px; height: 36px; font-size: 12px; }
.tray__ago { display: block; margin-top: 2px; color: var(--faint); font-size: 12px; }

/* Avatar */
.avatar { display: grid; place-items: center; flex: 0 0 auto; width: 44px; height: 44px; border-radius: 50%; background: var(--av, var(--g-100)); color: #121624c7; letter-spacing: .02em; font-size: 13.5px; font-weight: 600; }
.avatar--sm { width: 36px; height: 36px; font-size: 12px; }
.avatar--lg { width: 54px; height: 54px; font-size: 16px; }
.avatar--xl { width: 72px; height: 72px; font-size: 22px; }

/* ---- Board (page) ---- */
.board { min-width: 0; padding: 28px 22px 22px; background: var(--panel); border-radius: var(--r-lg); }
.board__head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px 24px; margin-bottom: 26px; }
.board__title { letter-spacing: -.035em; font-size: clamp(30px, 3vw, 40px); font-weight: 600; line-height: 1.1; outline: none; }
.board__title .word { display: inline-block; overflow: hidden; vertical-align: top; margin-bottom: -.08em; padding-bottom: .08em; }
.board__title .ch { display: inline-block; will-change: transform; }
.board__sub { margin-top: 8px; color: var(--muted); }
.board__sub a { color: var(--g-700); font-weight: 600; }
.board__sub a:hover { text-decoration: underline; text-underline-offset: 3px; }
.board__actions { display: flex; flex-wrap: wrap; gap: 12px; }
.back { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 10px; color: var(--muted); font-size: 14px; font-weight: 500; }
.back svg { width: 16px; height: 16px; }
.back:hover { color: var(--ink); }

/* Buttons */
.btn { display: inline-flex; justify-content: center; align-items: center; gap: 10px; height: 54px; padding: 0 26px; border-radius: 999px; white-space: nowrap; cursor: pointer; font-size: 16px; font-weight: 500; transition: background-color .2s, box-shadow .2s, color .2s; }
.btn svg { width: 20px; height: 20px; }
.btn--primary { color: var(--on-dark); background: linear-gradient(180deg, var(--g-700), var(--g-950)); }
.btn--primary:hover { background: linear-gradient(180deg, var(--g-600), var(--g-800)); }
.btn--ghost { color: var(--ink); background: var(--card); box-shadow: inset 0 0 0 1.5px var(--g-950); }
.btn--ghost:hover { background: var(--g-100); }
.btn--danger { color: #fff6f5; background: linear-gradient(#d64a4a, #a32727); }
.btn--danger:hover { background: linear-gradient(#e05555, #b23030); }
.btn--light { color: var(--g-950); background: var(--on-dark); }
.btn--light:hover { background: #fff; }
.btn--block { width: 100%; }
.btn--sm { height: 42px; padding: 0 18px; font-size: 14px; }
.btn--sm svg { width: 18px; height: 18px; }
.btn--md { height: 48px; padding: 0 22px; font-size: 15px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: default; }
.link-btn { color: var(--g-700); border-radius: 6px; font-size: 13.5px; font-weight: 600; }
.link-btn:hover { text-decoration: underline; text-underline-offset: 3px; }
.link-btn--danger { color: var(--rose); }
.chip { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 999px; white-space: nowrap; box-shadow: inset 0 0 0 1.5px var(--g-950); font-size: 14px; font-weight: 500; transition: background .2s; }
.chip svg { width: 15px; height: 15px; stroke-width: 2px; }
.chip:hover { background: var(--g-100); }
.chip--soft { box-shadow: none; background: var(--panel); }

/* ---- Cards ---- */
.card { position: relative; min-width: 0; padding: 22px; border-radius: var(--r-md); background: var(--card); box-shadow: var(--shadow); }
.card.card--flush { padding: 0; overflow: hidden; }
.card__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.card__title { letter-spacing: -.02em; font-size: 19px; font-weight: 500; }
.card__sub { margin-top: 4px; color: var(--muted); font-size: 13px; }
.empty { margin-top: 14px; color: var(--faint); font-size: 13.5px; }
.empty--block { padding: 40px 20px; text-align: center; }

/* Dashboard grid */
.grid { display: grid; gap: var(--gap); grid-template-columns: repeat(12, minmax(0, 1fr)); grid-template-areas: "s1 s1 s1 s2 s2 s2 s3 s3 s3 s4 s4 s4" "an an an an an an re re re sd sd sd" "tm tm tm tm tm pg pg pg pg sd sd sd"; }
.side { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }
.side .projects { flex: 1 1 0%; }

/* Stat cards */
.stat { display: flex; flex-direction: column; min-height: 178px; }
.stat__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.stat__title { letter-spacing: -.015em; font-size: 18px; font-weight: 500; }
.arrow { display: grid; place-items: center; flex: 0 0 auto; width: 38px; height: 38px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px; transition: transform .3s var(--ease), background .2s, color .2s; }
.arrow:hover { background: var(--ink); color: var(--card); transform: rotate(45deg); }
.stat__num { margin: auto 0 10px; padding-top: 18px; letter-spacing: -.04em; font-size: clamp(42px, 4vw, 56px); font-weight: 600; line-height: 1; }
.stat__note { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13.5px; }
.stat__note--plain { color: var(--g-700); }
.trend { display: inline-flex; align-items: center; gap: 1px; padding: 0 4px; border-radius: 5px; box-shadow: inset 0 0 0 1px; font-size: 10.5px; line-height: 16px; }
.trend svg { width: 10px; height: 10px; stroke-width: 2.6px; }
.stat--hero { color: var(--on-dark); background: linear-gradient(135deg, var(--g-800) 0%, var(--g-950) 100%); box-shadow: 0 14px 30px -16px #1f2360b3; }
.stat--hero::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; background: radial-gradient(90% 80% at 100% 100%, #7f88d64d, transparent 60%); }
.stat--hero .arrow { color: var(--g-950); background: var(--on-dark); box-shadow: none; }
.stat--hero .arrow:hover { background: var(--g-400); }
.stat--hero .stat__note { color: var(--on-dark-soft); }

/* Weekly pill bars */
.analytics { display: flex; flex-direction: column; }
.bars { flex: 1 1 0%; display: grid; grid-template-columns: repeat(var(--n, 7), minmax(0, 1fr)); gap: clamp(8px, 1.4vw, 16px); min-height: 190px; margin-top: 26px; }
.bars li { display: grid; grid-template-rows: 1fr auto; gap: 10px; min-width: 0; }
.bar { position: relative; align-self: end; width: 100%; height: calc(var(--h) * 100%); min-height: 40px; border-radius: 999px; overflow: hidden; -webkit-tap-highlight-color: transparent; }
.bar:focus-visible { box-shadow: var(--focus); }
.bar__fill { position: absolute; inset: 0; border-radius: inherit; background: var(--g-700); }
.bar--light .bar__fill { background: var(--g-400); }
.bar--dark .bar__fill { background: var(--g-950); }
.bar--plan .bar__fill { background: repeating-linear-gradient(-45deg, var(--hatch) 0 2.4px, transparent 2.4px 8px); box-shadow: inset 0 0 0 1.5px #8f97ab59; }
.bar:hover .bar__fill { filter: brightness(1.08); }
.bar__day { text-align: center; color: var(--faint); font-size: 14px; }
.bars__tip { position: absolute; z-index: 2; top: 0; left: 0; padding: 3px 8px; border-radius: 7px; white-space: nowrap; color: var(--ink); background: var(--card); box-shadow: 0 0 0 1px var(--hair), 0 6px 16px -8px #12162459; pointer-events: none; font-size: 11px; font-weight: 600; opacity: 0; }
.bars__tip::after { content: ""; position: absolute; top: 100%; left: 50%; translate: -50%; width: 1px; height: 10px; background: var(--hatch); }

/* Reminder-style "live now" */
.reminder { display: flex; flex-direction: column; }
.reminder__what { margin-top: 26px; letter-spacing: -.025em; color: var(--g-800); font-size: clamp(20px, 1.8vw, 24px); font-weight: 600; line-height: 1.15; overflow-wrap: anywhere; }
.reminder__when { margin: 10px 0 22px; color: var(--muted); font-size: 14.5px; }
.reminder__btn { margin-top: auto; }

/* Project-style lists */
.plist { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; max-height: 300px; margin-top: 20px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.pitem { display: flex; align-items: center; gap: 14px; }
.pitem:hover .pitem__name { color: var(--g-700); }
.pitem__name { display: block; font-size: 15px; font-weight: 500; line-height: 1.3; transition: color .2s; }
.pitem__due { display: block; color: var(--faint); font-size: 12px; }
.pico { position: relative; flex: 0 0 auto; width: 28px; height: 28px; border-radius: 8px; }
.pico--0 { border-radius: 4px; background: repeating-linear-gradient(-60deg, transparent 0 4px, #3b5bdb 4px 7px, transparent 7px 9px); }
.pico--1 { border-radius: 50%; background: conic-gradient(#1f9e8f 0 33%, #0b5f6b 0 66%, #6bd1c2 0); }
.pico--2 { background: linear-gradient(#f08c3c, #f08c3c) 50% 0 / 6px 11px no-repeat, linear-gradient(#4ab6e8, #4ab6e8) 50% 100% / 6px 11px no-repeat, linear-gradient(#e64980, #e64980) 0 50% / 11px 6px no-repeat, linear-gradient(#40c057, #40c057) 100% 50% / 11px 6px no-repeat; }
.pico--3 { border-radius: 50%; background: conic-gradient(from 200deg, #f59f00 0 50%, #fd7e14 0 75%, transparent 0); }
.pico--4 { background: radial-gradient(circle at 50% 30%, #e8590c 0 6px, transparent 6.5px), radial-gradient(circle at 28% 70%, #6741d9 0 6px, transparent 6.5px), radial-gradient(circle at 72% 70%, #364fc7 0 6px, transparent 6.5px); }
.pico--5 { border-radius: 50%; background: radial-gradient(circle, var(--g-400) 0 5px, transparent 5.5px), var(--g-100); }

/* Team-style lists */
.tlist { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; margin-top: 22px; }
.titem { display: flex; align-items: center; gap: 14px; min-width: 0; }
.titem__body { display: grid; flex: 1 1 0%; min-width: 0; }
.titem__name { font-size: 15.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.titem__task { color: var(--faint); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.titem__task b { color: var(--ink); font-weight: 600; }
.pill { flex: 0 0 auto; padding: 2px 8px; border-radius: 6px; box-shadow: inset 0 0 0 1px; font-size: 11px; font-weight: 500; white-space: nowrap; }
.pill--done { color: var(--g-700); background: var(--g-100); }
.pill--prog { color: var(--amber); background: var(--amber-bg); }
.pill--pend { color: var(--rose); background: var(--rose-bg); }
.pill--live { color: var(--mint); background: var(--mint-bg); }
.pill--mute { color: var(--muted); background: var(--panel); }

/* Gauge */
.progress { display: flex; flex-direction: column; }
.gauge { position: relative; flex: 1 1 0%; display: grid; place-items: end center; width: min(100%, 300px); margin: 18px auto 0; }
.gauge__svg { width: 100%; height: auto; overflow: visible; }
.gauge__track, .gauge__seg { fill: none; stroke-width: 44px; stroke-linecap: round; }
.gauge__track { stroke: var(--panel); }
.gauge__seg { stroke-dasharray: 0 100; }
.gauge__seg--done { stroke: var(--g-700); }
.gauge__seg--prog { stroke: var(--g-950); }
.gauge__seg--pend { stroke: url(#hatch); }
.gauge__read { position: absolute; left: 0; right: 0; bottom: 0; display: grid; justify-items: center; }
.gauge__pct { letter-spacing: -.05em; font-size: clamp(36px, 3.6vw, 50px); font-weight: 600; line-height: 1; }
.gauge__lbl { margin-top: 4px; color: var(--muted); font-size: 13.5px; }
.legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 16px; margin-top: 22px; color: var(--muted); font-size: 13.5px; }
.legend li { display: inline-flex; align-items: center; gap: 8px; }
.sw { width: 16px; height: 16px; border-radius: 50%; }
.sw--done { background: var(--g-700); }
.sw--prog { background: var(--g-950); }
.sw--pend { background: repeating-linear-gradient(-45deg, var(--hatch) 0 2px, transparent 2px 5px); box-shadow: inset 0 0 0 1px #8f97ab66; }

/* Dark swirl card (tracker) */
.tracker { isolation: isolate; display: flex; flex-direction: column; min-height: 210px; overflow: hidden; color: var(--on-dark); background: var(--deep); }
.tracker::before { content: ""; z-index: -1; position: absolute; inset: -30%; background: repeating-radial-gradient(ellipse at 95% 105%, transparent 0 11px, var(--swirl) 12px 13px), radial-gradient(60% 70% at 100% 100%, var(--g-700), transparent 70%), radial-gradient(55% 55% at 0% 0%, var(--g-950), transparent 70%); }
.tracker__time { display: flex; justify-content: center; margin: auto 0 0; padding-top: 14px; text-align: center; letter-spacing: -.02em; font-size: clamp(38px, 3.4vw, 52px); font-weight: 600; line-height: 1.1; }
.tracker__sub { margin-top: 6px; text-align: center; color: var(--on-dark-soft); font-size: 13px; }
.tracker__ctrl { display: flex; justify-content: center; gap: 14px; margin-top: 14px; }
.tbtn { display: grid; place-items: center; width: 50px; height: 50px; border-radius: 50%; color: var(--g-950); background: var(--on-dark); transition: transform .25s var(--ease); }
.tbtn:hover { transform: scale(1.07); }
.tbtn:active { transform: scale(.94); }
.tbtn svg { width: 22px; height: 22px; }
.tbtn:focus-visible { box-shadow: 0 0 0 3px var(--deep), 0 0 0 5px var(--on-dark); }

/* ---- Toolbar + segmented control ---- */
.toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px 20px; margin-bottom: 18px; }
.toolbar__meta { color: var(--muted); font-size: 14px; }
.toolbar__meta b { color: var(--ink); font-weight: 600; }
.toolbar__group { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.seg { isolation: isolate; position: relative; display: inline-flex; gap: 2px; max-width: 100%; padding: 5px; border-radius: 999px; background: var(--card); box-shadow: var(--shadow); overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg__pill { position: absolute; z-index: -1; top: 5px; bottom: 5px; left: 0; width: 0; border-radius: 999px; background: linear-gradient(180deg, var(--g-700), var(--g-950)); opacity: 0; }
.seg__btn { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 18px; border-radius: 999px; white-space: nowrap; color: var(--muted); font-size: 14px; font-weight: 500; transition: color .25s; }
.seg__btn:hover { color: var(--ink); }
.seg__btn[aria-pressed="true"], .seg__btn[aria-current="page"] { color: var(--on-dark); }
.seg__btn:focus-visible { box-shadow: inset 0 0 0 2px var(--g-400); }
.seg__btn svg { width: 17px; height: 17px; }
.seg--tabs .seg__btn { height: 44px; padding: 0 20px; }
/* Before JS has placed the pill, keep the active button readable. */
html:not(.js) .seg__btn[aria-pressed="true"], html:not(.js) .seg__btn[aria-current="page"] { background: var(--g-800); }

/* ---- Forms ---- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 18px; }
.form-stack { display: grid; gap: 16px; }
.field { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; color: var(--muted); font-size: 13.5px; font-weight: 500; }
.field > :is(input, select, textarea, .field__err) { flex: 1 0 100%; }
.field--wide { grid-column: 1 / -1; }
.field__hint { color: var(--faint); font-weight: 400; }
.field input:not([type="checkbox"]):not([type="radio"]), .field select, .field textarea, .input {
  width: 100%; min-height: 48px; padding: 0 14px; border: 1.5px solid var(--hair); border-radius: 12px; outline: none; background: var(--panel); color: var(--ink); font-size: 15px; font-weight: 400; transition: border-color .2s, box-shadow .2s; }
.field textarea, textarea.input { padding: 12px 14px; line-height: 1.5; resize: vertical; }
.field select, select.input { appearance: none; cursor: pointer; padding-right: 42px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23616a7e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E"); background-position: right 14px center; background-repeat: no-repeat; background-size: 18px auto; }
.field :is(input, select, textarea):focus-visible, .input:focus-visible { border-color: var(--g-600); box-shadow: 0 0 0 3px color-mix(in srgb, var(--g-600) 18%, transparent); }
.field :is(input, select, textarea):disabled, .input:disabled { opacity: .6; cursor: not-allowed; }
.field input[readonly], .input[readonly] { color: var(--muted); }
.input--sm { min-height: 40px; border-radius: 10px; font-size: 14px; }
.input--mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13.5px; }
.input--bare { min-height: 0; padding: 4px 8px; border-color: transparent; background: transparent; }
.input--bare:hover { border-color: var(--hair); }
.field__err { color: var(--rose); font-size: 12.5px; font-weight: 500; }
.has-error :is(input, select, textarea) { border-color: var(--rose) !important; }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.set-label { margin-bottom: 12px; padding: 0; color: var(--faint); letter-spacing: .06em; text-transform: uppercase; font-size: 13px; font-weight: 600; }
.lang-box { padding: 18px; border-radius: 16px; background: var(--panel); box-shadow: inset 4px 0 0 var(--g-400); }
.lang-box .field input:not([type="checkbox"]), .lang-box .field textarea { background: var(--card); }
.lang-box__head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }

/* Switches */
.switches { display: grid; }
.switches li { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 16px 0; border-bottom: 1px solid var(--hair); }
.switches li:last-child { border-bottom: 0; }
.switches__t { font-size: 15px; font-weight: 600; }
.switches__d { margin-top: 2px; color: var(--muted); font-size: 13px; }
.switch { position: relative; flex: 0 0 auto; display: inline-block; width: 52px; height: 30px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch__track { position: absolute; inset: 0; border-radius: 999px; background: #cfd3dc; transition: background-color .3s; pointer-events: none; }
.switch__knob { position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fbfbfd; box-shadow: 0 2px 6px #12162440; transition: transform .45s var(--ease); pointer-events: none; }
.switch input:checked ~ .switch__track { background: var(--g-700); }
.switch input:checked ~ .switch__knob { transform: translateX(22px); }
.switch input:focus-visible ~ .switch__track { box-shadow: var(--focus); }
.switch input:disabled ~ .switch__track { opacity: .5; }

/* Radio chips + swatches */
.radios { display: flex; flex-wrap: wrap; gap: 10px; }
.radios--tight { gap: 6px; }
.radio { cursor: pointer; }
.radio input { position: absolute; opacity: 0; pointer-events: none; }
.radio span { display: inline-block; padding: 10px 18px; border-radius: 999px; background: var(--panel); font-size: 14.5px; font-weight: 500; transition: background-color .2s, color .2s; }
.radios--tight .radio span { padding: 7px 14px; font-size: 13.5px; }
.radio input:checked + span { color: var(--on-dark); background: var(--g-700); }
.radio input:focus-visible + span { box-shadow: var(--focus); }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.swatch { position: relative; display: flex; align-items: center; gap: 10px; padding: 10px 16px 10px 10px; border-radius: 14px; background: var(--panel); cursor: pointer; font-size: 14.5px; font-weight: 500; box-shadow: inset 0 0 0 1.5px transparent; transition: box-shadow .2s, background-color .2s; }
.swatch input { position: absolute; opacity: 0; pointer-events: none; }
.swatch__chip { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, var(--sw), color-mix(in srgb, var(--sw) 55%, #000)); }
.swatch__trio { display: flex; flex: 0 0 auto; width: 36px; height: 30px; border-radius: 9px; overflow: hidden; box-shadow: inset 0 0 0 1px #0000001a; }
.swatch__trio i { flex: 1; }
.swatch:has(input:checked) { background: var(--card); box-shadow: inset 0 0 0 2px var(--sw, var(--g-600)); }
.swatch:has(input:focus-visible) { box-shadow: var(--focus); }

/* Checkbox (matrix, inline) */
.check { appearance: none; display: inline-grid; place-items: center; width: 22px; height: 22px; margin: 0; border-radius: 7px; background: var(--panel); box-shadow: inset 0 0 0 1.5px var(--hair); cursor: pointer; transition: background .2s, box-shadow .2s; }
.check::after { content: ""; width: 10px; height: 6px; border: 2.2px solid var(--on-dark); border-top: 0; border-right: 0; transform: translateY(-1px) rotate(-45deg) scale(0); transition: transform .3s var(--ease); }
.check:checked { background: var(--g-700); box-shadow: none; }
.check:checked::after { transform: translateY(-1px) rotate(-45deg) scale(1); }
.check:hover { box-shadow: inset 0 0 0 1.5px var(--g-400); }
.inline-check { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-size: 14.5px; font-weight: 500; cursor: pointer; }

/* ---- Settings-style split (tabs + pane) ---- */
.settings { display: grid; grid-template-columns: 260px minmax(0, 1fr); align-items: start; gap: var(--gap); }
.set-nav { position: sticky; top: 14px; padding: 10px; }
.set-nav__tabs { position: relative; display: grid; gap: 4px; }
.set-nav__pill { position: absolute; top: 0; left: 0; right: 0; height: 48px; border-radius: 14px; background: var(--g-100); opacity: 0; }
.set-nav__tab { position: relative; display: flex; align-items: center; gap: 12px; height: 48px; padding: 0 14px; border-radius: 14px; color: var(--muted); font-size: 15px; font-weight: 500; text-align: left; transition: color .2s; }
.set-nav__tab:hover { color: var(--ink); }
.set-nav__tab[aria-selected="true"] { color: var(--g-800); font-weight: 600; }
.set-nav__tab:focus-visible { box-shadow: inset 0 0 0 2px var(--g-600); }
.set-nav__tab .count { margin-left: auto; color: var(--faint); font-size: 12px; font-weight: 600; }
.set-body { min-height: 460px; padding: 28px; }
.pane__head { display: flex; align-items: center; gap: 18px; margin-bottom: 24px; }
.pane__title { letter-spacing: -.03em; font-size: 22px; font-weight: 600; }
.pane__sub { margin-top: 4px; color: var(--muted); font-size: 14px; }
.pane__foot { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 10px; margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--hair); }
.pane__foot .btn { height: 48px; padding: 0 24px; font-size: 15px; }
.pane__foot-note { margin-right: auto; color: var(--faint); font-size: 13px; }

/* ---- Survey cards (project cards) ---- */
.cards { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.scard { display: flex; flex-direction: column; padding: 22px 22px 20px; }
.scard__top { display: flex; align-items: flex-start; gap: 12px; }
.scard__top .pico { margin-top: 2px; }
.scard__name { letter-spacing: -.015em; font-size: 17px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.scard__name a:hover { color: var(--g-700); }
.scard__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: 6px; }
.scard__desc { margin-top: 14px; color: var(--muted); font-size: 13.5px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 3em; }
.scard__stats { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--hair); text-align: center; }
.scard__stats p { color: var(--muted); font-size: 12px; }
.scard__stats b { display: block; color: var(--ink); font-size: 18px; font-weight: 600; }
.scard__actions { display: flex; gap: 8px; margin-top: 18px; }
.scard__actions .btn { flex: 1 1 0%; height: 42px; padding: 0 12px; font-size: 14px; }

/* Dot menu */
.dmenu { position: relative; margin-left: auto; }
.dmenu__btn { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; color: var(--muted); }
.dmenu__btn:hover { background: var(--panel); color: var(--ink); }
.dmenu__btn svg { width: 18px; height: 18px; }
.menu { position: absolute; z-index: 30; top: calc(100% + 6px); right: 0; min-width: 200px; padding: 6px; border-radius: 14px; background: var(--card); box-shadow: 0 0 0 1px var(--hair), 0 18px 40px -12px #12162459; transform-origin: 100% 0; }
.menu__label { padding: 8px 10px 4px; color: var(--faint); letter-spacing: .06em; text-transform: uppercase; font-size: 11.5px; font-weight: 600; }
.menu__item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 9px; text-align: left; font-size: 14px; }
.menu__item svg { width: 17px; height: 17px; color: var(--muted); }
.menu__item:hover, .menu__item:focus-visible { background: var(--g-100); outline: none; }
.menu__item--danger { color: var(--rose); }
.menu__item--danger svg { color: currentColor; }
.menu__item--danger:hover { background: var(--rose-bg); }
.menu__sep { height: 1px; margin: 6px 4px; background: var(--hair); }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; min-width: 640px; text-align: left; font-size: 14px; }
.table th { padding: 14px 16px 10px; color: var(--faint); letter-spacing: .06em; text-transform: uppercase; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.table td { padding: 12px 16px; border-top: 1px solid var(--hair); vertical-align: middle; }
.table tbody tr { transition: background .2s; }
.table tbody tr:hover { background: color-mix(in srgb, var(--panel) 70%, transparent); }
.table .muted { color: var(--muted); }
.table .faint { color: var(--faint); }
.table .num { text-align: right; }
.table a:not(.btn):not(.chip) { color: var(--g-700); font-weight: 500; }
.table a:not(.btn):not(.chip):hover { text-decoration: underline; text-underline-offset: 3px; }
.who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.who .avatar { width: 38px; height: 38px; font-size: 12px; }
.who__name { display: block; font-weight: 600; }
.who__sub { display: block; color: var(--faint); font-size: 12.5px; }

/* Pagination */
.pager { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-top: 18px; }
.pager__info { color: var(--muted); font-size: 14px; }
.pager__info b { color: var(--ink); }
.pager__btns { display: flex; gap: 8px; }

/* ---- Analytics (results) ---- */
.an-grid { display: grid; gap: var(--gap); grid-template-columns: repeat(12, minmax(0, 1fr)); }
.span-3 { grid-column: span 3; } .span-4 { grid-column: span 4; } .span-5 { grid-column: span 5; } .span-6 { grid-column: span 6; } .span-7 { grid-column: span 7; } .span-8 { grid-column: span 8; } .span-12 { grid-column: span 12; }
.kpi { display: flex; flex-direction: column; min-height: 150px; overflow: hidden; }
.kpi__label { color: var(--muted); font-size: 14.5px; font-weight: 500; }
.kpi__num { margin-top: 10px; letter-spacing: -.04em; font-size: clamp(30px, 2.6vw, 40px); font-weight: 600; line-height: 1; }
.kpi__num small { color: var(--faint); font-size: .5em; letter-spacing: 0; font-weight: 500; }
.kpi__delta { display: inline-flex; align-items: center; gap: 4px; margin-top: auto; padding-top: 10px; color: var(--g-700); font-size: 12.5px; font-weight: 600; }
.kpi__delta span { color: var(--faint); font-weight: 500; }
.kpi__delta svg { width: 14px; height: 14px; stroke-width: 2.4px; }
.donut { position: relative; width: min(200px, 100%); margin: 18px auto 0; }
.donut__svg { display: block; width: 100%; height: auto; transform: rotate(-90deg); }
.donut__svg circle { fill: none; stroke-width: 16px; stroke-linecap: butt; }
.donut__svg .donut__track { stroke: var(--panel); }
.donut__read { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.donut__num { letter-spacing: -.04em; font-size: 30px; font-weight: 600; line-height: 1.1; }
.donut__lbl { color: var(--muted); font-size: 12.5px; }
.donut__legend { display: grid; gap: 4px; margin-top: 18px; }
.donut__legend li { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 10px; font-size: 13.5px; }
.donut__legend b { margin-left: auto; font-weight: 600; }
.col__dot { flex: 0 0 auto; width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.leaders { display: grid; gap: 14px; margin-top: 18px; }
.leaders li { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 6px 12px; }
.leaders__name { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.leaders__n { color: var(--muted); font-size: 13px; font-weight: 600; white-space: nowrap; }
.leaders .meter { grid-column: 1 / -1; }
.meter { height: 8px; border-radius: 99px; background: var(--panel); overflow: hidden; }
.meter__fill { height: 100%; border-radius: inherit; background: var(--g-600); transform-origin: 0 50%; }
.meter__fill--top { background: var(--g-950); }
.qcard__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.qcard__num { color: var(--g-700); font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.qcard__title { margin-top: 4px; letter-spacing: -.015em; font-size: 17px; font-weight: 600; line-height: 1.35; }
.qcard__count { flex: 0 0 auto; padding: 4px 10px; border-radius: 999px; background: var(--panel); color: var(--muted); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.avg { display: flex; align-items: baseline; gap: 10px; margin-top: 16px; }
.avg b { letter-spacing: -.04em; font-size: 40px; font-weight: 600; line-height: 1; }
.avg span { color: var(--muted); font-size: 13.5px; }
.bars--compact { min-height: 150px; margin-top: 18px; }
.answers { display: grid; gap: 8px; max-height: 300px; margin-top: 16px; overflow-y: auto; scrollbar-width: thin; }
.answers li { padding: 10px 12px; border-radius: 12px; background: var(--panel); font-size: 14px; line-height: 1.45; }

/* ---- Builder ---- */
.builder { display: grid; grid-template-columns: 360px minmax(0, 1fr); align-items: start; gap: var(--gap); }
.qlist-card { position: sticky; top: 14px; padding: 18px; }
.qlist { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; margin-top: 14px; }
.qrow { position: relative; display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 14px; transition: background .2s; }
.qrow:hover { background: var(--panel); }
.qrow.is-active { background: var(--g-100); }
.qrow__main { display: flex; flex: 1 1 0%; align-items: center; gap: 12px; min-width: 0; text-align: left; }
.qrow__icon { display: grid; place-items: center; flex: 0 0 auto; width: 38px; height: 38px; border-radius: 12px; background: var(--g-100); color: var(--g-700); }
.qrow.is-active .qrow__icon { background: linear-gradient(180deg, var(--g-700), var(--g-950)); color: var(--on-dark); }
.qrow__icon svg { width: 19px; height: 19px; }
.qrow__k { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--g-700); font-size: 11.5px; font-weight: 600; }
.qrow__k span { color: var(--faint); font-weight: 500; }
.qrow__req { color: var(--rose); }
.qrow__t { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 14px; font-weight: 500; }
/* Row tools float over the end of the row on hover, so titles get the full width. */
.qrow__tools { --row-bg: var(--panel); position: absolute; top: 50%; right: 8px; translate: 0 -50%; display: flex; gap: 2px; padding-left: 30px; background: linear-gradient(90deg, transparent, var(--row-bg) 26px); border-radius: 0 10px 10px 0; opacity: 0; pointer-events: none; transition: opacity .2s; }
.qrow:hover .qrow__tools, .qrow:focus-within .qrow__tools { opacity: 1; pointer-events: auto; }
.qrow.is-active .qrow__tools { --row-bg: var(--g-100); }
.section-box .qrow__tools { --row-bg: var(--card); }
.qrow__tools .tool:hover { background: var(--hair); }
@media (hover: none) {
  .qrow__tools { position: static; translate: none; padding-left: 0; background: none; opacity: 1; pointer-events: auto; }
}
.tool { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; color: var(--muted); }
.tool:hover { background: var(--card); color: var(--ink); }
.tool--danger:hover { color: var(--rose); }
.tool svg { width: 15px; height: 15px; }
.section-box { margin-top: 14px; padding: 8px; border-radius: 16px; background: var(--panel); }
.section-box .qrow:hover { background: var(--card); }
.section-box__head { display: flex; align-items: center; gap: 2px; }
.section-box__name { flex: 1 1 0%; min-width: 0; color: var(--faint); letter-spacing: .06em; text-transform: uppercase; font-size: 12px; font-weight: 600; }
.section-box__es { width: 100%; color: var(--muted); font-size: 12.5px; }
.add-q { display: flex; justify-content: space-between; align-items: center; width: 100%; height: 50px; padding: 0 8px 0 20px; border-radius: 999px; color: var(--on-dark); background: linear-gradient(180deg, var(--g-700), var(--g-950)); font-size: 15px; font-weight: 500; }
.add-q:hover { background: linear-gradient(180deg, var(--g-600), var(--g-800)); }
.add-q i { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: #ffffff26; font-style: normal; }
.add-q svg { width: 18px; height: 18px; }
.types { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.type { display: grid; gap: 4px; align-content: start; padding: 14px; border-radius: 16px; background: var(--panel); text-align: left; box-shadow: inset 0 0 0 1.5px transparent; transition: box-shadow .2s, background .2s, transform .25s var(--ease); }
.type:hover { background: var(--g-100); }
.type svg { width: 22px; height: 22px; margin-bottom: 6px; color: var(--muted); }
.type b { font-size: 13.5px; font-weight: 600; line-height: 1.3; }
.type small { color: var(--faint); font-size: 12px; line-height: 1.35; }
.type[aria-pressed="true"] { background: var(--card); box-shadow: inset 0 0 0 2px var(--g-600); }
.type[aria-pressed="true"] svg { color: var(--g-700); }
.editor__head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; padding-bottom: 18px; margin-bottom: 22px; border-bottom: 1px solid var(--hair); }
.editor__head .btn { height: 44px; padding: 0 20px; font-size: 15px; }
.blank { display: grid; place-items: center; min-height: 460px; text-align: center; }
.blank__art { width: 230px; height: auto; margin: 0 auto; }
.blank__title { margin-top: 18px; letter-spacing: -.03em; font-size: 22px; font-weight: 600; }
.blank__sub { margin-top: 6px; color: var(--muted); font-size: 14.5px; }
.blank .btn { margin-top: 22px; }

.flag { flex: 0 0 auto; width: 30px; height: 20px; border-radius: 5px; overflow: hidden; stroke: none; box-shadow: 0 0 0 1px #0000000f; }
.bleed { margin: 18px -22px -22px; }
@media (max-width: 1360px) { .bleed { margin: 18px -20px -20px; } }
@media (min-width: 1181px) and (max-height: 1060px) { .bleed { margin: 18px -20px -18px; } }
.pane__head .flag { width: 42px; height: 28px; border-radius: 7px; }

/* Share */
.copy-row { display: flex; gap: 10px; }
.copy-row .input { flex: 1 1 0%; }
.share-btns { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.callout { display: flex; gap: 14px; align-items: flex-start; margin-bottom: var(--gap); padding: 16px 18px; border-radius: var(--r-md); background: var(--amber-bg); color: #6d4206; font-size: 14px; }
.callout svg { color: var(--amber); }
.callout b { color: #4a2c03; }

/* Roles matrix */
.matrix .table { min-width: 720px; }
.matrix td, .matrix th { text-align: center; }
.matrix td:first-child, .matrix th:first-child { text-align: left; }
.matrix .grp td { padding-top: 18px; color: var(--faint); letter-spacing: .06em; text-transform: uppercase; font-size: 11.5px; font-weight: 600; border-top: 0; background: transparent; }
.matrix .perm { display: block; font-weight: 500; }
.matrix .perm-key { display: block; color: var(--faint); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11.5px; }
.tick { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; }
.tick--on { color: var(--on-dark); background: var(--g-700); }
.tick--off { color: var(--hatch); }
.tick svg { width: 14px; height: 14px; stroke-width: 2.6px; }

/* People (users) */
.people { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.member { display: flex; flex-direction: column; align-items: center; padding: 26px 20px 20px; text-align: center; }
.member__av { position: relative; }
.member__av .avatar { width: 76px; height: 76px; font-size: 22px; }
.status { position: absolute; right: 2px; bottom: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 3px var(--card); }
.status--online { --c: #2fb36b; }
.status--offline { --c: #b5bac6; }
.member__name { margin-top: 14px; letter-spacing: -.015em; font-size: 16.5px; font-weight: 600; }
.member__role { margin-top: 2px; color: var(--muted); font-size: 13.5px; overflow-wrap: anywhere; }
.member__dept { margin-top: 10px; padding: 3px 10px; border-radius: 999px; color: var(--g-800); background: var(--g-100); font-size: 11.5px; font-weight: 600; }
.member__stats { display: grid; grid-template-columns: 1fr 1fr; width: 100%; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--hair); }
.member__stats p { color: var(--muted); font-size: 12px; }
.member__stats b { display: block; color: var(--ink); font-size: 15px; font-weight: 600; }
.member__actions { display: flex; gap: 8px; width: 100%; margin-top: 18px; }
.member__actions .btn { flex: 1 1 0%; height: 42px; padding: 0 12px; font-size: 14px; }
.member .dmenu { position: absolute; top: 14px; right: 14px; }
.you { margin-left: 4px; color: var(--faint); font-size: 12px; font-weight: 500; }

/* ---- Modal (dialog look, Livewire-driven) ---- */
.modal { position: fixed; z-index: 90; inset: 0; display: grid; place-items: center; padding: 16px; background: #0d111d66; backdrop-filter: blur(3px); animation: fade-in .25s ease; }
.dlg { width: min(460px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; border-radius: 22px; color: var(--ink); background: var(--card); box-shadow: 0 30px 80px -20px #12162473; animation: dlg-in .45s var(--ease); }
.dlg--wide { width: min(620px, 100%); }
.dlg__form { display: grid; gap: 16px; padding: 26px; }
.dlg__title { letter-spacing: -.03em; font-size: 22px; font-weight: 600; }
.dlg__text { color: var(--muted); font-size: 14.5px; }
.dlg__cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dlg__row { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.dlg .btn { height: 46px; padding: 0 20px; font-size: 15px; }
@keyframes dlg-in { from { opacity: 0; transform: translateY(14px) scale(.98); } }
@keyframes fade-in { from { opacity: 0; } }

/* Toast */
.toast { position: fixed; z-index: 120; left: 0; right: 0; bottom: 24px; width: fit-content; max-width: calc(100vw - 32px); margin: 0 auto; padding: 12px 18px; border-radius: 999px; color: var(--on-dark); background: var(--g-950); box-shadow: 0 16px 40px -14px #1f236099; font-size: 14px; font-weight: 500; opacity: 0; pointer-events: none; }
.toast:empty { display: none; }

/* Inline status messages */
.note { padding: 10px 14px; border-radius: 12px; font-size: 13.5px; font-weight: 500; }
.note--ok { color: var(--g-800); background: var(--g-100); }
.note--err { color: var(--rose); background: var(--rose-bg); }

/* Scrim (mobile drawer) */
.scrim { position: fixed; z-index: 30; inset: 0; background: #0d111d59; opacity: 0; transition: opacity .3s; }
.scrim.is-on { opacity: 1; }

/* ---- Login ---- */
.auth { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 14px; min-height: 100dvh; padding: 14px; }
.auth__panel { display: grid; place-items: center; padding: 40px 24px; border-radius: var(--r-lg); background: var(--panel); }
.auth__form { display: grid; gap: 18px; width: min(400px, 100%); }
.auth__hero { isolation: isolate; position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; padding: 40px; border-radius: var(--r-lg); color: var(--on-dark); background: var(--deep); }
.auth__hero::before { content: ""; z-index: -1; position: absolute; inset: -30%; background: repeating-radial-gradient(circle at 80% 75%, transparent 0 16px, var(--swirl) 17px 18px), radial-gradient(60% 60% at 85% 80%, var(--g-700), transparent 70%), radial-gradient(55% 55% at 0% 0%, var(--g-950), transparent 70%); }
.auth__quote { max-width: 14em; letter-spacing: -.035em; font-size: clamp(30px, 3.2vw, 44px); font-weight: 600; line-height: 1.1; }
.auth__sub { max-width: 30em; margin-top: 14px; color: var(--on-dark-soft); font-size: 15px; }

/* ---- Helpers ---- */
.stack-sm { display: grid; gap: 8px; } .stack { display: grid; gap: var(--gap); } .stack-lg { display: grid; gap: 22px; }
.row { display: flex; align-items: center; gap: 12px; } .row--wrap { flex-wrap: wrap; } .row--between { justify-content: space-between; }
.mt-4 { margin-top: 4px; } .mt-8 { margin-top: 8px; } .mt-14 { margin-top: 14px; } .mt-18 { margin-top: 18px; } .mt-22 { margin-top: 22px; } .ml-auto { margin-left: auto; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 13px; } .strong { font-weight: 600; } .accent { color: var(--g-700); }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--gap); align-items: start; }

/* ---- Responsive (Fernly's breakpoints) ---- */
@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after { transition-duration: .01ms !important; animation: none !important; }
}
@media (max-width: 1360px) {
  .app { grid-template-columns: 224px minmax(0, 1fr); }
  .profile__mail { display: none; }
  .card { padding: 20px; }
  .stat__title { font-size: 16.5px; }
  .builder { grid-template-columns: 320px minmax(0, 1fr); }
}
@media (min-width: 1181px) and (max-height: 1060px) {
  .app { gap: 12px; padding: 12px; }
  .shell { gap: 12px; }
  .sidebar { height: calc(100dvh - 24px); padding-top: 22px; top: 12px; }
  .nav { margin-top: 26px; }
  .nav + .nav { margin-top: 22px; }
  .nav__link { padding-top: 9px; padding-bottom: 9px; }
  .topbar { padding: 10px 14px; }
  .search input { height: 46px; }
  .icon-btn--round { width: 46px; height: 46px; }
  .dot { top: 11px; right: 12px; }
  .avatar--lg { width: 46px; height: 46px; font-size: 14.5px; }
  .board { padding: 22px 20px 16px; }
  .board__head { margin-bottom: 18px; }
  .board__title { font-size: 34px; }
  .board__sub { margin-top: 4px; }
  .btn { height: 48px; }
  .card { padding: 18px 20px; }
  .stat { min-height: 148px; }
  .stat__num { margin-bottom: 8px; padding-top: 8px; font-size: 48px; }
  .bars { min-height: 150px; margin-top: 16px; }
  .reminder__what { margin-top: 16px; }
  .plist { gap: 12px; margin-top: 14px; }
  .tlist { gap: 10px; margin-top: 14px; }
  .tracker { min-height: 0; }
  .gauge { width: min(100%, 270px); margin-top: 8px; }
  .legend { margin-top: 14px; }
}
@media (max-width: 1280px) {
  .span-3 { grid-column: span 6; }
  .span-8, .span-7 { grid-column: span 12; }
  .span-4, .span-5 { grid-column: span 6; }
}
@media (max-width: 1180px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-areas: "s1 s2" "s3 s4" "an an" "re pr" "tm tm" "pg tr"; }
  .side { display: contents; }
  .builder { grid-template-columns: minmax(0, 1fr); }
  .qlist-card { position: static; }
}
@media (max-width: 1024px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; z-index: 40; inset: 0 auto 0 0; width: min(290px, 84vw); height: 100dvh; border-radius: 0 var(--r-lg) var(--r-lg) 0; visibility: hidden; transform: translateX(-105%); transition: transform .45s var(--ease), visibility 0s .45s; box-shadow: 20px 0 60px -20px #12162459; }
  .sidebar.is-open { visibility: visible; transform: none; transition: transform .45s var(--ease); }
  .icon-btn.sidebar__close { display: grid; }
  .icon-btn.topbar__menu { display: grid; }
  .two-col { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .settings { grid-template-columns: minmax(0, 1fr); }
  .set-nav { position: static; }
  .set-nav__tabs { grid-auto-flow: column; grid-auto-columns: 1fr; }
  .set-nav__pill { display: none; }
  .set-nav__tab[aria-selected="true"] { background: var(--g-100); }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth__hero { display: none; }
}
@media (max-width: 720px) {
  .app { gap: 10px; padding: 10px; }
  .shell { gap: 10px; }
  .topbar { gap: 8px; padding: 10px; border-radius: 22px; }
  .search { flex: 1 1 0%; }
  .search input { height: 44px; padding-right: 16px; }
  .search__kbd, .profile__text { display: none; }
  .topbar__actions { gap: 6px; }
  .icon-btn--round { width: 44px; height: 44px; }
  .dot { top: 10px; right: 11px; }
  .avatar--lg { width: 44px; height: 44px; font-size: 14px; }
  .board { padding: 22px 12px 12px; border-radius: 22px; }
  .board__head { padding: 0 4px; }
  .board__actions { width: 100%; }
  .board__actions .btn { flex: 1 1 0%; height: 50px; padding: 0 16px; }
  .grid { grid-template-areas: "s1 s2" "s3 s4" "an an" "re re" "pr pr" "tm tm" "pg pg" "tr tr"; gap: 12px; }
  .stat { min-height: 150px; padding: 16px; }
  .stat__title { font-size: 14.5px; }
  .arrow { width: 30px; height: 30px; }
  .arrow svg { width: 16px; height: 16px; }
  .stat__note { font-size: 11.5px; }
  .an-grid { gap: 12px; }
  .span-3 { grid-column: span 6; } .span-4, .span-5, .span-6 { grid-column: span 12; }
  .kpi { min-height: 120px; padding: 16px; }
  .kpi__label { font-size: 13px; }
  .kpi__num { font-size: 26px; }
  .form-grid, .dlg__cols { grid-template-columns: minmax(0, 1fr); }
  .set-body { padding: 20px; }
  .set-nav__tab { justify-content: center; padding: 0 8px; font-size: 13.5px; }
  .set-nav__tab svg, .set-nav__tab .count { display: none; }
  .seg--tabs { width: 100%; }
  .seg--tabs .seg__btn { flex: 1 1 0%; justify-content: center; padding: 0 10px; }
  .seg--tabs .seg__btn svg { display: none; }
  .toolbar .seg { width: 100%; }
  .cards, .people { grid-template-columns: minmax(0, 1fr); }
  .copy-row { flex-direction: column; }
  .types { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pane__foot .btn { flex: 1 1 0%; }
}
@media (max-width: 400px) {
  .topbar .tray-wrap { display: none; }
}

/* Hide the shell until the intro runs; a failsafe reveals it if scripts fail. */
html.js.intro:not(.failsafe) .app { opacity: 0; }
