:root {
  color-scheme: light;
  --navy: #082e5f;
  --blue: #075bb8;
  --blue-dark: #064a94;
  --yellow: #ffd900;
  --ink: #0b2747;
  --muted: #63768e;
  --line: #d8e2ee;
  --surface: #ffffff;
  --background: #f2f6fb;
  --danger: #b42332;
  --success: #15764a;
  --warning: #815600;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--background); }
body { min-height: 100vh; margin: 0; color: var(--ink); background: radial-gradient(circle at 70% 10%, #fff 0, transparent 38%), var(--background); }
a { color: var(--blue); }
button, input { font: inherit; }

.test-banner {
  position: relative;
  z-index: 10;
  padding: 9px 16px;
  background: var(--yellow);
  color: #342c00;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .09em;
  text-align: center;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 74px;
  padding: 12px clamp(20px, 5vw, 72px);
  background: rgba(255,255,255,.96);
  border-bottom: 1px solid var(--line);
}
.topbar nav { display: flex; align-items: center; gap: 22px; }
.topbar nav a, .link-button { color: var(--ink); font-size: 14px; font-weight: 750; text-decoration: none; }
.topbar form { margin: 0; }
.link-button { padding: 0; border: 0; background: transparent; cursor: pointer; }
.wordmark { display: flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; font-weight: 850; }
.wordmark small { display: block; color: var(--blue); font-size: 10px; letter-spacing: .12em; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 12px;
  background: var(--yellow);
  color: var(--navy);
  font-family: Georgia, serif;
  font-size: 24px;
  font-weight: 900;
  box-shadow: inset 0 0 0 2px rgba(8,46,95,.1);
}

.auth-shell, .setup-shell {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 34px);
  padding: 38px 18px;
}
.auth-card, .setup-card, .panel, .account-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 24px 70px rgba(8,46,95,.12);
}
.auth-card { width: min(100%, 520px); padding: clamp(28px, 5vw, 52px); }
.setup-card { width: min(100%, 900px); padding: clamp(26px, 5vw, 54px); }
.brand { display: flex; align-items: center; gap: 14px; margin-bottom: 34px; }
.brand strong { display: block; font-family: Georgia, serif; font-size: 20px; }
.brand small { display: block; margin-top: 3px; color: var(--muted); }
.eyebrow { margin: 0 0 10px; color: var(--blue); font-size: 12px; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; }
h1, h2 { margin-top: 0; font-family: Georgia, "Times New Roman", serif; }
h1 { margin-bottom: 14px; font-size: clamp(34px, 5vw, 52px); line-height: 1.02; letter-spacing: -.025em; }
h2 { font-size: 25px; }
.lede { max-width: 740px; margin: 0 0 30px; color: var(--muted); font-size: 17px; line-height: 1.6; }

form { display: grid; gap: 20px; }
fieldset { display: grid; gap: 18px; margin: 0; padding: 22px; border: 1px solid var(--line); border-radius: 18px; }
legend { padding: 0 8px; color: var(--navy); font-weight: 850; }
label { display: grid; gap: 8px; color: var(--ink); font-size: 13px; font-weight: 800; }
label small { color: var(--muted); font-weight: 500; line-height: 1.45; }
input {
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #b9c9da;
  border-radius: 13px;
  outline: none;
}
input:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(7,91,184,.14); }
input[readonly] { color: var(--muted); background: #f5f7fa; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 12px 20px;
  border: 1px solid transparent;
  border-radius: 13px;
  font-weight: 850;
  text-decoration: none;
  cursor: pointer;
}
.button-primary { color: #fff; background: var(--blue); box-shadow: 0 10px 24px rgba(7,91,184,.2); }
.button-primary:hover { background: var(--blue-dark); }
.button-secondary { color: var(--navy); background: #fff; border-color: #b9c9da; }
.security-note { margin: 25px 0 0; color: var(--muted); font-size: 12px; text-align: center; }
.back-link { display: inline-block; margin-top: 24px; font-weight: 750; }

.alert { margin: 0 0 22px; padding: 15px 17px; border: 1px solid; border-radius: 14px; line-height: 1.5; }
.alert p { margin: 8px 0; }
.alert-error { color: var(--danger); background: #fff3f4; border-color: #f0bcc3; }
.alert-success { color: var(--success); background: #effaf4; border-color: #b9e3ce; }
.alert-warning { color: var(--warning); background: #fff9e7; border-color: #efd88e; }

.content-shell { width: min(100% - 36px, 1240px); margin: 0 auto; padding: 64px 0 90px; }
.content-shell.narrow { width: min(100% - 36px, 760px); }
.hero { padding: 18px 0 42px; }
.hero.compact { padding-bottom: 26px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; align-items: start; }
.app-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.app-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 15px;
  min-height: 106px;
  padding: 20px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 10px 28px rgba(8,46,95,.07);
  text-decoration: none;
  transition: transform .16s ease, box-shadow .16s ease;
}
.app-card:hover { transform: translateY(-2px); box-shadow: 0 18px 36px rgba(8,46,95,.12); }
.app-card strong, .app-card small { display: block; }
.app-card small { margin-top: 5px; color: var(--muted); }
.app-icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 15px; color: #fff; background: linear-gradient(145deg, var(--navy), var(--blue)); font-family: Georgia, serif; font-size: 24px; font-weight: 900; }
.arrow { color: var(--blue); font-size: 24px; }
.account-card { display: grid; gap: 7px; padding: 24px; }
.account-card span { color: var(--muted); font-size: 12px; }
.account-card small { color: var(--muted); overflow-wrap: anywhere; }
.account-card hr { width: 100%; margin: 14px 0; border: 0; border-top: 1px solid var(--line); }
.status-pill { display: inline-flex; width: fit-content; margin-top: 12px; padding: 6px 9px; color: var(--success); background: #eaf8f0; border-radius: 999px; font-size: 11px; font-weight: 850; }
.status-pill.muted { color: var(--muted); background: #edf1f6; }
.empty-state { padding: 30px; color: var(--muted); background: #fff; border: 1px dashed #afc1d4; border-radius: 18px; }

.panel { padding: clamp(24px, 4vw, 42px); }
.secret-box { margin: 24px 0; padding: 20px; background: #eef5fd; border: 1px solid #c5d9ef; border-radius: 16px; }
.secret-box span, .secret-box strong { display: block; }
.secret-box span { margin-bottom: 8px; color: var(--muted); font-size: 12px; }
.secret-box strong { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: clamp(16px, 3vw, 23px); overflow-wrap: anywhere; }
details { margin: 0 0 24px; color: var(--muted); }
.uri-code, .secret-output { display: block; margin-top: 12px; padding: 12px; background: #f1f4f8; border-radius: 10px; font-size: 12px; overflow-wrap: anywhere; user-select: all; }
.recovery-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 25px 0; padding: 0; list-style: none; }
.recovery-list code { display: block; padding: 12px; background: #f2f5f8; border-radius: 9px; text-align: center; user-select: all; }
.table-panel { padding: 0; overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 18px 20px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { color: var(--muted); background: #f7f9fc; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
td small { display: block; margin-top: 5px; color: var(--muted); }
td form { display: block; }

@media (max-width: 760px) {
  .topbar { align-items: flex-start; gap: 14px; }
  .topbar nav { align-items: flex-end; flex-direction: column; gap: 8px; }
  .wordmark span:last-child { display: none; }
  .grid, .app-grid, .dashboard-grid { grid-template-columns: 1fr; }
  .account-card { order: -1; }
  .content-shell { padding-top: 38px; }
  .recovery-list { grid-template-columns: 1fr; }
  .table-panel { overflow-x: auto; }
  table { min-width: 680px; }
}
