:root {
  --bg: #f6f3ee;
  --panel: #ffffff;
  --ink: #1d1b19;
  --muted: #6f6a63;
  --line: #e7e1d8;
  --accent: #e2553f;
  --accent-soft: #fbe7e3;
  --ok: #2f8a5b;
  --ok-soft: #e3f3ea;
  --warn: #b7791f;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(29, 27, 25, .05), 0 4px 16px rgba(29, 27, 25, .04);
  font-family: ui-sans-serif, -apple-system, "SF Pro Text", "Segoe UI", Inter, Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141312; --panel: #1c1b19; --ink: #f2eee8; --muted: #a39d94;
    --line: #2d2b28; --accent: #ff6b55; --accent-soft: #3a211c;
    --ok: #57c48a; --ok-soft: #17301f;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.5; }
a { color: inherit; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
h1 { font-size: 26px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px; background: var(--bg); padding: 1px 6px; border-radius: 6px; }

/* layout */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { border-right: 1px solid var(--line); padding: 24px 16px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 24px; font-weight: 650; }
.brand .dot { width: 30px; height: 30px; border-radius: 9px; background: var(--accent); display: grid; place-items: center; color: #fff; font-size: 15px; }
.brand small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; text-decoration: none; color: var(--muted); font-weight: 500; }
.nav a:hover { background: var(--panel); color: var(--ink); }
.nav a.on { background: var(--panel); color: var(--ink); box-shadow: var(--shadow); }
.side .foot { margin-top: auto; padding: 8px; }
main { padding: 32px 40px 64px; max-width: 1180px; width: 100%; }
.head { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }

/* cards */
.grid { display: grid; gap: 16px; }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g2 { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card h2 { margin-bottom: 14px; }
.stat .label { color: var(--muted); font-size: 13px; }
.stat .value { font-size: 24px; font-weight: 650; margin: 4px 0 10px; font-variant-numeric: tabular-nums; }
.bar { height: 6px; background: var(--bg); border-radius: 99px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.pill { white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 99px; background: var(--bg); color: var(--muted); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.ok::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
td, th { text-align: left; padding: 9px 0; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
tr:last-child td { border-bottom: 0; }
td.r, th.r { text-align: right; }

.notes h2 { font-size: 14px; margin: 18px 0 6px; color: var(--accent); }
.notes h2:first-child { margin-top: 0; }
.notes ul { margin: 0; padding-left: 18px; }
.notes li { margin: 3px 0; font-size: 14px; }

/* connections */
.group-title { margin: 28px 0 12px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.apps { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.app { display: flex; flex-direction: column; gap: 12px; }
.app-top { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.app-top .ic { width: 36px; height: 36px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 700; flex: none; }
.app-top .t { display: flex; gap: 12px; align-items: center; }
details summary { cursor: pointer; list-style: none; color: var(--accent); font-weight: 600; font-size: 14px; }
details summary::-webkit-details-marker { display: none; }
details[open] summary { margin-bottom: 12px; }

/* forms */
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
input[type=text], input[type=email], input[type=password], input[type=url] {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--ink); font: inherit; font-size: 14px;
}
input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 10px; padding: 10px 16px; font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; background: var(--ink); color: var(--panel); text-decoration: none; }
.btn.accent { background: var(--accent); color: #fff; }
.btn.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.btn.link { background: none; color: var(--muted); padding: 0; font-weight: 500; text-decoration: underline; }
.row { display: flex; gap: 8px; align-items: center; margin-top: 14px; flex-wrap: wrap; }

.flash { padding: 10px 14px; border-radius: 10px; margin-bottom: 16px; font-size: 14px; font-weight: 500; }
.flash.ok { background: var(--ok-soft); color: var(--ok); }
.flash.error { background: var(--accent-soft); color: var(--accent); }

/* auth pages */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth .card { width: 100%; max-width: 400px; padding: 32px; }
.auth .brand { padding: 0 0 20px; }
.auth h1 { font-size: 22px; margin-bottom: 6px; }
.auth .btn { width: 100%; margin-top: 18px; }

@media (max-width: 960px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g2 { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; align-items: center; border-right: 0; border-bottom: 1px solid var(--line); padding: 12px 16px; overflow-x: auto; }
  .brand { padding: 0 8px 0 0; }
  .brand small { display: none; }
  .nav { display: flex; gap: 4px; }
  .side .foot { margin: 0 0 0 auto; padding: 0; }
  main { padding: 20px 16px 48px; }
  .apps { grid-template-columns: 1fr; }
}
