/* Standards' own pages (Hadi, 5 Oct 2026): a classic sidebar menu like the admin pages, on the same Lens palette
   (style.css tokens only), but visibly separate from admin: brass top edge and "Standards Portal" instead of
   "Fusinite staff only". Before the person belongs to an approved standard (sign-in, registration) the page keeps
   the simple centred layout with the top header. Phone: the sidebar becomes a top bar with a scrolling menu. */
body.std .shell { display: block; }
body.std .side[hidden] { display: none !important; }

body.has-nav header { display: none; }
body.has-nav .shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh;
  background: linear-gradient(to right, var(--paper) 235px, var(--stone-line) 235px, var(--stone-line) 236px, transparent 236px); }
body.has-nav .side { position: sticky; top: 0; align-self: start; height: 100vh; display: flex; flex-direction: column; gap: 18px;
  padding: 18px 14px; background: var(--paper); border-top: 3px solid var(--brass); }
body.has-nav .brand { display: flex; flex-direction: column; gap: 8px; text-decoration: none; color: var(--heading); }
body.has-nav .brand .logo-chip { padding: 6px 8px; border-radius: var(--radius-sm); }
body.has-nav .brand .logo-chip img { height: 40px; }
body.has-nav .brand-text { font: 600 15px var(--font-display); letter-spacing: -0.2px; }
.org-box { display: flex; flex-direction: column; gap: 4px; padding: 10px 11px; border: 1px solid var(--stone-line);
  border-radius: var(--radius-sm); background: var(--parchment); }
.org-label { font: 500 10.5px var(--font-mono); letter-spacing: 1px; text-transform: uppercase; color: var(--brass-deep); }
.org-box strong { font: 600 15px var(--font-display); color: var(--heading); overflow-wrap: anywhere; }
.org-box select { margin-top: 4px; padding: 6px 8px; border: 1px solid var(--stone-line); border-radius: var(--radius-sm);
  background: var(--paper); color: var(--ink); font: 14px var(--font-body); }
body.has-nav #tabs { display: flex; flex-direction: column; gap: 2px; }
body.has-nav #tabs button { display: block; width: 100%; text-align: left; padding: 9px 11px; border: 0; border-radius: var(--radius-sm);
  background: none; color: var(--ink); font: 500 15px var(--font-body); box-shadow: none; transform: none; }
body.has-nav #tabs button:hover { background: var(--forest-mist); }
body.has-nav #tabs button[aria-current="page"] { background: var(--forest-mist); color: var(--heading); font-weight: 700;
  box-shadow: inset 3px 0 0 var(--forest); }
body.has-nav #tabs button[hidden] { display: none; }
body.has-nav .side-foot { margin-top: auto; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.who-line { width: 100%; font-size: 13px; color: var(--stone); overflow-wrap: anywhere; }
body.has-nav .side-foot .switch-link { font: 600 14px var(--font-body); color: var(--brass-deep); border: 1px dashed var(--brass);
  border-radius: var(--radius-sm); padding: 5px 10px; text-decoration: none; }

body.has-nav main { max-width: 1120px; margin: 0; padding: 28px 32px 64px; }
body.has-nav section#home { background: none; border: 0; box-shadow: none; padding: 0; border-radius: 0; }
body.has-nav .tab-panel, body.has-nav #orgs:not(:empty), body.has-nav #joins:not(:empty), body.has-nav #requests:not(:empty) {
  background: var(--paper); border: 1px solid var(--stone-line); border-radius: var(--radius-md); padding: 20px 24px;
  box-shadow: var(--shadow-soft); margin-bottom: 18px; min-width: 0; }
body.has-nav .tab-panel > h2:first-child, body.has-nav #orgs > h2:first-child,
body.has-nav #joins > h2:first-child, body.has-nav #requests > h2:first-child { margin-top: 0; font-size: 22px; }

@media (max-width: 860px) {
  body.has-nav .shell { grid-template-columns: 1fr; background: none; }
  body.has-nav .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 14px; }
  body.has-nav .brand { flex-direction: row; align-items: center; }
  body.has-nav .brand .logo-chip img { height: 30px; }
  .org-box { order: 2; flex: 1 1 100%; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 6px 10px; }
  body.has-nav #tabs { order: 3; flex-direction: row; width: 100%; overflow-x: auto; gap: 4px; padding-bottom: 2px; }
  body.has-nav #tabs button { width: auto; white-space: nowrap; padding: 7px 10px; }
  body.has-nav .side-foot { margin: 0 0 0 auto; }
  .who-line { display: none; }
  body.has-nav main { padding: 18px 16px 48px; }
  body.has-nav .tab-panel { padding: 16px 14px; }
}

/* Welcome / loading box: the same design as Fusinite Lens's welcome box (Hadi, 6 Oct 2026). */
#welcomeOverlay { position: fixed; inset: 0; z-index: 20000; display: flex; justify-content: center; align-items: center;
  background: radial-gradient(circle at 50% 40%, #fffefb 0, var(--parchment) 100%); transition: opacity .5s var(--ease); }
[data-theme=dark] #welcomeOverlay { background: radial-gradient(circle at 50% 40%, #1b1916 0, var(--parchment) 100%); }
#welcomeOverlay.is-hiding { opacity: 0; pointer-events: none; }
.welcome-box { background: var(--paper); padding: 44px 40px; border-radius: 26px; box-shadow: 0 20px 48px rgba(23, 20, 15, .16);
  max-width: 600px; width: 90%; text-align: center; border: 1px solid var(--stone-line); }
.welcome-logo { height: 120px; width: 260px; max-width: 100%; margin: 0 auto 18px; border: 2px dashed var(--stone-line); border-radius: 18px;
  display: flex; align-items: center; justify-content: center; background: var(--parchment); }
.welcome-logo span { font: 500 12px var(--font-mono); letter-spacing: 1px; text-transform: uppercase; color: var(--stone); }
.welcome-text { font-size: 16.5px; line-height: 1.7; color: var(--ink-soft); margin: 0 0 28px; font-family: var(--font-body); }
.welcome-text strong { font-family: var(--font-display); font-weight: 600; color: var(--heading); }
.data-status { margin-top: 22px; font-size: 12.5px; color: var(--stone); font-family: var(--font-mono); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.aperture-loader { width: 64px; height: 64px; margin: 0 auto; position: relative; }
.aperture-loader svg { width: 100%; height: 100%; }
.aperture-ring { transform-origin: 50% 50%; animation: aperture-spin 2.4s linear infinite; }
.aperture-ring.r2 { animation-duration: 3.6s; animation-direction: reverse; }
.aperture-blade { transform-origin: 50% 50%; animation: aperture-breathe 1.8s var(--ease) infinite; }
@keyframes aperture-spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }
@keyframes aperture-breathe { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .aperture-ring, .aperture-blade { animation: none; } }

/* Start of the journey (Hadi, 6 Oct 2026): signed-out visitors stay in the welcome box: the four steps, then email -> code. */
#welcomeOverlay.is-landing { overflow-y: auto; align-items: flex-start; padding: 6vh 0 40px; }
#welcomeOverlay.is-landing .welcome-box { text-align: left; padding: 36px 36px 30px; }
#welcomeOverlay.is-landing .welcome-logo { margin-bottom: 16px; }
#welcomeOverlay.is-landing .welcome-text { text-align: center; margin-bottom: 22px; }
.steps { list-style: none; counter-reset: step; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 0; margin: 0 0 24px; }
.steps li { counter-increment: step; position: relative; padding: 34px 6px 0; text-align: center; font-size: 12.5px; line-height: 1.35; color: var(--stone); }
.steps li::before { content: counter(step); position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 26px; height: 26px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center; font: 600 13px var(--font-mono);
  background: var(--parchment); border: 1.5px solid var(--stone-line); color: var(--stone); }
.steps li::after { content: ""; position: absolute; top: 13px; left: calc(50% + 17px); right: calc(-50% + 13px); height: 1.5px; background: var(--stone-line); }
.steps li:last-child::after { display: none; }
.steps li b { display: block; font: 600 13.5px var(--font-display); color: var(--heading); margin-bottom: 2px; }
.steps li.done::before { content: "✓"; background: var(--forest); border-color: var(--forest); color: #fff; }
.steps li.current::before { background: var(--brass); border-color: var(--brass); color: #17140f; box-shadow: 0 0 0 4px var(--brass-pale); }
.steps li.current b { color: var(--brass-deep); }
#journey .steps li[data-step="1"]::before { background: var(--brass); border-color: var(--brass); color: #17140f; box-shadow: 0 0 0 4px var(--brass-pale); }
#journey form { display: flex; flex-direction: column; gap: 8px; margin: 0; }
#journey label { font: 600 14px var(--font-body); color: var(--heading); }
#journey input { font-size: 17px; padding: 12px 14px; border: 1.5px solid var(--stone-line); border-radius: 12px; background: var(--paper); color: var(--ink); }
#journey input:focus { outline: none; border-color: var(--forest); box-shadow: 0 0 0 3px var(--forest-mist); }
#j-code-input { font: 600 28px var(--font-mono) !important; letter-spacing: 12px; text-align: center; }
#journey form button[type=submit] { margin-top: 6px; padding: 12px; font-size: 16px; border-radius: 24px; }
.j-title { margin: 0 0 6px; font: 600 22px var(--font-display); color: var(--heading); }
.j-sent { margin: 0 0 16px; font-size: 15.5px; overflow-wrap: anywhere; }
.j-note { font-size: 13.5px; color: var(--ink-soft); line-height: 1.55; margin: 14px 0 0; }
.j-links { font-size: 14px; margin: 12px 0 0; }
#j-message:not(:empty) { margin: 0 0 14px; padding: 10px 12px; border-radius: 10px; font-size: 14px; background: var(--forest-mist); }
#j-message.error { background: var(--clay-soft); border: 1px solid var(--clay); }
.or { display: flex; align-items: center; gap: 10px; margin: 16px 0 10px; color: var(--stone); font-size: 13px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--stone-line); }
button.provider { width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 8px; padding: 11px;
  background: var(--paper); color: var(--ink); border: 1.5px solid var(--stone-line); border-radius: 24px; font: 600 15px var(--font-body); box-shadow: none; }
button.provider:hover { background: var(--parchment); transform: none; }
.p-icon { width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; }
.p-google { font: 700 17px Arial, sans-serif; color: #4285f4; }
.p-ms { display: inline-grid; grid-template-columns: 9px 9px; gap: 2px; }
.p-ms i { width: 9px; height: 9px; display: block; } .p-ms i:nth-child(1) { background: #f25022; } .p-ms i:nth-child(2) { background: #7fba00; }
.p-ms i:nth-child(3) { background: #00a4ef; } .p-ms i:nth-child(4) { background: #ffb900; }

/* Waiting / outcome pages and the step guide after signing in. */
#status-page .steps, #start .steps { margin: 4px 0 20px; }
.status-card { background: var(--paper); border: 1px solid var(--stone-line); border-left: 4px solid var(--brass); border-radius: var(--radius-md);
  padding: 22px 24px; box-shadow: var(--shadow-soft); }
.status-card.warn { border-left-color: var(--clay); }
.status-card h2 { margin: 8px 0 10px; }
.status-pill { display: inline-block; font: 600 11px var(--font-mono); letter-spacing: 1px; text-transform: uppercase; padding: 4px 10px;
  border-radius: 20px; background: var(--brass-pale); color: var(--brass-deep); }
.status-card.warn .status-pill { background: var(--clay-soft); color: var(--ink); }
.status-facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 16px 0; font-size: 15px; }
.status-facts dt { font-weight: 600; color: var(--stone); } .status-facts dd { margin: 0; overflow-wrap: anywhere; }
.status-card .muted, #start .lead { color: var(--ink-soft); font-size: 14.5px; }
@media (max-width: 560px) {
  #welcomeOverlay.is-landing { padding-top: 16px; }
  #welcomeOverlay.is-landing .welcome-box { padding: 24px 18px; width: calc(100% - 32px); }
  .steps { grid-template-columns: repeat(2, 1fr); row-gap: 16px; }
  .steps li:nth-child(2)::after { display: none; }
  .status-facts { grid-template-columns: 1fr; gap: 2px; } .status-facts dd { margin-bottom: 8px; }
}

/* The "Fusinite Standard" logo (Hadi, 7 Oct 2026). Its lettering is dark green, so on dark backgrounds it always sits on a
   light panel (like the Fusinite logo chip); on light backgrounds it blends in. */
.welcome-logo { height: auto; width: min(340px, 100%); border: 0; background: none; padding: 0; }
.welcome-logo img { display: block; width: 100%; height: auto; }
[data-theme=dark] .welcome-logo { background: #fffdf8; border-radius: 18px; padding: 10px 14px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme=light]) .welcome-logo { background: #fffdf8; border-radius: 18px; padding: 10px 14px; } }
#welcomeOverlay.is-landing .welcome-logo { width: min(300px, 100%); }
body.has-nav .brand .logo-chip.std-logo { padding: 6px 8px; background: #fffdf8; }
body.has-nav .brand .logo-chip.std-logo img { height: auto; width: 100%; max-width: 196px; }
@media (max-width: 860px) {
  body.has-nav .brand .logo-chip.std-logo img { width: auto; height: 44px; }
}
