/* media0 console — small hand-rolled stylesheet, light + dark. */

:root {
  --bg: #ffffff;
  --bg-soft: #f6f7f9;
  --bg-inset: #eef0f3;
  --fg: #111318;
  --fg-muted: #5c6370;
  --line: #e4e7eb;
  --accent: #4f46e5;
  --accent-fg: #ffffff;
  --danger: #dc2626;
  --ok: #16a34a;
  --code-bg: #0f1117;
  --code-fg: #d6dae2;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0c0f;
    --bg-soft: #14161b;
    --bg-inset: #1a1d23;
    --fg: #e8eaee;
    --fg-muted: #9aa1ad;
    --line: #24272e;
    --accent: #7c85f5;
    --accent-fg: #0b0c0f;
    --danger: #f87171;
    --ok: #4ade80;
    --code-bg: #14161b;
  }
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--fg);
  font-size: 14.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
code, pre, .mono, input.mono, textarea {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas,
    "Liberation Mono", monospace;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.hidden { display: none !important; }
.muted { color: var(--fg-muted); }
.error { color: var(--danger); font-size: 13.5px; }

.logo { font-weight: 700; font-size: 16px; letter-spacing: -0.02em; color: var(--fg); }
.logo span { color: var(--accent); }
.logo:hover { text-decoration: none; }

/* ---------- login ---------- */

.login {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.login-card {
  width: 100%; max-width: 400px;
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 14px; padding: 32px;
  display: flex; flex-direction: column; gap: 14px;
}
.login-card h1 { font-size: 22px; letter-spacing: -0.02em; }
.login-card p { font-size: 13.5px; }
.login-card.wide { max-width: 560px; }
.login-card form { display: flex; flex-direction: column; gap: 12px; }
.login-card label.field { margin-bottom: 0; }
.check { display: flex; gap: 8px; align-items: center; font-size: 13.5px; color: var(--fg-muted); }
.gate-body { width: 100%; display: flex; justify-content: center; }

/* sign-in tabs */
.tabs {
  display: flex; gap: 4px;
  background: var(--bg-inset); border: 1px solid var(--line);
  border-radius: 10px; padding: 4px;
}
.tab {
  flex: 1; padding: 6px 10px; border: 0; border-radius: 7px;
  background: transparent; color: var(--fg-muted);
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.tab.active { background: var(--bg); color: var(--fg); box-shadow: 0 1px 3px rgba(0,0,0,0.14); }

/* one-time recovery codes */
.codegrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0; }
.codegrid code {
  background: var(--bg-inset); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 12px;
  font-size: 13.5px; text-align: center; letter-spacing: 0.04em;
  user-select: all;
}
@media (max-width: 480px) { .codegrid { grid-template-columns: 1fr; } }

/* claim checklist */
.checklist { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.checklist .item {
  border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 16px; background: var(--bg);
}
.checklist h3 { font-size: 14px; margin-bottom: 4px; }
.check-done { color: var(--ok); font-size: 12.5px; margin-left: 6px; }

/* ---------- shell ---------- */

.shell { display: flex; min-height: 100vh; }
.side {
  width: 210px; flex-shrink: 0;
  border-right: 1px solid var(--line);
  padding: 20px 14px;
  display: flex; flex-direction: column; gap: 24px;
  position: sticky; top: 0; height: 100vh;
}
.side nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side nav a {
  padding: 8px 12px; border-radius: 8px;
  color: var(--fg-muted); font-weight: 500;
}
.side nav a:hover { background: var(--bg-soft); text-decoration: none; color: var(--fg); }
.side nav a.active { background: var(--bg-inset); color: var(--fg); }
.side-foot { display: flex; flex-direction: column; gap: 10px; }

.main { flex: 1; padding: 32px 40px 64px; max-width: 1040px; min-width: 0; }
.main h1 { font-size: 22px; letter-spacing: -0.02em; margin-bottom: 4px; }
.main .sub { color: var(--fg-muted); margin-bottom: 24px; }
.view-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }

@media (max-width: 720px) {
  .shell { flex-direction: column; }
  /* Sidebar becomes a sticky top bar: logo + scope/sign-out on the
     first row, a horizontally scrollable nav strip below. */
  .side {
    width: auto; height: auto;
    position: sticky; top: 0; z-index: 30; background: var(--bg);
    flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px;
    padding: 10px 14px;
    border-right: 0; border-bottom: 1px solid var(--line);
  }
  .side-foot { flex-direction: row; align-items: center; gap: 8px; margin-left: auto; }
  .side nav {
    order: 3; width: 100%; flex: none;
    flex-direction: row; flex-wrap: nowrap; overflow-x: auto;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  .side nav::-webkit-scrollbar { display: none; }
  .side nav a { white-space: nowrap; padding: 8px 10px; }
  .main { padding: 20px 16px 48px; }
  .view-head { flex-wrap: wrap; }
  table.list { display: block; overflow-x: auto; }
  .toasts { left: 16px; right: 16px; max-width: none; }
}

/* ---------- widgets ---------- */

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 8px;
  background: var(--bg-inset); color: var(--fg);
  border: 1px solid var(--line);
  font: inherit; font-weight: 600; font-size: 13.5px;
  cursor: pointer;
}
.btn:hover { filter: brightness(0.97); }
.btn.primary { background: var(--accent); color: var(--accent-fg); border-color: transparent; }
.btn.danger { color: var(--danger); }
.btn.ghost { background: transparent; }
.btn.small { padding: 4px 10px; font-size: 12.5px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
button:disabled:hover { filter: none; }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; }

input[type="text"], input[type="email"], input[type="password"],
input[type="number"], select, textarea {
  width: 100%;
  padding: 8px 12px; border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg); color: var(--fg);
  font: inherit; font-size: 13.5px;
}
textarea { min-height: 200px; resize: vertical; font-size: 12.5px; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: 12.5px; font-weight: 600; color: var(--fg-muted); margin-bottom: 5px; }

.card {
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 12px; padding: 20px; margin-bottom: 20px;
}
.card h2 { font-size: 15px; margin-bottom: 12px; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--bg-soft); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; }
.stat .v { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.stat .k { font-size: 12.5px; color: var(--fg-muted); text-transform: uppercase; letter-spacing: 0.06em; }

.progress { height: 8px; border-radius: 99px; background: var(--bg-inset); overflow: hidden; margin: 8px 0 4px; }
.progress > div { height: 100%; border-radius: 99px; background: var(--accent); transition: width 0.3s; }
.progress > div.warn { background: var(--danger); }

table.list { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.list th {
  text-align: left; padding: 8px 12px;
  color: var(--fg-muted); font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  border-bottom: 1px solid var(--line);
}
table.list td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list tr:last-child td { border-bottom: 0; }
table.list td.actions { text-align: right; white-space: nowrap; }

.pill {
  display: inline-block; padding: 2px 10px; border-radius: 99px;
  font-size: 12px; font-weight: 600;
  background: var(--bg-inset); color: var(--fg-muted);
  border: 1px solid var(--line);
}
.pill.write { color: var(--ok); }
.pill.read { color: var(--fg-muted); }

pre.code {
  background: var(--code-bg); color: var(--code-fg);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 16px; overflow-x: auto;
  font-size: 12.5px; line-height: 1.55;
  max-height: 420px; overflow-y: auto;
}

.copyrow {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-inset); border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 6px 6px 12px; margin: 6px 0;
}
.copyrow code {
  flex: 1; font-size: 12px; overflow-x: auto; white-space: nowrap;
  scrollbar-width: none;
}

.crumb { font-size: 13px; color: var(--fg-muted); margin-bottom: 14px; display: inline-block; }

/* ---------- toasts ---------- */

.toasts {
  position: fixed; bottom: 20px; right: 20px; z-index: 50;
  display: flex; flex-direction: column; gap: 8px; max-width: 380px;
}
.toast {
  padding: 11px 16px; border-radius: 10px;
  background: var(--fg); color: var(--bg);
  font-size: 13.5px; font-weight: 500;
  box-shadow: 0 6px 24px rgba(0,0,0,0.25);
  animation: toast-in 0.18s ease-out;
}
.toast.err { background: var(--danger); color: #fff; }
.toast.ok { background: var(--ok); color: #fff; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

/* ---------- modal ---------- */

.modal-backdrop {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(0,0,0,0.45);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.modal {
  width: 100%; max-width: 520px;
  background: var(--bg); border: 1px solid var(--line);
  border-radius: 14px; padding: 24px;
}
.modal h2 { font-size: 17px; margin-bottom: 10px; }
.modal-actions { margin-top: 18px; display: flex; justify-content: flex-end; }
