:root {
  /* Royal Energy brand tokens — matched to the Lead Extractor / royalenergy.co */
  --navy: #002366; --navy-deep: #001a4d; --navy-ink: #0a2c70; --blue: #2a55c9;
  --gold: #bf9a3f; --gold-deep: #8f6f23; --gold-bright: #e3c578;
  --bg: #eef3fc; --bg-grad: #f8fbff; --panel: #fff; --panel-2: #f4f8fd;
  --border: #e2e8f3; --border-strong: #d2dcec; --text: #10203f; --text-dim: #566583;
  --accent: #002366; --accent-hover: #2a55c9; --accent-tint: rgba(0, 35, 102, 0.07); --accent-ring: rgba(0, 35, 102, 0.15);
  --green: #15915f; --amber: #8f6f23; --red: #b4232c;
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --sans: 'Libre Franklin', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --radius: 14px; --radius-btn: 11px;
  --shadow: 0 1px 2px rgba(16, 32, 63, 0.05), 0 10px 28px -14px rgba(0, 35, 102, 0.22);
  --fs-display: clamp(2rem, 3.6vw, 2.9rem); --fs-h2: clamp(1.4rem, 2.4vw, 1.9rem);
  --fs-lead: clamp(1.05rem, 1.4vw, 1.22rem); --fs-body: clamp(1rem, 1.05vw, 1.1rem);
  --fs-control: clamp(1rem, 1vw, 1.05rem); --fs-sm: 0.9rem; --fs-xs: 0.8rem;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; font-family: var(--sans); color: var(--text); font-size: var(--fs-body); line-height: 1.65;
  background: radial-gradient(1200px 620px at 82% -12%, var(--bg-grad) 0%, var(--bg) 60%);
  background-attachment: fixed; min-height: 100vh; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
.app { max-width: 1100px; margin: 0 auto; padding: 32px 32px 64px; }

/* Header */
.header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; color: inherit; }
.logo-badge { width: clamp(46px, 5vw, 58px); height: clamp(46px, 5vw, 58px); flex: none; color: var(--navy); }
.brand-text { display: flex; flex-direction: column; }
h1 { font-family: var(--serif); font-size: var(--fs-display); margin: 0; font-weight: 600; letter-spacing: -0.015em; line-height: 1.02; color: var(--navy); }
h1 .brand-tool { color: var(--gold-deep); font-style: italic; font-weight: 500; }
.subtitle { margin: 5px 0 0; font-size: var(--fs-lead); font-weight: 400; line-height: 1.4; color: var(--text-dim); }
.header-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

/* Account hamburger menu */
.menu { position: relative; display: inline-flex; }
.menu-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; background: var(--panel-2); color: var(--text-dim); border: 1px solid var(--border); border-radius: 8px; cursor: pointer; font-family: inherit; transition: border-color 0.15s, color 0.15s; }
.menu-btn svg { width: 18px; height: 18px; }
.menu-btn:hover { border-color: var(--accent); color: var(--accent); }
.menu-dropdown { position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); padding: 8px; z-index: 60; display: flex; flex-direction: column; gap: 3px; }
.menu-dropdown[hidden] { display: none; }
.menu-email { font-size: 12px; color: var(--text-dim); font-weight: 500; padding: 7px 10px 9px; border-bottom: 1px solid var(--border); margin-bottom: 4px; word-break: break-all; }
.menu-item { display: inline-flex; align-items: center; gap: 8px; width: 100%; text-align: left; background: transparent; border: none; border-radius: 8px; padding: 9px 10px; font-size: 13px; font-weight: 500; color: var(--text); font-family: inherit; cursor: pointer; }
.menu-item:hover { background: var(--panel-2); }
.menu form { margin: 0; }

/* Setup bar (matches the Balances bar) */
.balances { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; padding: 10px 14px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); }
.bal-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); display: inline-flex; align-items: center; gap: 5px; }
.bal-chip { font-size: 12.5px; padding: 4px 10px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--border); color: var(--text); font-variant-numeric: tabular-nums; }
.bal-chip.bal-good { border-color: rgba(21, 145, 95, 0.4); color: var(--green); background: rgba(21, 145, 95, 0.07); }
.bal-chip.bal-warn { color: var(--gold-deep); border-color: rgba(191, 154, 63, 0.45); background: rgba(191, 154, 63, 0.1); }

/* Info tooltip */
span.info { position: relative; display: inline-flex; width: 15px; height: 15px; flex: none; color: var(--text-dim); cursor: help; vertical-align: middle; }
span.info:hover { color: var(--accent); }
span.info svg { width: 15px; height: 15px; }
span.info::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 9px); left: 50%; transform: translateX(-50%); width: max-content; max-width: 260px; white-space: normal; text-align: left; background: var(--navy-deep); color: #fff; font-size: 12px; font-weight: 500; line-height: 1.45; text-transform: none; letter-spacing: 0; padding: 8px 11px; border-radius: 9px; box-shadow: 0 10px 26px -8px rgba(0, 35, 102, 0.5); opacity: 0; visibility: hidden; pointer-events: none; transition: opacity 0.13s; z-index: 60; }
span.info::before { content: ''; position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%); border: 5px solid transparent; border-top-color: var(--navy-deep); opacity: 0; visibility: hidden; transition: opacity 0.13s; z-index: 60; }
span.info:hover::after, span.info:hover::before { opacity: 1; visibility: visible; }

/* Panels */
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); margin-bottom: 20px; }
.panel h2 { margin: 0 0 4px; font-family: var(--serif); font-weight: 600; font-size: var(--fs-h2); color: var(--navy); display: flex; align-items: center; letter-spacing: -0.01em; }
.panel .hint { margin: 0 0 16px; color: var(--text-dim); font-size: 13.5px; line-height: 1.5; }
.step-num { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 8px; background: var(--accent-tint); color: var(--navy); font-weight: 700; font-size: 14px; margin-right: 12px; font-family: var(--sans); }

/* Fields */
label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
textarea, input[type='text'], input[type='password'] { width: 100%; font: inherit; font-size: 15px; padding: 11px 13px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--panel-2); color: var(--text); }
textarea { min-height: 116px; resize: vertical; font-family: var(--mono); font-size: 13.5px; line-height: 1.6; }
textarea:focus, input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text); font-weight: 500; cursor: pointer; }
.toggle input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 16px; }
.spacer { flex: 1; }

/* Buttons */
.btn-primary { background: var(--accent); color: #fff; border: 1px solid transparent; border-radius: var(--radius-btn); padding: 11px 26px; font-size: var(--fs-control); font-weight: 600; font-family: inherit; cursor: pointer; transition: background 0.18s, transform 0.05s, box-shadow 0.18s; height: 48px; box-shadow: 0 1px 2px rgba(0, 35, 102, 0.18), 0 8px 22px -10px rgba(0, 35, 102, 0.35); }
.btn-primary:hover:not(:disabled) { background: var(--navy-deep); }
.btn-primary:active:not(:disabled) { transform: translateY(1px); }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; box-shadow: none; }
.btn-secondary { display: inline-flex; align-items: center; gap: 7px; background: var(--panel); color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--radius-btn); height: 48px; padding: 0 20px; font-size: var(--fs-sm); font-weight: 600; font-family: inherit; cursor: pointer; transition: border-color 0.15s, background 0.15s, color 0.15s; }
.btn-secondary:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-tint); color: var(--accent); }
.btn-secondary:disabled { opacity: 0.55; cursor: not-allowed; }

/* Results table */
.table-wrap { margin-top: 16px; overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
thead th { text-align: left; padding: 12px 15px; background: var(--panel-2); color: var(--text-dim); font-weight: 700; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 1px solid var(--border); }
tbody td { padding: 12px 15px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(0, 35, 102, 0.025); }
td .name { font-weight: 600; }
.badge { font-size: 11.5px; font-weight: 600; padding: 3px 10px; border-radius: 999px; }
.badge.avail { color: var(--green); background: rgba(21, 145, 95, 0.1); }
.badge.taken { color: var(--text-dim); background: var(--panel-2); }
.badge.err { color: var(--red); background: rgba(180, 35, 44, 0.08); }
.price { font-variant-numeric: tabular-nums; }

/* Messages + spinner */
.message { margin: 0 0 20px; padding: 12px 16px; border-radius: var(--radius-btn); font-size: 13.5px; line-height: 1.5; }
.message.info { background: var(--accent-tint); border: 1px solid var(--accent-ring); color: var(--navy-deep); }
.message.error { background: rgba(180, 35, 44, 0.07); border: 1px solid rgba(180, 35, 44, 0.28); color: var(--red); }
.message.warn { background: rgba(191, 154, 63, 0.1); border: 1px solid rgba(191, 154, 63, 0.4); color: var(--gold-deep); }

/* Log console */
.log { margin-top: 4px; background: #0a1733; color: #cdd9f5; font-family: var(--mono); font-size: 12.5px; line-height: 1.6; border-radius: 12px; padding: 16px 18px; max-height: 320px; overflow: auto; white-space: pre-wrap; }
.log:empty { display: none; }

@media (max-width: 900px) { .app { padding: 24px 20px 56px; } }
@media (max-width: 640px) {
  .app { padding: 18px 14px 48px; }
  .header { flex-direction: column; align-items: flex-start; gap: 14px; margin-bottom: 22px; }
  .header-right { justify-content: flex-start; }
  .row .btn-primary, .row .btn-secondary { width: 100%; }
}

/* --- Admin approvals panel --- */
.results-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.results-count { font-family: var(--serif); font-size: 1.2rem; font-weight: 600; color: var(--navy-deep); }
.admin-count { display: inline-block; min-width: 18px; padding: 0 6px; margin-left: 6px; background: var(--gold); color: #fff; border-radius: 999px; font-size: 0.72rem; font-weight: 700; line-height: 18px; text-align: center; }
.status-pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.74rem; font-weight: 600; text-transform: capitalize; border: 1px solid transparent; }
.status-pill.admin { background: var(--accent-tint); color: var(--navy-deep); border-color: var(--accent-ring); }
.status-pill.approved { background: rgba(21, 145, 95, 0.1); color: var(--green); border-color: rgba(21, 145, 95, 0.3); }
.status-pill.pending { background: rgba(191, 154, 63, 0.12); color: var(--gold-deep); border-color: rgba(191, 154, 63, 0.4); }
.status-pill.unverified { background: rgba(180, 35, 44, 0.08); color: var(--red); border-color: rgba(180, 35, 44, 0.28); }
#admin-list .btn-primary, #admin-list .btn-secondary { height: 34px; padding: 0 14px; font-size: 0.82rem; }

/* --- Inbox name generator --- */
input.num { width: 54px; padding: 7px 9px; font: inherit; font-size: 14px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--panel-2); color: var(--text); text-align: center; }
input.num:focus, input.namefld:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
input.namefld { width: auto; flex: 1 1 150px; min-width: 130px; padding: 9px 12px; font: inherit; font-size: 14px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--panel-2); color: var(--text); }
#gen-names-btn { height: 40px; padding: 0 16px; font-size: 0.85rem; white-space: nowrap; }
.inbox-preview { margin-top: 12px; font-variant-numeric: tabular-nums; }
.ipv-head { font-size: 13px; font-weight: 600; color: var(--navy-deep); margin-bottom: 9px; }
.ipv-dom { margin-bottom: 11px; }
.ipv-domname { display: inline-block; font-size: 12.5px; font-weight: 600; color: var(--gold-deep); margin-bottom: 6px; }
.ipv-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.ipv-list li { font-family: var(--mono); font-size: 12.5px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 7px; padding: 4px 9px; color: var(--text); }
.ipv-at { color: var(--text-dim); }
.price-list { color: var(--text-dim); font-size: 0.82em; margin-left: 4px; white-space: nowrap; }
