:root {
  --ink: #111111;
  --bg: #FAFAFA;
  --surface: #FFFFFF;
  --surface-2: #F3F3F3;
  --line: #E4E4E4;
  --muted: #5F5F5F;
  --wordmark-soft: #8a8a8a;
  --accent: #E89CA8;
  --deep: #8E3B47;
  --ok: #1F7A4D;
  --ok-bg: #E6F4EC;
  --warn: #8A5A00;
  --warn-bg: #FFF4DB;
  --bad: #A3263A;
  --bad-bg: #FCE8EC;
  --info-bg: #EEF0F6;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.04);
  --radius: 12px;
  color-scheme: light;
}
/* Dark theme: follows the system unless the theme switch pinned one (html[data-theme], see theme.js). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #F2F2F2; --bg: #0F0F10; --surface: #18181A; --surface-2: #222225; --line: #2E2E32; --muted: #A3A3A8; --wordmark-soft: rgba(255,255,255,.55);
    --deep: #E89CA8; --ok: #6BD49D; --ok-bg: #133524; --warn: #F2C063; --warn-bg: #3A2E10; --bad: #F08A9B; --bad-bg: #3D1820;
    --info-bg: #23252E; --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ink: #F2F2F2; --bg: #0F0F10; --surface: #18181A; --surface-2: #222225; --line: #2E2E32; --muted: #A3A3A8; --wordmark-soft: rgba(255,255,255,.55);
  --deep: #E89CA8; --ok: #6BD49D; --ok-bg: #133524; --warn: #F2C063; --warn-bg: #3A2E10; --bad: #F08A9B; --bad-bg: #3D1820;
  --info-bg: #23252E; --shadow: none; color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: var(--deep); }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
h1 { font-size: 22px; letter-spacing: -.02em; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 18px 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.error { color: var(--bad); }

/* brand */
/* Hestaworks lockup: H mark + wordmark ("hesta" bold, "works" regular) + product label. */
.brand { display: flex; align-items: center; }
.brand-lg { margin-bottom: 18px; }
.lockup { display: inline-flex; align-items: center; gap: 10px; }
.lockup picture, .lockup img { display: block; flex: none; }
.lockup-text { display: flex; flex-direction: column; line-height: 1.15; }
.wordmark { font-size: 18px; letter-spacing: -.02em; font-weight: 400; color: var(--wordmark-soft); }
.wordmark b { font-weight: 700; color: var(--ink); }
.brand-lg .wordmark { font-size: 21px; }
.lockup-product { font-size: 10.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-top: 3px; }
.topbar .lockup-text { flex-direction: row; align-items: baseline; gap: 6px; }
.topbar .lockup-product { margin-top: 0; }

/* sign-in */
.signin { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.signin-card { width: 100%; max-width: 420px; padding: 28px; }
.signin-card label { display: block; font-weight: 600; margin: 16px 0 6px; }

/* layout */
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--surface); border-right: 1px solid var(--line); padding: 20px 14px;
  display: flex; flex-direction: column; gap: 24px; position: sticky; top: 0; height: 100vh;
}
.sidebar .brand { padding: 0 6px; }
/* Account name belongs to the brand block: pull it up against the 24px sidebar gap. */
.account { font-size: 12px; color: var(--muted); padding: 0 6px; margin-top: -14px; word-break: break-word; }
nav { display: flex; flex-direction: column; gap: 2px; }
nav a {
  padding: 8px 10px; border-radius: 8px; color: var(--ink); text-decoration: none; font-weight: 500;
}
nav a:hover { background: var(--surface-2); }
nav a.active { background: var(--ink); color: var(--bg); }
.signout { margin-top: auto; text-align: left; }
.theme-toggle { margin-top: auto; display: flex; align-items: center; gap: 8px; width: 100%; font-weight: 500; text-align: left; }
.theme-toggle + .signout { margin-top: -22px; } /* 2px apart, as in the Feedback dashboard */
.theme-toggle:not([data-next]) { display: none; }
.theme-toggle[data-next="dark"] .icon-sun, .theme-toggle[data-next="light"] .icon-moon { display: none; }
.theme-toggle svg { flex: none; }
.topbar { display: none; }
.view { padding: 28px 32px 64px; max-width: 1100px; width: 100%; outline: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }

@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 20; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .sidebar.open { transform: none; }
  .topbar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 10; }
  .view { padding: 20px 16px 48px; }
}

/* components */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.grid { display: grid; gap: 14px; }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stat .label { font-size: 12px; color: var(--muted); font-weight: 500; }
.stat .value { font-size: 26px; font-weight: 650; letter-spacing: -.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .sub { font-size: 12px; color: var(--muted); }
.meter { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.meter > span { display: block; height: 100%; background: var(--ink); border-radius: 99px; }
.meter > span.hot { background: var(--bad); }

.btn {
  font: inherit; font-weight: 600; border-radius: 8px; padding: 8px 14px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, nav a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn-primary:hover { background: var(--ink); opacity: .88; }
.btn-danger { color: var(--bad); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { padding: 4px 10px; font-size: 12.5px; }
.btn-block { width: 100%; margin-top: 18px; }
.btn[disabled] { opacity: .5; cursor: default; }

input, select, textarea {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; width: 100%;
}
textarea { min-height: 140px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.form-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.form-row > .field { flex: 1 1 200px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.checks { display: flex; gap: 14px; align-items: center; padding: 8px 0; }
.checks label { display: flex; gap: 6px; align-items: center; font-weight: 500; color: var(--ink); }
.checks input { width: auto; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--surface-2); }
.wrap-any { word-break: break-all; }
.empty { padding: 28px; text-align: center; color: var(--muted); }

.badge { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--info-bg); color: var(--ink); white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }

.notice { border-radius: 10px; padding: 12px 14px; background: var(--info-bg); margin-bottom: 14px; }
.notice.warn { background: var(--warn-bg); color: var(--warn); }
.notice.bad { background: var(--bad-bg); color: var(--bad); }

.dns-value { display: flex; gap: 8px; align-items: flex-start; }
.dns-value code { flex: 1; word-break: break-all; background: var(--surface-2); padding: 6px 8px; border-radius: 6px; }
.row-end { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

.modal { border: 1px solid var(--line); border-radius: var(--radius); padding: 0; max-width: 560px; width: calc(100% - 32px); background: var(--surface); color: var(--ink); }
.modal::backdrop { background: rgba(0,0,0,.4); }
.modal-body { padding: 22px; }
.secret-box { display: flex; gap: 8px; margin: 8px 0; }
.secret-box code { flex: 1; word-break: break-all; background: var(--surface-2); padding: 8px; border-radius: 6px; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; z-index: 50; max-width: calc(100% - 32px); }
.toast.bad { background: var(--bad); color: #fff; }

.dns-table td:nth-child(3) { min-width: 230px; width: 30%; }
.dns-table td:nth-child(4) { min-width: 320px; }
