/* MIPL Hub — "Peacock & Marigold" theme */

/* ---------- Fonts (bundled, no CDN) ---------- */
@font-face { font-family: 'Bricolage'; font-style: normal; font-display: swap; font-weight: 200 800; font-stretch: 75% 100%;
  src: url(../fonts/bricolage-grotesque-latin-standard-normal.woff2) format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Bricolage'; font-style: normal; font-display: swap; font-weight: 200 800; font-stretch: 75% 100%;
  src: url(../fonts/bricolage-grotesque-latin-ext-standard-normal.woff2) format('woff2-variations');
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Hind'; font-weight: 400; font-display: swap; src: url(../fonts/hind-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+2212; }
@font-face { font-family: 'Hind'; font-weight: 500; font-display: swap; src: url(../fonts/hind-latin-500-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+2212; }
@font-face { font-family: 'Hind'; font-weight: 600; font-display: swap; src: url(../fonts/hind-latin-600-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+2212; }
@font-face { font-family: 'Hind'; font-weight: 700; font-display: swap; src: url(../fonts/hind-latin-700-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+2212; }
@font-face { font-family: 'Hind'; font-weight: 400; font-display: swap; src: url(../fonts/hind-latin-ext-400-normal.woff2) format('woff2'); unicode-range: U+0100-02AF, U+20A0-20C0, U+2113; }
@font-face { font-family: 'Hind'; font-weight: 500; font-display: swap; src: url(../fonts/hind-latin-ext-500-normal.woff2) format('woff2'); unicode-range: U+0100-02AF, U+20A0-20C0, U+2113; }
@font-face { font-family: 'Hind'; font-weight: 600; font-display: swap; src: url(../fonts/hind-latin-ext-600-normal.woff2) format('woff2'); unicode-range: U+0100-02AF, U+20A0-20C0, U+2113; }
@font-face { font-family: 'Hind'; font-weight: 700; font-display: swap; src: url(../fonts/hind-latin-ext-700-normal.woff2) format('woff2'); unicode-range: U+0100-02AF, U+20A0-20C0, U+2113; }
@font-face { font-family: 'JB Mono'; font-weight: 400; font-display: swap; src: url(../fonts/jetbrains-mono-latin-400-normal.woff2) format('woff2'); }

/* ---------- Tokens ---------- */
:root, [data-theme="dark"] {
  --bg: #0C2329;
  --side: #0A1E23;
  --surface: #11313A;
  --surface-2: #163E48;
  --surface-3: #1C4A55;
  --line: #22505B;
  --line-soft: rgba(141, 200, 190, .12);
  --text: #E6F2EF;
  --muted: #8DB0AB;
  --faint: #5E8580;
  --marigold: #F4A62A;
  --marigold-text: #F7B445;
  --marigold-ink: #2B1800;
  --marigold-soft: rgba(244, 166, 42, .14);
  --teal: #33C7AE;
  --teal-soft: rgba(51, 199, 174, .14);
  --ruby: #F2555E;
  --ruby-soft: rgba(242, 85, 94, .14);
  --sky: #6DB8FF;
  --sky-soft: rgba(109, 184, 255, .14);
  --shadow: 0 18px 40px -18px rgba(0, 0, 0, .55);
  --focus: 0 0 0 3px rgba(244, 166, 42, .45);
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #EEF4F2;
  --side: #0C2329;
  --surface: #FFFFFF;
  --surface-2: #F4F8F7;
  --surface-3: #E7F0EE;
  --line: #D2E1DE;
  --line-soft: rgba(12, 35, 41, .07);
  --text: #0C2329;
  --muted: #4F716C;
  --faint: #7D9A96;
  --marigold-text: #A86304;
  --marigold-soft: rgba(244, 166, 42, .18);
  --teal: #0F8F7B;
  --teal-soft: rgba(15, 143, 123, .12);
  --ruby: #D33A44;
  --ruby-soft: rgba(211, 58, 68, .1);
  --sky: #1F74C9;
  --sky-soft: rgba(31, 116, 201, .1);
  --shadow: 0 18px 40px -22px rgba(12, 35, 41, .35);
  color-scheme: light;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 15px/1.55 'Hind', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: 'Bricolage', 'Hind', system-ui, sans-serif; font-weight: 640; line-height: 1.15; margin: 0; letter-spacing: -.01em; }
h1 { font-size: 30px; font-weight: 700; letter-spacing: -.02em; overflow-wrap: anywhere; }
h2 { font-size: 20px; }
h3 { font-size: 16.5px; }
p { margin: 0 0 .6em; }
a { color: var(--marigold-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
code, .mono, pre { font-family: 'JB Mono', ui-monospace, Consolas, monospace; font-size: .86em; font-variant-ligatures: none; font-feature-settings: 'liga' 0, 'calt' 0; }
code { background: var(--surface-2); border: 1px solid var(--line-soft); padding: .1em .4em; border-radius: 6px; }
img { max-width: 100%; }
.ic { width: 18px; height: 18px; flex: none; }
.ic.big { width: 40px; height: 40px; stroke-width: 1.3; color: var(--faint); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--marigold); color: var(--marigold-ink); padding: 8px 14px; border-radius: 8px; }
.skip:focus { left: 8px; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 8px; }
.pad { padding: 16px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.ok-t { color: var(--teal); } .bad-t { color: var(--ruby); } .warn-t { color: var(--marigold-text); }
hr { border: 0; border-top: 1px solid var(--line-soft); margin: 18px 0; }
::selection { background: var(--marigold); color: var(--marigold-ink); }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 268px minmax(0, 1fr); min-height: 100vh; background: linear-gradient(to right, var(--side) 268px, transparent 268px); }
.side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--side); color: #DCEDEA;
  border-right: 1px solid rgba(141, 200, 190, .1); padding: 18px 14px 28px; scrollbar-width: thin;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 14px; }
.brand strong { display: block; font-family: 'Bricolage', sans-serif; font-size: 18px; font-weight: 700; letter-spacing: -.01em; color: #fff; }
.brand span { font-size: 12.5px; color: #7FA39E; }
.icon-btn.side-close { display: none; margin-left: auto; color: #DCEDEA; }
.nav-group { margin-top: 10px; }
.nav-head { font-size: 12px; color: #6E928D; margin: 0 0 4px 12px; font-weight: 500; }
.nav-link {
  position: relative; display: flex; align-items: center; gap: 11px; padding: 7px 12px; border-radius: 10px;
  color: #BFD6D2; font-size: 14.5px; transition: background .15s, color .15s;
}
.nav-link:hover { background: rgba(141, 200, 190, .08); color: #fff; text-decoration: none; }
.nav-link .ic { color: #7FA39E; transition: color .15s; }
.nav-link.on { background: linear-gradient(90deg, rgba(244, 166, 42, .16), rgba(244, 166, 42, .03)); color: #fff; }
.nav-link.on .ic { color: var(--marigold); }
.nav-link.on::before { content: ''; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--marigold); }
.nav-link .count { margin-left: auto; min-width: 22px; padding: 0 7px; height: 20px; border-radius: 999px; font-size: 12px; line-height: 20px; text-align: center; background: var(--marigold); color: var(--marigold-ink); font-weight: 600; }
.nav-link .count.bad { background: var(--ruby); color: #fff; }
.side-scrim { display: none; }

.main-col { min-width: 0; display: flex; flex-direction: column; }
.top {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px; padding: 12px 32px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
}
.icon-btn.menu-btn { display: none; }
.site-switch { position: relative; display: flex; align-items: center; }
.site-switch select { padding-left: 32px; min-width: 200px; font-weight: 500; }
.switch-dot { position: absolute; left: 13px; width: 10px; height: 10px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 25%, transparent); pointer-events: none; }
.top-search { position: relative; flex: 1; max-width: 520px; }
.top-search .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.top-search input { width: 100%; padding-left: 38px; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.icon-btn {
  position: relative; display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; border: 0;
  background: transparent; color: var(--muted); cursor: pointer; transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
[data-theme="dark"] .i-moon, :root:not([data-theme="light"]) .i-moon { display: none; }
[data-theme="light"] .i-sun { display: none; }
[data-theme="light"] .i-moon { display: block; }
.dot-count { position: absolute; top: 4px; right: 3px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--ruby); color: #fff; font-size: 11px; line-height: 18px; font-weight: 600; }
.avatar { width: 38px; height: 38px; border-radius: 50%; border: 0; cursor: pointer; background: linear-gradient(140deg, var(--marigold), #E7703A); color: var(--marigold-ink); font: 700 16px 'Bricolage', sans-serif; }
.content { padding: 28px 32px 72px; width: 100%; max-width: 1500px; }
.content:focus { outline: none; }

/* ---------- Popovers ---------- */
.pop-wrap { position: relative; }
.pop {
  position: absolute; right: 0; top: calc(100% + 8px); width: 380px; max-width: calc(100vw - 24px); z-index: 40;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden;
  animation: pop-in .16s ease-out;
}
.pop.small { width: 230px; }
@keyframes pop-in { from { opacity: 0; transform: translateY(-6px) scale(.98); } }
.pop-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); }
.pop-head.col { flex-direction: column; align-items: flex-start; gap: 0; }
.pop-list { max-height: 380px; overflow-y: auto; }
.pop-item { display: flex; gap: 10px; align-items: center; padding: 10px 16px; color: var(--text); }
.pop-item:hover { background: var(--surface-2); text-decoration: none; }
.pop-foot { display: block; padding: 11px 16px; text-align: center; border-top: 1px solid var(--line-soft); font-weight: 500; }
.notif { display: grid; grid-template-columns: 10px 1fr; gap: 10px; padding: 11px 16px; color: var(--text); border-bottom: 1px solid var(--line-soft); }
.notif:hover { background: var(--surface-2); text-decoration: none; }
.notif i { width: 8px; height: 8px; margin-top: 7px; border-radius: 50%; background: var(--c, var(--faint)); }
.notif.unread { background: color-mix(in srgb, var(--marigold) 5%, transparent); }
.notif b { display: block; font-weight: 600; font-size: 14px; overflow-wrap: anywhere; }
.notif small { color: var(--muted); font-size: 12.5px; }
.link-btn { background: none; border: 0; color: var(--marigold-text); cursor: pointer; font: inherit; font-size: 13.5px; padding: 0; }

/* ---------- Page head ---------- */
.page-head > div:first-child { min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head p { margin: 6px 0 0; max-width: 70ch; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font: 500 14.5px 'Hind', sans-serif;
  cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, transform .08s;
}
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--marigold); border-color: var(--marigold); color: var(--marigold-ink); font-weight: 600; }
.btn.primary:hover { background: #FFB540; }
.btn.ok { background: var(--teal); border-color: var(--teal); color: #032019; font-weight: 600; }
.btn.danger { background: transparent; border-color: color-mix(in srgb, var(--ruby) 50%, transparent); color: var(--ruby); }
.btn.danger:hover { background: var(--ruby-soft); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.sm { height: 32px; padding: 0 11px; font-size: 13.5px; border-radius: 8px; }
.btn.sm .ic { width: 16px; height: 16px; }
.btn.lg { height: 46px; padding: 0 22px; font-size: 15.5px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px;
  height: 40px; padding: 0 12px; min-width: 0; transition: border-color .15s, box-shadow .15s;
}
textarea { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.5; }
select { padding-right: 32px; appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238DB0AB' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--line) 50%, var(--muted)); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--marigold); box-shadow: var(--focus); }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; padding: 0; accent-color: var(--marigold); cursor: pointer; }
input[type="color"] { padding: 4px; width: 56px; cursor: pointer; }
input::placeholder, textarea::placeholder { color: var(--faint); }
.form { display: grid; gap: 14px; }
.form label, label.field { display: grid; gap: 6px; font-size: 13.5px; color: var(--muted); font-weight: 500; }
.form label > input, .form label > select, .form label > textarea { color: var(--text); font-size: 15px; font-weight: 400; }
.form .check, label.check { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: 14.5px; font-weight: 400; }
.hint { font-size: 12.5px; color: var(--faint); font-weight: 400; }
fieldset { border: 1px solid var(--line-soft); border-radius: 14px; padding: 16px 18px 18px; margin: 0; }
legend { padding: 0 8px; font-family: 'Bricolage', sans-serif; font-weight: 600; color: var(--text); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.span-2 { grid-column: span 2; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.filters input[type="search"] { min-width: 320px; }
.filters input[type="date"] { width: 160px; }

/* ---------- Panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--line-soft); border-radius: 16px; min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line-soft); }
.panel-head h2 { font-size: 17px; }
.panel-head .sub { font-size: 13px; color: var(--muted); }
.panel-body { padding: 18px 20px; }
.panel + .panel { margin-top: 20px; }
.cols { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); margin-top: 20px; }
.cols.wide-left { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }
.cols.wide-right { grid-template-columns: minmax(0, 1fr) minmax(0, 1.65fr); }
.cols.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols:first-child { margin-top: 0; }
.cols > * { min-width: 0; }
.cols > .panel { align-self: start; }
.cols > .panel + .panel, .cols > * + .panel { margin-top: 0; }
.stack > * + * { margin-top: 20px; }

/* ---------- Stats row (not cards: one ruled band) ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); background: var(--surface); border: 1px solid var(--line-soft); border-radius: 16px; overflow: hidden; }
.stat { padding: 16px 20px; border-right: 1px solid var(--line-soft); min-width: 0; }
.stat:last-child { border-right: 0; }
.stat .lbl { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.stat .num { font-family: 'Bricolage', sans-serif; font-size: 26px; font-weight: 650; letter-spacing: -.02em; margin-top: 2px; font-stretch: 92%; }
.stat .delta { font-size: 12.5px; }
.stat .delta.up { color: var(--teal); } .stat .delta.down { color: var(--ruby); }

/* ---------- Site pulse strip (dashboard signature) ---------- */
.pulse { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(236px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 20px; scroll-snap-type: x proximity; scrollbar-width: thin; }
.ptile {
  position: relative; scroll-snap-align: start; padding: 14px 16px 12px; border-radius: 16px; background: var(--surface);
  border: 1px solid var(--line-soft); color: var(--text); overflow: hidden; display: grid; gap: 6px;
}
.ptile:hover { text-decoration: none; border-color: color-mix(in srgb, var(--c) 55%, transparent); }
.ptile::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--c); }
.ptile-top { display: flex; align-items: center; gap: 8px; }
.ptile-top strong { font-family: 'Bricolage', sans-serif; font-weight: 650; font-size: 15.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ptile-top .badge { margin-left: auto; }
.ptile .host { font-size: 12.5px; color: var(--faint); margin-top: -4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.beat { width: 100%; height: 38px; display: block; }
.beat path { fill: none; stroke: var(--c); stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.beat .area { stroke: none; fill: color-mix(in srgb, var(--c) 14%, transparent); }
.ptile.down .beat path { stroke: var(--ruby); }
.ptile.down .beat .area { display: none; }
.beat .blip { fill: var(--c); }
.ptile.down .beat .blip { fill: var(--ruby); }
.ptile-meta { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.ptile-meta b { color: var(--text); font-weight: 600; }
.live { display: inline-flex; align-items: center; gap: 6px; }
.live::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 0 var(--teal); animation: live 2s infinite; }
@keyframes live { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--teal) 60%, transparent); } 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.pulse-add { display: grid; place-items: center; gap: 4px; text-align: center; border: 1.5px dashed var(--line); border-radius: 16px; color: var(--muted); padding: 14px; min-height: 140px; }
.pulse-add:hover { border-color: var(--marigold); color: var(--marigold-text); text-decoration: none; }

/* draw-in on first paint */
.beat .line { stroke-dasharray: 600; stroke-dashoffset: 600; animation: draw 1.4s cubic-bezier(.4, 0, .2, 1) forwards; animation-delay: calc(var(--i, 0) * 90ms); }
.beat .area { opacity: 0; animation: fade .6s ease forwards; animation-delay: calc(var(--i, 0) * 90ms + .9s); }
.beat .blip { opacity: 0; animation: fade .3s ease forwards, blip 2.4s ease-in-out infinite; animation-delay: calc(var(--i, 0) * 90ms + 1.3s), calc(var(--i, 0) * 90ms + 1.6s); transform-box: fill-box; transform-origin: center; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fade { to { opacity: 1; } }
@keyframes blip { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.7); } }

/* ---------- Needs-action list ---------- */
.todo { list-style: none; margin: 0; padding: 6px; }
.todo a { display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; color: var(--text); }
.todo a:hover { background: var(--surface-2); text-decoration: none; }
.todo .tic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--marigold-soft); color: var(--marigold-text); }
.todo .tic.bad { background: var(--ruby-soft); color: var(--ruby); }
.todo .tic.info { background: var(--sky-soft); color: var(--sky); }
.todo .tic.ok { background: var(--teal-soft); color: var(--teal); }
.todo b { font-weight: 600; display: block; }
.todo small { color: var(--muted); }
.todo .n { font-family: 'Bricolage', sans-serif; font-size: 22px; font-weight: 650; }
.todo .n.zero { color: var(--faint); font-weight: 500; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.tbl th { text-align: left; font-weight: 500; font-size: 13px; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; background: var(--surface); position: sticky; top: 0; }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; overflow-wrap: anywhere; }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .amt { font-weight: 600; white-space: nowrap; text-align: right; }
.tbl th.amt { text-align: right; }
.tbl .sub { display: block; font-size: 12.5px; color: var(--muted); }
.tbl .actions { white-space: nowrap; text-align: right; }
.tbl .actions form { display: inline; }
.tbl.compact td { padding: 8px 14px; }
.tbl a.rowlink { color: var(--text); font-weight: 500; }
.panel > .table-wrap .tbl th:first-child, .panel > .table-wrap .tbl td:first-child { padding-left: 20px; }
.panel > .table-wrap .tbl th:last-child, .panel > .table-wrap .tbl td:last-child { padding-right: 20px; }

/* ---------- Chips & badges ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding: 2px 10px 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text); white-space: nowrap; border: 1px solid var(--line-soft); }
.chip.site i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.chip.muted { color: var(--muted); }
.badge { display: inline-block; font-size: 12.5px; font-weight: 600; padding: 2px 9px; border-radius: 6px; white-space: nowrap; }
.badge.ok { background: var(--teal-soft); color: var(--teal); }
.badge.warn { background: var(--marigold-soft); color: var(--marigold-text); }
.badge.bad { background: var(--ruby-soft); color: var(--ruby); }
.badge.info { background: var(--sky-soft); color: var(--sky); }
.badge.mute { background: var(--surface-2); color: var(--muted); }
.stars { color: var(--marigold); letter-spacing: 1px; white-space: nowrap; }
.stars .off { color: var(--line); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 16px; padding: 4px; background: var(--surface); border: 1px solid var(--line-soft); border-radius: 12px; width: fit-content; max-width: 100%; }
.tab { padding: 6px 14px; border-radius: 9px; color: var(--muted); font-weight: 500; font-size: 14px; white-space: nowrap; }
.tab:hover { color: var(--text); text-decoration: none; background: var(--surface-2); }
.tab.on { background: var(--surface-3); color: var(--text); box-shadow: inset 0 -2px 0 var(--marigold); }
.tab b { font-weight: 600; color: var(--marigold-text); margin-left: 4px; }

/* ---------- Alerts, toasts, empty ---------- */
.alert { padding: 12px 14px; border-radius: 12px; font-size: 14.5px; border: 1px solid; margin-bottom: 14px; }
.alert.bad { background: var(--ruby-soft); border-color: color-mix(in srgb, var(--ruby) 35%, transparent); color: var(--ruby); }
.alert.warn { background: var(--marigold-soft); border-color: color-mix(in srgb, var(--marigold) 35%, transparent); color: var(--marigold-text); }
.alert.ok { background: var(--teal-soft); border-color: color-mix(in srgb, var(--teal) 35%, transparent); color: var(--teal); }
.alert.info { background: var(--sky-soft); border-color: color-mix(in srgb, var(--sky) 30%, transparent); color: var(--text); }
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 80; display: grid; gap: 10px; width: min(380px, calc(100vw - 40px)); }
.toast {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--surface);
  border: 1px solid var(--line); box-shadow: var(--shadow); font-size: 14.5px; animation: toast-in .35s cubic-bezier(.2, .9, .3, 1.2);
}
.toast .ic { color: var(--teal); margin-top: 2px; }
.toast.bad .ic { color: var(--ruby); }
.toast.info .ic { color: var(--marigold); }
.toast.out { animation: toast-out .3s ease forwards; }
.toast a { color: var(--text); font-weight: 600; }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px) scale(.97); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(30px); } }
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty h2, .empty h3 { color: var(--text); margin: 12px 0 6px; }
.empty p { max-width: 46ch; margin: 0 auto 14px; }

/* ---------- Pager ---------- */
.pager { display: flex; align-items: center; gap: 4px; padding: 14px 20px; flex-wrap: wrap; border-top: 1px solid var(--line-soft); }
.pager-info { margin-right: auto; font-size: 13px; color: var(--muted); }
.pg { min-width: 34px; height: 32px; padding: 0 10px; display: inline-grid; place-items: center; border-radius: 8px; color: var(--text); font-size: 13.5px; }
.pg:hover { background: var(--surface-2); text-decoration: none; }
.pg.cur { background: var(--marigold); color: var(--marigold-ink); font-weight: 600; }
.pg.dis { color: var(--faint); }

/* ---------- Modal ---------- */
dialog.modal { width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 40px); border: 1px solid var(--line); border-radius: 18px; padding: 0; background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
dialog.modal.wide { width: min(820px, calc(100vw - 24px)); }
dialog.modal[open] { animation: modal-in .2s cubic-bezier(.2, .9, .3, 1.1); }
dialog.modal::backdrop { background: rgba(4, 14, 17, .62); backdrop-filter: blur(3px); }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.97); } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line-soft); }
.modal-body { padding: 18px 20px 20px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding-top: 6px; }

/* ---------- Conversation ---------- */
.conv { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.thread { display: flex; flex-direction: column; gap: 12px; padding: 20px; max-height: 62vh; overflow-y: auto; }
.msg { overflow-wrap: anywhere; max-width: 76%; padding: 10px 14px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--line-soft); white-space: pre-wrap; word-wrap: break-word; }
.msg.out { align-self: flex-end; background: var(--marigold-soft); border-color: color-mix(in srgb, var(--marigold) 25%, transparent); border-bottom-right-radius: 4px; }
.msg.in { border-bottom-left-radius: 4px; }
.msg.note { align-self: center; max-width: 90%; background: transparent; border-style: dashed; color: var(--muted); font-size: 14px; }
.msg time { display: block; font-size: 11.5px; color: var(--faint); margin-top: 4px; white-space: normal; }
.composer { padding: 14px 20px 18px; border-top: 1px solid var(--line-soft); display: grid; gap: 10px; }
.composer textarea { width: 100%; min-height: 90px; }
.suggests { display: flex; gap: 6px; flex-wrap: wrap; }
.suggest { border: 1px solid var(--line); background: var(--surface-2); color: var(--text); border-radius: 999px; padding: 5px 12px; font: inherit; font-size: 13px; cursor: pointer; text-align: left; max-width: 100%; }
.suggest:hover { border-color: var(--marigold); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; font-size: 14px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; word-break: break-word; }
.inbox-row.unread td:first-child { box-shadow: inset 3px 0 0 var(--marigold); }
.inbox-row.unread .rowlink { font-weight: 700; }

/* ---------- Key box / code ---------- */
.keybox { min-width: 0; display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 6px 6px 6px 14px; }
.keybox code { background: none; border: 0; padding: 0; font-size: 14px; flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
.field { min-width: 0; }
pre.code { font-variant-ligatures: none; font-feature-settings: 'liga' 0, 'calt' 0; margin: 0; padding: 16px 18px; background: #071519; color: #CFE6E1; border-radius: 12px; overflow-x: auto; font: 13px/1.6 'JB Mono', ui-monospace, Consolas, monospace; border: 1px solid rgba(141, 200, 190, .14); position: relative; }
[data-theme="light"] pre.code { background: #0C2329; }
pre.code .c { color: #6E928D; } pre.code .s { color: #F7B445; } pre.code .k { color: #6DD3C1; }
.code-wrap { position: relative; }
.code-wrap .copy-btn { position: absolute; top: 8px; right: 8px; }
.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.steps > li { counter-increment: s; display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 12px; }
.steps > li::before { content: counter(s); width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--marigold-soft); color: var(--marigold-text); font-weight: 700; font-size: 14px; }
.conn-state { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); }
.conn-state .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--faint); }
.conn-state.on .dot { background: var(--teal); box-shadow: 0 0 0 4px var(--teal-soft); }

/* ---------- Misc ---------- */
.meter { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--c, var(--marigold)); border-radius: 99px; transition: width .8s cubic-bezier(.4, 0, .2, 1); }
.bar-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.bar-list li { display: grid; gap: 5px; }
.bar-list .row { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; }
.bar-list .row span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed { list-style: none; margin: 0; padding: 6px 0; }
.feed li { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 12px; padding: 9px 20px; align-items: baseline; }
.feed li i { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--faint)); transform: translateY(-1px); }
.feed li small { color: var(--faint); white-space: nowrap; font-size: 12.5px; }
.feed li span { font-size: 14px; min-width: 0; overflow-wrap: anywhere; }
.feed li.new { animation: feed-in .6s ease; }
@keyframes feed-in { from { background: var(--marigold-soft); } }
.chart-box { position: relative; height: 290px; }
.chart-box.sm { height: 220px; }
.color-pick { display: flex; gap: 8px; flex-wrap: wrap; }
.color-pick label { cursor: pointer; }
.color-pick input { position: absolute; opacity: 0; width: 0; height: 0; }
.color-pick span { display: block; width: 30px; height: 30px; border-radius: 50%; background: var(--c); border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--line); transition: transform .12s; }
.color-pick input:checked + span { box-shadow: 0 0 0 2px var(--text); transform: scale(1.08); }
.color-pick input:focus-visible + span { box-shadow: var(--focus); }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px 16px; }
.doc-thumb { display: block; width: 72px; height: 52px; border-radius: 8px; object-fit: cover; border: 1px solid var(--line); background: var(--surface-2); }
.section-title { font-size: 15px; margin: 22px 0 10px; color: var(--muted); font-weight: 600; font-family: 'Hind', sans-serif; }
.big-num { font-family: 'Bricolage', sans-serif; font-weight: 700; font-size: 34px; letter-spacing: -.02em; font-stretch: 90%; }
.split { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---------- Auth screens ---------- */
.auth-body { min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(244, 166, 42, .16), transparent 60%),
    radial-gradient(700px 520px at -10% 110%, rgba(51, 199, 174, .14), transparent 60%),
    var(--bg); }
.auth-card { width: min(430px, 100%); background: var(--surface); border: 1px solid var(--line-soft); border-radius: 22px; padding: 30px 30px 32px; box-shadow: var(--shadow); }
.auth-card.wide { width: min(720px, 100%); }
.auth-card h1 { font-size: 28px; margin-bottom: 6px; }
.auth-card .form { margin-top: 18px; }
.auth-brand { display: flex; gap: 12px; align-items: center; margin-bottom: 26px; }
.auth-brand strong { display: block; font: 700 18px 'Bricolage', sans-serif; }
.auth-brand span { font-size: 13px; color: var(--muted); }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  .cols.three { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .conv { grid-template-columns: 1fr; }
}
@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; background: none; }
  .side { position: fixed; z-index: 60; left: 0; top: 0; width: 284px; transform: translateX(-100%); transition: transform .25s ease; }
  body.side-open .side { transform: none; box-shadow: var(--shadow); }
  body.side-open .side-scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(4, 14, 17, .55); }
  .icon-btn.side-close, .icon-btn.menu-btn { display: inline-grid; }
  .top { padding: 10px 16px; gap: 8px; flex-wrap: wrap; }
  .top-search { order: 5; flex-basis: 100%; max-width: none; }
  .site-switch select { min-width: 0; max-width: 42vw; }
  .top-actions { gap: 2px; }
  .content { padding: 20px 16px 64px; }
  .cols, .cols.wide-left, .cols.wide-right, .cols.three { grid-template-columns: 1fr; }
  h1 { font-size: 25px; }
}
@media (max-width: 640px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat { border-bottom: 1px solid var(--line-soft); }
  .stat:nth-child(2n) { border-right: 0; }
  .pulse { grid-auto-columns: 78%; }
  .filters input[type="search"] { min-width: 0; flex: 1 1 100%; }
  .msg { max-width: 92%; }
  .auth-card { padding: 24px 20px; }
  .page-head { align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; animation-delay: 0s !important; }
  .beat .line { stroke-dashoffset: 0; }
}
@media print {
  .side, .top, .toasts, .head-actions, .filters { display: none !important; }
  .shell { display: block; }
  body { background: #fff; color: #000; }
}

/* ---------- Connect type picker ---------- */
[hidden] { display: none !important; }
.mode-pick { padding: 12px 14px 14px; }
.form label.mode-card { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; background: var(--surface-2); transition: border-color .15s, box-shadow .15s; }
.mode-card input { margin-top: 3px; flex: none; }
.mode-card b { display: block; color: var(--text); font-size: 15px; font-weight: 600; }
.mode-card small { display: block; color: var(--muted); font-weight: 400; font-size: 13px; line-height: 1.45; margin-top: 2px; }
.mode-card:has(input:checked) { border-color: var(--marigold); box-shadow: inset 0 0 0 1px var(--marigold); }
.quick { display: grid; grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); gap: 10px; margin: 0 0 20px; }
.quick a { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line-soft); color: var(--text); }
.quick a:hover { text-decoration: none; border-color: color-mix(in srgb, var(--c, var(--marigold)) 55%, transparent); }
.quick a .ic { color: var(--c, var(--marigold)); }
.quick a b { display: block; font-family: 'Bricolage', sans-serif; font-size: 19px; font-weight: 650; line-height: 1.1; }
.quick a small { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.quick a > span:not(.w) { min-width: 0; }
.quick a .w { margin-left: auto; white-space: nowrap; align-self: flex-start; font-size: 12px; font-weight: 600; color: var(--marigold-text); background: var(--marigold-soft); padding: 1px 8px; border-radius: 6px; }
.site-hero { display: flex; gap: 16px; align-items: center; }
.site-hero .mark { width: 52px; height: 52px; border-radius: 15px; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 18%, transparent); color: var(--c); font: 700 22px 'Bricolage', sans-serif; flex: none; border: 1px solid color-mix(in srgb, var(--c) 35%, transparent); }
.sync-mods { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-top: 12px; }
.sync-mods div { background: var(--surface-2); border-radius: 10px; padding: 8px 12px; font-size: 13px; color: var(--muted); }
.sync-mods b { display: block; color: var(--text); font-size: 15px; }
