/* ============ Refined: everything below the hero, and the other pages ============
   Loaded after style.css (and app.css). The hero (cube field, wordmark, its toggles and the plain links shown when
   motion is off) keeps its own look; the rest reads like an established business's site: the system's own font,
   solid surfaces with fine borders and small corners, plain sentence-case labels, firm headings, no glows,
   gradients, hover lifts or letter-spaced capitals. */

:root {
  --ui-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --page: #0c0d0e;
  --surface: #15181a;
  --surface-2: #1b1f22;
  --border: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(255, 255, 255, 0.22);
  --text: #eceeef;
  --text-2: #b3babe;
  --text-3: #858d92;
  --primary: #f1eff4;
  --primary-hover: #ffffff;
  --on-primary: #141317;
  --link: #f1eff4;
  --focus: rgba(241, 239, 244, 0.55);
  --radius: 8px;
  --radius-sm: 6px;
}
html[data-theme="light"] {
  --page: #f2f4f4;
  --surface: #ffffff;
  --surface-2: #f7f8f8;
  --border: #d5d9d9;
  --border-strong: #b6bcbc;
  --text: #0f1111;
  --text-2: #3f4647;
  --text-3: #6b7273;
  --primary: #1d1c21;
  --primary-hover: #0b0a0d;
  --on-primary: #ffffff;
  --link: #0b0a0d;
  --focus: rgba(29, 28, 33, 0.45);
}

body { font-family: var(--ui-font); font-size: 16px; line-height: 1.55; color: var(--text); }
/* the hero keeps its wordmark face */
.hero, .prefs, .fallback-nav { font-family: var(--font); }
p { color: var(--text-2); }
em { color: var(--text); font-weight: 500; }
::selection { background: rgba(241, 239, 244, 0.28); }

/* ---------- Type ---------- */
.eyebrow,
html[data-theme="light"] .eyebrow {
  margin: 0 0 8px;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-3);
}
.display {
  margin: 0 0 16px;
  font-weight: 650;
  font-size: clamp(1.7rem, 2.8vw, 2.3rem);
  line-height: 1.2;
  letter-spacing: -0.01em;
  max-width: 34ch;
  color: var(--text);
}
.lede, html[data-theme="light"] .lede {
  font-size: 1.125rem;
  font-weight: 400;
  line-height: 1.55;
  color: var(--text-2);
  max-width: 62ch;
  margin: 0 0 20px;
}
h3, h4 { font-family: var(--ui-font); }
.section-title { margin: 48px 0 14px; font-weight: 650; font-size: 1.25rem; color: var(--text); }

a:not(.btn):not(.scene-card):not(.auth-brand) { color: var(--link); text-decoration: none; }
/* (On the light page a link is ink like the words round it: an underline tells it apart.) */
:root[data-theme="light"] a:not(.btn):not(.scene-card):not(.auth-brand) { text-decoration: underline; text-decoration-color: rgba(20, 19, 24, 0.35); text-underline-offset: 3px; }
a:not(.btn):not(.scene-card):not(.auth-brand):hover { text-decoration: underline; }

/* ---------- Buttons ---------- */
.btn {
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  font: 500 0.9375rem/1.2 var(--ui-font);
  letter-spacing: 0;
  text-transform: none;
  transition: background 0.15s, border-color 0.15s;
}
.btn:hover { background: var(--surface); border-color: var(--text-3); }
.btn:active { transform: none; filter: brightness(0.96); }
.btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.btn-primary,
html[data-theme="light"] .btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-primary:hover,
html[data-theme="light"] .btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--border); }
.btn.btn-small, .app-bar .btn, .scene-viewer-bar .btn, .inline-form .btn, .scene-admin-controls .btn, .share-row .btn,
#local-scenes .btn, .pc-controls .btn, .sqft-result .btn { padding: 7px 12px; font-size: 0.875rem; }

/* ---------- About (below the hero) ---------- */
.about, html[data-theme="light"] .about {
  padding: 72px 0 80px;
  background: var(--page);
  border-top: 1px solid var(--border);
}
.about-cols { gap: 40px; }
.about-cols p:not(.lede) { margin-top: 0; font-size: 1rem; }

.steps { margin: 48px 0 0; gap: 0; border-top: 1px solid var(--border); }
.steps li,
html[data-theme="light"] .steps li {
  padding: 24px 24px 8px 0;
  border: 0;
  border-radius: 0;
  background: none;
}
.steps li + li { padding-left: 24px; border-left: 1px solid var(--border); }
.step-n { font-size: 0.875rem; font-weight: 600; letter-spacing: 0; color: var(--text-3); }
.step-n::after { content: "."; }
.steps h3 { margin: 6px 0 6px; font-weight: 650; font-size: 1.125rem; color: var(--text); }
.steps p { font-size: 0.95rem; }

.about-roots { margin-top: 48px; padding: 20px 24px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); max-width: 720px; }
.about-roots .eyebrow { margin-bottom: 4px; }
.about-roots p:last-child { font-size: 1rem; margin: 0; }
.cta-row { gap: 10px; margin-top: 36px; }

.site-footer { background: var(--surface); border-top: 1px solid var(--border); font-family: var(--ui-font); font-size: 0.875rem; color: var(--text-3); }
.site-footer a { color: var(--text-2); }
.site-footer a:hover { color: var(--text); text-decoration: underline; }

/* ---------- Pages opened from the cubes ---------- */
.page-layer, html[data-theme="light"] .page-layer { background: var(--page); }
.page, html[data-theme="light"] .page { background: none; padding: clamp(84px, 9vw, 104px) 24px 72px; }
.page-narrow { max-width: 600px; }
/* content appears with the page, quickly, without rising in one line at a time */
.page > * { transform: none; transition: opacity 0.35s ease; }
.page-layer.open .page > *:nth-child(n) { transition-delay: 0.25s; }

.page-close, .scene-viewer-back,
html[data-theme="light"] .page-close, html[data-theme="light"] .scene-viewer-back {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font: 500 0.9rem/1.2 var(--ui-font);
  letter-spacing: 0;
  text-transform: none;
}
.page-close:hover, .scene-viewer-back:hover,
html[data-theme="light"] .page-close:hover, html[data-theme="light"] .scene-viewer-back:hover { background: var(--surface-2); }

.card-grid { gap: 16px; margin-top: 24px; }
.card,
html[data-theme="light"] .card {
  padding: 20px 22px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: none;
}
.card:hover, html[data-theme="light"] .card:hover { transform: none; border-color: var(--border); }
.card h3, .card h4 { margin: 0 0 6px; font-weight: 650; font-size: 1.05rem; color: var(--text); }
.card p { font-size: 0.95rem; }
.card ul, html[data-theme="light"] .card ul { color: var(--text-2); font-size: 0.95rem; }
.card li::marker { color: var(--text-3); }

.page-foot { margin-top: 48px; padding: 20px 22px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); gap: 12px; }
.page-foot p { font-size: 1rem; font-weight: 500; color: var(--text); }

/* Scenes */
.scene-grid { gap: 16px; margin-top: 28px; }
.scene-card,
html[data-theme="light"] .scene-card { border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); transition: border-color 0.15s; }
.scene-card:hover, html[data-theme="light"] .scene-card:hover { transform: none; border-color: var(--border-strong); }
.scene-card:hover h3 { text-decoration: underline; }
.scene-thumb { border-bottom: 1px solid var(--border); }
.scene-badge {
  top: 10px; left: 10px; padding: 3px 8px;
  border-radius: 4px; border: 0;
  background: rgba(0, 0, 0, 0.72); color: #fff;
  font: 600 0.75rem/1.3 var(--ui-font); letter-spacing: 0; text-transform: none;
}
.scene-meta { padding: 14px 16px 16px; }
.scene-meta h3 { font-weight: 650; font-size: 1rem; color: var(--text); }
.scene-meta p { font-size: 0.875rem; color: var(--text-2); }

/* Forms */
.quote-form, .login-form,
html[data-theme="light"] .quote-form, html[data-theme="light"] .login-form {
  gap: 16px 18px;
  margin-top: 24px;
  padding: 24px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
}
.field { gap: 6px; }
.field label { font-size: 0.875rem; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--text); }
.field input, .field select, .field textarea,
html[data-theme="light"] .field :is(input, select, textarea) {
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  font: 400 0.9375rem/1.4 var(--ui-font);
}
html[data-theme="light"] .field :is(input, select, textarea) { background: #fff; border-color: #a6acac; }
/* 16px on phones: iPhones zoom the page in on any field with smaller text when it is tapped */
@media (max-width: 760px) {
  .field input, .field select, .field textarea,
  html[data-theme="light"] .field :is(input, select, textarea) { font-size: 16px; }
}
.field input:focus, .field select:focus, .field textarea:focus,
html[data-theme="light"] .field :is(input, select, textarea):focus {
  border-color: var(--primary);
  background: var(--surface-2);
  box-shadow: 0 0 0 3px var(--focus);
}
html[data-theme="light"] .field :is(input, select, textarea):focus { background: #fff; }
.form-note { font-size: 0.875rem; color: var(--text-3); }
.form-note a, .quote-account a { color: var(--link); }
.quote-account { padding: 12px 14px; border: 1px solid var(--border); border-left: 3px solid var(--primary); border-radius: var(--radius-sm); background: var(--surface); color: var(--text-2); margin: 0 0 8px; }

/* Scene viewer bar */
.scene-viewer-bar { background: var(--surface); border-bottom: 1px solid var(--border); }
.scene-viewer-bar h2 { font: 600 1rem/1.3 var(--ui-font); letter-spacing: 0; color: var(--text); }

/* ============ Signed-in pages (account, profile, admin) and text pages ============ */
body.app, html[data-theme="light"] body.app { background: var(--page); }
.auth-card,
html[data-theme="light"] .auth-card, html[data-theme="light"] .scene-admin {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
}
.auth-card h1 { font-weight: 650; font-size: 1.5rem; color: var(--text); }
.auth-brand { font-family: var(--font); }
.muted { color: var(--text-3); }
.auth-msg { border-radius: var(--radius-sm); }
.auth-foot a, .forgot-link a { color: var(--link); }

.app-bar, html[data-theme="light"] .app-bar {
  background: var(--surface);
  -webkit-backdrop-filter: none; backdrop-filter: none;
  border-bottom: 1px solid var(--border);
  padding: 10px clamp(16px, 3vw, 28px);
  font-family: var(--ui-font);
}
.role-badge { padding: 2px 8px; border-radius: 4px; font: 600 0.75rem/1.4 var(--ui-font); letter-spacing: 0; text-transform: none; }
.app-main h1 { font-weight: 650; font-size: clamp(1.6rem, 2.6vw, 2rem); letter-spacing: -0.01em; color: var(--text); }
.app-main h2 { font-weight: 650; }
.empty { border-radius: var(--radius); border: 1px dashed var(--border-strong); background: var(--surface); color: var(--text-3); }

/* tabs: an underline under the one that's open, not a pill */
.app-tabs { gap: 2px; }
.app-tabs a, .books-tabs button {
  padding: 8px 12px;
  border-radius: 0;
  font: 500 0.9rem/1.2 var(--ui-font);
  color: var(--text-2);
  border-bottom: 2px solid transparent;
}
.app-tabs a:hover, .books-tabs button:hover { color: var(--text); text-decoration: none; }
.app-tabs a.active, .books-tabs button.active,
html[data-theme="light"] .app-tabs a.active, html[data-theme="light"] .books-tabs button.active {
  background: none; color: var(--text); border-bottom-color: var(--primary);
}
.tab-count { border-radius: 4px; }

.table-wrap { border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); }
.data-table th, .items-table th, .mini-table th {
  font: 600 0.8125rem/1.3 var(--ui-font);
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-2);
}
.data-table th { background: var(--surface-2); border-bottom: 1px solid var(--border); padding: 10px 14px; }
.data-table td { padding: 11px 14px; border-bottom-color: var(--border); }
.data-table tbody tr[data-id]:hover { background: var(--surface-2); }
.cell-main { color: var(--text); font-weight: 500; }
.cell-sub { color: var(--text-3); }

.pill { padding: 2px 8px; border-radius: 4px; font: 600 0.75rem/1.4 var(--ui-font); }

.sheet, html[data-theme="light"] .sheet { border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); }
.sheet-form h2 { font-weight: 650; font-size: 1.25rem; color: var(--text); }
.invite-box, .sqft-calc { border-radius: var(--radius); }

:is(.copy-row input, .share select, .items-table input, .inline-form input, .inline-form select, #local-scenes select,
    .year-pick select, .pc-controls select, .add-folder-row input, .add-folder-row select, .request-edit select, .request-edit input) {
  border-radius: var(--radius-sm) !important;
  font-family: var(--ui-font) !important;
}
.icon-x { border-radius: var(--radius-sm); }

.stat, .account-card, .pc-card, .project-item, .scene-admin,
html[data-theme="light"] :is(.stat, .account-card, .pc-card, .project-item) {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
}
.stat span, .share-title, .ov-h { font: 600 0.8125rem/1.3 var(--ui-font); letter-spacing: 0; text-transform: none; color: var(--text-3); }
.stat strong { font-weight: 650; font-size: 1.4rem; color: var(--text); }
.account-card h4, .pc-body h4, .scene-admin-body h3 { font-weight: 650; color: var(--text); }
.ov-watch li { border-radius: var(--radius-sm); background: var(--surface); }
.ov-meter, .ov-meter i, .ov-quota, .ov-share i { border-radius: 3px; }
.pc-badge { border-radius: 4px; }
.project-note { border-radius: var(--radius-sm); }

.prose h2 { font-weight: 650; font-size: 1.25rem; color: var(--text); }
.prose ul, html[data-theme="light"] .prose ul { color: var(--text-2); }
.prose li strong, .prose p strong { font-weight: 600; }
.app code, .manual code { border-radius: 4px; }

/* The display toggles on the other pages (the hero's own keep their look) */
.prefs-page .pref {
  border-radius: var(--radius-sm);
  border-color: var(--border);
  background: var(--surface);
  -webkit-backdrop-filter: none; backdrop-filter: none;
  color: var(--text-2);
  font: 500 0.8125rem/1 var(--ui-font);
  letter-spacing: 0;
  text-transform: none;
}
.prefs-page .pref:hover { color: var(--text); border-color: var(--border-strong); }

@media (max-width: 760px) {
  .about { padding: 48px 0 56px; }
  .steps li, .steps li + li { padding: 18px 0 14px; border-left: 0; }
  .steps li + li { border-top: 1px solid var(--border); }
  .quote-form, .login-form { padding: 18px; }
  .page-foot { padding: 16px; }
}

/* ============ The account area: sign-in, and the signed-in account (portal) ============
   A top bar and a menu that stay put, one view at a time, each with a heading, a line saying what it is, and one
   main button. Cards with plain labels on a quiet page; the same fields, buttons and status labels throughout. */

:root {
  --nav-active: rgba(241, 239, 244, 0.14);
  --nav-active-text: #ffffff;
  --field-border: rgba(255, 255, 255, 0.36);
  --ok-bg: rgba(241, 239, 244, 0.14);   --ok-text: #ffffff;
  --wait-bg: rgba(255, 212, 121, 0.14); --wait-text: #ffd98a;
  --bad-bg: rgba(255, 123, 123, 0.15);  --bad-text: #ffb3b3;
  --idle-bg: rgba(255, 255, 255, 0.08); --idle-text: #c9cfd2;
}
html[data-theme="light"] {
  --text-3: #5b6364;
  --nav-active: #d3ede5;
  --nav-active-text: #0b0a0d;
  --field-border: #848c8c;
  --ok-bg: #dcf1ea;   --ok-text: #0b0a0d;
  --wait-bg: #fbecd0; --wait-text: #6f3f00;
  --bad-bg: #fbe1e1;  --bad-text: #8f1d1d;
  --idle-bg: #e7eaea; --idle-text: #394041;
}

/* The mark is drawn in light lines: on a light page it sits on its own dark tile. */
html[data-theme="light"] .app .brand-mark { background: #0b1213; border-radius: 22%; }

/* Keyboard focus, the same ring on everything that can be clicked. */
.app :is(a, button, summary, [tabindex]):focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: var(--radius-sm); }
.app h1:focus { outline: none; }
.skip-link { position: absolute; left: -9999px; top: 8px; z-index: 30; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--border-strong); }
.skip-link:focus { left: 8px; }

/* Fields: a border that shows on its page, room to tap, text at reading size. */
.app .field :is(input, select, textarea),
html[data-theme="light"] .app .field :is(input, select, textarea) { padding: 11px 12px; border-color: var(--field-border); font-size: 1rem; }
.app .field :is(input, select, textarea)::placeholder { color: var(--text-3); opacity: 1; }
.app .field :is(input, select, textarea):focus,
html[data-theme="light"] .app .field :is(input, select, textarea):focus { border-color: var(--primary); }
.app .field label { font-size: 0.9375rem; }
:is(.shell, .auth-wrap) .muted { font-size: 0.9375rem; line-height: 1.55; color: var(--text-2); }
:is(.shell, .auth-wrap) .small { font-size: 0.875rem; }
.app .check input { width: 18px; height: 18px; flex: none; }
.app .terms-check { font-size: 0.9375rem; color: var(--text-2); }
:is(.shell, .auth-wrap) .btn { min-height: 40px; }

/* Status labels: a tinted chip, readable in both themes. */
.pill { padding: 3px 10px; border: 0; border-radius: 999px; font: 600 0.8125rem/1.45 var(--ui-font); background: var(--idle-bg); color: var(--idle-text); white-space: nowrap; }
:is(.pill-active, .pill-inv-paid, .pill-project-quoted, .pill-project-scheduled, .pill-project-in_progress),
html[data-theme="light"] :is(.pill-active, .pill-inv-paid) { background: var(--ok-bg); color: var(--ok-text); }
:is(.pill-invited, .pill-inv-sent),
html[data-theme="light"] :is(.pill-invited, .pill-inv-sent) { background: var(--wait-bg); color: var(--wait-text); }
:is(.pill-disabled, .pill-inv-void),
html[data-theme="light"] :is(.pill-disabled, .pill-inv-void) { background: var(--bad-bg); color: var(--bad-text); }
:is(.pill-inv-draft, .pill-project-new, .pill-project-done, .pill-project-closed, .pill-off),
html[data-theme="light"] .pill-inv-draft { background: var(--idle-bg); color: var(--idle-text); }
html[data-theme="light"] .warn { color: #8a4a00; }
.auth-msg { font-size: 0.9375rem; }

/* ---------- Sign in, sign up, reset ---------- */
.auth-wrap { gap: 20px; padding: 72px 16px 48px; }
.auth-wrap .auth-brand { color: var(--text); font-size: 1rem; }
.auth-card { width: min(448px, calc(100vw - 32px)); padding: clamp(24px, 6vw, 40px); border-radius: 12px; }
.auth-msg { width: min(448px, calc(100vw - 32px)); }
.auth-card .eyebrow { margin-bottom: 6px; }
.auth-card h1 { margin: 0 0 8px; font-size: 1.625rem; }
.auth-card > .muted { margin-bottom: 4px; }
.auth-form { gap: 18px; margin-top: 22px; }
.auth-card .auth-form .btn { min-height: 46px; font-size: 1rem; }
.auth-links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; margin: 22px 0 0; }
.forgot-link { margin: 20px 0 0; }
.auth-links a, .forgot-link a, .auth-foot a { font-size: 0.9375rem; font-weight: 500; padding: 4px 0; display: inline-block; }
.setup-steps, html[data-theme="light"] .setup-steps { color: var(--text-2); font-size: 0.9375rem; }
.manual { font-size: 0.9375rem; color: var(--text-2); }
.manual code { font-size: 0.9375rem; color: var(--text); }

/* ---------- The signed-in account: bar, menu, views ---------- */
body.shell { --bar-h: 60px; }
.shell .app-bar, html[data-theme="light"] .shell .app-bar { min-height: var(--bar-h); padding: 8px clamp(12px, 2vw, 24px); flex-wrap: nowrap; }
.shell .app-bar .auth-brand { font-size: 0.9rem; color: var(--text); min-width: 0; }
.shell .app-bar-right { gap: 10px; font-size: 0.9375rem; color: var(--text-2); min-width: 0; }
.avatar { display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: var(--on-primary); font: 600 0.9375rem/1 var(--ui-font); }
.avatar:empty { display: none; }

.shell-body { display: grid; grid-template-columns: 272px minmax(0, 1fr); max-width: 1320px; margin: 0 auto; }
.side-nav { position: sticky; top: var(--bar-h); align-self: start; display: grid; gap: 2px; align-content: start; max-height: calc(100vh - var(--bar-h)); overflow-y: auto; padding: 20px 12px 20px 8px; }
body.app.shell .side-nav a.nav-link {
  display: flex; align-items: center; gap: 14px;
  padding: 11px 18px; border-radius: 999px;
  color: var(--text-2); font: 500 0.9375rem/1.3 var(--ui-font); text-decoration: none; white-space: nowrap;
}
body.app.shell .side-nav a.nav-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
html[data-theme="light"] body.app.shell .side-nav a.nav-link:hover { background: #e4e8e8; }
body.app.shell .side-nav a.nav-link[aria-current="page"],
html[data-theme="light"] body.app.shell .side-nav a.nav-link[aria-current="page"] { background: var(--nav-active); color: var(--nav-active-text); font-weight: 600; }
.nav-icon { flex: none; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.shell .app-main { width: 100%; max-width: 960px; margin: 0 auto; padding: 32px clamp(16px, 4vw, 40px) 96px; }
.view-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; margin-bottom: 28px; }
.view-head > div { flex: 1 1 320px; min-width: 0; }
.shell .view-head h1 { margin: 0 0 6px; font-size: clamp(1.5rem, 2.4vw, 1.875rem); line-height: 1.25; overflow-wrap: anywhere; }
.view-sub { margin: 0; max-width: 64ch; font-size: 1rem; color: var(--text-2); }
.view-sub strong { color: var(--text); font-weight: 600; overflow-wrap: anywhere; }
.view-head .btn { flex: none; }
.shell .empty { margin-top: 0; padding: 36px 24px; font-size: 1rem; }
.shell .empty p { margin: 0 auto; max-width: 56ch; color: var(--text-2); }

/* Home: one card per part of the account */
.home-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
body.app.shell .home-grid a.home-card {
  display: grid; gap: 6px; align-content: start;
  padding: 20px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface);
  color: var(--text); text-decoration: none; transition: border-color 0.15s, box-shadow 0.15s;
}
body.app.shell .home-grid a.home-card:hover { border-color: var(--border-strong); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 4px 12px rgba(0, 0, 0, 0.08); text-decoration: none; }
.home-icon { display: grid; place-items: center; width: 40px; height: 40px; margin-bottom: 8px; border-radius: 50%; background: var(--nav-active); color: var(--nav-active-text); }
.home-card h2 { margin: 0; font: 650 1.0625rem/1.3 var(--ui-font); color: var(--text); }
.home-card p { margin: 0; font-size: 0.9375rem; line-height: 1.5; color: var(--text-2); }
.home-go { margin-top: 10px; font: 600 0.9375rem/1.2 var(--ui-font); color: var(--link); }
.home-go::after { content: " \2192"; }

/* Cards inside a view */
.shell :is(.account-card, .project-item),
html[data-theme="light"] .shell :is(.account-card, .project-item) { padding: 22px 24px; border-radius: 12px; }
.shell .table-wrap, .shell .scene-card, html[data-theme="light"] .shell .scene-card { border-radius: 12px; }
.shell .scene-card { overflow: hidden; }
.card-title { margin: 0; font: 650 1.125rem/1.3 var(--ui-font); color: var(--text); }
.card-title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.shell .account-grid { gap: 16px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.shell .account-card.auth-form { margin-top: 0; gap: 16px; }
.shell .account-card .btn { justify-self: start; }
#mfa-off, #mfa-enroll { display: grid; gap: 14px; }
.shell .project-form { margin: 0 0 20px; gap: 18px; }
.shell .project-list { margin-top: 0; gap: 14px; }
.shell .projects, .shell .account-section { margin: 0; }
.project-top strong { font: 650 1.0625rem/1.3 var(--ui-font); color: var(--text); }
.shell .project-item .muted { margin: 6px 0 0; color: var(--text-3); }
.shell .project-msg { margin: 12px 0 0; max-width: 70ch; font-size: 1rem; color: var(--text); }
.shell .project-note, html[data-theme="light"] .shell .project-note { margin: 14px 0 0; padding: 12px 14px; border-left: 3px solid var(--primary); background: var(--surface-2); font-size: 0.9375rem; color: var(--text); }
.shell .project-thanks { color: var(--ok-text); font-size: 0.9375rem; font-weight: 500; }
.shell .my-scenes { margin-top: 0; gap: 16px; }
.shell .scene-download { font-size: 0.9375rem; }

/* Tables */
.shell .data-table { font-size: 0.9375rem; }
.shell .data-table th { padding: 12px 16px; font-size: 0.875rem; }
.shell .data-table td { padding: 14px 16px; color: var(--text); vertical-align: middle; }
.shell .data-table td a { font-weight: 600; }
.shell .data-table td.warn { color: var(--wait-text); font-weight: 600; }
body.app.shell .data-table a.pay-link { display: inline-block; margin-left: 10px; padding: 3px 12px; border-radius: 999px; background: var(--primary); color: var(--on-primary); font-size: 0.8125rem; font-weight: 600; }

/* The admin's "Viewing as" bar (js/view-as.js): at the foot of the account pages, clear of the top bar's buttons */
body.shell .em-viewas { top: auto; bottom: 14px; }

/* A narrower window: the menu becomes a strip under the top bar */
@media (max-width: 900px) {
  .shell-body { display: block; }
  .side-nav { z-index: 4; display: flex; gap: 0; max-height: none; overflow-x: auto; overflow-y: hidden; padding: 0 8px; background: var(--surface); border-bottom: 1px solid var(--border); scrollbar-width: none; }
  .side-nav::-webkit-scrollbar { display: none; }
  body.app.shell .side-nav a.nav-link { padding: 14px 12px 11px; border-radius: 0; border-bottom: 3px solid transparent; }
  body.app.shell .side-nav a.nav-link:hover,
  html[data-theme="light"] body.app.shell .side-nav a.nav-link:hover { background: none; }
  body.app.shell .side-nav a.nav-link[aria-current="page"],
  html[data-theme="light"] body.app.shell .side-nav a.nav-link[aria-current="page"] { background: none; color: var(--text); border-bottom-color: var(--primary); }
  .side-nav .nav-icon { display: none; }
  .shell .app-main { padding-top: 24px; }
  .shell .prefs-page .pref-label { display: none; }
  .shell .prefs-page .pref { padding: 7px; gap: 7px; }
}
@media (max-width: 640px) {
  .shell .app-bar #who { display: none; }
  .shell .app-bar .auth-brand { letter-spacing: 0.18em; font-size: 0.8rem; }
  .shell .prefs-page #pref-motion { display: none; }
  .view-head .btn { width: 100%; justify-content: center; min-height: 46px; }
  .shell :is(.account-card, .project-item),
  html[data-theme="light"] .shell :is(.account-card, .project-item) { padding: 18px 16px; }
  .project-top { align-items: flex-start; }
  /* a table's rows as cards: each value with its label */
  .data-table.stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .data-table.stack, .data-table.stack tbody { display: block; }
  .data-table.stack tr { display: block; padding: 14px 16px; border-bottom: 1px solid var(--border); }
  .data-table.stack tr:last-child { border-bottom: 0; }
  .shell .data-table.stack td { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 4px 0; border: 0; text-align: right; white-space: normal; }
  .data-table.stack td[data-label]::before { content: attr(data-label); flex: none; color: var(--text-3); font-weight: 500; text-align: left; }
  .shell .data-table.stack td:first-child { font-size: 1.0625rem; padding-bottom: 8px; text-align: left; }
}

/* ---------- Admin: the same layout, with more views (admin/index.html) ---------- */
body.admin-shell .shell-body { max-width: 1480px; }
body.admin-shell .app-main { max-width: 1200px; }
/* The menu's groups, and the count of new requests */
.nav-head { margin: 16px 18px 4px; font: 600 0.75rem/1.3 var(--ui-font); letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); }
.side-nav .tab-count { margin-left: auto; background: var(--primary); color: var(--on-primary); }
/* (The menu, Home's cards and their links aren't underlined in the light theme either: links in text are.) */
:root[data-theme="light"] body.app.shell :is(.side-nav a.nav-link, .home-grid a.home-card, .ov-watch a.ov-go) { text-decoration: none; }
/* Home: what needs a look, then the cards in groups */
.home-h { margin: 36px 0 12px; font: 600 0.875rem/1.3 var(--ui-font); color: var(--text-3); }
.view > .home-h:first-of-type { margin-top: 0; }
.home-card h3 { margin: 0; font: 650 1.0625rem/1.3 var(--ui-font); color: var(--text); }
.view > .ov-watch { grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 12px; }
.ov-watch li { align-content: start; }
.ov-watch .ov-go { justify-self: start; margin-top: 4px; font: 600 0.875rem/1.2 var(--ui-font); color: var(--link); }
.ov-watch .ov-go::after { content: " \2192"; }
/* Inside a view: a heading, the row of buttons under the head, the cards' spacing */
.shell .view-h { margin: 40px 0 12px; font: 650 1.125rem/1.3 var(--ui-font); color: var(--text); }
.shell .view-h-sub { margin: -4px 0 14px; }
.shell .view-tools { margin: -12px 0 20px; }
.shell .stat-grid { margin: 0 0 20px; }
.shell :is(.request-list, .scene-admin-list, .pc-library) { margin-top: 0; }
.shell .pc-library-head .section-title { font-size: 1.125rem; }
.shell .ov-storage-card { margin-bottom: 16px; }
.shell .ov-storage-card .inline-form { margin: 16px 0 0; }
.shell .view-head .year-pick { align-self: center; }
@media (max-width: 900px) {
  .nav-head { display: none; }
  .side-nav .tab-count { margin-left: 6px; }
}
@media (max-width: 640px) {
  .shell .app-bar .role-badge { display: none; }
  .shell .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
}
/* The admin's tables: a list, each value with its label, wherever the table's box is too narrow for its
   columns (beside the menu on a smaller screen, and on a phone). */
.admin-shell .table-wrap { container-type: inline-size; }
@container (max-width: 759px) {
  .data-table.cq-stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .data-table.cq-stack, .data-table.cq-stack tbody { display: block; }
  .data-table.cq-stack tr { display: block; padding: 14px 16px; border-bottom: 1px solid var(--border); }
  .data-table.cq-stack tr:last-child { border-bottom: 0; }
  .shell .data-table.cq-stack td { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 4px 0; border: 0; text-align: right; white-space: normal; }
  .data-table.cq-stack td[data-label]::before { content: attr(data-label); flex: none; color: var(--text-3); font-weight: 500; text-align: left; }
  .shell .data-table.cq-stack td:first-child { display: block; padding-bottom: 8px; font-size: 1.0625rem; text-align: left; }
  .shell .data-table.cq-stack td:empty { display: none; }
  .shell .data-table.cq-stack td:not([data-label]):not(:first-child) { justify-content: flex-end; padding-top: 8px; }
}
