/* SlowProvider admin — restrained, system-font, mobile-first. */
:root {
  --bg: #f5f6f8; --surface: #ffffff; --border: #e3e6ea; --text: #1d2128; --muted: #6b7280;
  --accent: #1f5eff; --accent-hover: #174bd1; --danger: #c62828; --warn: #b26a00; --ok: #1b7f3b; --info: #2156a5;
  --radius: 8px; --shadow: 0 1px 2px rgba(16, 24, 40, .06);
  --sidenav-w: 220px; --topbar-h: 52px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; }
code { background: #eef0f3; padding: 1px 5px; border-radius: 4px; }
table code { white-space: nowrap; }
code.wrap, .keybox code, .flash code { white-space: normal; overflow-wrap: anywhere; }
.flash, .dl dd, .plain-list li, .help, .field-error { overflow-wrap: anywhere; min-width: 0; }
pre { background: #f0f2f5; padding: 8px; border-radius: 6px; overflow: auto; max-width: 70vw; white-space: pre-wrap; margin: 4px 0 0; font-size: 12px; }
h1 { font-size: 22px; margin: 0; font-weight: 650; }
h2 { font-size: 15px; margin: 0 0 12px; font-weight: 650; }
h2.mt { margin-top: 24px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); } .small { font-size: 13px; } .nowrap { white-space: nowrap; }
.ok-text { color: var(--ok); } .error-text { color: var(--danger); }
.skip { position: absolute; left: -9999px; } .skip:focus { left: 8px; top: 8px; background: #fff; padding: 8px; z-index: 100; }

/* layout */
.topbar { position: fixed; top: 0; left: 0; right: 0; height: var(--topbar-h); background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 12px; gap: 10px; z-index: 50; }
.brand { font-weight: 700; color: var(--text); letter-spacing: .2px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.topbar-user { color: var(--muted); font-size: 14px; }
.nav-toggle { display: inline-flex; flex-direction: column; justify-content: center; gap: 4px; width: 36px; height: 36px; border: 1px solid var(--border); background: #fff; border-radius: 6px; padding: 0 8px; cursor: pointer; }
.nav-toggle span { display: block; height: 2px; background: var(--text); border-radius: 2px; }
.shell { display: flex; padding-top: var(--topbar-h); min-height: 100vh; }
.sidenav { position: fixed; top: var(--topbar-h); bottom: 0; left: 0; width: var(--sidenav-w); background: var(--surface); border-right: 1px solid var(--border); overflow-y: auto; transform: translateX(-100%); transition: transform .18s ease; z-index: 40; }
.sidenav.open { transform: none; box-shadow: 0 0 0 100vw rgba(0,0,0,.25); }
.sidenav ul { list-style: none; margin: 0; padding: 10px 8px; }
.sidenav a { display: block; padding: 9px 12px; border-radius: 6px; color: var(--text); font-size: 14px; }
.sidenav a:hover { background: #f0f3f8; text-decoration: none; }
.sidenav a.active { background: #e8efff; color: var(--accent-hover); font-weight: 600; }
.main { flex: 1; padding: 18px 16px 60px; max-width: 1280px; width: 100%; margin: 0 auto; min-width: 0; }
@media (min-width: 900px) {
  .nav-toggle { display: none; }
  .sidenav { transform: none; box-shadow: none; }
  .shell { padding-left: var(--sidenav-w); }
  .main { padding: 24px 28px 60px; }
}

/* page */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 16px; min-width: 0; }
.card-highlight { border-color: #f4c87a; background: #fff9ec; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.card-head h2 { margin: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 1000px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.empty { color: var(--muted); padding: 12px 0; margin: 0; }
.plain-list { list-style: none; margin: 0 0 12px; padding: 0; }
.plain-list li { padding: 8px 0; border-top: 1px solid var(--border); }
.plain-list li:first-child { border-top: 0; }
.dl { display: grid; grid-template-columns: 1fr; gap: 2px 16px; margin: 0 0 12px; }
.dl dt { color: var(--muted); font-size: 13px; } .dl dd { margin: 0 0 8px; }
@media (min-width: 700px) {
  .dl { grid-template-columns: minmax(120px, max-content) 1fr; gap: 6px 16px; }
  .dl dt { font-size: inherit; } .dl dd { margin: 0; }
}
.table-plain td { overflow-wrap: anywhere; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }
@media (min-width: 700px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.stat-warn { border-color: #f1c27a; background: #fff8ea; }
.stat-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.stat-value { font-size: 26px; font-weight: 650; line-height: 1.2; margin: 4px 0 2px; }
.stat-value-sm { font-size: 18px; }
.stat-sub { font-size: 12px; color: var(--muted); }

/* tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .3px; white-space: nowrap; }
tbody tr:hover { background: #fafbfc; }
.table-plain th { text-transform: none; font-size: 14px; color: var(--text); width: 1%; white-space: nowrap; }
.table-log td { font-size: 13px; }
.actions-cell { white-space: nowrap; } .actions-cell form { display: inline-block; margin-right: 4px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 4px; }
.actions form { margin: 0; }

/* badges */
.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; line-height: 1.5; }
.badge-ok { background: #e3f5e8; color: var(--ok); } .badge-info { background: #e5edfb; color: var(--info); }
.badge-warn { background: #fff1d6; color: var(--warn); } .badge-danger { background: #fde4e4; color: var(--danger); }
.badge-muted { background: #eceff3; color: #4b5563; } .badge-done { background: #ececf4; color: #4c4c8a; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.dot-ok { background: var(--ok); } .dot-warn { background: #e0a100; } .dot-error { background: var(--danger); }

/* forms */
label { display: block; font-size: 13px; font-weight: 600; margin: 12px 0 4px; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
input[type=text], input[type=password], input[type=number], input[type=url], input[type=email], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid #cfd4db; border-radius: 6px; font: inherit; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid #9fb8ff; outline-offset: 1px; }
input[type=file] { margin: 4px 0; }
textarea { min-height: 120px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
.input-sm { max-width: 180px; }
.help { font-size: 13px; color: var(--muted); margin: 4px 0 0; }
.field-error { color: var(--danger); font-size: 13px; margin: 4px 0 0; }
.row-2 { display: grid; grid-template-columns: 1fr; gap: 0 16px; }
@media (min-width: 600px) { .row-2 { grid-template-columns: 1fr 1fr; } }
.setting { padding: 10px 0; border-top: 1px solid var(--border); }
.setting:first-of-type { border-top: 0; }
.setting label { margin-top: 0; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.filters select { width: auto; }
.inline { display: inline; }
.mb { margin-bottom: 14px; }

/* buttons */
.btn { display: inline-block; padding: 8px 14px; border-radius: 6px; border: 1px solid #cfd4db; background: #fff; color: var(--text); font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; line-height: 1.3; min-height: 38px; }
.btn:hover { background: #f3f5f8; text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger { color: var(--danger); border-color: #f0b4b4; }
.btn-danger:hover { background: #fdecec; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-sm { padding: 5px 10px; font-size: 13px; min-height: 32px; }
.btn-block { display: block; width: 100%; margin-top: 18px; }
form .btn-primary { margin-top: 16px; }
.sticky-actions { position: sticky; bottom: 0; background: linear-gradient(to top, var(--bg) 70%, transparent); padding: 14px 0 6px; }
.sticky-actions .btn { margin-top: 0; }

/* flashes */
.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; border: 1px solid; font-size: 14px; }
.flash-success { background: #e9f7ee; border-color: #b7e2c4; color: #1b5e2f; }
.flash-error { background: #fdecec; border-color: #f2b8b8; color: #8f1d1d; }
.flash-warn { background: #fff5e0; border-color: #f2d59b; color: #6d4700; }
.flash-info { background: #eaf1fd; border-color: #bfd3f5; color: #1e3f73; }

/* key display */
.keybox { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 8px 0; }
.keybox code { font-size: 14px; padding: 8px 10px; background: #fff; border: 1px solid #e5d4ad; border-radius: 6px; user-select: all; }

/* pagination */
.pagination { display: flex; gap: 16px; align-items: center; justify-content: center; padding: 12px 0 0; font-size: 14px; color: var(--muted); }

/* auth */
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 16px; }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); width: 100%; max-width: 380px; padding: 28px 24px; }
.auth-title { font-size: 22px; margin: 0 0 2px; }

details summary { cursor: pointer; color: var(--accent); font-size: 13px; }

/* rendered markdown (API docs) */
.md { line-height: 1.55; max-width: 920px; }
.md .md-h1 { font-size: 22px; margin: 0 0 12px; }
.md .md-h2 { font-size: 17px; margin: 26px 0 8px; padding-top: 14px; border-top: 1px solid var(--border); }
.md .md-h3 { font-size: 15px; margin: 18px 0 6px; }
.md p { margin: 0 0 10px; }
.md .md-list { margin: 0 0 10px 20px; padding: 0; }
.md .md-list li { margin: 3px 0; }
.md .md-code { max-width: none; font-size: 13px; padding: 10px 12px; margin: 6px 0 12px; white-space: pre; overflow: auto; }
.md .md-table { margin: 6px 0 12px; }
.md .md-table th { text-transform: none; font-size: 13px; }
.md .md-table td { font-size: 13.5px; }
.md code { white-space: normal; }
