@font-face {
  font-family: "Lora";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/assets/fonts/lora-latin.woff2") format("woff2");
}

:root {
  --blue-900: #17334c;
  --blue-800: #224b6f;
  --blue-700: #2b5e8a;
  --blue-600: #3e759a;
  --coral-500: #e07856;
  --on-brand: #ffffff;
  --ink: #1a2230;
  --muted: #5a6675;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --raised: #e9eef3;
  --hairline: #dae1e8;
  --tint: rgba(43, 94, 138, 0.08);
  --error: #ff3b30;
  --success: #3d8a5f;
  --warning: #c2841c;
  --radius-sm: 12px;
  --radius: 12px;
  --radius-lg: 24px;
  --radius-pill: 999px;
  --shadow-card: 0 1px 3px rgba(15, 23, 42, 0.08);
  --shadow-float: 0 4px 14px rgba(15, 23, 42, 0.14);
  --font-display: "Lora", Georgia, "Times New Roman", serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --touch: 56px;
  --med-primary: #2b5e8a;
  --med-primary-dark: #224b6f;
  --med-accent: #e07856;
  --med-on-brand: #ffffff;
  --med-background: var(--bg);
  --med-surface: var(--surface);
  --med-raised: var(--raised);
  --med-border: var(--hairline);
  --med-text-primary: var(--ink);
  --med-text-secondary: var(--muted);
  --med-error: var(--error);
  --med-success: var(--success);
  --auth-canvas: #f7f4ee;
}

html[data-theme="dark"] {
  --ink: #e8eef4;
  --muted: #9aa8b8;
  --bg: #0f1419;
  --surface: #1a222c;
  --raised: #24303c;
  --hairline: #2e3a48;
  --blue-700: #5fa0d4;
  --med-primary: #5fa0d4;
  --med-primary-dark: #7bb4de;
  --tint: rgba(95, 160, 212, 0.14);
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-float: 0 8px 24px rgba(0, 0, 0, 0.45);
  --auth-canvas: #0b0f14;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font-body);
  color: var(--med-text-primary);
  background:
    radial-gradient(1200px 540px at 85% -12%, var(--med-raised) 0%, rgba(0, 0, 0, 0) 66%),
    linear-gradient(180deg, var(--med-surface) 0%, var(--med-background) 760px);
  font-size: 19px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.15;
  margin: 0 0 0.4em;
}
h1 { font-size: 1.7rem; }
h2 { font-size: 1.2rem; }
p { margin: 0 0 1em; }
button, input { font: inherit; color: inherit; }
a { color: var(--med-primary); }

.skip {
  position: absolute;
  left: -999px;
}
.skip:focus {
  left: 12px;
  top: 12px;
  background: var(--med-surface);
  padding: 8px 12px;
  z-index: 20;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--med-border);
  background: var(--med-surface);
}
.top[hidden] { display: none; }
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--med-text-primary);
  min-height: var(--touch);
}
.wordmark {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
}
.top-nav { display: flex; gap: 4px; }
.text-btn {
  background: none;
  border: 0;
  color: var(--med-primary);
  min-height: var(--touch);
  padding: 0 12px;
  cursor: pointer;
  font-weight: 600;
}

main { max-width: 720px; margin: 0 auto; padding: 28px 20px 120px; }
main:has(.authx) { max-width: none; padding: 0; }

.muted { color: var(--med-text-secondary); }
.small { font-size: 0.9rem; }
.error { color: var(--med-error); font-weight: 600; }

.card {
  background: var(--med-surface);
  border: 1px solid var(--med-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-float);
  padding: 30px 28px;
}

.field { display: block; margin-bottom: 16px; }
.field__label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--med-text-secondary);
  margin-bottom: 6px;
}
.input {
  width: 100%;
  min-height: var(--touch);
  padding: 0 16px;
  background: var(--med-surface);
  border: 1px solid var(--med-border);
  border-radius: var(--radius-sm);
  color: var(--med-text-primary);
}
.input:focus { outline: 2px solid var(--med-primary); outline-offset: -1px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--touch);
  padding: 0 24px;
  border: 0;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  width: 100%;
}
.btn:disabled { opacity: 0.5; cursor: default; }
.btn:active { opacity: 0.85; transform: scale(0.985); }
.btn--primary { background: var(--med-primary); color: var(--med-on-brand); }
.btn--ghost {
  background: var(--med-surface);
  color: var(--med-text-primary);
  border: 1px solid var(--med-border);
}
.btn--danger-soft {
  background: color-mix(in srgb, var(--med-error) 14%, transparent);
  color: var(--med-error);
}
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; }
.btn-row .btn { width: auto; flex: 1; min-width: 160px; }
.switch {
  text-align: center;
  margin-top: 18px;
  font-size: 0.95rem;
  color: var(--med-text-secondary);
}
.switch button {
  background: none;
  border: 0;
  color: var(--med-primary);
  font-weight: 600;
  cursor: pointer;
}

.otp {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 16px 0 24px;
}
.otp input {
  width: 46px;
  height: 58px;
  text-align: center;
  font-size: 1.4rem;
  font-weight: 600;
  border: 1px solid var(--med-border);
  border-radius: var(--radius-sm);
  background: var(--med-surface);
  color: var(--med-text-primary);
}
.otp input:focus { outline: 2px solid var(--med-primary); outline-offset: -1px; }

.authx {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--auth-canvas);
}
.authx__stage {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: 1fr;
  justify-content: center;
  align-content: center;
  gap: 36px;
  padding: 56px 24px 40px;
}
.authx__brandinner { width: 100%; max-width: 460px; margin: 0 auto; }
.authx__lockup {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  text-decoration: none;
  color: inherit;
}
.authx__lede {
  margin: 0 0 8px;
  max-width: 30ch;
  font-size: 1.05rem;
  line-height: 1.45;
  color: var(--med-text-secondary);
  font-weight: 500;
}
.authx__form { display: grid; place-items: center; }
.authx__formcard { width: min(100%, 420px); }
.authx__formcard h1 {
  font-family: var(--font-display);
  font-size: 26px;
  margin-top: 0;
}
.authx__note {
  margin: 24px 0 0;
  font-size: 0.85rem;
  color: var(--med-text-secondary);
}
@media (min-width: 860px) {
  .authx__stage {
    grid-template-columns: minmax(0, 460px) minmax(0, 400px);
    gap: 72px;
    align-items: center;
    max-width: 980px;
    margin: 0 auto;
  }
}

.row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  background: var(--med-surface);
  border: 0;
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  color: inherit;
}
.row + .row { margin-top: 8px; }
.row:hover { background: var(--med-raised); }
.row__body { flex: 1; min-width: 0; }
.row__title { font-weight: 600; }
.row__sub {
  font-size: 0.9rem;
  color: var(--med-text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row__chevron { color: var(--med-text-secondary); font-size: 20px; }

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-pill);
  padding: 3px 10px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--med-primary);
  background: var(--tint);
}
.pill--ready { color: var(--med-success); background: color-mix(in srgb, var(--med-success) 15%, transparent); }
.pill--error { color: var(--med-error); background: color-mix(in srgb, var(--med-error) 15%, transparent); }
.pill--processing { color: var(--warning); background: color-mix(in srgb, var(--warning) 15%, transparent); }

.empty {
  text-align: center;
  padding: 48px 16px;
  color: var(--med-text-secondary);
}

.drop {
  border: 2px dashed var(--med-border);
  border-radius: var(--radius);
  padding: 36px 16px;
  text-align: center;
  cursor: pointer;
  background: var(--med-raised);
}
.drop.drag { border-color: var(--med-primary); background: var(--tint); }
.file-list { margin: 12px 0 0; padding-left: 1.2em; color: var(--med-text-secondary); }

.banner {
  background: var(--tint);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 20px;
}

.section { margin: 0 0 28px; }
.section h2 {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.field-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--med-border);
}
.field-row .label { color: var(--med-text-secondary); font-size: 0.95rem; }
.field-row .value { grid-column: 1; font-weight: 600; }
.field-row .value.empty { font-weight: 400; color: var(--med-text-secondary); }
.copy {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  background: none;
  border: 0;
  color: var(--med-primary);
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
}
.copy.done { color: var(--med-success); }

.sticky {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--med-background) 92%, transparent);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--med-border);
}
.sticky-inner {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  gap: 12px;
}
.sticky-inner .btn { flex: 1; }

.spinner {
  width: 36px;
  height: 36px;
  margin: 24px auto;
  border: 3px solid var(--med-border);
  border-top-color: var(--med-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.settings-block { margin-top: 32px; }
.settings-block h2 { margin-bottom: 8px; }
