/* delelisten admin panel */
:root {
  --brand: #1b6e5b;
  --brand-ink: #ffffff;
  --bg: #f4f6f5;
  --surface: #ffffff;
  --ink: #1d2422;
  --muted: #66716d;
  --line: #dfe5e2;
  --warn-bg: #fff4d6; --warn-ink: #7a5300;
  --danger: #b3261e; --danger-bg: #fde8e6;
  --ok-bg: #e2f3ec; --ok-ink: #145443;
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --brand: #3fae8f;
    --brand-ink: #08130f;
    --bg: #111615;
    --surface: #1a201e;
    --ink: #e6ecea;
    --muted: #93a09b;
    --line: #2c3532;
    --warn-bg: #3a2f12; --warn-ink: #f2cf7a;
    --danger: #ff8a80; --danger-bg: #3d1b19;
    --ok-bg: #163229; --ok-ink: #9fe0c8;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--brand); }
h1 { font-size: 1.6rem; margin: .2rem 0 1rem; line-height: 1.25; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .92em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.hint { color: var(--muted); font-size: .88rem; margin: .25rem 0 .75rem; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

/* Top bar and side menu.
   Wide screens (901px and up): the menu is a column on the left, always there.
   Phones and small tablets: the menu hides behind the ☰ button and slides in from the left. */
:root { --side-w: 236px; --top-h: 48px; }
.topbar { background: var(--brand); color: var(--brand-ink); display: flex; align-items: center; gap: .75rem; height: var(--top-h); padding: 0 16px; position: sticky; top: 0; z-index: 30; }
.topbar a { color: var(--brand-ink); text-decoration: none; }
.logo { display: flex; align-items: center; gap: .5rem; font-weight: 700; }
.logo img { border-radius: 5px; background: #fff; }
.logo span { font-weight: 400; opacity: .8; }
.linklike { background: none; border: 0; font: inherit; color: inherit; cursor: pointer; padding: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.nav-toggle { position: absolute; opacity: 0; pointer-events: none; }
.nav-burger { display: none; }

.shell { display: flex; align-items: flex-start; }
.shell > .page { flex: 1; min-width: 0; }
.side { width: var(--side-w); flex: none; position: sticky; top: var(--top-h); height: calc(100vh - var(--top-h)); height: calc(100dvh - var(--top-h)); overflow-y: auto; overscroll-behavior: contain; background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.sidenav { padding: .75rem .6rem; display: flex; flex-direction: column; gap: .15rem; flex: 1; }
.sidenav a, .side-foot a, .side-foot .linklike { display: block; padding: .42rem .7rem; border-radius: 7px; color: var(--ink); text-decoration: none; }
.sidenav a:hover, .side-foot a:hover, .side-foot .linklike:hover { background: var(--bg); }
.sidenav a.active, .side-foot a.active { background: var(--ok-bg); color: var(--ok-ink); font-weight: 600; }
.navgroup { margin-top: .35rem; }
.navgroup summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; padding: .4rem .7rem; border-radius: 7px; color: var(--muted); font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; user-select: none; }
.navgroup summary::-webkit-details-marker { display: none; }
.navgroup summary::after { content: ""; width: .45rem; height: .45rem; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform .15s; margin-right: .2rem; }
.navgroup[open] summary::after { transform: rotate(45deg); }
.navgroup summary:hover { background: var(--bg); color: var(--ink); }
.navgroup a { padding-left: 1.2rem; }
.sidenav a:focus-visible, .navgroup summary:focus-visible, .side-foot a:focus-visible, .side-foot .linklike:focus-visible, .nav-toggle:focus-visible + .topbar .nav-burger { outline: 2px solid var(--brand); outline-offset: 1px; }
.side-foot { border-top: 1px solid var(--line); padding: .6rem; display: flex; flex-direction: column; gap: .1rem; }
.side-foot .linklike { text-align: left; width: 100%; color: var(--muted); }
.side-backdrop { display: none; }
.has-side .admin-foot { margin-left: var(--side-w); }

@media (max-width: 900px) {
  .nav-burger { display: block; width: 36px; height: 36px; margin-left: -6px; position: relative; cursor: pointer; border-radius: 7px; }
  .nav-burger:hover { background: rgba(255,255,255,.15); }
  .nav-burger span, .nav-burger span::before, .nav-burger span::after { content: ""; position: absolute; left: 8px; right: 8px; height: 2px; background: var(--brand-ink); border-radius: 2px; transition: transform .2s, opacity .2s; }
  .nav-burger span { top: 17px; }
  .nav-burger span::before { top: -6px; left: 0; right: 0; }
  .nav-burger span::after { top: 6px; left: 0; right: 0; }
  .nav-toggle:checked + .topbar .nav-burger span { background: transparent; }
  .nav-toggle:checked + .topbar .nav-burger span::before { transform: translateY(6px) rotate(45deg); }
  .nav-toggle:checked + .topbar .nav-burger span::after { transform: translateY(-6px) rotate(-45deg); }
  .side { position: fixed; left: 0; top: var(--top-h); bottom: 0; height: auto; width: min(300px, 86vw); z-index: 25; transform: translateX(-102%); transition: transform .2s ease; box-shadow: 0 10px 30px rgba(0,0,0,.25); visibility: hidden; }
  .nav-toggle:checked ~ .shell .side { transform: none; visibility: visible; }
  .nav-toggle:checked ~ .shell .side-backdrop { display: block; position: fixed; inset: var(--top-h) 0 0 0; background: rgba(0,0,0,.35); z-index: 20; }
  .sidenav a, .side-foot a, .side-foot .linklike { padding: .6rem .8rem; }
  .navgroup summary { padding: .6rem .8rem; }
  .has-side .admin-foot { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .side, .nav-burger span, .nav-burger span::before, .nav-burger span::after, .navgroup summary::after { transition: none; }
}

/* Page */
.page { max-width: 1160px; margin: 0 auto; padding: 1.25rem 16px 3rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; margin-bottom: 1rem; min-width: 0; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 1rem; margin-bottom: 1rem; }
.grid2 > .card { margin-bottom: 0; }
.stack { display: flex; flex-direction: column; gap: .7rem; }
.stack > h2 { margin-bottom: 0; }
.row { display: flex; gap: .6rem; align-items: flex-end; flex-wrap: wrap; }
.grow { flex: 1 1 200px; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .75rem; }
.inline { display: inline; margin: 0; }
.danger-zone { border-top: 1px solid var(--line); padding-top: .8rem; margin-top: .3rem; display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }

/* Forms */
label { display: flex; flex-direction: column; gap: .25rem; font-size: .88rem; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: .45rem; color: var(--ink); }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=date], input[type=datetime-local], input[type=number], select, textarea {
  font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: .5rem .65rem; min-height: 40px; width: 100%;
}
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1rem; }
.filters input[type=search] { flex: 1 1 260px; width: auto; }
.filters select { width: auto; }
.filters label { flex-direction: row; align-items: center; gap: .5rem; color: var(--ink); font-size: inherit; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: .75rem; align-items: end; }
input.copy { cursor: copy; }
input.copied { border-color: var(--brand); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; font: inherit; font-weight: 600; min-height: 40px; padding: .45rem .9rem; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.ghost { background: transparent; }
.btn.danger { background: var(--danger-bg); border-color: transparent; color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); }
.btn.small { min-height: 32px; padding: .25rem .65rem; font-size: .85rem; }

/* Flash & badges */
.flash { border-radius: var(--radius); padding: .75rem 1rem; margin-bottom: 1rem; background: var(--ok-bg); color: var(--ok-ink); }
.flash.error { background: var(--danger-bg); color: var(--danger); }
.flash input.copy { width: auto; min-width: 16rem; margin: .4rem 0; }
.badge { display: inline-block; font-size: .72rem; font-weight: 600; padding: .1rem .45rem; border-radius: 99px; background: var(--line); color: var(--ink); vertical-align: middle; white-space: nowrap; }
.badge.warn { background: var(--warn-bg); color: var(--warn-ink); }
.badge.danger { background: var(--danger-bg); color: var(--danger); }
.badge.ok { background: var(--ok-bg); color: var(--ok-ink); }

/* Tables */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 1rem; }
.card .table-wrap { border: 0; margin: 0 -1.1rem; border-radius: 0; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: .55rem .8rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table td.right, .table th.right { text-align: right; }
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; white-space: nowrap; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tr.done td { color: var(--muted); }
.table.compact td { padding: .4rem 0; }
.table.compact td + td { padding-left: .75rem; }
.pager { display: flex; gap: .75rem; align-items: center; justify-content: center; }

/* Dashboard */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 1rem; margin-bottom: 1rem; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; display: flex; flex-direction: column; color: var(--ink); text-decoration: none; }
a.tile:hover { border-color: var(--brand); }
.tile.warn { background: var(--warn-bg); border-color: transparent; }
.tile-label { font-size: .85rem; color: var(--muted); }
.tile.warn .tile-label, .tile.warn .tile-sub { color: var(--warn-ink); }
.tile-value { font-size: 2rem; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.tile-sub { font-size: .82rem; color: var(--muted); }
.chart { width: 100%; height: auto; display: block; }
.chart .bar { fill: var(--brand); }
.chart .bar:hover { opacity: .75; }
.chart .axis { stroke: var(--line); stroke-width: 1; }
.chart .lbl { fill: var(--muted); font-size: 11px; }

dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: 0; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; min-width: 0; }

/* Cleanup */
.job { display: flex; justify-content: space-between; gap: 1rem; align-items: center; flex-wrap: wrap; }
.job > div:first-child { flex: 1 1 300px; }
.job h2 { margin-bottom: .2rem; }
.job .hint { margin: 0; }
.job-action { display: flex; align-items: center; gap: .75rem; }
.job-count { font-size: 1.5rem; font-weight: 700; min-width: 3ch; text-align: right; font-variant-numeric: tabular-nums; }

/* Sign-in / setup */
.auth-box { max-width: 420px; margin: 2rem auto; }
.steps li { margin-bottom: 1rem; }
.qr { margin: .75rem 0; }
.qr svg { width: 200px; height: 200px; border-radius: 6px; }

.admin-foot { text-align: center; color: var(--muted, #6b7a73); font-size: .8rem; padding: 1.5rem 1rem 2rem; }
textarea { resize: vertical; font: inherit; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem 1rem; margin: 0; }
legend { font-weight: 600; padding: 0 .3rem; }

/* Tabs (Inbox, Newsletter) */
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 18px; border-bottom: 1px solid var(--line); }
.tabs a { padding: 8px 14px; border-radius: 8px 8px 0 0; text-decoration: none; color: inherit; border: 1px solid transparent; border-bottom: 0; margin-bottom: -1px; }
.tabs a.active { background: var(--surface, #fff); border-color: var(--line); font-weight: 600; }
.tabs .count { font-size: .8em; opacity: .7; margin-left: 4px; }
.msg-body { white-space: pre-wrap; word-break: break-word; line-height: 1.5; }
tr.unread td { font-weight: 600; }
.preview-frame { width: 100%; height: 640px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.dns-row { display: grid; grid-template-columns: 9em 1fr; gap: 4px 14px; padding: 8px 0; border-top: 1px solid var(--line); }
.dns-row pre { white-space: pre-wrap; margin: 6px 0 0; font-size: .85em; }
textarea.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85em; }
.flash.warn { background: var(--warn-bg); color: var(--warn-ink); }
.mode-row { display: flex; flex-wrap: wrap; gap: .4rem 1.4rem; }
