/* Guardian — Sortie 1 stylesheet.
   Locked design language per Captain's brief §13.
   Cinzel / Share Tech Mono / Cormorant Garamond will be self-hosted in
   Sortie 3 when the PWA shell lands — for now we degrade to serif/mono
   system fonts so the install can boot without Google Fonts fetches. */

:root {
  --void-0: #04161e;
  --void-1: #020b14;
  --void-2: #01060c;
  --void-3: #000308;

  --cyan-bright: #3aecd0;
  --cyan-mid:    #1ab8a4;
  --cyan-dim:    #4a8a7e;

  --gold-bright: #d4a000;
  --gold-mid:    #a08440;
  --gold-dim:    rgba(212, 160, 0, 0.55);

  --font-serif: 'Cinzel', 'Trajan Pro', 'Cormorant Garamond', Georgia, serif;
  --font-mono:  'Share Tech Mono', 'DejaVu Sans Mono', Menlo, monospace;
  --font-quote: 'Cormorant Garamond', Georgia, serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  width: 100%;
  background: radial-gradient(ellipse at 50% 42%,
              var(--void-0) 0%,
              var(--void-1) 38%,
              var(--void-2) 72%,
              var(--void-3) 100%);
  color: var(--cyan-bright);
  font-family: var(--font-serif);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body.standby {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: env(safe-area-inset-top, 24px) 24px env(safe-area-inset-bottom, 32px);
}

.standby-frame {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  width: 100%;
  max-width: 520px;
  text-align: center;
}

.standby-disc img {
  display: block;
  width: 280px;
  height: 280px;
  max-width: 65vw;
  max-height: 65vw;
  filter: drop-shadow(0 0 24px rgba(58, 236, 208, 0.18));
}

.standby-title {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: clamp(36px, 9vw, 56px);
  letter-spacing: 0.32em;
  margin-top: 12px;
  color: var(--cyan-bright);
  text-shadow: 0 0 18px rgba(58, 236, 208, 0.25);
}

.standby-subtitle {
  font-family: var(--font-mono);
  font-size: clamp(14px, 3.5vw, 18px);
  letter-spacing: 0.4em;
  color: var(--cyan-mid);
  opacity: 0.85;
  margin-top: -4px;
}

.standby-rule {
  width: 64px;
  height: 1px;
  background: var(--gold-dim);
  margin: 14px 0 6px;
}

.standby-pocket {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.5em;
  color: var(--gold-mid);
  opacity: 0.78;
}

.standby-status {
  font-family: var(--font-quote);
  font-style: italic;
  font-size: clamp(14px, 3.4vw, 16px);
  color: var(--cyan-dim);
  margin-top: 18px;
  letter-spacing: 0.04em;
}

.standby-footer {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  max-width: 520px;
  justify-content: center;
  padding-bottom: 8px;
}

.footer-rule {
  flex: 0 0 64px;
  height: 1px;
  background: var(--gold-dim);
}

.footer-decree {
  font-family: var(--font-serif);
  font-size: clamp(10px, 2.8vw, 13px);
  letter-spacing: 0.32em;
  color: var(--gold-bright);
  text-shadow: 0 0 6px rgba(212, 160, 0, 0.25);
}

@media (prefers-reduced-motion: no-preference) {
  .standby-disc img {
    animation: standby-breathe 7s ease-in-out infinite;
  }
}

@keyframes standby-breathe {
  0%, 100% { filter: drop-shadow(0 0 24px rgba(58, 236, 208, 0.18)); opacity: 0.96; }
  50%      { filter: drop-shadow(0 0 36px rgba(58, 236, 208, 0.32)); opacity: 1.00; }
}

/* --- Auth forms (login + enroll) --- */

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 380px;
  margin-top: 22px;
  padding: 0 8px;
}

.auth-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.32em;
  color: var(--cyan-mid);
  text-transform: uppercase;
  margin-top: 8px;
}

.auth-hint {
  font-family: var(--font-quote);
  font-style: italic;
  font-size: 10px;
  letter-spacing: 0;
  color: var(--cyan-dim);
  text-transform: none;
  margin-left: 4px;
}

.auth-form input[type="text"] {
  width: 100%;
  padding: 12px 14px;
  background: rgba(4, 22, 30, 0.6);
  border: 1px solid rgba(26, 184, 164, 0.35);
  border-radius: 2px;
  color: var(--cyan-bright);
  font-family: var(--font-mono);
  font-size: 16px;     /* ≥16px prevents iOS auto-zoom */
  letter-spacing: 0.08em;
  outline: none;
  transition: border-color 0.18s ease;
  -webkit-appearance: none;
  appearance: none;
}
.auth-form input[type="text"]:focus {
  border-color: var(--cyan-bright);
  box-shadow: 0 0 12px rgba(58, 236, 208, 0.18);
}
.auth-form input[type="text"]::placeholder {
  color: var(--cyan-dim);
  opacity: 0.5;
  letter-spacing: 0.18em;
}

.auth-btn {
  margin-top: 14px;
  padding: 16px 18px;
  background: linear-gradient(180deg, rgba(26, 184, 164, 0.18), rgba(26, 184, 164, 0.05));
  border: 1px solid var(--cyan-mid);
  border-radius: 2px;
  color: var(--cyan-bright);
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.28em;
  cursor: pointer;
  text-shadow: 0 0 8px rgba(58, 236, 208, 0.32);
  transition: all 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}
.auth-btn:hover:not(:disabled),
.auth-btn:active:not(:disabled) {
  background: linear-gradient(180deg, rgba(26, 184, 164, 0.28), rgba(26, 184, 164, 0.10));
  box-shadow: 0 0 18px rgba(58, 236, 208, 0.32);
}
.auth-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.auth-status {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.1em;
  margin-top: 10px;
  min-height: 18px;
  text-align: center;
}
.auth-status.pending { color: var(--cyan-mid); }
.auth-status.ok      { color: var(--cyan-bright); }
.auth-status.err     { color: #ff6b6b; }

.auth-link {
  font-family: var(--font-quote);
  font-style: italic;
  font-size: 13px;
  color: var(--cyan-dim);
  margin-top: 14px;
  text-align: center;
}
.auth-link a {
  color: var(--gold-mid);
  text-decoration: none;
  border-bottom: 1px solid var(--gold-dim);
  padding-bottom: 1px;
}
.auth-link a:hover, .auth-link a:active { color: var(--gold-bright); }

/* --- Dashboard (positions panel) --- */

body.dashboard {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: env(safe-area-inset-top, 12px) 0 env(safe-area-inset-bottom, 12px);
  min-height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
}

.dash-header {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 600px;
  padding: 6px 16px 12px;
  border-bottom: 1px solid rgba(26, 184, 164, 0.15);
}
.dash-disc img {
  display: block;
  width: 36px; height: 36px;
  filter: drop-shadow(0 0 4px rgba(58, 236, 208, 0.32));
}
.dash-title-block { flex: 1; }
.dash-title {
  font-family: var(--font-serif);
  font-size: 18px;
  letter-spacing: 0.22em;
  color: var(--cyan-bright);
  font-weight: 500;
}
.dash-subtitle {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.28em;
  color: var(--cyan-mid);
  margin-top: 2px;
}
.dash-subtitle.gate-open  { color: var(--cyan-bright); }
.dash-subtitle.gate-amber  { color: #ffb84d; }
.dash-subtitle.gate-closed { color: #ff9b6b; }
.dash-bias {
  color: var(--cyan-dim) !important;
  font-size: 9px !important;
  letter-spacing: 0.18em !important;
  margin-top: 1px !important;
}
.dash-logout {
  background: transparent;
  border: 1px solid rgba(26, 184, 164, 0.3);
  border-radius: 2px;
  color: var(--cyan-mid);
  font-size: 18px;
  padding: 4px 10px;
  cursor: pointer;
  font-family: var(--font-mono);
}
.dash-logout:hover, .dash-logout:active { color: #ff9b6b; border-color: #ff9b6b; }

.dash-install {
  background: rgba(212, 160, 0, 0.12);
  border: 1px solid var(--gold-mid);
  border-radius: 2px;
  color: var(--gold-bright);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  padding: 6px 10px;
  margin-left: 4px;
  cursor: pointer;
}
.dash-install:hover, .dash-install:active {
  background: rgba(212, 160, 0, 0.22);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  width: 100%;
  max-width: 600px;
  padding: 12px 12px 8px;
}
.metric {
  background: rgba(4, 22, 30, 0.45);
  border: 1px solid rgba(26, 184, 164, 0.15);
  border-radius: 2px;
  padding: 8px 6px;
  text-align: center;
}
.metric-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.24em;
  color: var(--cyan-mid);
  opacity: 0.8;
}
.metric-value {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 500;
  color: var(--cyan-bright);
  letter-spacing: 0.04em;
  margin: 2px 0;
}
.metric-value.pos        { color: #5ee3a4; }
.metric-value.neg        { color: #ff9b6b; }
.metric-value.alert-red    { color: #ff6b6b; }
.metric-value.alert-amber  { color: #ffb84d; }
.metric-value.alert-yellow { color: #f0e068; }
.metric-detail {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  color: var(--cyan-dim);
}

.positions-section {
  width: 100%;
  max-width: 600px;
  padding: 8px 12px 12px;
}
.positions-section-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.32em;
  color: var(--cyan-mid);
  padding: 6px 4px 8px;
  border-bottom: 1px solid rgba(26, 184, 164, 0.12);
}
.refresh-meta {
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--cyan-dim);
  text-transform: none;
}
.refresh-meta.ok  { color: var(--cyan-mid); }
.refresh-meta.err { color: #ff9b6b; }

.positions-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
}
.position {
  background: rgba(4, 22, 30, 0.35);
  border: 1px solid rgba(26, 184, 164, 0.12);
  border-radius: 2px;
  padding: 8px 10px;
  margin-bottom: 6px;
  font-family: var(--font-mono);
  font-size: 13px;
}
.position.alert-red    { border-left: 3px solid #ff6b6b; }
.position.alert-amber  { border-left: 3px solid #ffb84d; }
.position.alert-yellow { border-left: 3px solid #f0e068; }
.pos-row1, .pos-row2 {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pos-row1 { margin-bottom: 4px; }
.pos-symbol {
  flex: 0 0 auto;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.1em;
  color: var(--cyan-bright);
}
.pos-sleeve {
  flex: 0 0 auto;
  font-size: 9px;
  letter-spacing: 0.18em;
  padding: 1px 6px;
  border-radius: 2px;
  background: rgba(26, 184, 164, 0.12);
  color: var(--cyan-mid);
}
.pos-sleeve.sleeve-live   { background: rgba(212, 160, 0, 0.18); color: var(--gold-bright); }
.pos-sleeve.sleeve-paper  { background: rgba(26, 184, 164, 0.15); color: var(--cyan-mid); }
.pos-sleeve.sleeve-wallet { background: rgba(255, 155, 107, 0.12); color: #ff9b6b; }
.pos-slot { opacity: 0.7; margin-left: 2px; }
.pos-pnl {
  flex: 1 1 auto;
  text-align: right;
  font-size: 14px;
  font-weight: 600;
}
.pos-pnl.pos { color: #5ee3a4; }
.pos-pnl.neg { color: #ff9b6b; }
.pos-row2 {
  font-size: 11px;
  color: var(--cyan-dim);
}
.pos-price { flex: 0 0 auto; }
.pos-mv    { flex: 0 0 auto; color: var(--cyan-mid); }
.pos-dd    { flex: 0 0 auto; opacity: 0.85; }
.pos-dd.pos { color: rgba(94, 227, 164, 0.85); }
.pos-dd.neg { color: rgba(255, 155, 107, 0.85); }
.pos-dca   { flex: 0 0 auto; letter-spacing: 2px; color: var(--gold-mid); font-size: 12px; }
.pos-dca.dim { color: var(--cyan-dim); opacity: 0.5; }
.pos-drift {
  flex: 0 0 auto;
  font-size: 11px;
  color: var(--gold-mid);
  background: rgba(212, 160, 0, 0.12);
  padding: 1px 4px;
  border-radius: 2px;
  margin-left: -4px;
}
.pos-held  { flex: 1 1 auto; text-align: right; opacity: 0.65; }
.position-skeleton, .position-empty {
  list-style: none;
  text-align: center;
  padding: 24px;
  color: var(--cyan-dim);
  font-family: var(--font-quote);
  font-style: italic;
}

.dash-footer {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  max-width: 600px;
  justify-content: center;
  padding: 10px 12px 4px;
  margin-top: auto;
}
