/* PDS Pro design system — tokens + components. Light/dark follows the OS.
   Shares its accent with the bskypds.pro funnel so the two read as one
   product. No framework; everything the templates use is defined here. */

:root {
  --accent: #1d65ff;
  --accent-strong: #1450d4;
  --accent-soft: #1d65ff1a;
  --ok: #148a4e;
  --ok-soft: #148a4e1f;
  --warn: #b0790a;
  --warn-soft: #b0790a1f;
  --danger: #c62f3f;
  --danger-soft: #c62f3f1a;

  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #eef0f4;
  --fg: #191c21;
  --fg-muted: #667085;
  --border: #e0e3e9;
  --shadow: 0 1px 2px #10182812, 0 1px 3px #1018280f;

  --radius: 8px;
  --radius-lg: 12px;
  --sidebar-w: 232px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101318;
    --surface: #171b22;
    --surface-2: #1f242e;
    --fg: #e6e9ee;
    --fg-muted: #8b94a5;
    --border: #2a303c;
    --shadow: 0 1px 2px #00000040;
    --accent-soft: #1d65ff2b;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 15px/1.55 var(--font);
  background: var(--bg);
  color: var(--fg);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .75rem; }
h2 { font-size: 1.35rem; font-weight: 650; }
h3 { font-size: 1.05rem; font-weight: 650; }
code, pre { font-family: var(--mono); font-size: .86em; }
code { background: var(--surface-2); padding: .1em .35em; border-radius: 4px; word-break: break-all; }
pre {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .75rem 1rem; overflow-x: auto;
}
.muted { color: var(--fg-muted); }
.small { font-size: .85rem; }

/* ---- app shell ---------------------------------------------------------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar {
  background: var(--surface); border-right: 1px solid var(--border);
  padding: 1rem .85rem; display: flex; flex-direction: column; gap: 1rem;
}
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 700; font-size: 1.05rem; color: var(--fg); }
.brand:hover { text-decoration: none; }
.brand img { width: 26px; height: 26px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: .5rem;
  padding: .45rem .6rem; border-radius: var(--radius);
  color: var(--fg); font-weight: 480;
}
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav .nav-label {
  margin: .6rem .6rem .15rem; font-size: .72rem; font-weight: 650;
  letter-spacing: .06em; text-transform: uppercase; color: var(--fg-muted);
}
.sidebar-foot { margin-top: auto; font-size: .78rem; color: var(--fg-muted); padding: 0 .6rem; }

.switcher select {
  width: 100%; padding: .45rem .6rem; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--fg); font: inherit;
}

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: flex-end; gap: .9rem;
  padding: .65rem 1.5rem; border-bottom: 1px solid var(--border); background: var(--surface);
}
.content { padding: 1.5rem; max-width: 1160px; width: 100%; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--border); }
  .content { padding: 1rem; }
}

/* ---- minimal chrome (login / claim) ------------------------------------- */
.solo { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.solo-card { width: 100%; max-width: 26rem; }
.solo-brand { display: flex; align-items: center; justify-content: center; gap: .55rem; font-weight: 700; font-size: 1.15rem; margin-bottom: 1.25rem; }
.solo-brand img { width: 30px; height: 30px; }

/* ---- components --------------------------------------------------------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
  padding: 1.1rem 1.25rem; margin-bottom: 1rem;
}
.card.danger-zone { border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.card h3 { margin-top: 0; }

.grid { display: grid; gap: 1rem; }
.grid.cols { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .45rem .9rem; border-radius: var(--radius);
  border: 1px solid transparent; background: var(--accent); color: #fff;
  font: inherit; font-weight: 570; cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--accent-strong); text-decoration: none; }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: color-mix(in srgb, var(--danger) 85%, #000); }
.btn.ghost { background: transparent; color: var(--fg); border-color: var(--border); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { padding: .22rem .6rem; font-size: .84rem; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

.badge {
  display: inline-block; padding: .12rem .55rem; border-radius: 999px;
  font-size: .76rem; font-weight: 620; white-space: nowrap;
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.neutral { background: var(--surface-2); color: var(--fg-muted); }

table.tbl { border-collapse: collapse; width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; display: table; box-shadow: var(--shadow); }
.tbl th, .tbl td { text-align: left; padding: .55rem .8rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl thead th { background: var(--surface-2); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--fg-muted); border-bottom: 1px solid var(--border); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: color-mix(in srgb, var(--accent) 3%, transparent); }
.tbl .actions { text-align: right; white-space: nowrap; }
.tbl .actions form { display: inline; margin-left: .3rem; }
.tbl-wrap { overflow-x: auto; }

.kv { border-collapse: collapse; width: 100%; }
.kv th { text-align: left; color: var(--fg-muted); font-weight: 550; padding: .35rem 1.2rem .35rem 0; white-space: nowrap; vertical-align: top; }
.kv td { padding: .35rem 0; word-break: break-word; }

.field { display: block; margin: .7rem 0; }
.field > span { display: block; font-size: .84rem; font-weight: 580; margin-bottom: .25rem; }
.field .hint { font-weight: 400; color: var(--fg-muted); }
input[type=text], input[type=email], input[type=number], input:not([type]), select {
  width: 100%; padding: .5rem .65rem; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface); color: var(--fg);
  font: inherit;
}
input:focus-visible, select:focus-visible, .btn:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
.check { display: flex; align-items: center; gap: .45rem; margin: .7rem 0; }

.toolbar { display: flex; gap: .7rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.toolbar .spacer { flex: 1; }
.toolbar input[type=search] { max-width: 320px; padding: .45rem .65rem; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); color: var(--fg); font: inherit; }

.stat { display: flex; flex-direction: column; gap: .1rem; }
.stat .n { font-size: 1.5rem; font-weight: 700; }
.stat .l { font-size: .78rem; color: var(--fg-muted); text-transform: uppercase; letter-spacing: .05em; }
.stat-row { display: flex; gap: 1.75rem; flex-wrap: wrap; }

.empty {
  text-align: center; color: var(--fg-muted); padding: 2.5rem 1rem;
  background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius-lg);
}

.toast {
  display: flex; align-items: baseline; gap: .6rem;
  border-radius: var(--radius); padding: .6rem .9rem; margin-bottom: 1rem;
  border: 1px solid; font-weight: 500;
}
.toast.notice { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.toast.alert { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.toast button { margin-left: auto; background: none; border: 0; color: inherit; font: inherit; cursor: pointer; opacity: .7; }

dialog.confirm {
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--surface); color: var(--fg); box-shadow: var(--shadow);
  padding: 1.25rem 1.4rem; max-width: 26rem;
}
dialog.confirm::backdrop { background: #0008; }
dialog.confirm .dlg-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1rem; }

.pager { display: flex; gap: .5rem; align-items: center; margin-top: 1rem; color: var(--fg-muted); font-size: .88rem; }
.secret {
  font-family: var(--mono); font-size: 1.02rem; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius); padding: .7rem .9rem;
  word-break: break-all; user-select: all;
}
.backlink { display: inline-block; margin-bottom: .8rem; color: var(--fg-muted); font-size: .88rem; }
.page-head { display: flex; align-items: baseline; gap: .8rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head h2 { margin: 0; }
.htmx-indicator { opacity: 0; transition: opacity .15s; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }
