/* eideticstudio cockpit — design system per projects/_company/cockpit-redesign/ux-redesign.md */

@font-face {
  font-family: 'Inter Variable';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('fonts/InterVariable.woff2') format('woff2-variations');
}

:root {
  /* surfaces — warm near-black, not cool blue-black */
  --bg:                #0A0A0A;
  --surface:           #131313;
  --surface-elevated:  #1A1A1A;
  --surface-alert:     rgba(200, 255, 0, 0.06);
  --overlay:           rgba(10, 10, 10, 0.78);

  /* borders — never pure white */
  --border:            rgba(240, 237, 232, 0.06);
  --border-strong:     rgba(240, 237, 232, 0.12);
  --border-accent:     rgba(200, 255, 0, 0.35);

  /* text — warm white, never pure */
  --text:              #F0EDE8;
  --text-muted:        rgba(240, 237, 232, 0.55);
  --text-subtle:       rgba(240, 237, 232, 0.35);
  --text-inverse:      #0A0A0A;

  /* brand — action only */
  --accent:            #C8FF00;
  --accent-hover:      #B8EE00;
  --accent-soft:       rgba(200, 255, 0, 0.15);

  /* signal — system state, not brand */
  --success:           #7CD992;
  --warn:              #F2C674;
  --danger:            #E8847C;
  --success-soft:      rgba(124, 217, 146, 0.12);
  --warn-soft:         rgba(242, 198, 116, 0.12);
  --danger-soft:       rgba(232, 132, 124, 0.12);

  /* type */
  --font-sans: 'Inter Variable', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, monospace;
  --text-xs:   11px;
  --text-sm:   13px;
  --text-base: 15px;
  --text-md:   17px;
  --text-lg:   22px;
  --text-xl:   32px;
  --leading-tight: 1.15;
  --leading-snug:  1.30;
  --leading-body:  1.50;
  --weight-regular:  420;
  --weight-medium:   500;
  --weight-semibold: 600;
  --tracking-tight:  -0.011em;
  --tracking-normal: 0;
  --tracking-loose:  0.06em;

  /* space — modular */
  --space-1:  4px;
  --space-2:  8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 999px;

  /* shadows + glow */
  --shadow-sm:  0 1px 2px rgba(0, 0, 0, 0.20);
  --shadow-md:  0 6px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg:  0 14px 48px rgba(0, 0, 0, 0.55);
  --shadow-glow: 0 0 0 4px var(--accent-soft);

  /* motion */
  --ease-out:    cubic-bezier(0.16, 1, 0.30, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --duration-micro: 120ms;
  --duration-base:  180ms;
  --duration-view:  240ms;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 1ms !important; animation-duration: 1ms !important; animation-iteration-count: 1 !important; }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  line-height: var(--leading-body);
  letter-spacing: var(--tracking-normal);
  font-feature-settings: 'cv11' 1;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  -webkit-font-smoothing: antialiased;
}

.view { padding: var(--space-5) var(--space-5) var(--space-12); max-width: 480px; margin: 0 auto; }
@media (min-width: 481px) { .view { padding: var(--space-6) var(--space-6) var(--space-16); } }

.hidden { display: none !important; }

/* ── Utility ─────────────────────────────────────────────────────────── */
.muted   { color: var(--text-muted); }
.subtle  { color: var(--text-subtle); }
.small   { font-size: var(--text-sm); }
.xs      { font-size: var(--text-xs); }
.mono    { font-family: var(--font-mono); word-break: break-all; }
.tabular { font-feature-settings: 'tnum' 1, 'cv11' 1; }

/* ── Icon ────────────────────────────────────────────────────────────── */
.icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; flex-shrink: 0; color: currentColor;
}
.icon svg { width: 100%; height: 100%; display: block; }

/* ── Brand wordmark ──────────────────────────────────────────────────── */
.brand {
  font-family: var(--font-sans);
  font-weight: var(--weight-semibold);
  font-size: 28px;
  letter-spacing: var(--tracking-tight);
  color: var(--text);
  line-height: 1;
}
.brand__dot { color: var(--accent); }
.brand--sm { font-size: 14px; color: var(--text-muted); font-weight: var(--weight-medium); }
.brand--sm .brand__dot { color: var(--text-muted); }

/* ── Buttons ─────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  height: 48px; padding: 0 var(--space-4); border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-weight: var(--weight-semibold);
  font-size: var(--text-base);
  line-height: 1;
  border: 1px solid transparent;
  cursor: pointer; user-select: none;
  transition: transform var(--duration-micro) var(--ease-out),
              background var(--duration-micro) var(--ease-out),
              border-color var(--duration-micro) var(--ease-out),
              opacity var(--duration-micro) var(--ease-out);
  background: transparent; color: var(--text);
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; pointer-events: none; }
.btn:focus-visible { outline: none; box-shadow: var(--shadow-glow); }

.btn--primary { background: var(--accent); color: var(--text-inverse); }
.btn--primary:active { background: var(--accent-hover); }

.btn--secondary { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn--secondary:active { background: var(--surface-elevated); }

.btn--danger { background: transparent; color: var(--danger); border-color: var(--danger-soft); }
.btn--danger:active { background: var(--danger-soft); }

.btn--full { width: 100%; }
.btn--lg { height: 52px; font-size: var(--text-md); }

.btn--icon {
  width: 36px; height: 36px; padding: 0; border-radius: var(--radius-md);
  color: var(--text-muted); background: transparent;
}
.btn--icon:active { background: var(--surface-elevated); color: var(--text); }

.btn--ghost { background: transparent; color: var(--text-muted); font-weight: var(--weight-regular); height: auto; padding: var(--space-2) var(--space-3); font-size: var(--text-sm); }
.btn--ghost:active { background: var(--surface); color: var(--text); }

.btn--loading { pointer-events: none; }
.btn--loading .btn__label { opacity: 0.5; }

/* ── Inputs ──────────────────────────────────────────────────────────── */
.input-group { position: relative; display: flex; align-items: center; width: 100%; }
.input-group__icon-left,
.input-group__icon-right {
  position: absolute; pointer-events: none;
  color: var(--text-muted);
  display: inline-flex; align-items: center; justify-content: center;
}
.input-group__icon-left  { left: var(--space-4); }
.input-group__icon-right { right: var(--space-3); width: 36px; height: 36px; pointer-events: auto; cursor: pointer; border-radius: var(--radius-sm); }
.input-group__icon-right:active { background: var(--surface-elevated); color: var(--text); }

.input {
  width: 100%; height: 52px;
  padding: 0 var(--space-4);
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-weight: var(--weight-regular);
  font-size: var(--text-base);
  line-height: 1;
  transition: border-color var(--duration-micro) var(--ease-out),
              box-shadow var(--duration-micro) var(--ease-out);
}
.input::placeholder { color: var(--text-subtle); }
.input:focus { outline: none; border-color: var(--border-accent); box-shadow: var(--shadow-glow); }
.input--with-icon-left  { padding-left: 44px; }
.input--with-icon-right { padding-right: 48px; }
.input--error { border-color: var(--danger); }

.input--code {
  font-size: 28px;
  font-weight: var(--weight-medium);
  text-align: center;
  letter-spacing: 0.35em;
  height: 64px;
  font-feature-settings: 'tnum' 1;
  padding: 0 var(--space-3);
}

/* ── Form messages ───────────────────────────────────────────────────── */
.form-msg { margin: var(--space-2) 0 0; font-size: var(--text-sm); color: var(--text-muted); min-height: 1.2em; }
.form-msg--error { color: var(--danger); }

/* ── Login / MFA shared layout ───────────────────────────────────────── */
#login, #mfa-challenge, #mfa-enroll {
  min-height: 100dvh;
  display: flex; flex-direction: column;
  padding-top: max(env(safe-area-inset-top), var(--space-12));
  gap: var(--space-6);
}
.auth-header { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-2); margin-top: var(--space-10); }
.auth-header__icon { width: 28px; height: 28px; color: var(--accent); margin-bottom: var(--space-2); }
.auth-header h1 { margin: 0; font-size: var(--text-lg); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-tight); line-height: var(--leading-snug); }
.auth-header p { margin: 0; color: var(--text-muted); font-size: var(--text-sm); }

.auth-form { display: flex; flex-direction: column; gap: var(--space-3); }
.auth-chrome { display: flex; align-items: center; justify-content: flex-start; min-height: 36px; }

/* ── MFA enrol QR ────────────────────────────────────────────────────── */
.qr-box {
  background: #FFFFFF; padding: 16px; border-radius: var(--radius-lg);
  display: flex; justify-content: center; align-items: center;
  align-self: center; margin: var(--space-2) 0;
}
.qr-box canvas { display: block; border-radius: 4px; }
.qr-fallback { padding: var(--space-4); background: var(--surface); border-radius: var(--radius-md); }

details.manual-code {
  background: var(--surface); border-radius: var(--radius-md); padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
}
details.manual-code summary {
  display: flex; align-items: center; gap: var(--space-2);
  cursor: pointer; list-style: none; color: var(--text-muted); font-size: var(--text-sm); font-weight: var(--weight-medium);
}
details.manual-code summary::-webkit-details-marker { display: none; }
details.manual-code[open] summary { color: var(--text); margin-bottom: var(--space-3); }
details.manual-code .manual-code__chev { transition: transform var(--duration-base) var(--ease-out); }
details.manual-code[open] .manual-code__chev { transform: rotate(180deg); }
.manual-code__body { display: flex; flex-direction: column; gap: var(--space-3); }
.manual-code__secret { font-family: var(--font-mono); font-size: var(--text-base); letter-spacing: 0.05em; color: var(--text); word-break: break-all; padding: var(--space-3); background: var(--bg); border-radius: var(--radius-sm); border: 1px solid var(--border); }

/* ── App chrome ──────────────────────────────────────────────────────── */
.app-chrome { display: flex; justify-content: space-between; align-items: center; min-height: 44px; margin-bottom: var(--space-4); }
.app-chrome__left { display: flex; align-items: center; gap: var(--space-2); }
.app-chrome__right { display: flex; gap: var(--space-1); }

/* ── Status line (hero) ──────────────────────────────────────────────── */
.status-line { margin: var(--space-6) 0 var(--space-8); }
.status-line__primary {
  margin: 0 0 var(--space-2);
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-tight);
  color: var(--text);
}
.status-line__primary .accent { color: var(--accent); font-feature-settings: 'tnum' 1; }
.status-line__secondary { margin: 0; font-size: var(--text-xs); color: var(--text-subtle); line-height: 1.4; }
.status-line--interactive { cursor: pointer; }

/* ── Sections ────────────────────────────────────────────────────────── */
.section { margin-top: var(--space-8); }
.section__label {
  display: flex; align-items: center; gap: var(--space-2);
  margin: 0 0 var(--space-3);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: var(--tracking-loose);
}
.section__label .icon { color: var(--text-subtle); }

/* ── Surfaces (replace .card) ────────────────────────────────────────── */
.surface {
  background: var(--surface);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-3);
}
.surface:last-child { margin-bottom: 0; }
.surface--elevated { background: var(--surface-elevated); border: 1px solid var(--border); }
.surface--alert {
  background: var(--surface-alert);
  border: 1px solid var(--border-accent);
  border-left: 3px solid var(--accent);
  padding-left: calc(var(--space-5) - 2px);
}
.surface--interactive { cursor: pointer; transition: transform var(--duration-micro) var(--ease-out), background var(--duration-micro) var(--ease-out); }
.surface--interactive:active { transform: scale(0.985); background: var(--surface-elevated); }
.surface--muted { color: var(--text-muted); font-size: var(--text-sm); }

/* ── Sprint row ──────────────────────────────────────────────────────── */
.sprint-row__head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-3); }
.sprint-row__title { font-weight: var(--weight-semibold); font-size: var(--text-base); color: var(--text); }
.sprint-row__gates { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--space-3); }

/* ── Pills (status tags) ─────────────────────────────────────────────── */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px var(--space-2);
  border-radius: var(--radius-full);
  font-size: var(--text-xs); font-weight: var(--weight-medium); line-height: 1.4;
  background: var(--surface-elevated); color: var(--text-muted);
  white-space: nowrap;
}
.pill--success { color: var(--success); background: var(--success-soft); }
.pill--warn    { color: var(--warn);    background: var(--warn-soft); }
.pill--danger  { color: var(--danger);  background: var(--danger-soft); }
.pill--accent  { color: var(--accent);  background: var(--accent-soft); }
.pill__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }

/* gate (a sprint open-gate chip — quieter than a pill) */
.gate { font-size: var(--text-xs); padding: 3px var(--space-2); border-radius: var(--radius-sm); background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); }
.gate--good { color: var(--success); border-color: transparent; background: var(--success-soft); }

/* ── Stats row ───────────────────────────────────────────────────────── */
.stat-row { display: flex; gap: var(--space-6); flex-wrap: wrap; }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat__value { font-size: var(--text-md); font-weight: var(--weight-semibold); line-height: 1; color: var(--text); font-feature-settings: 'tnum' 1, 'cv11' 1; }
.stat__label { font-size: 10px; font-weight: var(--weight-medium); color: var(--text-subtle); text-transform: uppercase; letter-spacing: var(--tracking-loose); }

/* ── Routine row ─────────────────────────────────────────────────────── */
.routines { padding: var(--space-2) 0; }
.routine { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-5); border-top: 1px solid var(--border); }
.routine:first-child { border-top: none; }
.routine__main { flex: 1; min-width: 0; }
.routine__name { font-size: var(--text-base); font-weight: var(--weight-medium); color: var(--text); line-height: 1.2; }
.routine__meta { font-size: var(--text-xs); color: var(--text-subtle); margin-top: 2px; line-height: 1.3; }
.routine__age { font-size: var(--text-xs); color: var(--text-subtle); font-feature-settings: 'tnum' 1; flex-shrink: 0; }

/* ── Signal lines ────────────────────────────────────────────────────── */
.signal { display: flex; gap: var(--space-3); padding: var(--space-3) 0; align-items: flex-start; line-height: var(--leading-snug); }
.signal + .signal { border-top: 1px solid var(--border); }
.signal__icon { color: var(--text-subtle); margin-top: 2px; }
.signal__text { font-size: var(--text-sm); color: var(--text); }

/* ── Proposals ───────────────────────────────────────────────────────── */
.proposal {
  background: var(--surface); border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  margin-bottom: var(--space-3);
  transition: opacity var(--duration-base) var(--ease-out), max-height var(--duration-base) var(--ease-in-out), margin var(--duration-base) var(--ease-in-out), padding var(--duration-base) var(--ease-in-out);
  overflow: hidden;
}
.proposal--leaving { opacity: 0; max-height: 0; margin-bottom: 0; padding-top: 0; padding-bottom: 0; }
.proposal__head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-3); margin-bottom: var(--space-2); }
.proposal__title { margin: 0; font-size: var(--text-base); font-weight: var(--weight-semibold); color: var(--text); line-height: var(--leading-snug); }
.proposal__rationale {
  margin: 0 0 var(--space-3);
  color: var(--text-muted);
  font-size: var(--text-sm);
  line-height: var(--leading-body);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.proposal__rationale--full { display: block; -webkit-line-clamp: none; }
.proposal__meta { display: flex; gap: var(--space-3); align-items: center; font-size: var(--text-xs); color: var(--text-subtle); margin-bottom: var(--space-3); flex-wrap: wrap; }
.proposal__meta a { color: var(--text-muted); text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.proposal__meta a:hover, .proposal__meta a:active { color: var(--text); }
.proposal__actions { display: flex; gap: var(--space-2); }
.proposal__actions .btn { flex: 1; height: 44px; }
.proposal__expand { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 0; display: inline-flex; align-items: center; gap: 4px; font-size: var(--text-xs); }
.proposal__expand:active { color: var(--text); }

/* ── Spinner ─────────────────────────────────────────────────────────── */
.spinner {
  width: 26px; height: 26px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 40vh auto;
}
@keyframes spin { to { transform: rotate(360deg); } }
.btn .spinner { width: 16px; height: 16px; margin: 0; border-width: 2px; }

/* ── Toast ───────────────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: calc(env(safe-area-inset-bottom) + var(--space-6)); left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--surface-elevated); color: var(--text);
  padding: var(--space-3) var(--space-5); border-radius: var(--radius-full);
  font-size: var(--text-sm);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transition: opacity var(--duration-base) var(--ease-out), transform var(--duration-base) var(--ease-out);
  pointer-events: none;
  z-index: 100;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast--success { color: var(--success); }
.toast--error { color: var(--danger); }

/* ── View transitions (fade between auth/cockpit) ────────────────────── */
.view {
  animation: viewIn var(--duration-view) var(--ease-out);
}
@keyframes viewIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Stagger fade-in for cockpit content cards ───────────────────────── */
.fade-in { animation: fadeIn var(--duration-base) var(--ease-out) both; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Cockpit content scaffolding ─────────────────────────────────────── */
.action-zone { margin: var(--space-6) 0 var(--space-8); display: flex; flex-direction: column; gap: var(--space-3); }
.action-card { background: var(--surface-alert); border: 1px solid var(--border-accent); border-left: 3px solid var(--accent); border-radius: var(--radius-lg); padding: var(--space-4) var(--space-5); padding-left: calc(var(--space-5) - 2px); display: flex; gap: var(--space-3); align-items: center; }
.action-card__icon { color: var(--accent); flex-shrink: 0; }
.action-card__text { font-size: var(--text-sm); color: var(--text); line-height: var(--leading-snug); }
.action-card__text strong { color: var(--text); font-weight: var(--weight-semibold); }
