/* Agency admin and login pages */
:root {
  --ink: #101828;
  --muted: #5d6b7e;
  --line: #e4e7ec;
  --bg: #f6f7f9;
  --card: #ffffff;
  --brand: #3b5bfd;
  --brand-ink: #2b47e0;
  --side: #101828;
  --side-ink: #cbd2dc;
  --ok-bg: #ecfdf3;
  --ok-ink: #067647;
  --err-bg: #fef3f2;
  --err-ink: #b42318;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  line-height: 1.5;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); font-size: 15px; }
a { color: var(--brand-ink); }
a:hover { color: var(--ink); }
:focus-visible { outline: 3px solid #9db0ff; outline-offset: 2px; }
h1 { font-size: 26px; letter-spacing: -0.02em; margin: 0 0 8px; }
h2 { font-size: 17px; margin: 0 0 10px; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -0.01em; }
.brand b { font-weight: 500; color: #98a2b3; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 13px; margin: 2px 0 6px; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.08em; font-size: 12px; font-weight: 700; color: var(--muted); margin: 0 0 6px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.alert { padding: 12px 14px; border-radius: 10px; margin: 12px 0; font-weight: 600; }
.alert-ok { background: var(--ok-bg); color: var(--ok-ink); }
.alert-error { background: var(--err-bg); color: var(--err-ink); }

.button { display: inline-flex; justify-content: center; align-items: center; min-height: 44px; padding: 10px 18px; border: 0; border-radius: 10px; background: var(--brand); color: #fff; font-family: inherit; font-weight: 600; font-size: 15px; text-decoration: none; cursor: pointer; }
.button:hover { background: var(--brand-ink); color: #fff; }
.link-button { background: none; border: 0; padding: 0; font: inherit; color: var(--brand-ink); text-decoration: underline; cursor: pointer; }
.link-button.danger { color: var(--err-ink); }
.button-secondary { background: #eef2ff; color: var(--brand-ink); }
.button-secondary:hover { background: #dfe6ff; color: var(--ink); }
.button-danger { background: #d92d20; }
.button-danger:hover { background: #b42318; }

.stack { display: flex; flex-direction: column; gap: 6px; margin-top: 16px; }
.stack .button { margin-top: 12px; }
.narrow { max-width: 420px; }
label { font-weight: 600; font-size: 14px; margin-top: 8px; }
input[type="email"], input[type="password"], input[type="text"], input[type="search"], input[type="url"], input:not([type]), .code-input, select {
  height: 46px; padding: 0 14px; border: 1.5px solid #c9d2dc; border-radius: 10px; font-family: inherit; font-weight: 500; font-size: 16px; color: var(--ink); background: #fff; width: 100%;
}
textarea { width: 100%; padding: 10px 14px; border: 1.5px solid #c9d2dc; border-radius: 10px; font-family: inherit; font-size: 15px; color: var(--ink); background: #fff; resize: vertical; }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--brand); flex: none; }
.code-input { letter-spacing: 0.2em; font-size: 20px; }

/* Login and two-step pages */
body.auth { display: flex; min-height: 100vh; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 440px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 32px; box-shadow: 0 18px 40px rgba(16, 24, 40, 0.08); }
.auth-card .brand { margin-bottom: 22px; }
.qr { display: flex; justify-content: center; margin: 16px 0 8px; }
.qr img { width: 200px; height: 200px; border: 1px solid var(--line); border-radius: 12px; }
.key { display: inline-block; padding: 8px 12px; background: var(--bg); border-radius: 8px; font-size: 15px; letter-spacing: 0.06em; word-break: break-all; }
.codes { columns: 2; padding-left: 22px; margin: 16px 0 22px; }
.codes li { margin-bottom: 6px; }
.codes code { font-size: 16px; }

/* Logged-in admin */
.shell { display: flex; flex-wrap: wrap; min-height: 100vh; }
.side { flex: 1 1 240px; background: var(--side); color: var(--side-ink); padding: 22px 16px; display: flex; flex-direction: column; gap: 20px; }
.side .brand { color: #fff; }
.side .agency { display: flex; flex-direction: column; padding: 12px 14px; border-radius: 12px; background: #1d2939; }
.side .agency strong { color: #fff; }
.side .agency span { font-size: 13px; color: #98a2b3; }
.side .links { display: flex; flex-direction: column; gap: 2px; }
.side .links a { color: var(--side-ink); text-decoration: none; padding: 10px 12px; border-radius: 9px; font-weight: 500; }
.side .links a:hover, .side .links a[aria-current="page"] { background: #1d2939; color: #fff; }
.side .logout { margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-top: 14px; border-top: 1px solid #1d2939; }
.side .logout .link-button { color: #cbd2dc; }
.content { flex: 999 1 560px; min-width: 0; padding: 28px 36px 48px; }
.cards { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 16px; }
.card { flex: 1 1 260px; min-width: 0; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 20px 22px; margin-top: 16px; }
.cards .card { margin-top: 0; }
.big { font-size: 30px; font-weight: 800; margin: 0; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; background: #eef2ff; color: var(--brand-ink); font-size: 12px; font-weight: 700; }
.plain { list-style: none; padding: 0; margin: 0 0 8px; }
.note { margin-top: 24px; }
.upload { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.upload label { margin: 0; }
.table-wrap { overflow-x: auto; }
table { width: 100%; min-width: 640px; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; padding: 10px 12px; }
td { padding: 12px; border-top: 1px solid #f0f2f5; }
td.actions { display: flex; gap: 14px; align-items: center; }
td.actions form { margin: 0; }

/* Banners across the top: notices, support logins, paused sites */
.banner { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; padding: 12px 24px; font-weight: 600; font-size: 14px; }
.banner p { margin: 0; flex: 1 1 320px; }
.banner a { font-weight: 700; }
.banner-info { background: #eef4ff; color: #1d3a8a; }
.banner-warn { background: #fffaeb; color: #93370d; }
.banner-support { background: #5b21b6; color: #fff; }
.banner-support a { color: #fff; }
.banner.preview { border-radius: 10px; padding: 12px 16px; }

/* Status tags */
.status { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; vertical-align: middle; white-space: nowrap; }
.status-active { background: var(--ok-bg); color: var(--ok-ink); }
.status-setting_up { background: #eef2ff; color: var(--brand-ink); }
.status-payment_failed { background: var(--err-bg); color: var(--err-ink); }
.status-suspended { background: #fffaeb; color: #b54708; }
.status-cancelled { background: #f2f4f7; color: #475467; }
.tag-warn { background: #fffaeb; color: #b54708; }
.tag-danger { background: var(--err-bg); color: var(--err-ink); }
.card h3 { font-size: 15px; margin: 18px 0 8px; }
h1 .status { font-size: 13px; margin-left: 8px; letter-spacing: 0; }

/* Control panel: a darker, purple sidebar so it's never mistaken for an agency's admin */
.control .side { background: #1b1033; }
.control .side .agency { background: #2e1a52; }
.control .side .links a:hover, .control .side .links a[aria-current="page"] { background: #2e1a52; }
.control .side .logout { border-top-color: #2e1a52; }
.crumbs { margin: 0 0 4px; font-size: 14px; }
.stats .card { flex: 1 1 150px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.filters input { flex: 1 1 260px; width: auto; }
.filters select { flex: 0 1 200px; width: auto; }
.sub { display: block; color: var(--muted); font-size: 13px; }
.actions-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 12px 0 4px; }
.actions-row form { margin: 0; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 10px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.warn-card { border-color: #fedf89; background: #fffcf5; }
.notes { list-style: none; padding: 0; margin: 16px 0 0; }
.notes li { border-top: 1px solid #f0f2f5; padding: 12px 0; }
.notes p { margin: 0 0 4px; white-space: pre-wrap; }
.note-meta { display: flex; gap: 12px; align-items: center; font-size: 13px; }
.note-meta form { margin: 0; }
.errors { background: var(--err-bg); color: var(--err-ink); border-radius: 10px; padding: 12px 14px 12px 32px; font-weight: 600; }
.edit-table { min-width: 560px; }
.edit-table td, .edit-table th[scope="row"] { vertical-align: middle; }
.edit-table th[scope="row"] { color: var(--ink); font-size: 14px; text-transform: none; letter-spacing: 0; font-weight: 600; }
.edit-table tr.dim td { opacity: 0.6; }
.edit-table tr.add-row td { background: #fafbfc; }
.money { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-weight: 600; }
.money input { width: 110px; }
input.num { width: 90px; display: inline-block; }
input.hex { width: 120px; text-transform: uppercase; }
label.inline { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-weight: 500; }
label.check { display: flex; align-items: flex-start; gap: 10px; font-weight: 500; margin: 6px 0; }
.choice { border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; margin: 12px 0; }
.choice legend { font-weight: 700; padding: 0 6px; }
.swatch svg { display: block; }
.history li { margin-bottom: 10px; }
.content .stack .button { align-self: flex-start; }
.signup-card { max-width: 620px; }
.option { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 12px; margin: 8px 0; font-weight: 500; cursor: pointer; }
.option:has(input:checked) { border-color: var(--brand); background: #f5f7ff; }
.option > span { display: flex; flex-direction: column; gap: 2px; }
.inline-form { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 8px 0; }
.inline-form label { margin: 0; }
tr.current td { background: #f5f7ff; }
.money-cell { white-space: nowrap; }
.one-off > span:first-child { min-width: 240px; }
.one-off { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-start; gap: 12px 24px; padding: 14px 12px 4px; border-top: 1px solid #f0f2f5; font-weight: 600; font-size: 14px; }
.history ul { margin: 4px 0 0; padding-left: 20px; color: var(--muted); }

@media (max-width: 640px) {
  .content { padding: 20px 16px 40px; }
  .auth-card { padding: 24px 20px; }
  .banner { padding: 10px 16px; }
}
