/* ==========================================================================
   Solfa HQ stylesheet
   --------------------------------------------------------------------------
   The same system as singwithsolfa.com, calibrated for a working tool:
     1. Tokens   – the Solfa palette, type, shape, shadows and motion, mirrored
                   from the app and the website. Change a token, never a rule.
     2. Base     – reset, type scale, buttons, fields, cards, states.
     3. Sky      – the sky band every screen opens with: gradient, three cloud
                   depths, the cloud-edge wave into the white sheet.
     4. Screens  – navigation, sign-in, home, sheet, settings, toasts.
   Laws, from the app: things have mass (springs, never linear snaps), the sky
   is calm, joy is earned. Clouds never cross text and never touch an edge.
   ========================================================================== */

/* ---------- 1. Tokens ---------------------------------------------------- */

@font-face {
  font-family: "Bricolage Grotesque";
  src: url("/assets/fonts/BricolageGrotesque-Variable.woff2") format("woff2");
  font-weight: 200 800;
  font-stretch: 75% 100%;
  font-display: swap;
}
@font-face { font-family: "M PLUS Rounded 1c"; src: url("/assets/fonts/MPLUSRounded1c-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "M PLUS Rounded 1c"; src: url("/assets/fonts/MPLUSRounded1c-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "M PLUS Rounded 1c"; src: url("/assets/fonts/MPLUSRounded1c-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  color-scheme: light;

  /* Core blue */
  --sky-50: #EFF9FF; --sky-100: #D9F1FE; --sky-200: #A2DDF9; --sky-400: #4AC4F6;
  --solfa-blue: #32ABED; --blue-600: #2D9FED; --blue-700: #2678EE;
  /* Accents: teal = live and progress, green = done, yellow = waiting, coral = errors only */
  --teal-100: #CCFAF4; --teal-500: #16CDB8; --teal-700: #078578;
  --green-100: #D7FADD; --green-500: #34D264; --green-700: #168C3B;
  --yellow-100: #FFF1BD; --yellow-700: #B97200;
  --coral-100: #FFD9D8; --coral-700: #B92F32;
  --violet-100: #E7E0FF; --violet-700: #4E2FC6;
  /* Whites and grays */
  --cloud: #FDFDFF; --mist: #F5F5F8; --fog: #E7E7EB; --silver: #C5C5C8;
  --muted: #9B9B9F; --secondary: #5D5D61; --ink: #262627;

  /* Roles */
  --surface: var(--cloud);
  --surface-2: var(--mist);
  --line: var(--fog);
  --text: var(--ink);
  --text-2: var(--secondary);
  --text-on-color: var(--cloud);
  --action-commit: var(--ink);
  --action-primary-text: var(--blue-700);
  --sky-gradient: linear-gradient(180deg, var(--sky-400) 0%, var(--solfa-blue) 100%);

  /* Type: Bricolage for titles and the wordmark, Rounded M+ for everything else. */
  --font-display: "Bricolage Grotesque", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --font-body: "M PLUS Rounded 1c", "Hiragino Maru Gothic ProN", "Nunito", system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, monospace;
  --tracking-display: -0.02em;

  /* Shape */
  --radius-control: 999px;
  --radius-field: 16px;
  --radius-card: 20px;
  --radius-canvas: 28px;
  --control-height: 56px;
  --control-sm: 46px;

  /* Shadows: ink at low opacity, layered like the app's popup card */
  --shadow-lift: 0 3px 8px rgba(38, 38, 39, 0.08);
  --shadow-card: 0 8px 18px rgba(38, 38, 39, 0.08), 0 2px 4px rgba(38, 38, 39, 0.04);
  --shadow-modal: 0 10px 18px rgba(38, 38, 39, 0.10), 0 24px 40px rgba(38, 38, 39, 0.06);
  --shadow-on-sky: 0 24px 48px rgba(20, 60, 100, 0.28);
  --shadow-shelf: 0 5px 0 rgba(0, 0, 0, 0.18);
  --shadow-shelf-pressed: 0 1px 0 rgba(0, 0, 0, 0.18);

  /* Motion: the app's springs sampled into CSS curves. */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.45, 0, 0.55, 1);
  --ease-press: linear(0, 0.064 4%, 0.21 8%, 0.387 12%, 0.561 17%, 0.713 21%, 0.834 25%, 0.924 29%, 0.984 33%, 1.021 38%, 1.04 42%, 1.046 46%, 1.044 50%, 1.038 54%, 1.03 58%, 1.022 62%, 1.014 67%, 1.009 71%, 1.004 75%, 1.001 79%, 0.999 83%, 0.998 88%, 0.998 92%, 0.998 96%, 1);
  --ease-settle: linear(0, 0.047 4%, 0.155 8%, 0.289 12%, 0.425 17%, 0.551 21%, 0.661 25%, 0.752 29%, 0.824 33%, 0.88 38%, 0.922 42%, 0.952 46%, 0.973 50%, 0.988 54%, 0.997 58%, 1.002 62%, 1.005 67%, 1.006 71%, 1.006 75%, 1.006 79%, 1.005 83%, 1.004 88%, 1.003 92%, 1.003 96%, 1);
  --ease-celebrate: linear(0, 0.072 4%, 0.239 8%, 0.442 12%, 0.64 17%, 0.808 21%, 0.936 25%, 1.022 29%, 1.072 33%, 1.093 38%, 1.093 42%, 1.081 46%, 1.063 50%, 1.043 54%, 1.026 58%, 1.012 62%, 1.001 67%, 0.995 71%, 0.992 75%, 0.991 79%, 0.992 83%, 0.993 88%, 0.995 92%, 0.997 96%, 1);
  --t-press: 0.33s;
  --t-settle: 0.58s;
  --t-slap: 0.65s;
  --t-transition: 0.28s;
  --t-breath: 1.9s;

  /* Layout */
  --gutter: 24px;
  --container: 1120px;
  --nav-height: 76px;
  /* The sky band is the same height on every screen, so the wave and the title never move between tabs. */
  --band-h: 440px;
  --band-pad: 136px;
}

/* ---------- 2. Base ------------------------------------------------------ */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; height: 100%; }
body {
  margin: 0; min-height: 100%;
  background: var(--surface); color: var(--text);
  font-family: var(--font-body); font-size: 17px; line-height: 1.55; font-weight: 400;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
img[width][height] { height: auto; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--blue-700); outline-offset: 3px; border-radius: 6px; }
.sky :focus-visible { outline-color: var(--cloud); }
::selection { background: var(--sky-100); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }

/* Type scale */
h1, h2, h3, .display {
  font-family: var(--font-display); font-weight: 700; letter-spacing: var(--tracking-display);
  line-height: 1.05; margin: 0; font-optical-sizing: auto; text-wrap: balance; color: var(--text);
}
h1 { font-size: clamp(36px, 5vw, 56px); }
h2 { font-size: clamp(28px, 3.6vw, 40px); color: var(--blue-700); }
.sky h1, .sky h2 { color: var(--cloud); }
h3 { font-size: clamp(21px, 2.2vw, 24px); line-height: 1.15; }
p { margin: 0; }
.lede { font-size: clamp(17px, 1.6vw, 19px); line-height: 1.5; color: var(--text-2); max-width: 34em; text-wrap: pretty; }
.sky .lede { color: rgba(253, 253, 255, 0.88); }
.muted { color: var(--text-2); }
.small { font-size: 15px; }
.micro { font-size: 14px; color: var(--text-2); font-weight: 500; }
b, strong { font-weight: 700; }

.wordmark { font-family: var(--font-display); font-weight: 800; font-size: 30px; letter-spacing: -0.03em; line-height: 1; color: var(--text); display: inline-flex; align-items: baseline; gap: 0.28em; white-space: nowrap; }
.wordmark__hq { font-weight: 500; letter-spacing: -0.01em; opacity: 0.78; font-size: 0.82em; }
.wordmark--lg { font-size: 44px; }

.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon--sm { width: 16px; height: 16px; }

/* Buttons: capsules, Rounded Bold. Ink is the commit colour; the shelf makes it read as pressable, and pressing sinks it. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: var(--control-height); padding: 0 28px;
  border-radius: var(--radius-control);
  font-family: var(--font-body); font-weight: 700; font-size: 18px; line-height: 1.2; white-space: nowrap; text-align: center;
  color: var(--text-on-color); background: var(--action-commit);
  box-shadow: var(--shadow-shelf);
  transform: translateY(0) scale(1);
  transition: transform var(--t-press) var(--ease-press), box-shadow var(--t-press) var(--ease-press), background-color var(--t-transition) var(--ease-in-out), opacity var(--t-transition);
  user-select: none;
}
.btn:hover { background: #333335; }
.btn:active, .btn.is-pressed { transform: translateY(4px) scale(0.985); box-shadow: var(--shadow-shelf-pressed); opacity: 0.92; }
.btn[disabled], .btn[aria-busy="true"] { opacity: 0.6; pointer-events: none; }
.btn--sm { min-height: var(--control-sm); padding: 0 22px; font-size: 16px; }
.btn--block { width: 100%; }
.btn--on-sky { background: var(--cloud); color: var(--ink); box-shadow: 0 5px 0 rgba(20, 60, 100, 0.28); }
.btn--on-sky:hover { background: #ffffff; }
.btn--on-sky:active { box-shadow: 0 1px 0 rgba(20, 60, 100, 0.28); }
.btn--secondary { background: var(--fog); color: var(--ink); box-shadow: 0 5px 0 rgba(38, 38, 39, 0.10); }
.btn--secondary:hover { background: #dedee3; }
.btn--secondary:active { box-shadow: 0 1px 0 rgba(38, 38, 39, 0.10); }
.btn--ghost-sky { background: rgba(253, 253, 255, 0.16); color: var(--cloud); box-shadow: none; border: 1px solid rgba(253, 253, 255, 0.3); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.btn--ghost-sky:hover { background: rgba(253, 253, 255, 0.26); }
.btn--ghost-sky:active { transform: scale(0.97); box-shadow: none; }
.btn--quiet { background: var(--mist); color: var(--ink); box-shadow: none; }
.btn--quiet:hover { background: var(--fog); }
.btn--quiet:active { transform: scale(0.97); box-shadow: none; opacity: 1; }
.btn--danger { background: var(--coral-100); color: var(--coral-700); box-shadow: none; }
.btn--danger:hover { background: #ffc9c7; }
.btn--danger:active { transform: scale(0.97); box-shadow: none; }
.btn--danger-sky { background: rgba(253, 253, 255, 0.16); color: var(--cloud); box-shadow: none; border: 1px solid rgba(253, 253, 255, 0.3); }
.btn--danger-sky:hover { background: rgba(255, 139, 135, 0.35); }
.btn--danger-sky:active { transform: scale(0.97); box-shadow: none; }

.text-link { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--action-primary-text); min-height: 44px; }
.text-link svg { width: 16px; height: 16px; transition: transform var(--t-press) var(--ease-press); }
.text-link:hover svg { transform: translateX(3px); }
.text-link--back svg { transition: transform var(--t-press) var(--ease-press); }
.text-link--back:hover svg { transform: translateX(-3px); }
.text-link--on-sky { color: var(--cloud); }

/* Fields */
.field { display: block; min-width: 0; }
.field__label { display: block; font-size: 15px; font-weight: 700; color: var(--text-2); margin: 0 0 7px 2px; }
.input {
  display: block; width: 100%; min-height: var(--control-height); padding: 0 18px;
  background: var(--mist); border: 1.5px solid var(--fog); border-radius: var(--radius-field);
  font-size: 17px; color: var(--text);
  transition: border-color var(--t-transition), background-color var(--t-transition), box-shadow var(--t-transition);
}
.input::placeholder { color: var(--muted); }
.input:hover { border-color: var(--silver); }
.input:focus { outline: none; background: var(--cloud); border-color: var(--solfa-blue); box-shadow: 0 0 0 4px var(--sky-100); }
.input[readonly] { color: var(--text-2); cursor: default; }
.input[readonly]:focus { border-color: var(--fog); box-shadow: none; background: var(--mist); }
select.input { appearance: none; -webkit-appearance: none; padding-right: 44px; cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235D5D61' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 16px center; }
.input--sm { min-height: var(--control-sm); padding: 0 14px; font-size: 16px; border-radius: 14px; }
select.input--sm { padding-right: 38px; background-position: right 12px center; }

/* Cards: Cloud White, a hairline of Fog, the app's shadows. Quiet. */
.card { background: var(--surface); border: 1px solid rgba(231, 231, 235, 0.9); border-radius: var(--radius-card); box-shadow: var(--shadow-card); }
.canvas { background: var(--surface); border: 1px solid rgba(231, 231, 235, 0.9); border-radius: var(--radius-canvas); box-shadow: var(--shadow-modal); }
.canvas__body { padding: clamp(22px, 3vw, 30px) clamp(22px, 3vw, 32px); }
.canvas__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.canvas__head p { margin-top: 6px; color: var(--text-2); max-width: 36em; text-wrap: pretty; }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 14px 16px; border-radius: 16px; font-size: 15px; line-height: 1.45; background: var(--mist); color: var(--text-2); font-weight: 500; }
.notice--error { background: var(--coral-100); color: var(--coral-700); }
.notice--ok { background: var(--green-100); color: var(--green-700); }
.notice .icon { margin-top: 2px; }
.row { display: flex; align-items: center; gap: 12px; }
.row--between { justify-content: space-between; }
.row--wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }

/* States: a word with its colour and a mark, never a decorative chip. */
.state { display: inline-flex; align-items: center; gap: 6px; font-size: 15px; font-weight: 700; color: var(--text-2); white-space: nowrap; }
.state svg { width: 14px; height: 14px; }
.state--active { color: var(--green-700); }
.state--invited { color: var(--yellow-700); }
.state--pending { color: var(--blue-700); }
.state--revoked { color: var(--coral-700); }
.live { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; color: var(--teal-700); background: var(--teal-100); padding: 7px 14px 7px 11px; border-radius: var(--radius-control); }
.live::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--teal-500); animation: blink 1.2s var(--ease-in-out) infinite alternate; }
@keyframes blink { from { opacity: 0.35; } to { opacity: 1; } }

/* Entrances. Only on a screen change (#app.anim); a redraw of the same screen never replays them. */
.anim .rise { animation: rise var(--t-settle) var(--ease-settle) both; animation-delay: calc(var(--i, 0) * 50ms); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.anim .fade, .menu { animation: fade var(--t-transition) var(--ease-out) both; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--fog); border-top-color: var(--solfa-blue); animation: spin 0.8s linear infinite; }
.sky .spinner { border-color: rgba(253, 253, 255, 0.3); border-top-color: var(--cloud); }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: flex; justify-content: center; padding: 56px 0; }

/* ---------- 3. Sky ------------------------------------------------------- */

/* One sky for the whole site: a fixed layer behind the app holding the gradient and the clouds.
   Screens open with a transparent band onto it and the white sheet slides over it on scroll.
   Because the layer sits outside #app, no re-render ever restarts a cloud. */
#sky { position: fixed; inset: 0 0 auto 0; height: 100vh; z-index: 0; overflow: hidden; pointer-events: none; background: linear-gradient(180deg, var(--sky-400) 0, var(--solfa-blue) 460px, var(--solfa-blue) 100%); }
#app { position: relative; z-index: 1; }
.sky { position: relative; background: transparent; color: var(--text-on-color); }

/* Drifting clouds, the website's rule: slow, shallow, linear, in the strip above the title. */
.drift { position: absolute; top: calc(var(--nav-height) + var(--y, 10px)); pointer-events: none; opacity: var(--cloud-opacity, 0.9); animation: drift var(--drift-t, 60s) linear infinite; animation-delay: var(--drift-delay, 0s); will-change: transform; }
@keyframes drift { from { transform: translateX(-12vw); } to { transform: translateX(112vw); } }

.cloud-edge { position: absolute; left: 0; right: 0; bottom: -1px; width: 100%; height: clamp(44px, 7vw, 96px); color: var(--surface); pointer-events: none; }
.cloud-edge svg { width: 100%; height: 100%; }

/* The band every screen opens with: title in Cloud White, clouds above it, the wave below. */
.band { min-height: var(--band-h); padding-top: calc(var(--nav-height) + 104px); padding-bottom: var(--band-pad); }
.band .container { position: relative; z-index: 2; }
.band__sub { margin-top: 10px; font-size: clamp(16px, 1.5vw, 19px); font-weight: 500; color: rgba(253, 253, 255, 0.86); }
.band__row { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px 28px; flex-wrap: wrap; }
.band__actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.band .text-link--on-sky { margin-bottom: 14px; }

/* ---------- 4. Screens --------------------------------------------------- */

/* Navigation: transparent over the sky, frosted white once scrolled. */
.nav { position: fixed; inset: 0 0 auto 0; z-index: 50; height: var(--nav-height); display: flex; align-items: center; color: var(--cloud); transition: background-color var(--t-transition) var(--ease-in-out), color var(--t-transition) var(--ease-in-out), box-shadow var(--t-transition) var(--ease-in-out); }
.nav .container { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.nav .wordmark { color: inherit; padding: 8px 0; }
.nav__links { display: flex; align-items: center; gap: 4px; list-style: none; margin: 0; padding: 0; }
.nav__link { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: var(--radius-control); font-weight: 700; font-size: 16px; color: inherit; opacity: 0.86; transition: opacity var(--t-transition), background-color var(--t-transition); }
.nav__link:hover { opacity: 1; background: rgba(253, 253, 255, 0.14); }
.nav__link[aria-current="page"] { opacity: 1; background: rgba(253, 253, 255, 0.2); }
.nav__right { display: flex; align-items: center; gap: 8px; }
.nav.is-solid { color: var(--ink); background: rgba(253, 253, 255, 0.84); backdrop-filter: saturate(160%) blur(16px); -webkit-backdrop-filter: saturate(160%) blur(16px); box-shadow: inset 0 -1px 0 rgba(231, 231, 235, 0.9); }
.nav.is-solid .nav__link { color: var(--secondary); opacity: 1; }
.nav.is-solid .nav__link:hover { color: var(--ink); background: var(--mist); }
.nav.is-solid .nav__link[aria-current="page"] { color: var(--ink); background: var(--mist); }

.account { position: relative; }
.account__btn { display: inline-flex; align-items: center; gap: 10px; min-height: 46px; padding: 4px 10px 4px 4px; border-radius: var(--radius-control); color: inherit; transition: background-color var(--t-transition); }
.account__btn:hover, .account__btn[aria-expanded="true"] { background: rgba(253, 253, 255, 0.16); }
.nav.is-solid .account__btn:hover, .nav.is-solid .account__btn[aria-expanded="true"] { background: var(--mist); }
.account__name { font-weight: 700; font-size: 16px; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--cloud); color: var(--blue-700); display: inline-flex; align-items: center; justify-content: center; font-family: var(--font-display); font-weight: 800; font-size: 15px; letter-spacing: 0; flex: none; box-shadow: 0 2px 6px rgba(20, 60, 100, 0.18); }
.nav.is-solid .avatar { background: var(--solfa-blue); color: var(--cloud); box-shadow: none; }
.avatar--sm { width: 40px; height: 40px; font-size: 15px; background: var(--sky-100); color: var(--blue-700); box-shadow: none; }
.avatar--mist { background: var(--fog); color: var(--secondary); }
.menu { position: absolute; right: 0; top: calc(100% + 10px); min-width: 240px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-modal); padding: 8px; z-index: 60; }
.menu__head { padding: 10px 14px 10px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.menu__head b { display: block; }
.menu__head .small { display: block; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu__item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 46px; padding: 0 14px; border-radius: 12px; font-weight: 700; text-align: left; color: var(--text); transition: background-color var(--t-transition); }
.menu__item:hover { background: var(--mist); }
.menu__item--danger { color: var(--coral-700); }
.menu__item--danger:hover { background: var(--coral-100); }

/* The white sheet after the band, where the work happens. */
.sheet { position: relative; z-index: 1; background: var(--surface); min-height: 100vh; padding: clamp(8px, 2vw, 24px) 0 120px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }

/* Sign in: the sky, a card of Cloud White floating on it. */
.gate { min-height: 100svh; display: grid; place-items: center; padding: calc(var(--nav-height) + 112px) var(--gutter) 56px; }
.gate .container { position: relative; z-index: 2; display: grid; justify-items: center; }
.gate__card { width: 100%; max-width: 440px; padding: clamp(26px, 4vw, 40px); background: var(--cloud); color: var(--ink); border-radius: var(--radius-canvas); box-shadow: var(--shadow-on-sky); }
.gate__card h1 { font-size: clamp(30px, 4vw, 38px); margin-bottom: 10px; color: var(--ink); }
.gate__card .lede { font-size: 17px; margin-bottom: 26px; color: var(--text-2); }
.gate__card form { display: flex; flex-direction: column; gap: 16px; }
.gate__card form .btn { margin-top: 6px; }
.gate__foot { margin-top: 22px; text-align: center; }
.gate__foot .text-link { justify-content: center; }
.gate__status { min-height: 100svh; display: grid; place-items: center; }
.gate__status > div { display: flex; flex-direction: column; align-items: center; gap: 18px; position: relative; z-index: 2; }

/* Home: the linked sheets. */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.sheet-card { display: flex; flex-direction: column; gap: 18px; padding: 24px 26px 26px; min-height: 180px; text-align: left; width: 100%; color: var(--ink); transition: transform var(--t-settle) var(--ease-settle), box-shadow var(--t-settle) var(--ease-settle); }
.sheet-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-modal); }
.sheet-card:active { transform: translateY(0); transition-duration: var(--t-press); }
.sheet-card__top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sheet-card__glyph { width: 48px; height: 48px; border-radius: 14px; background: var(--green-100); color: var(--green-700); display: inline-flex; align-items: center; justify-content: center; }
.sheet-card__glyph .icon { width: 22px; height: 22px; }
.sheet-card__open { color: var(--muted); transition: color var(--t-transition), transform var(--t-press) var(--ease-press); }
.sheet-card:hover .sheet-card__open { color: var(--blue-700); transform: translate(2px, -2px); }
.sheet-card__title { margin-top: auto; }
.sheet-card__meta { font-size: 15px; font-weight: 500; color: var(--text-2); }
.sheet-card--add { border-style: dashed; border-color: var(--silver); box-shadow: none; background: transparent; justify-content: center; align-items: center; gap: 12px; color: var(--text-2); font-weight: 700; font-size: 17px; }
.sheet-card--add:hover { background: var(--mist); color: var(--ink); box-shadow: none; border-color: var(--muted); }
.sheet-card--add .sheet-card__glyph { background: var(--mist); color: var(--text-2); width: 52px; height: 52px; border-radius: 50%; }
.sheet-card--add:hover .sheet-card__glyph { background: var(--sky-100); color: var(--blue-700); }

.empty { text-align: center; padding: clamp(40px, 6vw, 64px) 24px; display: grid; justify-items: center; }
.empty h3 { margin-bottom: 8px; }
.empty p { color: var(--text-2); margin-bottom: 24px; max-width: 30em; text-wrap: pretty; }

.linkform { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.linkform .input { flex: 1 1 320px; }
.linkform + .micro { margin-top: 12px; }

/* The sheet: tabs on the sheet, the table in a canvas, cells that edit in place. */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.tab { min-height: 42px; padding: 0 18px; border-radius: var(--radius-control); font-weight: 700; font-size: 15px; color: var(--text-2); background: var(--mist); transition: background-color var(--t-transition), color var(--t-transition), transform var(--t-press) var(--ease-press); }
.tab:hover { color: var(--ink); background: var(--fog); }
.tab:active { transform: scale(0.97); }
.tab[aria-selected="true"] { background: var(--ink); color: var(--cloud); }
.table-canvas { overflow: hidden; }
.table-wrap { overflow: auto; max-height: calc(100vh - 360px); min-height: 160px; }
.table { border-collapse: separate; border-spacing: 0; min-width: 100%; font-size: 15px; }
.table th, .table td { padding: 0; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); vertical-align: top; }
.table th:last-child, .table td:last-child { border-right: 0; }
.table tr:last-child td { border-bottom: 0; }
.table th { position: sticky; top: 0; z-index: 2; background: var(--mist); color: var(--text-2); font-weight: 700; text-align: left; font-size: 14px; }
.table th .cell { white-space: nowrap; }
.table .rn { position: sticky; left: 0; z-index: 1; background: var(--mist); color: var(--muted); text-align: right; font-family: var(--font-mono); font-size: 12px; width: 52px; min-width: 52px; user-select: none; }
.table th.rn { z-index: 3; }
.cell { display: block; padding: 11px 14px; min-width: 130px; max-width: 380px; min-height: 44px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell--edit { padding: 0; }
.cell--edit input { width: 100%; min-width: 130px; height: 44px; padding: 0 14px; border: 0; background: var(--sky-50); box-shadow: inset 0 0 0 2px var(--solfa-blue); outline: none; font-size: 15px; color: var(--ink); }
.table td:hover .cell:not(.cell--edit) { background: var(--sky-50); cursor: text; }
.addrow { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; padding: 20px; border-radius: var(--radius-card); margin-top: 16px; background: var(--mist); }
.addrow .field { flex: 1 1 170px; }
.addrow .field__label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.addrow .input { background: var(--cloud); }
.addrow__actions { display: flex; gap: 8px; }
.sheet-foot { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 18px; flex-wrap: wrap; }
.sheet-foot .micro { font-size: 15px; }
.table-empty { padding: 8px; }

/* Settings: one canvas per topic, rows with hairlines between them. */
.settings { display: flex; flex-direction: column; gap: 22px; max-width: 800px; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 14px 18px; align-items: center; }
.kv .field__label { margin: 0; }
.member { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 16px 0; border-top: 1px solid var(--line); }
.member:first-of-type { border-top: 0; padding-top: 4px; }
.member__name { font-weight: 700; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member__name .micro { font-weight: 500; }
.member__email { color: var(--text-2); font-size: 15px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member__ctrl { display: flex; align-items: center; gap: 10px; flex: none; }
.member .input--sm { width: auto; min-width: 124px; }
.member__x { width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); transition: background-color var(--t-transition), color var(--t-transition); }
.member__x:hover { background: var(--coral-100); color: var(--coral-700); }
.invite { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; padding-top: 20px; margin-top: 10px; border-top: 1px solid var(--line); }
.invite .field { flex: 1 1 240px; }
.invite .field--role { flex: 0 1 170px; }
.roles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-top: 18px; }
.role { padding: 14px 16px; border-radius: 16px; background: var(--mist); font-size: 15px; line-height: 1.45; }
.role b { display: block; margin-bottom: 2px; font-size: 16px; }
.role span { color: var(--text-2); font-weight: 500; }
.signout { display: flex; justify-content: flex-start; padding-top: 4px; }

/* Toasts: an ink capsule that lands with the celebrate spring. */
#toast-root { position: fixed; left: 0; right: 0; bottom: 28px; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; z-index: 70; padding: 0 var(--gutter); }
.toast { pointer-events: auto; max-width: 520px; padding: 14px 22px; border-radius: var(--radius-control); background: var(--ink); color: var(--cloud); font-weight: 700; font-size: 16px; box-shadow: var(--shadow-modal); animation: toast-in var(--t-slap) var(--ease-celebrate) both; text-align: center; }
.toast--error { background: var(--coral-700); }
.toast.is-leaving { animation: toast-out var(--t-transition) var(--ease-out) both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(10px); } }

/* Phones first */
@media (max-width: 760px) {
  :root { --nav-height: 68px; --band-h: 470px; --band-pad: 100px; }
  .band { padding-top: calc(var(--nav-height) + 84px); }
  .drift { max-width: 132px; }
  .nav__links { display: none; }
  .account__name { display: none; }
  .account__btn { padding: 4px; }
  .account__btn > .icon { display: none; }
  .band__row { align-items: flex-start; }
  .band__actions .btn { min-height: 44px; padding: 0 16px; font-size: 15px; }
  .canvas__body { padding: 20px; }
  .kv { grid-template-columns: 1fr; gap: 8px; }
  .member { grid-template-columns: 40px minmax(0, 1fr); }
  .member__ctrl { grid-column: 2; justify-content: flex-start; }
  .table-wrap { max-height: none; }
  .gate__card { padding: 24px 20px; }
  .btn--block { font-size: 17px; }
}

/* Reduce Motion: no drifting, every state still shown finished. */
@media (prefers-reduced-motion: reduce) {
  .drift, .live::before { animation: none !important; }
  .anim .rise, .anim .fade, .menu, .toast { animation: none !important; opacity: 1; transform: none; }
  .btn, .sheet-card, .tab, .text-link svg { transition: none; }
}
