/* The account portal and the admin console: one small stylesheet, light and dark. */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --text: #16181d;
  --muted: #5d6470;
  --border: #dfe3e8;
  --accent: #2f5bea;
  --accent-text: #ffffff;
  --ok: #1d7f4e;
  --ok-bg: #e5f5ec;
  --warn: #9a5b00;
  --warn-bg: #fff3dc;
  --bad: #b42318;
  --bad-bg: #fde8e6;
  --info-bg: #e8eefe;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1115; --surface: #171a21; --surface-2: #1e222b; --text: #e8eaee;
    --muted: #9aa3b2; --border: #2a2f3a; --accent: #6d8dff; --accent-text: #0f1115;
    --ok: #4cc38a; --ok-bg: #12291f; --warn: #f0b44c; --warn-bg: #2b2112;
    --bad: #ff8a80; --bad-bg: #2d1615; --info-bg: #182036;
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1115; --surface: #171a21; --surface-2: #1e222b; --text: #e8eaee;
  --muted: #9aa3b2; --border: #2a2f3a; --accent: #6d8dff; --accent-text: #0f1115;
  --ok: #4cc38a; --ok-bg: #12291f; --warn: #f0b44c; --warn-bg: #2b2112;
  --bad: #ff8a80; --bad-bg: #2d1615; --info-bg: #182036;
  --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
code, .mono { font-family: var(--mono); font-size: .92em; }

header.top {
  display: flex; align-items: center; gap: 16px; padding: 12px 24px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; letter-spacing: -.01em; }
/* The 4colors logo (marketing-web site/src): the white one on the dark theme. */
.brand .logo { height: 26px; width: auto; display: block; flex: none; }
.brand .logo-on-dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand .logo-on-light { display: none; }
  :root:not([data-theme="light"]) .brand .logo-on-dark { display: block; }
}
:root[data-theme="dark"] .brand .logo-on-light { display: none; }
:root[data-theme="dark"] .brand .logo-on-dark { display: block; }
.brand .app { color: var(--muted); font-weight: 500; }
header.top .spacer { flex: 1; }
header.top .who { color: var(--muted); font-size: 14px; min-width: 0; overflow: hidden;
                  text-overflow: ellipsis; white-space: nowrap; }
header.top > * { flex-shrink: 0; }
header.top > .who { flex-shrink: 1; }

main { max-width: 1080px; margin: 0 auto; padding: 24px 16px 64px; }
main.narrow { max-width: 440px; padding-top: 56px; }
h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -.01em; }
h2 { font-size: 16px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 16px 0 8px; color: var(--muted); font-weight: 600; }
.sub { color: var(--muted); margin: 0 0 20px; }

.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
        align-items: start; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow); min-width: 0;
}
.card + .card { margin-top: 16px; }
.grid .card + .card { margin-top: 0; }
.card.wide { grid-column: 1 / -1; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 10px; }

label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
input, select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text); font: inherit;
}
textarea { font: inherit; min-height: 80px; resize: vertical; }
textarea.code { font-family: var(--mono); font-size: 13px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline-offset: -1px; border-radius: 8px; }
button:focus-visible, .btn:focus-visible { outline-offset: 2px; border-radius: 8px; }
.check input:focus-visible { outline-offset: 2px; border-radius: 2px; }
.field { margin-bottom: 12px; }
.fields { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text); }
.check input { width: auto; }
fieldset.plain { border: 0; padding: 0; margin: 0 0 12px; min-width: 0; }
.legend { font-size: 13px; color: var(--muted); margin-bottom: 4px; padding: 0; }
.forgot { margin: -4px 0 12px; }
details.mail { border-bottom: 1px solid var(--border); padding: 8px 0; }
details.mail > summary { cursor: pointer; overflow-wrap: anywhere; }

button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 550;
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
button:hover, .btn:hover { background: var(--surface-2); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
button.primary:hover { filter: brightness(1.06); background: var(--accent); }
button.danger { color: var(--bad); }
button.small { padding: 4px 10px; font-size: 13px; }
button.block { width: 100%; }
button:disabled { opacity: .55; cursor: default; }

.tabs { display: flex; flex-wrap: wrap; gap: 2px 4px; border-bottom: 1px solid var(--border);
        margin-bottom: 20px; }
.tabs button {
  border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none;
  color: var(--muted); padding: 10px 12px;
}
.tabs button.on, .tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.tabs button:focus-visible { outline-offset: -2px; border-radius: 6px 6px 0 0; }

.badge {
  display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--border);
}
.badge.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.badge.bad { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.badge.info { background: var(--info-bg); color: var(--accent); border-color: transparent; }

.notice { border-radius: 8px; padding: 10px 14px; margin-bottom: 16px; font-size: 14px;
          border: 1px solid transparent; }
.notice.ok { background: var(--ok-bg); color: var(--ok); }
.notice.warn { background: var(--warn-bg); color: var(--warn); }
.notice.bad { background: var(--bad-bg); color: var(--bad); }
.notice.info { background: var(--info-bg); color: var(--text); }

.meter { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden;
         border: 1px solid var(--border); }
.meter > span { display: block; height: 100%; background: var(--accent); }
.meter.warn > span { background: var(--warn); }
.meter.bad > span { background: var(--bad); }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

.table-wrap { overflow-x: auto; position: relative; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px;
     text-transform: uppercase; letter-spacing: .03em; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { color: var(--muted); font-size: 14px; padding: 8px 0; }

.secret {
  font-family: var(--mono); background: var(--surface-2); border: 1px dashed var(--border);
  padding: 10px 12px; border-radius: 8px; overflow-wrap: anywhere; font-size: 13px;
}
pre.snippet {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px;
  padding: 12px; overflow-x: auto; font-size: 12.5px; margin: 8px 0 0;
}
.providers { display: grid; gap: 8px; margin-bottom: 16px; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px;
           margin: 16px 0; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
.timeline { list-style: none; margin: 0; padding: 0; font-size: 13.5px; }
.timeline .detail { overflow-wrap: anywhere; }
.timeline li { padding: 6px 0 6px 14px; border-left: 2px solid var(--border); position: relative; }
.timeline li::before { content: ""; position: absolute; left: -5px; top: 12px; width: 8px;
                       height: 8px; border-radius: 50%; background: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 20;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 8px;
  font-size: 14px; box-shadow: var(--shadow); max-width: calc(100% - 32px);
}
.hidden { display: none !important; }

@media (max-width: 600px) {
  header.top { padding: 10px 16px; gap: 10px; }
  .grid { grid-template-columns: minmax(0, 1fr); }
  .tabs button { padding: 10px 8px; }
  main { padding: 16px 16px 48px; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 8px; }
}

/* --- first run, jobs, dialogs, sections (account and admin) ------------------------------------ */
.checklist { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 10px;
             grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); counter-reset: step; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 8px;
                background: var(--surface-2); border: 1px solid var(--border); font-size: 14px; }
.checklist .tick { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
                   font-size: 12px; font-weight: 700; border: 2px solid var(--border); color: var(--muted); }
.checklist li.done .tick { background: var(--ok); border-color: var(--ok); color: var(--surface); }
.checklist li.done .step-label { color: var(--muted); text-decoration: line-through; }
.checklist li.next { border-color: var(--accent); }
.checklist .step-label { font-weight: 600; }
.hint { font-size: 13px; color: var(--muted); margin: 6px 0 0; }
.hint.warn { color: var(--warn); }
tr.failed td { background: var(--bad-bg); }
tr.failed td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
td.nowrap, th.nowrap { white-space: nowrap; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font: inherit;
           text-decoration: underline; font-weight: 500; }
.linkbtn:hover { background: none; }
dialog.modal { border: 1px solid var(--border); border-radius: var(--radius); padding: 0; width: min(760px, calc(100% - 32px));
               max-height: calc(100% - 48px); background: var(--surface); color: var(--text); box-shadow: 0 10px 40px rgba(0,0,0,.25); }
dialog.modal::backdrop { background: rgba(10, 12, 16, .45); }
dialog.modal .modal-head { display: flex; align-items: center; gap: 8px; padding: 14px 18px; border-bottom: 1px solid var(--border);
                           position: sticky; top: 0; background: var(--surface); }
dialog.modal .modal-head h2 { margin: 0; flex: 1; min-width: 0; overflow-wrap: anywhere; }
dialog.modal .modal-body { padding: 14px 18px 18px; }
dialog.modal pre.snippet { max-height: 60vh; white-space: pre-wrap; overflow-wrap: anywhere; }
details.section { border-top: 1px solid var(--border); margin-top: 16px; padding-top: 4px; }
details.section > summary { cursor: pointer; font-weight: 600; padding: 8px 0; list-style-position: inside; }
details.section[open] > summary { margin-bottom: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { border-radius: 999px; padding: 4px 12px; font-size: 13px; }
.chips button[aria-pressed="true"] { background: var(--info-bg); border-color: var(--accent); color: var(--accent); }
.seg { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 0; }
.seg button { padding: 5px 12px; font-size: 13px; border-radius: 999px; }
.seg button[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.plans { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.plan { border: 1px solid var(--border); border-radius: 8px; padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.plan.pick { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.plan .price { font-size: 18px; font-weight: 650; }
.plan .grow { flex: 1; }
.summary-bar { display: grid; gap: 12px 24px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); margin: 12px 0 4px; }
.summary-bar .k { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.summary-bar .v { font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.quick { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.quick form { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--border);
              border-radius: 8px; background: var(--surface-2); }
.quick form label { margin-bottom: 2px; }
.quick form .act-title { font-weight: 600; font-size: 14px; }
.quick form .grow-col { flex: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
           clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* Utilities that replace inline style attributes (the CSP refuses them). */
.ml-6 { margin-left: 6px; }
.mt-0 { margin-top: 0; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 6px; }
.wrap-any { overflow-wrap: anywhere; }
.ellipsis { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
ul.members { list-style: none; margin: 0; padding: 0; font-size: 14px; }
ul.members li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0;
                border-bottom: 1px solid var(--border); }
.my-8 { margin: 8px 0; }
.m-0 { margin: 0; }
.grow { flex: 1; min-width: 140px; }
.grow-2 { flex: 2; min-width: 160px; }
.brand-plain { color: inherit; text-decoration: none; }
.mt-32 { margin-top: 32px; }
