/*
 * DarziOS PWA — application shell styles (production).
 *
 * Owner rule (strict): every color, spacing value, radius and shadow in
 * this file resolves to a custom property in css/design-tokens.css.
 * Zero raw color literals. Control patterns (buttons, inputs, tags) live
 * in css/controls.css — the single production control kit, mirroring the
 * patterns the owner approved on the Design Board.
 */

/* -------------------------------------------------------------- base */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--canvas-dark);
  color: var(--chalk-white);
  font-family: var(--font-ui);
  font-size: var(--text-md);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* Brand wordmark — v2: Manrope extrabold (owner readability directive
   2026-11-01 — Cinzel retired; reads as a modern, confident mark). */
.wordmark {
  font-family: var(--font-brand);
  font-weight: var(--weight-extrabold);
  color: var(--brand-brass);
  letter-spacing: 0.06em;
  font-size: var(--text-xl);
}
.wordmark--lg { font-size: var(--text-2xl); }

/* -------------------------------------------------------------- shell */
/* Full-viewport centered stage for single-column screens (login, lock). */
.shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--space-6);
}

.shell__fatal {
  max-width: 48ch;
  text-align: center;
  color: var(--status-danger);
}

/* ------------------------------------------------- SCR-AUTH-01 login */
.auth {
  width: 100%;
  max-width: 420px;
  display: grid;
  gap: var(--space-6);
  justify-items: center;
}

.auth__card {
  width: 100%;
  display: grid;
  gap: var(--space-6);
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--space-6);
}

.auth__brand {
  display: grid;
  gap: var(--space-1);
  justify-items: center;
  text-align: center;
}
.auth__tagline {
  margin: 0;
  font-size: var(--text-xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--chalk-muted);
}

.auth__form {
  display: grid;
  gap: var(--space-4);
}

.auth__error {
  margin: 0;
  min-height: 1em;
  font-size: var(--text-sm);
  color: var(--status-danger);
}

.auth__status {
  margin: 0;
  min-height: 1em;
  font-size: var(--text-xs);
  color: var(--chalk-muted);
  text-align: center;
}

.auth__foot {
  margin: 0;
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--chalk-muted);
}

/* ------------------------------------------------- full-screen layout */
/* Screens with an app bar (dashboard and beyond) use block layout;
   single-column screens (login) keep the centered .shell grid. */
.shell--full {
  display: block;
}

/* -------------------------------------------------------------- app bar */
.app-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
  padding: var(--space-3) var(--space-6);
  background: var(--surface-card);
  border-bottom: 1px solid var(--border-subtle);
}
.app-bar__brand {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
}
.app-bar__sub {
  color: var(--chalk-muted);
  font-size: var(--text-sm);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.app-bar__user {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.app-bar__name {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
}

/* ------------------------------------------------ shared screen elements */
/* Visible honesty chip: fixture data, never mistaken for live values.
   Used by every screen that renders sample data (dashboard, stepper, …). */
.sample-chip {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-2);
  border: 1px solid var(--status-warning);
  border-radius: var(--radius-sm);
  background: var(--warning-faint);
  color: var(--status-warning);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* --------------------------------------------------------- screen stub */
/* Placeholder stage for screens not yet built (visual-gate pipeline). */
.stub {
  min-height: calc(100vh - var(--touch-workshop-lg));
  display: grid;
  place-items: center;
  padding: var(--space-6);
}
.stub__card {
  display: grid;
  gap: var(--space-3);
  justify-items: center;
  text-align: center;
  max-width: 46ch;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--space-8) var(--space-6);
}
.stub__id {
  margin: 0;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.1em;
  color: var(--brand-brass-ink);
  text-transform: uppercase;
}
.stub__title {
  margin: 0;
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
}
.stub__note {
  margin: 0;
  color: var(--chalk-muted);
  font-size: var(--text-sm);
}

/* Shared measurement chip grid (SCR-ORD-03 snapshot, SCR-CUST-02
 * current version). Migrated out of order-hub.css when the second
 * consumer landed — same pattern as .sample-chip. */
.meas-chips {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: var(--space-2);
}
.meas-chip {
  display: grid;
  gap: 2px;
  padding: var(--space-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--surface-elevated);
}
.meas-chip__name {
  font-size: var(--text-xs);
  color: var(--chalk-muted);
}
.meas-chip__value {
  font-family: var(--font-mono);
  font-size: var(--text-md);
  font-weight: var(--weight-bold);
  font-variant-numeric: tabular-nums;
  color: var(--brand-brass-ink);
}

/* ------------------------------------------------------- theme toggle
 * Shell chrome (v2): floating light/dark switch, present on every
 * screen including login. Icon state is driven by the
 * :root[data-theme='dark'] selector — no JS icon swapping. */
.theme-toggle {
  position: fixed;
  bottom: var(--space-4);
  right: var(--space-4);
  z-index: 30;
  width: var(--touch-min);
  height: var(--touch-min);
  display: grid;
  place-items: center;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  background: var(--surface-card);
  color: var(--chalk-muted);
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition:
    color var(--duration-fast) var(--ease-standard),
    border-color var(--duration-fast) var(--ease-standard);
}
.theme-toggle:hover {
  color: var(--brand-brass-ink);
  border-color: var(--brand-brass);
}
.theme-toggle .icon--sun { display: none; }
:root[data-theme='dark'] .theme-toggle .icon--sun { display: block; }
:root[data-theme='dark'] .theme-toggle .icon--moon { display: none; }

/* ----------------------------------------------------- compact shell */
/* Smartphone (Doc 7 §16): tighten the app bar, drop the secondary
   label, and respect the home-indicator safe area on the toggle. */
@media (max-width: 560px) {
  .app-bar {
    padding: var(--space-3) var(--space-4);
  }
  .app-bar__sub {
    display: none;
  }
  .theme-toggle {
    bottom: calc(var(--space-4) + env(safe-area-inset-bottom, 0px));
    right: calc(var(--space-4) + env(safe-area-inset-right, 0px));
  }
}
