[hidden] { display: none !important; }
:root {
  --paper: #f6f4ef;
  --card: #ffffff;
  --ink: #1d2433;
  --muted: #5d6676;
  --line: #e2ded4;
  --accent: #0f5c63;
  --accent-ink: #ffffff;
  --accent-soft: #e3efef;
  --warn: #9a3412;
  --warn-soft: #fdeee6;
  --ok: #166534;
  --ok-soft: #e7f4ea;
  --radius: 10px;
  --serif: "Source Serif 4", Georgia, serif;
  --sans: "IBM Plex Sans", system-ui, -apple-system, Segoe UI, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.55 var(--sans); }
a { color: var(--accent); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: clamp(1.7rem, 3.5vw, 2.4rem); letter-spacing: -.01em; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; }
code, .mono { font-family: var(--mono); font-size: .9em; }
pre { font-family: var(--mono); font-size: 13px; background: #18202c; color: #e6e9ef; padding: 14px 16px; border-radius: 8px; overflow-x: auto; line-height: 1.5; margin: 0; }

/* header */
.topbar { background: var(--ink); color: #fff; }
.topbar .wrap { display: flex; align-items: center; gap: 24px; min-height: 58px; flex-wrap: wrap; }
.brand { color: #fff; text-decoration: none; font-family: var(--serif); font-size: 1.15rem; font-weight: 600; display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 28px; height: 28px; border-radius: 6px; background: var(--accent); display: grid; place-items: center; font-family: var(--mono); font-size: 13px; }
.nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.nav a { color: #c9cfda; text-decoration: none; padding: 7px 12px; border-radius: 6px; font-size: 14px; }
.nav a:hover { color: #fff; background: rgba(255,255,255,.08); }
.nav a.active { color: #fff; background: rgba(255,255,255,.14); }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 28px; padding-bottom: 60px; }
.footer { border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; padding: 18px 0 30px; }

/* hero */
.hero { padding: 26px 0 18px; }
.hero p { color: var(--muted); max-width: 680px; margin: 0; font-size: 16px; }

/* cards & grid */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card + .card { margin-top: 16px; }
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.stat .label { color: var(--muted); font-size: 13px; }
.stat .value { font-family: var(--serif); font-size: 1.9rem; font-weight: 600; margin-top: 2px; }
.stat .sub { color: var(--muted); font-size: 12px; }

/* forms */
label { display: block; font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 5px; }
input[type=text], input[type=search], input[type=password], input[type=number], input[type=email], input[type=tel], input[type=url], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: #fff; border: 1px solid #cfcabd; border-radius: 8px; padding: 9px 11px; min-height: 40px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.filters { display: grid; grid-template-columns: 2.2fr 1.6fr .8fr .8fr auto; gap: 12px; align-items: end; }
@media (max-width: 820px) { .filters { grid-template-columns: 1fr 1fr; } .filters .f-q { grid-column: 1 / -1; } }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 500; font-size: 14px; border: 1px solid transparent; background: var(--accent); color: var(--accent-ink); padding: 9px 16px; border-radius: 8px; cursor: pointer; text-decoration: none; min-height: 40px; white-space: nowrap; }
.btn:hover { filter: brightness(1.08); }
.btn.secondary { background: #fff; color: var(--ink); border-color: #cfcabd; }
.btn.danger { background: #fff; color: var(--warn); border-color: #e7c3b1; }
.btn.small { padding: 5px 10px; min-height: 30px; font-size: 13px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }

/* table */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #faf9f5; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th button { all: unset; cursor: pointer; }
th button:hover { color: var(--ink); }
td { padding: 10px 14px; border-bottom: 1px solid #efece5; vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfaf7; }
td.num { font-family: var(--mono); font-size: 13px; }
.empty { padding: 40px 14px; text-align: center; color: var(--muted); }

.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 18px 0 10px; flex-wrap: wrap; color: var(--muted); font-size: 14px; }
.pager { display: flex; gap: 6px; align-items: center; }

/* bits */
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 500; background: var(--accent-soft); color: var(--accent); }
.pill.off { background: #eee; color: #777; }
.pill.s2 { background: var(--ok-soft); color: var(--ok); }
.pill.s4 { background: var(--warn-soft); color: var(--warn); }
.alert { padding: 12px 14px; border-radius: 8px; margin-bottom: 16px; border: 1px solid; }
.alert.ok { background: var(--ok-soft); border-color: #bfe0c7; color: var(--ok); }
.alert.err { background: var(--warn-soft); border-color: #f1c8b3; color: var(--warn); }
.keybox { font-family: var(--mono); background: #fffbe8; border: 1px dashed #d8c36a; padding: 12px; border-radius: 8px; word-break: break-all; }
.muted { color: var(--muted); }
.bar { height: 8px; background: var(--accent-soft); border-radius: 4px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); }
.spark { display: flex; align-items: flex-end; gap: 3px; height: 120px; padding-top: 8px; }
.spark div { flex: 1; background: var(--accent); border-radius: 3px 3px 0 0; min-height: 2px; position: relative; }
.spark div:hover { background: #0b444a; }
.spark-axis { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; margin-top: 6px; }

/* docs */
.endpoint { border-top: 1px solid var(--line); padding-top: 20px; margin-top: 24px; }
.method { font-family: var(--mono); font-size: 12px; font-weight: 600; background: var(--ok-soft); color: var(--ok); padding: 3px 8px; border-radius: 5px; margin-right: 8px; }
.path { font-family: var(--mono); font-weight: 600; }
.params td:first-child { font-family: var(--mono); font-size: 13px; white-space: nowrap; }
.docs-layout { display: grid; grid-template-columns: 200px 1fr; gap: 32px; }
.docs-nav { position: sticky; top: 16px; align-self: start; font-size: 14px; }
.docs-nav a { display: block; padding: 4px 0; text-decoration: none; color: var(--muted); }
.docs-nav a:hover { color: var(--accent); }
@media (max-width: 820px) { .docs-layout { grid-template-columns: 1fr; } .docs-nav { position: static; } }

dialog { border: 1px solid var(--line); border-radius: 12px; padding: 22px; width: min(520px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(20,25,35,.45); }
.detail dt { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-top: 12px; }
.detail dd { margin: 2px 0 0; font-size: 16px; }
.login { max-width: 380px; margin: 60px auto; }
.grid > .card + .card { margin-top: 0; }
@media (max-width: 820px) { .filters > .row { grid-column: 1 / -1; } .filters > .row .btn { flex: 1; } }
.docs-layout > div { min-width: 0; }

/* import: tabs, drop zone, progress */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: -4px 0 16px; flex-wrap: wrap; }
.tab { all: unset; cursor: pointer; padding: 9px 14px; font-weight: 500; font-size: 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 30px 16px; border: 2px dashed #cfcabd; border-radius: 10px; background: #fbfaf7; cursor: pointer; text-align: center; margin: 0; color: var(--ink); }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop.has-file { border-style: solid; border-color: var(--accent); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.drop-title { font-weight: 600; font-size: 16px; word-break: break-all; }
.progress { position: relative; height: 18px; background: var(--accent-soft); border-radius: 9px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--accent); border-radius: 9px; transition: width .25s ease; }
.progress.paused .progress-fill { background: #8a9aa0; }
.progress.indeterminate .progress-fill { width: 30% !important; animation: slide 1.1s ease-in-out infinite; }
@keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(340%); } }
@media (prefers-reduced-motion: reduce) { .progress-fill { transition: none; } .progress.indeterminate .progress-fill { animation: none; width: 100% !important; opacity: .5; } }
.err-list { font-size: 13px; max-height: 180px; overflow-y: auto; margin: 8px 0 0; color: var(--warn); }
details summary { cursor: pointer; font-size: 14px; color: var(--warn); }
