/* ==========================================================================
   SOLVO — Layout: auth screen, app shell, rail, topbar, page frame
   ========================================================================== */

/* ==========================================================================
   Auth / login
   ========================================================================== */
.auth-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  background: var(--canvas);
}
.auth-card {
  position: relative;
  align-self: center;
  justify-self: center;
  width: min(440px, 100%);
  padding: var(--s-9) var(--s-7) var(--s-7);
  display: grid;
  align-content: start;
  gap: var(--s-5);
}
.auth-card h1 { font-size: var(--fs-hero); }
.auth-card .stack { gap: var(--s-4); }

/* Theme + language, reachable before anyone has an account. */
.auth-controls {
  position: absolute;
  top: var(--s-5);
  right: var(--s-7);
  display: flex;
  gap: var(--s-2);
}
.seg-toggle {
  display: flex;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-soft);
}
.seg-toggle button {
  height: 26px;
  padding: 0 var(--s-2);
  border: 0;
  border-radius: var(--r-xs);
  background: transparent;
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semi);
}
.seg-toggle button:hover { background: transparent; color: var(--ink); }
.seg-toggle button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-1);
}

.brand-lockup { display: grid; gap: var(--s-3); justify-items: start; }
.brand-lockup .solvo-mark { width: 40px; height: 40px; color: var(--brand); }
.brand-coin { width: 84px; height: 84px; }

/* Letterspaced caps, the way the name is set on the coin. The tracking adds
   a trailing gap after the final O that makes the block look shifted right;
   the negative margin takes exactly that gap back so the wordmark aligns
   with the form beneath it. The gradient is the sheen off struck metal —
   --brand is set first so the wordmark still has a colour if
   background-clip:text is unsupported. */
.brand-word {
  margin: 0;
  font-family: var(--font-display);
  font-size: 29px;
  font-weight: var(--fw-semi);
  letter-spacing: .3em;
  line-height: 1;
  text-transform: uppercase;
  color: var(--brand);
  margin-right: -.3em;
  background: linear-gradient(96deg, var(--brand) 8%, var(--brand-hover) 46%, var(--brand) 82%);
  -webkit-background-clip: text;
  background-clip: text;
}
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .brand-word { color: transparent; }
}

/* --- one screen at a time --------------------------------------------- */
.auth-view { display: grid; gap: var(--s-5); }
.auth-view.hidden { display: none !important; }
.auth-view-head { display: grid; gap: var(--s-1); }
.auth-view-head h1 { font-size: var(--fs-hero); }
.auth-submit { width: 100%; height: 42px; font-size: var(--fs-base); }

.auth-links {
  display: grid;
  gap: var(--s-2);
  justify-items: start;
  font-size: var(--fs-sm);
  color: var(--muted);
}
.auth-links p { margin: 0; }
button.linkish {
  height: auto;
  padding: 0;
  border: 0;
  background: none;
  color: var(--brand);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semi);
}
button.linkish:hover { background: none; color: var(--brand-hover); text-decoration: underline; }

/* --- password reveal --------------------------------------------------- */
.input-reveal { position: relative; display: block; }
.input-reveal input { padding-right: 42px; }
.reveal-btn {
  position: absolute;
  top: 50%;
  right: 5px;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: var(--r-xs);
  background: transparent;
  color: var(--muted);
}
.reveal-btn:hover { background: var(--surface-soft); color: var(--ink); }
.reveal-btn::before {
  content: "";
  display: block;
  width: 17px;
  height: 17px;
  margin: 0 auto;
  background: currentColor;
  -webkit-mask: var(--eye) center/contain no-repeat;
  mask: var(--eye) center/contain no-repeat;
  --eye: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2" stroke-linecap="round"><path d="M1.8 12S5.4 5.2 12 5.2 22.2 12 22.2 12 18.6 18.8 12 18.8 1.8 12 1.8 12Z"/><circle cx="12" cy="12" r="3.2"/></svg>');
}
.reveal-btn[aria-pressed="true"]::before {
  --eye: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2" stroke-linecap="round"><path d="M3 3l18 18"/><path d="M10.6 6a9.6 9.6 0 0 1 1.4-.1c6.6 0 10.2 6.1 10.2 6.1a17 17 0 0 1-3 3.6"/><path d="M6.4 7.6A16.8 16.8 0 0 0 1.8 12s3.6 6.1 10.2 6.1c1.6 0 3-.3 4.2-.9"/></svg>');
}

/* --- confirmation states ----------------------------------------------- */
.auth-sent { display: grid; gap: var(--s-3); justify-items: start; }
.auth-sent h1 { font-size: var(--fs-hero); }
.auth-sent-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
}
.auth-sent-icon svg { width: 22px; height: 22px; }
.auth-foot { margin-top: var(--s-2); }
.brand-wordmark, .sidebar-wordmark { display: block; height: 26px; width: auto; object-fit: contain; object-position: left center; }

/* The pitch panel. This is the commercial hook: the name explains the
   product before a single figure appears on screen. */
.auth-pitch {
  position: relative;
  display: grid;
  align-content: center;
  gap: var(--s-4);
  padding: var(--s-8) clamp(var(--s-7), 6vw, 72px);
  background: var(--rail);
  color: var(--rail-ink-on);
  overflow: hidden;
}
/* This panel is dark in BOTH themes, so its glow must not be built from a
   token that flips. --brand-soft is a pale tint in light mode and turned the
   panel into fog. Derived from --brand with alpha instead: subtle over a dark
   surface either way. */
.auth-pitch::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 84% 10%, color-mix(in srgb, var(--rail-accent) 26%, transparent), transparent 48%),
    radial-gradient(circle at 6% 94%, color-mix(in srgb, var(--rail-accent) 16%, transparent), transparent 44%);
  pointer-events: none;
}
.auth-pitch > * { position: relative; z-index: 1; }

/* Bled off the top-right corner. Must come after the rule above: both are
   single-class selectors, so source order is the only thing that keeps this
   behind the copy instead of on top of it. */
.auth-pitch-coin {
  position: absolute;
  z-index: 0;
  top: -92px;
  right: -104px;
  width: 360px;
  height: 360px;
  opacity: .085;
  pointer-events: none;
  user-select: none;
}
@media (max-width: 900px) {
  .auth-pitch-coin { width: 230px; height: 230px; top: -52px; right: -58px; }
}

.auth-etymology { display: grid; gap: var(--s-3); max-width: 40ch; }

/* The Latin root is the reason the product is called what it is, so it gets
   real typographic weight: the word set large in italic, its meaning beneath,
   separated from the claim by a rule. It reads as a dictionary entry — which
   is exactly the credential the headline is borrowing. */
.auth-etymology .root {
  display: grid;
  gap: 3px;
  padding-bottom: var(--s-4);
  border-bottom: 1px solid var(--rail-line);
}
.auth-etymology .root-word {
  font-family: var(--font-display);
  font-size: clamp(26px, 2.2vw, 34px);
  font-style: italic;
  font-weight: var(--fw-med);
  letter-spacing: -.01em;
  line-height: 1;
  color: var(--rail-accent);
}
.auth-etymology .root-def {
  font-size: var(--fs-sm);
  font-weight: var(--fw-med);
  letter-spacing: .03em;
  color: var(--rail-ink);
}

/* The <br> in the string owns the line break, so no max-width here — any
   extra wrapping would break the claim in the wrong place and kill the
   rhythm of the two lines.

   Sized down from 41px max: the panel is half the viewport, and the Spanish
   headline is a third longer than the English one. At the old size ES wrapped
   to three lines and pushed the sixth proof row off the screen. */
.auth-etymology .word {
  font-size: clamp(25px, 2.3vw, 33px);
  font-weight: var(--fw-bold);
  letter-spacing: -.04em;
  line-height: 1.04;
  color: var(--rail-ink-on);
}
/* No min-height here on purpose. Reserving space for the longest translation
   is handled globally at runtime by i18n.js (see reserveSpace): hardcoding a
   line count per element does not survive a copy edit and does not scale to
   the rest of the app. */
.auth-etymology .gloss {
  max-width: 42ch;
  font-size: var(--fs-base);
  line-height: var(--lh-snug);
  color: var(--rail-ink);
}
.auth-etymology .gloss b { color: var(--rail-ink-on); font-weight: var(--fw-semi); }

/* Six rows now, not three: the gap tightens and each row gets a hairline so
   the list reads as a spec sheet rather than as six loose paragraphs. */
.auth-proof { display: grid; gap: 0; max-width: 44ch; padding-top: var(--s-4); border-top: 1px solid var(--rail-line); }
.auth-proof-row { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: var(--s-3); align-items: start; padding: 9px 0; font-size: var(--fs-sm); color: var(--rail-ink); }
.auth-proof-row + .auth-proof-row { border-top: 1px solid var(--rail-line); }
.auth-proof-row svg { width: 17px; height: 17px; margin-top: 1px; color: var(--rail-accent); }
.auth-proof-row b { display: block; margin-bottom: 1px; color: var(--rail-ink-on); font-weight: var(--fw-semi); }
.auth-proof-row i { display: block; font-style: normal; }
/* Rows carry one line now, not a heading plus a paragraph. At that length the
   copy is the point, so it takes the panel's full ink rather than the muted
   secondary tone the two-part rows used. */
.auth-proof-row > span[data-i18n] { color: var(--rail-ink-on); }

/* Provenance and ownership. Deliberately the quietest type on the panel:
   present for anyone who looks, silent for anyone who does not. */
.auth-provenance, .auth-entity {
  max-width: 44ch;
  font-size: var(--fs-xs);
  line-height: var(--lh-snug);
  color: var(--rail-ink);
}
.auth-provenance {
  padding-top: var(--s-4);
  border-top: 1px solid var(--rail-line);
  font-style: italic;
}
.auth-entity { margin-top: calc(var(--s-2) * -1); opacity: .72; }

.boot-error {
  margin: 0;
  padding: 11px 13px;
  border: 1px solid var(--neg);
  border-radius: var(--r-sm);
  background: var(--neg-soft);
  color: var(--neg);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semi);
}

@media (max-width: 900px) {
  .auth-screen { grid-template-columns: 1fr; }
  .auth-pitch { order: -1; padding: var(--s-7) var(--s-5); }
  .auth-etymology .word { font-size: 44px; }
  .auth-proof { display: none; }
}

/* ==========================================================================
   App shell
   ========================================================================== */
.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  background: var(--canvas);
}

/* --- rail --------------------------------------------------------------- */
.sidebar {
  position: sticky;
  top: 0;
  z-index: var(--z-rail);
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: var(--s-4) var(--s-3);
  background: var(--rail);
  border-right: 1px solid var(--rail-line);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.logo-zone {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-1) var(--s-2) var(--s-5);
  min-width: 0;
}
.logo-zone .solvo-mark { width: 28px; height: 28px; flex: 0 0 auto; color: var(--brand); }
.logo-zone strong {
  display: block;
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
  letter-spacing: -.03em;
  color: var(--rail-ink-on);
}
.logo-zone span {
  display: block;
  margin-top: 1px;
  font-size: var(--fs-label);
  font-weight: var(--fw-med);
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--rail-ink);
  opacity: .8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav, .nav-groups { display: grid; gap: var(--s-4); align-content: start; }
.nav-group { display: grid; gap: 1px; }
.nav-group > span {
  padding: 0 var(--s-3) var(--s-1);
  font-size: var(--fs-label);
  font-weight: var(--fw-semi);
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--rail-ink);
  opacity: .58;
}
.nav button, .nav-group button {
  width: 100%;
  height: 35px;
  padding: 0 var(--s-3);
  justify-content: flex-start;
  text-align: left;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--rail-ink);
  font-size: var(--fs-base);
  font-weight: var(--fw-med);
  transition: background var(--t-fast), color var(--t-fast);
}
.nav button:hover, .nav-group button:hover {
  background: var(--rail-active);
  color: var(--rail-ink-on);
  border-color: transparent;
}
.nav button.active, .nav-group button.active {
  background: var(--rail-active);
  color: var(--rail-ink-on);
  font-weight: var(--fw-semi);
  box-shadow: inset 2px 0 0 var(--rail-accent);
}

.sidebar-footer {
  margin-top: auto;
  padding: var(--s-3) var(--s-2) var(--s-1);
  border-top: 1px solid var(--rail-line);
  display: grid;
  gap: var(--s-3);
}
.pref-row { display: grid; gap: var(--s-1); }
.pref-label {
  font-size: var(--fs-label);
  font-weight: var(--fw-semi);
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--rail-ink);
  opacity: .6;
}
.sidebar-foot-end {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
  padding-top: var(--s-2);
  border-top: 1px solid var(--rail-line);
}

/* The segmented toggle sits on the dark rail here and on the card surface on
   the auth screen, so it takes its colours from whichever context it is in. */
.sidebar .seg-toggle {
  width: 100%;
  background: color-mix(in srgb, var(--rail-ink) 9%, transparent);
  border-color: var(--rail-line);
}
.sidebar .seg-toggle button { flex: 1; color: var(--rail-ink); }
.sidebar .seg-toggle button:hover { color: var(--rail-ink-on); }
.sidebar .seg-toggle button[aria-pressed="true"] {
  background: var(--rail-active);
  color: var(--rail-ink-on);
  box-shadow: none;
}
.sidebar-footer .small, .sidebar-footer .muted { color: var(--rail-ink); font-size: var(--fs-xs); }
.sidebar-footer button {
  height: var(--ctrl-h-sm);
  background: transparent;
  border-color: var(--rail-line);
  color: var(--rail-ink);
}
.sidebar-footer button:hover { background: var(--rail-active); color: var(--rail-ink-on); border-color: var(--rail-line); }

.status-dot { display: flex; align-items: center; gap: var(--s-2); color: var(--rail-ink); font-size: var(--fs-xs); }
.status-dot::before {
  content: "";
  flex: 0 0 auto;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--warn);
}
.status-dot.ok::before { background: var(--pos); }
.status-dot.error::before { background: var(--neg); }

/* --- main / topbar ------------------------------------------------------- */
.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-topbar);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  min-height: var(--topbar-h);
  padding: var(--s-3) var(--s-6);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.topbar h2 { margin: 0; font-size: var(--fs-hero); font-weight: var(--fw-bold); }
.topbar .eyebrow { margin: 0 0 1px; }
.top-actions select { width: auto; min-width: 108px; }

.view { display: none; }
.view.active {
  display: grid;
  gap: var(--s-4);
  align-content: start;
  width: min(100%, var(--page-max));
  margin: 0 auto;
  padding: var(--s-5) var(--s-6) var(--s-9);
}

/* Page heading inside a view. The topbar already names the view, so this
   carries the subtitle and the primary action, not a duplicate title. */
.ui-page-heading, .ui-workspace-header, .workspace-head, .compact-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s-5);
}
.ui-page-heading h3, .ui-workspace-header h3, .workspace-head h3 {
  margin: 0;
  font-size: var(--fs-hero);
  font-weight: var(--fw-bold);
}
.ui-page-heading p, .ui-workspace-header p, .workspace-head p {
  max-width: 68ch;
  margin: var(--s-1) 0 0;
  color: var(--muted);
  font-size: var(--fs-sm);
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1080px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: relative;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--s-2);
    padding: var(--s-3) var(--s-4);
    border-right: 0;
    border-bottom: 1px solid var(--rail-line);
  }
  .logo-zone { padding: 0 var(--s-4) 0 0; }
  .nav, .nav-groups { flex: 1; display: flex; flex-wrap: wrap; gap: var(--s-1); }
  .nav-group { display: contents; }
  .nav-group > span { display: none; }
  .nav button, .nav-group button { width: auto; height: 32px; }
  .sidebar-footer {
    margin-top: 0;
    padding: 0;
    border-top: 0;
    grid-auto-flow: column;
    align-items: center;
  }
  .sidebar-footer .small { display: none; }
  .view.active { padding: var(--s-4) var(--s-4) var(--s-8); }
  .topbar { padding: var(--s-3) var(--s-4); }
}

@media (max-width: 720px) {
  .topbar { flex-direction: column; align-items: flex-start; gap: var(--s-2); }
  .top-actions { width: 100%; }
  .top-actions button { flex: 1; }
  .ui-page-heading, .ui-workspace-header, .workspace-head {
    flex-direction: column;
    align-items: stretch;
    gap: var(--s-3);
  }
}
