/* ============================================================
   model-release · style.css
   rawedit.io brand — Syne + IBM Plex Sans + DM Mono + Playfair
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@600;700;800&family=IBM+Plex+Sans:ital,wght@0,300;0,400;0,500;1,400&family=DM+Mono:wght@400;500&family=Playfair+Display:ital,wght@0,500;1,500&display=swap');

/* ── Custom properties ──────────────────────────────────────── */
:root {
  --accent: #7c6dfa;
  --accent2: #a89cf8;
  --copper: #c87941;
  --copper2: #e8a96a;
  --accent-dim: color-mix(in srgb, var(--accent) 28%, transparent);
  --accent-hover: color-mix(in srgb, var(--accent) 85%, white);

  --bg: #07060c;
  --bg-surface: #14121f;
  --bg-card: #1c1928;
  --bg-input: #0f0e18;
  --bg-hover: #231f32;

  --border: #2a2638;
  --border-focus: var(--accent);

  --text-primary: #ede9f5;
  --text-secondary: #8a85a0;
  --text-muted: #52506a;
  --text-heading: #f4f0ff;

  --paper: #faf8f4;

  --red: #e05c5c;
  --green: #5abf8a;
  --amber: #e0a94a;
  --amber-bg: #2a2010;

  --radius-sm: 2px;
  --radius-md: 4px;
  --radius-lg: 6px;

  --font-brand: 'Syne', sans-serif;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-ui: 'IBM Plex Sans', system-ui, sans-serif;
  --font-mono: 'DM Mono', monospace;

  --shadow-card: 0 4px 32px rgba(0,0,0,0.5);
  --shadow-focus: 0 0 0 3px var(--accent-dim);

  --transition: 140ms ease;
}

/* ── Light mode ─────────────────────────────────────────────── */
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f2f0f9;
    --bg-surface: #ffffff;
    --bg-card: #ffffff;
    --bg-input: #f6f4fc;
    --bg-hover: #ebe8f7;

    --border: #d8d4ed;
    --text-primary: #1a1630;
    --text-secondary: #5a5470;
    --text-muted: #9994b0;
    --text-heading: #0e0c1a;

    --shadow-card: 0 2px 16px rgba(0,0,0,0.08);
  }
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; }

body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; color: var(--accent-hover); }

/* ── Demo banner ────────────────────────────────────────────── */
#demo-banner {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: linear-gradient(135deg, #7a1010 0%, #a83232 100%);
  color: #ffd0d0;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
  padding: 8px 16px;
  border-bottom: 1px solid #c05555;
}

#demo-banner.visible { display: block; }

body.has-demo-banner {
  padding-top: 38px;
}

/* ── Layout ─────────────────────────────────────────────────── */
.page-wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 20px 80px;
}

/* ── Header ─────────────────────────────────────────────────── */
.app-header {
  text-align: center;
  margin-bottom: 36px;
}

.app-header h1 {
  font-family: var(--font-brand);
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--text-heading);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  line-height: 1.1;
  background: linear-gradient(90deg, var(--accent2), var(--copper2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.app-header .subtitle {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-top: 8px;
}

/* ── Step progress indicator ────────────────────────────────── */
.step-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 32px;
  padding: 0 4px;
}

.step-dot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: default;
}

.step-dot-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.step-dot.active .step-dot-circle {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.step-dot.done .step-dot-circle {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.step-dot-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.step-dot.active .step-dot-label { color: var(--accent); }
.step-dot.done .step-dot-label { color: var(--green); }

.step-connector {
  flex: 1;
  height: 2px;
  background: var(--border);
  margin: 0 4px;
  margin-bottom: 22px; /* align with circles */
  max-width: 80px;
  transition: background var(--transition);
}

.step-connector.done { background: var(--green); }

/* ── Card ────────────────────────────────────────────────────── */
.pad-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-card);
  margin-bottom: 20px;
}

.pad-card h2 {
  font-family: var(--font-brand);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-heading);
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

/* ── Form fields ────────────────────────────────────────────── */
.field-group {
  margin-bottom: 18px;
}

.field-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.field-group label .req {
  color: var(--red);
  margin-left: 2px;
}

.field-group input[type="text"],
.field-group input[type="email"],
.field-group input[type="tel"],
.field-group input[type="date"],
.field-group textarea,
.field-group select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 0.95rem;
  padding: 10px 14px;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  appearance: none;
}

.field-group input:focus,
.field-group textarea:focus,
.field-group select:focus {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-focus);
}

.field-group input.error,
.field-group textarea.error {
  border-color: var(--red);
}

.field-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.field-hint.age-ok { color: var(--green); }
.field-hint.age-bad { color: var(--red); font-weight: 600; }

/* ── Aliases repeater ───────────────────────────────────────── */
.alias-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}

.alias-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.alias-row input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 0.92rem;
  padding: 8px 12px;
  outline: none;
}

.alias-row input:focus {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-focus);
}

.btn-remove-alias {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
}

.btn-remove-alias:hover { border-color: var(--red); color: var(--red); }

.btn-add-alias {
  background: none;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--accent);
  font-family: var(--font-ui);
  font-size: 0.82rem;
  padding: 7px 14px;
  cursor: pointer;
  transition: var(--transition);
  width: 100%;
}

.btn-add-alias:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
}

/* ── ID capture ─────────────────────────────────────────────── */
.idcap {
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
  background: var(--bg-input);
  margin-bottom: 16px;
  transition: border-color var(--transition);
}

.idcap:hover { border-color: var(--accent); }

.idcap-label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.idcap-icon {
  font-size: 2rem;
  margin-bottom: 8px;
  opacity: 0.5;
}

.idcap input[type="file"] {
  display: none;
}

.idcap-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 10px;
}

.btn-secondary {
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 0.82rem;
  font-weight: 500;
  padding: 8px 16px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

.idcap-preview {
  margin-top: 12px;
}

.idcap-preview img {
  max-width: 100%;
  max-height: 200px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  object-fit: contain;
}

.idcap-filename {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 6px;
  word-break: break-all;
}

/* ── Waiver consent ─────────────────────────────────────────── */
.waiver-scroll {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  height: 220px;
  overflow-y: scroll;
  font-size: 0.82rem;
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: 12px;
  scroll-behavior: smooth;
}

.waiver-scroll::-webkit-scrollbar { width: 6px; }
.waiver-scroll::-webkit-scrollbar-track { background: transparent; }
.waiver-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.waiver-version-tag {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: right;
  margin-bottom: 6px;
}

.consent-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  transition: var(--transition);
}

.consent-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 2px;
}

.consent-row input[type="checkbox"]:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.consent-row label {
  font-size: 0.83rem;
  color: var(--text-secondary);
  cursor: pointer;
}

.scroll-hint {
  font-size: 0.75rem;
  color: var(--amber);
  text-align: center;
  margin-bottom: 10px;
  display: none;
}

.scroll-hint.visible { display: block; }

/* ── Signature pad ──────────────────────────────────────────── */
.sig-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--paper);
  overflow: hidden;
  position: relative;
  margin-bottom: 8px;
}

.sig-wrap canvas {
  display: block;
  width: 100%;
  height: 160px;
  cursor: crosshair;
  touch-action: none;
}

.sig-actions {
  display: flex;
  justify-content: flex-end;
  padding: 6px 10px;
  background: #f0ede6;
  border-top: 1px solid #ddd9d0;
}

.btn-clear-sig {
  background: none;
  border: 1px solid #bbb5a8;
  border-radius: var(--radius-sm);
  color: #666;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  padding: 4px 12px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-clear-sig:hover { border-color: var(--red); color: var(--red); }

.sig-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 12px;
}

/* ── Navigation buttons ─────────────────────────────────────── */
.form-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 24px;
  gap: 12px;
}

.btn-primary {
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  font-family: var(--font-ui);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 11px 28px;
  cursor: pointer;
  transition: background var(--transition), opacity var(--transition);
  letter-spacing: 0.02em;
}

.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-ghost {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font-ui);
  font-size: 0.88rem;
  padding: 10px 22px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ── Spinner ────────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Success / error states ─────────────────────────────────── */
.result-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  text-align: center;
  box-shadow: var(--shadow-card);
}

.result-card.success { border-color: var(--green); }
.result-card.error   { border-color: var(--red); }

.result-icon { font-size: 3rem; margin-bottom: 16px; }

.result-card h2 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.result-card.success h2 { color: var(--green); }
.result-card.error h2 { color: var(--red); }

.record-id-display {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  word-break: break-all;
  color: var(--text-secondary);
  margin: 16px 0;
}

.error-msg {
  color: var(--red);
  font-size: 0.85rem;
  margin-top: 8px;
}

/* ── Admin page ─────────────────────────────────────────────── */
.admin-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 20px 80px;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 12px;
}

.admin-header h1 {
  font-family: var(--font-brand);
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: linear-gradient(90deg, var(--accent2), var(--copper2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.admin-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* Stat cards */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  text-align: center;
}

.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 600;
  font-family: var(--font-display);
  color: var(--text-heading);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-card .stat-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.stat-card.warning .stat-value { color: var(--amber); }
.stat-card.danger .stat-value { color: var(--red); }

/* Search bar */
.search-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.search-bar input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 0.92rem;
  padding: 10px 14px;
  outline: none;
  transition: var(--transition);
}

.search-bar input:focus {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-focus);
}

/* Table */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
}

.records-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.records-table th {
  background: var(--bg-surface);
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.records-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}

.records-table tr:last-child td { border-bottom: none; }

.records-table tr:hover td { background: var(--bg-hover); }

.records-table .mono {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Badge */
.badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-demo { background: color-mix(in srgb, var(--amber) 15%, transparent); color: var(--amber); border: 1px solid color-mix(in srgb, var(--amber) 40%, transparent); }
.badge-real { background: color-mix(in srgb, var(--green) 12%, transparent); color: var(--green); border: 1px solid color-mix(in srgb, var(--green) 35%, transparent); }
.badge-expired { background: color-mix(in srgb, var(--red) 12%, transparent); color: var(--red); border: 1px solid color-mix(in srgb, var(--red) 35%, transparent); }

.table-empty {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
  font-size: 0.88rem;
}

/* Detail expand row */
.detail-row td {
  background: var(--bg-surface);
  padding: 16px 20px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}

.detail-item { }
.detail-item .dl { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin-bottom: 2px; }
.detail-item .dv { font-size: 0.85rem; color: var(--text-primary); word-break: break-word; }

/* ── Compliance page ────────────────────────────────────────── */
.compliance-wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

.compliance-doc {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 52px;
  font-family: Georgia, 'Times New Roman', serif;
  line-height: 1.8;
  box-shadow: var(--shadow-card);
}

@media (max-width: 600px) {
  .compliance-doc { padding: 28px 20px; }
}

.compliance-doc h1 {
  font-size: 1rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: center;
  margin-bottom: 28px;
  line-height: 1.5;
  color: var(--text-heading);
}

.compliance-doc h2 {
  font-size: 0.9rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 24px 0 8px;
  color: var(--text-heading);
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
}

.compliance-doc p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.compliance-doc .field-line {
  font-size: 0.9rem;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.compliance-doc .field-line strong {
  color: var(--text-secondary);
  font-weight: normal;
}

.compliance-footer {
  margin-top: 32px;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-ui);
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.compliance-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

/* ── Mobile ─────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .pad-card { padding: 20px 16px; }
  .page-wrap { padding: 24px 12px 60px; }
  .form-nav { flex-direction: column-reverse; }
  .form-nav .btn-primary,
  .form-nav .btn-ghost { width: 100%; text-align: center; }
  .app-header h1 { font-size: 1.8rem; }
  .step-dot-label { display: none; }
  .step-connector { max-width: 32px; }
}

/* ── Print styles ────────────────────────────────────────────── */
@media print {
  body {
    background: #fff;
    color: #000;
    font-family: Georgia, serif;
  }

  #demo-banner,
  .compliance-actions,
  .btn-primary,
  .btn-ghost { display: none !important; }

  .compliance-doc {
    border: none;
    box-shadow: none;
    padding: 0;
    background: #fff;
  }

  .compliance-doc h1,
  .compliance-doc h2,
  .compliance-doc p,
  .compliance-doc .field-line {
    color: #000;
  }

  .compliance-doc h2 { border-bottom: 1px solid #999; }

  .compliance-footer { color: #666; border-top: 1px solid #ccc; }
}

/* ── Admin action buttons ────────────────────────────────────── */
.btn-sm {
  font-size: 0.72rem;
  padding: 5px 10px;
  letter-spacing: 0.06em;
}

.btn-danger {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid color-mix(in srgb, var(--red) 50%, transparent);
  background: color-mix(in srgb, var(--red) 12%, transparent);
  color: var(--red);
  cursor: pointer;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: background var(--transition), border-color var(--transition);
}
.btn-danger:hover {
  background: color-mix(in srgb, var(--red) 22%, transparent);
  border-color: var(--red);
}

.action-cell {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: nowrap;
  white-space: nowrap;
}

/* ── Modal overlay + box ─────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 16px;
}

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  width: 100%;
  max-width: 460px;
  padding: 28px 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h2 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text-heading);
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
}
.modal-close:hover { color: var(--text-primary); background: var(--bg-hover); }

.modal-subhead {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin: -8px 0 0;
  font-family: monospace;
}

/* ── Send modal tabs ─────────────────────────────────────────── */
.modal-tabs {
  display: flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.modal-tab {
  flex: 1;
  background: none;
  border: none;
  padding: 9px 14px;
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.modal-tab:not(:last-child) { border-right: 1px solid var(--border); }
.modal-tab.active {
  background: var(--accent);
  color: #fff;
}
.modal-tab:not(.active):hover { background: var(--bg-hover); color: var(--text-primary); }
.modal-tab:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Modal panel / inputs ────────────────────────────────────── */
.modal-panel { display: flex; flex-direction: column; gap: 8px; }

.field-label {
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.modal-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 1rem;
  padding: 11px 13px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.modal-input:focus {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-focus);
}

.modal-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0;
}

/* ── Modal footer + status ───────────────────────────────────── */
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

.modal-status {
  font-size: 0.82rem;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
}
.modal-status-ok  { background: color-mix(in srgb, var(--green) 15%, transparent); color: var(--green); }
.modal-status-err { background: color-mix(in srgb, var(--red)   15%, transparent); color: var(--red); }

/* ── Light mode modal overrides ──────────────────────────────── */
@media (prefers-color-scheme: light) {
  .modal-box { background: #ffffff; border-color: #ddd; }
  .modal-overlay { background: rgba(0,0,0,0.45); }
}
