/* DETZEL LEADS — light dashboard theme. Flat colors only. */
:root {
  --bg: #f4f2ee;
  --card: #ffffff;
  --ink: #151515;
  --muted: #6b6a66;
  --faint: #9b9a95;
  --line: #e4e1da;
  --soft: #faf9f6;
  --ok: #1f7a4d;     --ok-bg: #e3f3ea;
  --warn: #9a5b00;   --warn-bg: #fdf0d5;
  --bad: #b42318;    --bad-bg: #fbe4e1;
  --info: #2a5ea8;   --info-bg: #e3edfa;
  --radius: 14px;
  --serif: 'Playfair Display', Georgia, serif;
  --sans: 'Outfit', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'DM Mono', ui-monospace, Menlo, monospace;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--sans); background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
.boot { padding: 4rem; text-align: center; color: var(--muted); }
[hidden] { display: none !important; }

/* ── layout ── */
.app { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.sidebar { background: var(--card); border-right: 1px solid var(--line); padding: 22px 14px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { font-family: var(--serif); font-weight: 900; font-size: 22px; letter-spacing: -0.5px; padding: 4px 10px 22px; }
.brand span { color: var(--faint); font-weight: 700; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 9px; text-decoration: none; color: var(--muted); font-weight: 500; }
.nav a:hover { background: var(--soft); color: var(--ink); }
.nav a.active { background: var(--ink); color: #fff; }
.nav svg { width: 18px; height: 18px; flex: none; }
.nav .count { margin-left: auto; font-family: var(--mono); font-size: 11px; background: var(--bad-bg); color: var(--bad); padding: 1px 7px; border-radius: 99px; }
.sidebar .foot { margin-top: auto; padding: 10px; font-size: 12px; color: var(--faint); }
.sidebar .foot button { margin-top: 8px; }
.main { padding: 26px 34px 60px; max-width: 1280px; width: 100%; }
.topbar { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.topbar h1 { font-family: var(--serif); font-size: 30px; font-weight: 900; letter-spacing: -0.8px; }
.topbar .spacer { flex: 1; }
.crumb { font-family: var(--mono); font-size: 12px; color: var(--muted); text-decoration: none; display: inline-block; margin-bottom: 6px; }
.crumb:hover { color: var(--ink); }

/* ── banner ── */
.banner { border-radius: 12px; padding: 12px 16px; margin-bottom: 20px; display: flex; gap: 12px; align-items: flex-start; border: 1px solid transparent; }
.banner.warn { background: var(--warn-bg); color: var(--warn); border-color: #f0dcae; }
.banner.bad { background: var(--bad-bg); color: var(--bad); border-color: #f3c3bd; }
.banner strong { font-weight: 600; }
.banner a { font-weight: 600; }
.banner ul { margin: 4px 0 0; padding-left: 18px; }

/* ── cards & grids ── */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card h2 { font-family: var(--serif); font-size: 19px; font-weight: 700; letter-spacing: -0.3px; margin-bottom: 4px; }
.card .sub { color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-head h2 { margin: 0; }
.grid { display: grid; gap: 16px; margin-bottom: 16px; }
.g4 { grid-template-columns: repeat(4, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g2 { grid-template-columns: 1fr 1fr; }
.g21 { grid-template-columns: 1.4fr 1fr; align-items: start; }
.stat .label, .label-mono { font-family: var(--mono); font-size: 11px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); }
.stat .value { font-family: var(--serif); font-weight: 900; font-size: 38px; letter-spacing: -1px; line-height: 1.1; margin: 6px 0 2px; }
.stat .note { font-size: 13px; color: var(--muted); }

/* ── buttons & inputs ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--ink); background: var(--ink); color: #fff; border-radius: 9px; padding: 9px 16px; font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: #2c2c2c; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.secondary { background: var(--card); color: var(--ink); border-color: var(--line); }
.btn.secondary:hover { border-color: var(--ink); background: var(--card); }
.btn.ghost { background: transparent; color: var(--muted); border-color: transparent; }
.btn.ghost:hover { color: var(--ink); background: var(--soft); }
.btn.danger { background: var(--bad); border-color: var(--bad); }
.btn.sm { padding: 5px 11px; font-size: 13px; border-radius: 8px; }
.btn svg { width: 16px; height: 16px; }
input[type=text], input[type=email], input[type=number], input[type=password], input[type=url], input[type=search], select, textarea {
  width: 100%; background: var(--card); border: 1px solid var(--line); border-radius: 9px; padding: 9px 12px; outline: none;
}
textarea { resize: vertical; min-height: 84px; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(21,21,21,.08); }
input[readonly] { background: var(--soft); color: var(--muted); }
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-family: var(--mono); font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
label.field > small { display: block; color: var(--faint); font-size: 12px; margin-top: 5px; }
.check { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--ink); flex: none; }
.check small { display: block; color: var(--muted); font-size: 12.5px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.inline { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.inline > input[type=search] { max-width: 280px; }

/* ── pills & dots ── */
.pill { display: inline-block; font-family: var(--mono); font-size: 11px; letter-spacing: .6px; text-transform: uppercase; padding: 3px 9px; border-radius: 99px; background: var(--soft); color: var(--muted); border: 1px solid var(--line); }
.pill.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.pill.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.pill.bad { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.pill.info { background: var(--info-bg); color: var(--info); border-color: transparent; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--faint); flex: none; }
.dot.ok { background: var(--ok); } .dot.warn { background: #d99100; } .dot.bad { background: var(--bad); } .dot.info { background: var(--info); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--card); border-radius: 99px; padding: 5px 13px; font-size: 13px; cursor: pointer; color: var(--muted); }
.chip:hover { border-color: var(--ink); color: var(--ink); }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ── tables ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-family: var(--mono); font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); font-weight: 500; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--soft); }
td .main-text { font-weight: 500; }
td .sub-text { font-size: 12.5px; color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.trunc { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.empty { text-align: center; padding: 38px 10px; color: var(--muted); }
.empty strong { display: block; font-family: var(--serif); font-size: 18px; color: var(--ink); margin-bottom: 4px; }
.bar { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; margin-top: 6px; width: 110px; }
.bar > i { display: block; height: 100%; background: var(--ink); }
.bar.warn > i { background: #d99100; } .bar.bad > i { background: var(--bad); }

/* ── gauge ── */
.gauges { display: flex; gap: 28px; flex-wrap: wrap; align-items: center; justify-content: space-around; }
.gauge { text-align: center; }
.gauge svg { display: block; margin: 0 auto 8px; }
.gauge .track { fill: none; stroke: var(--line); }
.gauge .progress { fill: none; stroke-linecap: round; transition: stroke-dashoffset 1s cubic-bezier(.2,.8,.2,1); transform: rotate(-90deg); transform-origin: 50% 50%; }
.gauge .big { font-family: var(--serif); font-weight: 900; font-size: 44px; fill: var(--ink); }
.gauge .of { font-family: var(--mono); font-size: 11px; fill: var(--muted); letter-spacing: .5px; }
.gauge .cap { font-family: var(--mono); font-size: 11px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); }
.gauge .progress.ok { stroke: var(--ok); } .gauge .progress.warn { stroke: #d99100; } .gauge .progress.bad { stroke: var(--bad); }

/* ── health list ── */
.health { list-style: none; margin: 0; padding: 0; }
.health li { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); align-items: flex-start; }
.health li:last-child { border-bottom: none; }
.health .dot { margin-top: 7px; }
.health .t { font-weight: 500; }
.health .d { color: var(--muted); font-size: 13px; }

/* ── chart ── */
.chart text { font-family: var(--mono); font-size: 10px; fill: var(--muted); }
.chart .bar-rect { fill: var(--ink); }
.chart .bar-rect:hover { fill: #444; }
.chart .grid-line { stroke: var(--line); }

/* ── recent list ── */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; gap: 12px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.list li:last-child { border-bottom: none; }
.list li:hover .who { text-decoration: underline; }
.list .who { font-weight: 500; }
.list .meta { font-size: 12.5px; color: var(--muted); }
.list .when { margin-left: auto; font-size: 12.5px; color: var(--muted); white-space: nowrap; }

/* ── tabs ── */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 6px 0 18px; }
.tab { background: none; border: none; padding: 10px 16px; cursor: pointer; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--ink); }
.tab.on { color: var(--ink); border-bottom-color: var(--ink); }

/* ── key/value ── */
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 10px 14px; font-size: 14px; }
.kv dt { color: var(--muted); font-family: var(--mono); font-size: 11.5px; letter-spacing: .6px; text-transform: uppercase; padding-top: 3px; }
.kv dd { margin: 0; word-break: break-word; }
.copyline { display: flex; gap: 8px; align-items: center; }
.copyline input { font-family: var(--mono); font-size: 12.5px; }

/* ── code ── */
.code { background: var(--soft); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; font-family: var(--mono); font-size: 12px; line-height: 1.6; white-space: pre; overflow: auto; max-height: 360px; margin: 0; }
.code-head { display: flex; align-items: center; justify-content: space-between; margin: 18px 0 8px; gap: 10px; }
.code-head:first-child { margin-top: 0; }
.code-head h3 { font-family: var(--serif); font-size: 16px; }
.code-head p { color: var(--muted); font-size: 13px; }

/* ── drawer / modal ── */
.overlay { position: fixed; inset: 0; background: rgba(21,21,21,.38); z-index: 50; display: flex; justify-content: flex-end; animation: fade .15s ease; }
.overlay.center { justify-content: center; align-items: center; padding: 20px; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer { background: var(--bg); width: min(780px, 100%); height: 100%; overflow-y: auto; box-shadow: -8px 0 30px rgba(0,0,0,.12); animation: slide .2s ease; display: flex; flex-direction: column; }
.drawer-head { position: sticky; top: 0; background: var(--bg); padding: 20px 26px 14px; border-bottom: 1px solid var(--line); z-index: 2; display: flex; align-items: center; gap: 12px; }
.drawer-head h2 { font-family: var(--serif); font-size: 24px; font-weight: 900; letter-spacing: -.5px; flex: 1; }
.drawer-body { padding: 22px 26px 30px; flex: 1; }
.drawer-foot { position: sticky; bottom: 0; background: var(--bg); border-top: 1px solid var(--line); padding: 14px 26px; display: flex; gap: 10px; justify-content: flex-end; }
.modal { background: var(--card); border-radius: 16px; padding: 24px; width: min(460px, 100%); box-shadow: 0 20px 60px rgba(0,0,0,.2); }
.modal h2 { font-family: var(--serif); font-size: 22px; margin-bottom: 6px; }
.modal p { color: var(--muted); margin-bottom: 16px; font-size: 14px; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }
.section-title { font-family: var(--mono); font-size: 11px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--muted); margin: 26px 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.section-title:first-child { margin-top: 0; }
.errors { background: var(--bad-bg); color: var(--bad); border-radius: 10px; padding: 12px 16px; margin-bottom: 18px; }
.errors ul { margin: 4px 0 0; padding-left: 18px; }

/* ── fields editor ── */
.fe-row { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 10px; }
.fe-main { display: grid; grid-template-columns: 1.3fr 1fr 130px auto; gap: 10px; align-items: end; }
.fe-main label.field { margin: 0; }
.fe-tools { display: flex; gap: 4px; align-items: center; }
.fe-opts { margin-top: 10px; }
.fe-req { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }

/* ── answers ── */
.answers { border: 1px solid var(--line); border-radius: 12px; background: var(--card); overflow: hidden; }
.answer { display: grid; grid-template-columns: 170px 1fr; gap: 14px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.answer:last-child { border-bottom: none; }
.answer .q { font-family: var(--mono); font-size: 11.5px; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); padding-top: 3px; }
.answer .a { white-space: pre-wrap; word-break: break-word; }

/* ── toasts ── */
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 10px; font-size: 14px; max-width: 380px; box-shadow: 0 8px 24px rgba(0,0,0,.2); animation: slide .2s ease; }
.toast.bad { background: var(--bad); } .toast.ok { background: var(--ok); }

/* ── login ── */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login .card { width: min(400px, 100%); padding: 34px; }
.login .brand { padding: 0 0 6px; font-size: 30px; }
.login p { color: var(--muted); margin-bottom: 22px; }
.err-text { color: var(--bad); font-size: 14px; margin: -6px 0 14px; }

.muted { color: var(--muted); }
.right { text-align: right; }
.mt { margin-top: 16px; }
.hint { background: var(--info-bg); color: var(--info); border-radius: 10px; padding: 11px 14px; font-size: 13.5px; margin-bottom: 16px; }
.steps { margin: 6px 0 0; padding-left: 20px; color: var(--muted); font-size: 14px; }
.steps li { margin-bottom: 5px; }

/* ── responsive ── */
@media (max-width: 1050px) { .g4 { grid-template-columns: repeat(2, 1fr); } .g21, .g2, .g3 { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; padding: 10px 12px; gap: 6px; overflow-x: auto; }
  .brand { padding: 0 10px 0 4px; font-size: 18px; }
  .nav { flex-direction: row; }
  .nav a { padding: 8px 11px; }
  .nav a span.lbl { display: none; }
  .sidebar .foot { display: none; }
  .main { padding: 18px 16px 50px; }
  .row2, .row3 { grid-template-columns: 1fr; }
  .fe-main { grid-template-columns: 1fr 1fr; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 10px; }
  .answer { grid-template-columns: 1fr; gap: 2px; }
}
@media (max-width: 560px) { .g4 { grid-template-columns: 1fr; } .drawer-head, .drawer-body, .drawer-foot { padding-left: 16px; padding-right: 16px; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
