/* DevsArt Innovation Mail — shared design system for the panel and the API pages.
   One file, copied into both services so each container stays self-contained.
   Mobile first: every rule below is the small-screen case, widened at min-width. */

/* ── tokens ──────────────────────────────────────────────────────────────── */
:root {
  /* Authoritative: the <meta name="color-scheme"> tag does not reliably reach
     the computed style, and without this the browser paints LIGHT native
     controls (checkboxes, scrollbars, date pickers) on these dark pages. */
  color-scheme: dark;

  --bg:       #0b1220;
  --surface:  #151f33;
  --surface-2:#1c2942;
  --line:     #2a3a56;
  --line-soft:#213047;

  --ink:      #e8eef8;
  --ink-dim:  #9fb0c9;
  --ink-faint:#6b7d99;

  --accent:   #4a8dff;
  --accent-ink:#ffffff;
  --ok:       #34d399;
  --warn:     #fbbf24;
  --danger:   #f87171;

  --s1: .25rem;  --s2: .5rem;   --s3: .75rem;  --s4: 1rem;
  --s5: 1.5rem;  --s6: 2rem;    --s7: 3rem;

  --r1: 6px; --r2: 10px; --r3: 14px;
  --topbar: 56px;
  --sidebar: 240px;
  --tap: 44px;                       /* minimum comfortable touch target */
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.18);
}

/* ── reset ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0 0 var(--s3); line-height: 1.25; font-weight: 650; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; color: var(--ink-dim); font-weight: 600; }
p  { margin: 0 0 var(--s3); }
a  { color: var(--accent); }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r1); }

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--accent); color: var(--accent-ink); padding: var(--s2) var(--s4);
}
.skip:focus { left: var(--s2); top: var(--s2); }

/* ── top bar ─────────────────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 40; height: var(--topbar);
  background: #070d18; border-bottom: 1px solid var(--line);
}
.navtoggle { position: absolute; opacity: 0; pointer-events: none; }
.topbar-inner {
  display: flex; align-items: center; gap: var(--s3);
  height: 100%; padding: 0 var(--s4);
}
.brand {
  display: flex; align-items: center; gap: var(--s2);
  color: var(--ink); text-decoration: none; font-weight: 650; font-size: 1rem;
  margin-right: auto; min-width: 0;
}
.brand .brand-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who { color: var(--ink-dim); font-size: .82rem; display: none; }
.who strong { color: var(--ink); font-weight: 600; }

.hamburger {
  display: grid; place-items: center; order: -1;
  width: var(--tap); height: var(--tap);
  border: 1px solid var(--line); border-radius: var(--r1);
  cursor: pointer; color: var(--ink-dim); font-size: 1.1rem; user-select: none;
}
.hamburger:hover { color: var(--ink); border-color: var(--accent); }

/* ── shell: sidebar + content ────────────────────────────────────────────── */
.shell { display: flex; align-items: flex-start; }

/* Off-canvas on small screens, pinned on large ones. */
.sidebar {
  position: fixed; top: var(--topbar); bottom: 0; left: 0; z-index: 30;
  width: min(80vw, var(--sidebar));
  background: #070d18; border-right: 1px solid var(--line);
  padding: var(--s4) var(--s3); overflow-y: auto;
  transform: translateX(-100%); transition: transform .18s ease;
}
.navtoggle:checked ~ .shell .sidebar { transform: none; }

.backdrop { display: none; position: fixed; inset: var(--topbar) 0 0 0; z-index: 25;
            background: rgba(2,6,14,.6); }
.navtoggle:checked ~ .shell .backdrop { display: block; }

/* Collapsible sections, built on <details> so expanding works without
   JavaScript and keeps native keyboard and screen-reader behaviour. */
.navgroup { margin-bottom: var(--s1); }
.navgroup > summary {
  display: flex; align-items: center; gap: var(--s2);
  padding: var(--s3); border-radius: var(--r1); cursor: pointer;
  color: var(--ink-dim); font-size: .72rem; font-weight: 650;
  text-transform: uppercase; letter-spacing: .08em;
  list-style: none; user-select: none;
}
.navgroup > summary::-webkit-details-marker { display: none; }
.navgroup > summary::after {
  content: "›"; margin-left: auto; font-size: 1.05rem; line-height: 1;
  transform: rotate(90deg); transition: transform .15s ease; color: var(--ink-faint);
}
.navgroup[open] > summary::after { transform: rotate(-90deg); }
.navgroup > summary:hover { background: var(--surface); color: var(--ink); }
.navgroup.has-active > summary { color: var(--ink); }

.navgroup-items {
  margin: var(--s1) 0 var(--s3) var(--s4);
  padding-left: var(--s2); border-left: 1px solid var(--line-soft);
}
.sidebar a {
  display: block; padding: var(--s3); border-radius: var(--r1);
  color: var(--ink-dim); text-decoration: none; font-size: .92rem; line-height: 1.4;
}
.sidebar a:hover { background: var(--surface); color: var(--ink); }
.sidebar a.on { background: var(--accent); color: var(--accent-ink); font-weight: 600; }

/* ── page shell ──────────────────────────────────────────────────────────── */
main {
  flex: 1 1 auto; min-width: 0; width: 100%;
  max-width: 1120px; margin: 0 auto;
  padding: var(--s5) var(--s4) var(--s7);
}
.page-head { margin-bottom: var(--s5); }
.page-head h1 { margin-bottom: var(--s1); }
.page-head .sub { color: var(--ink-dim); font-size: .92rem; margin: 0; }

.card {
  background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: var(--r3); padding: var(--s5) var(--s4); margin-bottom: var(--s5);
}
.card > :last-child { margin-bottom: 0; }
.card-head { display: flex; align-items: baseline; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s3); }
.card-head h2 { margin: 0; }
.card-head .count {
  background: var(--surface-2); color: var(--ink-dim); border-radius: 999px;
  padding: 2px var(--s2); font-size: .78rem; font-weight: 600;
}
.card.narrow { max-width: 27rem; margin-left: auto; margin-right: auto; }
.card.center { text-align: center; }

.muted { color: var(--ink-dim); }
.faint { color: var(--ink-faint); }
.small { font-size: .85rem; }
.hint  { color: var(--ink-dim); font-size: .85rem; margin-top: var(--s3); }

/* One DNS record, as a self-contained block the reader works through top to
   bottom: what it is, whether it is done, then the fields to fill in. */
.reccard { border: 1px solid var(--line); border-radius: var(--s3);
           padding: var(--s4); margin-top: var(--s4); background: var(--surface-2); }
.reccard-head { display: flex; align-items: flex-start; justify-content: space-between;
                gap: var(--s3); margin-bottom: var(--s3); }

/* Type / Name / Priority / TTL side by side, wrapping on narrow screens so the
   value field underneath always gets the full width. */
.recfields { display: flex; flex-wrap: wrap; gap: var(--s4); }
.recfields > div { min-width: 5rem; }

/* Guidance lists: roomier than a default <ul>, since each item is a full
   instruction the reader has to act on rather than a one-line bullet. */
.checklist { color: var(--ink-dim); font-size: .85rem; margin: var(--s3) 0 0;
             padding-left: var(--s4); }
.checklist li { margin-bottom: var(--s3); line-height: 1.55; }
.checklist li:last-child { margin-bottom: 0; }
.checklist li::marker { color: var(--accent); }
.checklist strong { color: var(--ink); }

/* ── forms ───────────────────────────────────────────────────────────────── */
label { display: block; margin-bottom: var(--s3); font-size: .88rem; color: var(--ink-dim); }
input, select, textarea {
  width: 100%; padding: var(--s3); margin-top: var(--s1);
  min-height: var(--tap);
  background: var(--bg); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--r1);
  font: inherit; font-size: .95rem;
}
input::placeholder { color: var(--ink-faint); }
/* The generic input rule above would turn a checkbox into a filled grey block. */
/* Drawn rather than native: the browser's own dark checkbox is a flat grey
   square that reads as a disabled block next to these inputs. */
input[type="checkbox"] {
  appearance: none; -webkit-appearance: none;
  width: 1.15rem; height: 1.15rem; min-height: 0; padding: 0; margin: 0;
  flex: 0 0 auto; cursor: pointer;
  background: var(--bg); border: 1px solid var(--line); border-radius: 4px;
  display: inline-grid; place-content: center;
}
input[type="checkbox"]::before {
  content: ""; width: .62rem; height: .62rem; transform: scale(0);
  transition: transform .1s ease; background: var(--accent-ink);
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}
input[type="checkbox"]:checked { background: var(--accent); border-color: var(--accent); }
input[type="checkbox"]:checked::before { transform: scale(1); }
input[type="checkbox"]:hover { border-color: var(--accent); }
input:focus, select:focus { border-color: var(--accent); }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink-faint) 50%), linear-gradient(135deg, var(--ink-faint) 50%, transparent 50%); background-position: right 1.1rem center, right .85rem center; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: var(--s6); }

/* a row of controls that becomes a stack on small screens */
.field-row { display: flex; flex-direction: column; gap: var(--s3); }
.field-row > label { margin: 0; }
.field-row > .grow { flex: 1; }
.field-row .arrow { display: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: var(--tap); padding: var(--s3) var(--s5);
  background: var(--accent); color: var(--accent-ink);
  border: 1px solid transparent; border-radius: var(--r1);
  font: inherit; font-size: .92rem; font-weight: 600;
  text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--ink-dim); }
.btn.ghost:hover { border-color: var(--accent); color: var(--ink); }
.btn.danger { background: transparent; border-color: rgba(248,113,113,.45); color: var(--danger); }
.btn.danger:hover { background: rgba(248,113,113,.12); }
.btn.xs { min-height: 34px; padding: var(--s1) var(--s3); font-size: .82rem; font-weight: 500; }
.btn.block { width: 100%; }
.actions { display: flex; flex-wrap: wrap; gap: var(--s3); }
.actions.center { justify-content: center; }

.check { display: flex; align-items: center; gap: var(--s2); font-size: .85rem; color: var(--ink-dim); margin: 0; }
.check input { cursor: pointer; }

/* ── feedback ────────────────────────────────────────────────────────────── */
.flash {
  padding: var(--s3) var(--s4); border-radius: var(--r2); margin-bottom: var(--s5);
  font-size: .92rem; border: 1px solid;
}
.flash.ok  { background: rgba(52,211,153,.12); border-color: rgba(52,211,153,.5); color: #a7f3d0; }
.flash.err { background: rgba(248,113,113,.12); border-color: rgba(248,113,113,.5); color: #fecaca; }
.banner {
  background: rgba(251,191,36,.1); border: 1px solid rgba(251,191,36,.45); color: #fde68a;
  padding: var(--s3) var(--s4); border-radius: var(--r2); margin-bottom: var(--s4); font-size: .9rem;
}
.banner a { color: var(--warn); }

.pill { display: inline-block; padding: 2px var(--s3); border-radius: 999px; font-size: .75rem; font-weight: 650; border: 1px solid; }
.pill.up   { background: rgba(52,211,153,.14); color: #6ee7b7; border-color: rgba(52,211,153,.45); }
.pill.down { background: rgba(248,113,113,.14); color: #fca5a5; border-color: rgba(248,113,113,.45); }
.pill.off  { background: var(--surface-2); color: var(--ink-faint); border-color: var(--line); }

.bar { height: 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); }
.bar-fill.warn { background: var(--warn); }
.bar-fill.over { background: var(--danger); }

.logbox {
  background: #060b14; border: 1px solid var(--line); border-radius: var(--r2);
  padding: var(--s3); margin: 0; max-height: 60vh; overflow: auto;
  font: 12px/1.5 ui-monospace, Menlo, Consolas, monospace;
  white-space: pre-wrap; word-break: break-word; color: #b6c4da;
}
.empty { color: var(--ink-faint); font-size: .9rem; padding: var(--s4) 0; margin: 0; }

/* ── stat tiles ──────────────────────────────────────────────────────────── */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: var(--s3); }
.tile { background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: var(--r2); padding: var(--s4); }
.tile .k { display: block; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); }
.tile .v { display: block; font-size: 1.4rem; font-weight: 650; margin-top: var(--s1); }

/* ── tables: real table on wide screens, stacked cards on phones ─────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; color: var(--ink-faint); font-weight: 600; font-size: .78rem;
     text-transform: uppercase; letter-spacing: .05em; padding: var(--s2) var(--s3); }
td { padding: var(--s3); border-top: 1px solid var(--line-soft); vertical-align: middle; }
td.nowrap { white-space: nowrap; }
tbody tr:hover { background: rgba(255,255,255,.02); }
.cell-actions { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }
.cell-actions form { display: flex; gap: var(--s2); align-items: center; margin: 0; }
.cell-actions input { width: auto; min-width: 7rem; min-height: 34px; padding: var(--s1) var(--s2); margin: 0; font-size: .85rem; }

@media (max-width: 47.99rem) {
  table, thead, tbody, tr, th, td { display: block; }
  thead { position: absolute; left: -9999px; }
  tbody tr {
    background: var(--surface-2); border: 1px solid var(--line-soft);
    border-radius: var(--r2); padding: var(--s3); margin-bottom: var(--s3);
  }
  tbody tr:hover { background: var(--surface-2); }
  /* Label above the value, and the cell stays a plain block.
     Side-by-side layouts (flex or grid) both break here: a cell often holds
     several children — "80 B" plus a <span>· no quota</span> — and each one
     becomes its own flex/grid item, scattering across columns. A long email
     address also cannot shrink a flex item below its content width.
     `overflow-wrap: anywhere` is what breaks long addresses; `break-word`
     would not, as it does not affect the min-content contribution. */
  td {
    display: block; border: 0; padding: var(--s2) 0;
    overflow-wrap: anywhere;
  }
  td::before {
    content: attr(data-label); display: block; margin-bottom: 2px;
    color: var(--ink-faint); font-size: .72rem; text-transform: uppercase; letter-spacing: .05em;
  }
  td.nowrap { white-space: normal; }
  td[data-label=""]::before, td:not([data-label])::before { display: none; }
  .cell-actions { width: 100%; }
  .cell-actions input { flex: 1; }
}

/* ── wider screens ───────────────────────────────────────────────────────── */
@media (min-width: 48rem) {
  body { font-size: 15px; }
  .who { display: block; }
  .card { padding: var(--s5); }
  .field-row { flex-direction: row; align-items: flex-end; flex-wrap: wrap; }
  .field-row > label { flex: 1 1 12rem; }
  .field-row .arrow { display: block; color: var(--ink-faint); padding-bottom: var(--s3); }
  .field-row .btn { flex: 0 0 auto; }
  h1 { font-size: 1.75rem; }
}

@media (min-width: 64rem) {
  /* Sidebar becomes part of the page rather than an overlay. */
  .hamburger { display: none; }
  .backdrop { display: none !important; }
  .sidebar {
    position: sticky; top: var(--topbar); transform: none;
    flex: 0 0 var(--sidebar); width: var(--sidebar);
    height: calc(100vh - var(--topbar));
  }
  main { padding: var(--s6) var(--s5) var(--s7); }
  .cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s5); align-items: start; }
  .cols-2 .card { margin-bottom: 0; }
}
