:root {
  --bg: #f3eee5;
  --ink: #24251f;
  --muted: #7b7c73;
  --gold: #e8a91c;
  --gold-deep: #c88406;
  --gold-soft: #fff4d4;
  --mint: #1f8f55;
  --mint-soft: #e5f6ec;
  --coral: #c45b52;
  --coral-soft: #fdeceb;
  --amber: #9a6b12;
  --amber-soft: #fff1d6;
  --teal: #3d8d86;
  --line: rgba(65, 61, 50, 0.1);
  --card: #fffdf9;
  --shadow: 0 24px 68px rgba(104, 83, 43, 0.1);
  --radius: 22px;
  --sidebar: 248px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  color: var(--ink);
  font-family: Manrope, "Segoe UI", sans-serif;
  font-size: 14px;
  background:
    radial-gradient(900px 520px at 78% 8%, rgba(232, 169, 28, 0.18), transparent 62%),
    radial-gradient(700px 480px at 8% 90%, rgba(102, 189, 134, 0.12), transparent 60%),
    var(--bg);
}
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
.skip {
  position: absolute; left: 12px; top: -40px; background: var(--ink); color: white; padding: 8px 12px; z-index: 5;
}
.skip:focus { top: 12px; }

.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar);
  flex: none;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  background: rgba(255, 253, 249, 0.92);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(16px);
}
.brand { display: flex; gap: 10px; align-items: center; padding: 6px 8px 16px; }
.brand strong { display: block; font-size: 15px; }
.brand em { display: block; font-style: normal; color: var(--muted); font-size: 12px; }
.mark, .avatar {
  width: 36px; height: 36px; border-radius: 12px;
  display: grid; place-items: center;
  background: var(--gold); color: #3d2a00; font-weight: 800; letter-spacing: -0.04em;
}
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-label { margin: 14px 8px 4px; color: var(--muted); font-size: 11px; letter-spacing: 0.08em; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 12px; color: #3c403a; font-weight: 600;
}
.nav-link.is-active, .nav-link:hover { background: #f6f0e4; }
.nav-ico { width: 22px; display: grid; place-items: center; color: var(--gold-deep); }
.nav-ico svg, .icon-btn svg, .search svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav-count, .icon-btn i {
  margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--coral); color: white; font-size: 11px;
  display: grid; place-items: center; font-style: normal;
}
.logout { margin-top: auto; }
.logout button {
  width: 100%; border: 0; background: transparent; color: var(--muted); text-align: left; padding: 10px; cursor: pointer;
}

.workspace { flex: 1; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; gap: 10px;
  padding: 16px 22px 8px;
}
.search {
  flex: 1; display: flex; align-items: center; gap: 8px; flex-wrap: nowrap;
  background: rgba(255, 253, 249, 0.9); border: 1px solid rgba(255,255,255,.7);
  border-radius: 999px; padding: 0 8px 0 12px; height: 42px;
  box-shadow: 0 10px 30px rgba(104, 83, 43, 0.06);
}
.search input { flex: 1; border: 0; background: transparent; outline: none; min-width: 0; }
.search kbd {
  flex: none; display: inline-flex; align-items: center; margin-left: auto;
  border-radius: 999px; background: #f6f1e6; color: var(--amber); font-size: 12px; padding: 4px 8px; font-weight: 700;
}
.pill, .live {
  border-radius: 999px; background: #f6f1e6; color: var(--amber); font-size: 12px; padding: 4px 8px; font-weight: 700;
}
.icon-btn {
  position: relative; width: 40px; height: 40px; border-radius: 999px; border: 0;
  background: rgba(255,253,249,.9); display: grid; place-items: center; cursor: pointer; color: var(--ink);
}
.icon-btn i { position: absolute; top: -2px; right: -2px; margin: 0; }
.live { display: inline-flex; align-items: center; gap: 6px; color: var(--mint); background: var(--mint-soft); }
.live i { width: 7px; height: 7px; border-radius: 99px; background: var(--mint); display: block; }
.live.tiny { font-weight: 700; }
.nav-toggle { display: none; }
.content { padding: 8px 22px 40px; display: flex; flex-direction: column; gap: 16px; }

.panel {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 18px 16px;
  border: 1px solid rgba(255,255,255,.7);
}
.panel-h { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.panel-h h2 { font-size: 16px; display: flex; align-items: center; gap: 8px; }
.panel-h a, .text-link { margin-left: auto; color: var(--gold-deep); font-weight: 700; font-size: 13px; }
.panel-h .muted { margin: 0; }
.ico {
  width: 28px; height: 28px; border-radius: 10px; display: grid; place-items: center; font-size: 13px;
}
.ico.gold { background: var(--gold-soft); color: var(--gold-deep); }
.ico.mint { background: var(--mint-soft); color: var(--mint); }
.ico.coral { background: var(--coral-soft); color: var(--coral); }
.muted { color: var(--muted); }
.tight { margin: -6px 0 10px; }
.eyebrow { color: var(--muted); font-size: 12px; font-weight: 700; margin-bottom: 4px; }
.page-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-end; }
.page-head h1 { font-size: 30px; letter-spacing: -0.04em; }
.note, .flash {
  background: #fff8e8; border-radius: 14px; padding: 12px 14px; color: #5c4a22; line-height: 1.5;
}
.flash-bad { background: var(--coral-soft); color: #8d3b34; }
.flash-ok { background: var(--mint-soft); color: #14643a; }
.flash-warn { background: var(--amber-soft); color: #7a5410; }

.hero, .split { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 16px; }
.stack, .quad, .cards { display: grid; gap: 16px; }
.quad { grid-template-columns: repeat(4, 1fr); }
.cards { grid-template-columns: repeat(2, 1fr); }
.kpi-line { display: flex; justify-content: space-between; align-items: flex-end; }
.stat-num { font-size: 40px; font-weight: 800; letter-spacing: -0.05em; line-height: 1; }
.stat-num.small { font-size: 18px; letter-spacing: -0.03em; line-height: 1.3; }
.stat-num small { font-size: 18px; color: var(--muted); font-weight: 700; }
.delta { color: var(--mint); font-weight: 700; font-size: 13px; margin-top: 6px; }
.spark { width: 100%; height: 84px; margin: 6px 0 8px; }
.spark polyline { fill: none; stroke: var(--gold); stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mini { border-radius: 16px; padding: 10px 12px; background: #f7f3ea; }
.mini span, .mini em { display: block; color: var(--muted); font-size: 12px; font-style: normal; }
.mini strong { display: block; font-size: 20px; margin: 2px 0; }
.mini.ok { background: var(--mint-soft); }
.mini.bad { background: var(--coral-soft); }
.mini.warn { background: #e7f4f3; }
.metric-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.metric-list li, .bars li, .audit li {
  display: flex; align-items: center; gap: 10px; background: #fbf8f2; border-radius: 14px; padding: 10px 12px;
}
.metric-list b, .chip-ok, .chip-bad { margin-left: auto; background: white; border-radius: 999px; padding: 4px 10px; }
.chip-ok { color: var(--mint); }
.chip-bad { color: var(--coral); }

.orbit {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.orbit-core {
  grid-column: 1 / -1;
  border-radius: 20px;
  display: grid; place-items: center; align-content: center;
  min-height: 112px;
  background:
    radial-gradient(circle at 35% 30%, #fff, #f8e7bc 42%, #f3d48a 78%);
  box-shadow: inset 0 0 0 8px rgba(255,255,255,.35);
}
.orbit-core strong { font-size: 22px; }
.orbit-core span { color: var(--amber); font-size: 12px; font-weight: 700; }
.float {
  background: #fbf8f2;
  border-radius: 16px; padding: 10px 12px;
}
.float b, .float span { display: block; }
.float span { color: var(--muted); font-size: 12px; }
.float.bad { outline: 1px solid rgba(196, 91, 82, 0.35); }
.float b { font-size: 13px; }
.num { white-space: nowrap; font-size: 13px; }

.sheet { display: flex; flex-direction: column; gap: 8px; }
.app-row {
  display: grid; grid-template-columns: 36px minmax(0, 1.5fr) auto auto auto; gap: 8px; align-items: center;
  background: #fbf8f2; border-radius: 16px; padding: 8px 10px;
}
.app-ico {
  width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center;
  background: var(--gold-soft); color: var(--gold-deep); font-weight: 800;
}
.app-row small { display: block; color: var(--muted); }
.num { font-weight: 800; }
.status {
  justify-self: end; border-radius: 999px; padding: 3px 8px; font-size: 12px; font-weight: 800;
  background: #f3efe6; color: var(--muted); white-space: nowrap;
}
.status.ok { background: var(--mint-soft); color: var(--mint); }
.status.bad { background: var(--coral-soft); color: var(--coral); }
.status.warn { background: var(--amber-soft); color: var(--amber); }
.status.info { background: #e5f3f2; color: var(--teal); }
.add-link {
  display: block; margin-top: 10px; text-align: center; border: 1px dashed #ead9b0;
  border-radius: 14px; padding: 12px; color: var(--gold-deep); font-weight: 800;
}
.issues { display: flex; flex-direction: column; gap: 8px; }
.issues.page { display: grid; gap: 10px; }
.issue { position: relative; border-radius: 16px; padding: 12px 12px 28px; background: #fbf8f2; }
.issue h3 { font-size: 14px; }
.issue p { color: var(--muted); font-size: 13px; margin-top: 4px; }
.issue .status { position: absolute; right: 10px; bottom: 8px; }
.issue time { position: absolute; left: 12px; bottom: 10px; color: var(--muted); font-size: 12px; }
.issue.bad { background: #fff6f5; }
.issue.warn { background: #fff8ee; }
.issue.ok { background: #f3fbf6; }
.issue.info { background: #f4fbfa; }

.quad .kpi { min-height: 148px; position: relative; overflow: hidden; }
.cols { display: flex; align-items: flex-end; gap: 4px; height: 64px; margin-top: 12px; }
.cols i {
  flex: 1; display: block; border-radius: 5px 5px 2px 2px;
  background: linear-gradient(#f0b4a4, #e8a91c 40%, #7dce9a);
}
.cols.cool i { background: linear-gradient(#9eb6e6, #7dce9a); }
.bars { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.bars b { flex: 1; height: 10px; background: #f3eee4; border-radius: 99px; overflow: hidden; }
.bars i { display: block; height: 100%; background: linear-gradient(90deg, #e8a91c, #66bd86); border-radius: 99px; }
.bars em { width: 140px; text-align: right; font-style: normal; color: var(--muted); font-size: 12px; }
.bars.tall em { width: 180px; }
.health { display: grid; grid-template-columns: 140px 1fr; gap: 12px; align-items: center; }
.rings { width: 132px; height: 132px; transform: rotate(-90deg); }
.rings .track { fill: none; stroke: #f1ebe1; stroke-width: 7; }
.rings .value { fill: none; stroke-width: 7; stroke-linecap: round; }
.rings .v0 { stroke: #e8a91c; }
.rings .v1 { stroke: #62aaa3; }
.rings .v2 { stroke: #7d8adf; }
.rings .v3 { stroke: #66bd86; }
.health ul { list-style: none; padding: 0; margin: 0; }
.health li { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--line); }
.good { color: var(--mint); }
.warn-text { color: var(--amber); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--muted); font-weight: 700; padding: 8px; white-space: nowrap; }
td { padding: 10px 8px; border-top: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
td a { font-weight: 800; }
.actions { display: flex; flex-wrap: nowrap; gap: 4px; }
.actions form { margin: 0; }
.text-btn, .btn {
  border-radius: 999px; border: 0; cursor: pointer; font-weight: 800;
}
.text-btn { background: #f6f1e6; color: var(--gold-deep); padding: 4px 8px; }
.btn { padding: 10px 16px; }
.btn-gold { background: var(--gold); color: #3d2a00; }
.btn-ghost { background: #f6f1e6; color: var(--ink); }
.tenant-card .domain { font-size: 18px; font-weight: 800; letter-spacing: -0.03em; margin-bottom: 10px; }
.meta { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.meta li { display: flex; justify-content: space-between; gap: 12px; }
.meta span { color: var(--muted); }
.meta.plain { margin-bottom: 12px; }
.form-grid, .panel form.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.panel form.account-create { grid-template-columns: repeat(3, minmax(0, 1fr)); }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 700; font-size: 13px; }
input, textarea {
  border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 10px 12px; font-weight: 500;
}
textarea { min-height: 420px; font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; line-height: 1.45; }
label.block { display: flex; flex-direction: column; gap: 8px; }
.form-actions { grid-column: 1 / -1; display: flex; gap: 8px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-end; margin: 0; }
.inline-form input { min-width: 9rem; }
td.stack { white-space: normal; }
.errors { margin: 0 0 8px; color: var(--coral); }
pre {
  margin: 0; white-space: pre-wrap; word-break: break-word;
  font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; line-height: 1.45;
}
.prose h2 { margin: 0 0 8px; font-size: 18px; }
.prose p, .prose li { line-height: 1.6; }
.prose ul, .prose ol { margin: 8px 0 0; padding-left: 18px; }
.prose li + li, .prose p + p, .prose p + ol, .prose p + ul { margin-top: 8px; }
.prose code { background: #f6f1e6; border-radius: 6px; padding: 1px 5px; }
.audit { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.audit em { margin-left: auto; color: var(--muted); font-style: normal; font-size: 12px; }
.toast {
  position: fixed; bottom: 16px; right: 16px; background: var(--ink); color: white;
  padding: 12px 14px; border-radius: 14px; max-width: 320px; z-index: 6;
}

.login-body { display: grid; place-items: center; }
.login-card {
  width: min(440px, calc(100% - 32px)); background: var(--card); border-radius: 28px;
  box-shadow: var(--shadow); padding: 28px; display: flex; flex-direction: column; gap: 12px;
}
.login-card h1 { font-size: 28px; letter-spacing: -0.04em; }
.login-card form { display: flex; flex-direction: column; gap: 12px; }
.login-card .mark { width: 48px; height: 48px; border-radius: 16px; }

@media (max-width: 1100px) {
  .quad, .hero, .split, .cards, .form-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 800px) {
  .nav-toggle { display: grid; }
  .sidebar {
    position: fixed; z-index: 4; transform: translateX(-105%); transition: transform .2s ease;
  }
  body.nav-open .sidebar { transform: none; }
  .quad, .hero, .split, .cards, .form-grid, .panel form.account-create, .health { grid-template-columns: 1fr; }
  .page-head, .topbar { align-items: stretch; flex-wrap: wrap; }
  .orbit { grid-template-columns: 1fr; }
  .content { padding-inline: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .sidebar { transition: none; }
}
