/* ==========================================================================
   Base — reset, document, typography primitives, form element defaults,
   boot screen, and shared utility classes.
   ========================================================================== */

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

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--surface-0);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior-y: none;
}

h1, h2, h3, h4 {
  margin: 0;
  font-weight: 600;
  line-height: var(--lh-tight);
  letter-spacing: -0.01em;
}

p { margin: 0; }
a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }

[hidden] { display: none !important; }

::selection { background: var(--accent-soft); }

/* Scrollbars — thin and unobtrusive, matching the surface ramp. */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--r-pill); }
*::-webkit-scrollbar-thumb:hover { background: var(--text-4); }

/* ---------- Text utilities ------------------------------------------------ */
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.num  { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.eyebrow {
  font-size: var(--fs-2xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  color: var(--text-4);
  font-weight: 600;
}
.muted { color: var(--text-3); }
.dim { color: var(--text-2); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.break { word-break: break-all; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }

/* ---------- Form elements ------------------------------------------------- */
input, select, textarea {
  width: 100%;
  background: var(--surface-1);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  font-size: var(--fs-base);
  font-family: inherit;
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
  -webkit-appearance: none;
  appearance: none;
}
textarea { resize: vertical; min-height: 80px; font-family: var(--font-mono); font-size: var(--fs-sm); }
input::placeholder, textarea::placeholder { color: var(--text-4); }
input:hover, select:hover, textarea:hover { border-color: var(--border-strong); }
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
input:disabled, select:disabled, textarea:disabled { opacity: 0.5; cursor: not-allowed; }

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236d7789' stroke-width='2.5' stroke-linecap='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  padding-right: 30px;
}

.field { display: flex; flex-direction: column; gap: var(--sp-2); width: 100%; }
.field-label {
  font-size: var(--fs-2xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  color: var(--text-3);
  font-weight: 600;
}
.field-hint { font-size: var(--fs-sm); color: var(--text-4); line-height: var(--lh-normal); }
.field-error { color: var(--danger); font-size: var(--fs-sm); margin: 0; min-height: 16px; }

.checkline {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-base);
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
}
.checkline input[type="checkbox"] {
  width: 16px; height: 16px;
  flex: 0 0 auto;
  accent-color: var(--accent);
  cursor: pointer;
}

/* iOS zooms any input whose font-size is under 16px on focus. */
@media (max-width: 860px) {
  input, select, textarea { font-size: 16px; }
}

/* ---------- Boot screen -------------------------------------------------- */
.boot-screen {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--surface-0);
  z-index: var(--z-modal);
  transition: opacity var(--dur-slow) var(--ease);
}
.boot-screen.is-hiding {
  opacity: 0;
  pointer-events: none;
}
.boot-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-4);
  text-align: center;
  padding: var(--sp-6);
  animation: boot-fade-in 400ms var(--ease) both;
}
@keyframes boot-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.boot-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-strong);
  box-shadow: 0 0 0 1px var(--accent-ring), 0 8px 32px rgba(255, 90, 31, 0.10);
}
.boot-brand {
  font-size: var(--fs-2xl);
  font-weight: 700;
  letter-spacing: var(--tracking-wide);
  color: var(--accent);
  line-height: var(--lh-tight);
}
.boot-brand-sub {
  display: block;
  font-size: var(--fs-lg);
  font-weight: 600;
  color: var(--text);
  letter-spacing: var(--tracking-caps);
  margin-top: var(--sp-1);
}
.boot-tagline {
  font-size: var(--fs-sm);
  color: var(--text-4);
  max-width: 280px;
  line-height: var(--lh-loose);
}
.boot-loading {
  margin-top: var(--sp-3);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  width: 180px;
}
.boot-bar {
  width: 100%;
  height: 2px;
  background: var(--surface-3);
  border-radius: var(--r-pill);
  overflow: hidden;
}
.boot-bar-fill {
  width: 40%;
  height: 100%;
  background: var(--accent);
  border-radius: var(--r-pill);
  animation: boot-shimmer 1.4s ease-in-out infinite;
}
@keyframes boot-shimmer {
  0%   { transform: translateX(-110%); }
  50%  { transform: translateX(200%); }
  100% { transform: translateX(-110%); }
}
.boot-loading-text {
  font-size: var(--fs-xs);
  color: var(--text-4);
}
@media (prefers-reduced-motion: reduce) {
  .boot-content { animation: none; }
  .boot-bar-fill { animation: none; width: 100%; }
}

/* ---------- Login (new landing design) ---------------------------------- */
.login-screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: var(--sp-5);
  background:
    radial-gradient(ellipse 640px 420px at 50% -8%, rgba(255, 90, 31, 0.09), transparent 70%),
    radial-gradient(ellipse 520px 380px at 88% 108%, rgba(62, 207, 224, 0.055), transparent 70%),
    var(--surface-0);
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-8) var(--sp-6) var(--sp-7);
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: var(--shadow-lg);
  animation: boot-fade-in 400ms var(--ease) both;
}
.login-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-strong);
  box-shadow: 0 0 0 1px var(--accent-ring), 0 8px 32px rgba(255, 90, 31, 0.10);
  transform: translateX(-8px);
}
.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-top: var(--sp-4);
  font-size: var(--fs-2xl);
  font-weight: 700;
  letter-spacing: var(--tracking-wide);
  color: var(--accent);
  line-height: var(--lh-tight);
}
.login-brand-sub {
  display: block;
  font-size: var(--fs-lg);
  font-weight: 600;
  color: var(--text);
  letter-spacing: var(--tracking-caps);
  margin-top: var(--sp-1);
}
.login-tagline {
  margin: var(--sp-3) 0 var(--sp-6);
  font-size: var(--fs-sm);
  color: var(--text-4);
  text-align: center;
  max-width: 280px;
  line-height: var(--lh-loose);
}
.login-card .field {
  width: 100%;
  margin-bottom: var(--sp-1);
}
.login-card .field-label {
  text-align: center;
}
.login-card .btn-block {
  margin-top: var(--sp-2);
}

@media (max-width: 420px) {
  .login-card {
    padding: var(--sp-7) var(--sp-5) var(--sp-6);
  }
  .login-avatar {
    width: 104px;
    height: 104px;
  }
}
