/*
 * Madam Maggie — tester tool theme.
 * Ported from maggie/app/lib/theme.ts (gilded-editorial: espresso black,
 * antique gold, warm ivory). Playfair Display (serif) + Montserrat (sans).
 */
:root {
  --bg: #0b0908;
  --bg-deep: #060504;
  --surface: #1b1613;
  --surface-hi: #26201a;
  --surface-deep: #100d0b;
  --border: #2c2520;
  --line: #3a3128;
  --gold: #cdab74;
  --gold-text: #e3c78d;
  --gold-hi: #f1dba8;
  --gold-deep: #7a6238;
  --gold-line: #5c4d30;
  --ink: #f4efe6;
  --ink-soft: #cdc4b6;
  --ink-mute: #9a9082;
  --error: #d4574a;

  --radius: 14px;
  --radius-sm: 10px;

  --serif: "Playfair Display", Georgia, serif;
  --sans: "Montserrat", system-ui, -apple-system, sans-serif;

  --e1: 0 4px 7px rgba(0, 0, 0, 0.32);
  --e3: 0 -10px 30px rgba(0, 0, 0, 0.6);
}

* {
  box-sizing: border-box;
}

/* Author display rules (flex) would otherwise override the UA [hidden] rule,
   leaving "hidden" elements visible. Force it. */
[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100dvh;
  background:
    radial-gradient(120% 80% at 50% -10%, #16120f 0%, var(--bg) 45%, var(--bg-deep) 100%);
  color: var(--ink);
  font-family: var(--serif);
  -webkit-font-smoothing: antialiased;
  display: flex;
  justify-content: center;
}

.muted {
  color: var(--ink-mute);
}

/* ── Phone frame ─────────────────────────────────────────────────────────── */
.frame {
  width: 100%;
  max-width: 430px;
  min-height: 100dvh;
  padding: max(28px, env(safe-area-inset-top)) 20px 28px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

/* ── Masthead ────────────────────────────────────────────────────────────── */
.masthead {
  text-align: center;
  padding-top: 14px;
}
.eyebrow {
  margin: 0;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 4px;
  color: var(--gold-text);
}
.title {
  margin: 6px 0 2px;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 40px;
  letter-spacing: 1px;
  color: var(--ink);
}
.tagline {
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: 14px;
  color: var(--ink-mute);
}

/* ── Gate ────────────────────────────────────────────────────────────────── */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.gate {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding-top: 12px;
}
.gate-copy {
  margin: 0;
  text-align: center;
  font-style: italic;
  color: var(--ink-soft);
  font-size: 15px;
}
#signin {
  width: 100%;
  display: flex;
  justify-content: center;
}

/* ── App ─────────────────────────────────────────────────────────────────── */
.app {
  display: flex;
  flex-direction: column;
  gap: 18px;
  flex: 1;
}

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
}
.tab {
  appearance: none;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  padding: 10px 16px;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--ink-mute);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.tab:hover {
  color: var(--ink-soft);
}
.tab.is-active {
  color: var(--ink);
  border-bottom-color: var(--gold);
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--sans);
  font-size: 11px;
}

/* ── Issue list ──────────────────────────────────────────────────────────── */
.issues {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.issue {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--gold-deep);
  border-top-color: rgba(241, 219, 168, 0.16);
  border-radius: var(--radius);
  box-shadow: var(--e1);
  padding: 12px 14px;
}
.issue-link {
  display: flex;
  gap: 8px;
  align-items: baseline;
  text-decoration: none;
}
.issue-num {
  font-family: var(--sans);
  font-size: 11px;
  color: var(--gold-text);
  flex-shrink: 0;
}
.issue-title {
  color: var(--ink);
  font-size: 15.5px;
  line-height: 1.35;
}
.issue-link:hover .issue-title {
  color: var(--gold-hi);
}
.issue-meta {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.pill {
  font-family: var(--sans);
  font-size: 9.5px;
  letter-spacing: 0.4px;
  text-transform: lowercase;
  color: var(--ink-mute);
  background: var(--surface-hi);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 8px;
}
.issue-date {
  font-family: var(--sans);
  font-size: 10px;
  color: var(--ink-mute);
  margin-left: auto;
}
.empty {
  text-align: center;
  color: var(--ink-mute);
  font-style: italic;
  padding: 28px 0;
}

/* ── Form ────────────────────────────────────────────────────────────────── */
.form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.label {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 9.5px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.control {
  width: 100%;
  background: var(--surface-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.control::placeholder {
  color: var(--ink-mute);
}
.control:focus {
  outline: none;
  border-color: var(--gold-deep);
  box-shadow: 0 0 0 1px var(--gold-deep);
}
textarea.control {
  resize: vertical;
  min-height: 120px;
  line-height: 1.5;
}
select.control {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--gold-text) 50%),
    linear-gradient(135deg, var(--gold-text) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.primary-btn {
  appearance: none;
  border: 1px solid var(--gold);
  border-top-color: var(--gold-hi);
  border-radius: var(--radius-sm);
  background: var(--gold);
  color: var(--bg-deep);
  font-family: var(--sans);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 13px 18px;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}
.primary-btn:hover {
  background: var(--gold-hi);
}
.primary-btn:disabled {
  opacity: 0.55;
  cursor: default;
}
.ghost-btn {
  appearance: none;
  background: none;
  border: none;
  color: var(--ink-mute);
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: color 0.15s;
}
.ghost-btn:hover {
  color: var(--ink);
}
.ghost-btn:disabled {
  opacity: 0.55;
  cursor: default;
}
.refresh-glyph {
  display: inline-block;
}
.ghost-btn.spin .refresh-glyph {
  animation: spin 0.8s linear infinite;
}

/* ── Footer ──────────────────────────────────────────────────────────────── */
.who {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--sans);
  font-size: 11px;
}
.who-email {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 60%;
}

/* ── Toast ───────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  max-width: 390px;
  width: calc(100% - 40px);
  background: var(--surface);
  border: 1px solid var(--gold-deep);
  border-top-color: var(--gold-hi);
  border-radius: var(--radius);
  box-shadow: var(--e3);
  padding: 13px 16px;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink);
  text-align: center;
}
.toast.is-error {
  border-color: var(--error);
  border-top-color: var(--error);
  color: #f3c9c3;
}

/* Clerk component theming — keep it on-brand inside the gold frame. */
#signin .cl-rootBox,
#signin .cl-card {
  width: 100%;
}
