/* ReHost panel - design system (from styleguide.html: dark, Roboto, one rust-red accent) */

@font-face { font-family: "Roboto"; font-weight: 400; font-display: swap; src: url("../fonts/roboto-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Roboto"; font-weight: 500; font-display: swap; src: url("../fonts/roboto-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Roboto"; font-weight: 700; font-display: swap; src: url("../fonts/roboto-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Roboto Mono"; font-weight: 400; font-display: swap; src: url("../fonts/roboto-mono-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Roboto Mono"; font-weight: 700; font-display: swap; src: url("../fonts/roboto-mono-latin-700-normal.woff2") format("woff2"); }

:root {
    --rh-base: #111317;
    --rh-panel: #171a1f;
    --rh-card: #1c2027;
    --rh-raised: #232831;
    --rh-line: #2a2f39;
    --rh-line-strong: #363c48;
    --rh-ink: #e7e9ee;
    --rh-ink-muted: #9aa1ad;
    --rh-ink-faint: #6b7280;
    --rh-white: #fff;
    --rh-accent: #e5483b;
    --rh-accent-hover: #f05a4d;
    --rh-accent-soft: rgba(229, 72, 59, .12);
    --rh-ok: #22c55e;
    --rh-warn: #f59e0b;
    --rh-info: #3b82f6;
    --rh-danger: #ef4444;
    --rh-radius: 8px;
    --rh-radius-lg: 12px;
    --rh-font: "Roboto", system-ui, -apple-system, "Segoe UI", sans-serif;
    --rh-mono: "Roboto Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
    --rh-sidebar: 248px;
    --rh-shadow: 0 10px 30px rgba(0, 0, 0, .35);
    color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--rh-base);
    color: var(--rh-ink);
    font: 14px/1.5 var(--rh-font);
    -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; color: var(--rh-white); line-height: 1.25; }
h1 { font-size: 24px; font-weight: 700; }
h2 { font-size: 20px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 600; }
p { margin: 0; }
a { color: var(--rh-accent); text-decoration: none; }
a:hover { color: var(--rh-accent-hover); }
code, kbd, .rh-mono { font-family: var(--rh-mono); font-size: .92em; }
:focus-visible { outline: 2px solid var(--rh-accent); outline-offset: 2px; }
::selection { background: rgba(229, 72, 59, .35); color: #fff; }

.rh-icon { width: 16px; height: 16px; flex-shrink: 0; }
.rh-muted { color: var(--rh-ink-muted); }
.rh-faint { color: var(--rh-ink-faint); }
.rh-white { color: var(--rh-white); }
.rh-num { font-family: var(--rh-mono); font-variant-numeric: tabular-nums; }
.rh-small { font-size: 12px; }
.rh-eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--rh-ink-faint); }
.rh-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.rh-grow { flex: 1; min-width: 200px; }
.rh-break { overflow-wrap: anywhere; word-break: break-all; }
.rh-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* ---------- layout helpers */
.rh-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.rh-row-tight { gap: 6px; }
.rh-stack { display: grid; gap: 16px; }
.rh-stack-sm { display: grid; gap: 8px; }
.rh-grid-2 { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.rh-grid-3 { display: grid; gap: 16px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.rh-grid-4 { display: grid; gap: 16px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.rh-span-2 { grid-column: span 2; }
.rh-ml-auto { margin-left: auto; }
.rh-mt { margin-top: 16px; }
.rh-mt-sm { margin-top: 8px; }
.rh-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---------- app shell */
.rh-shell { display: grid; grid-template-columns: var(--rh-sidebar) minmax(0, 1fr); min-height: 100vh; }
.rh-sidebar {
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
    display: flex; flex-direction: column;
    background: var(--rh-panel);
    border-right: 1px solid var(--rh-line);
}
.rh-brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 16px; color: var(--rh-white); }
.rh-brand:hover { color: var(--rh-white); }
.rh-brand img { width: 34px; height: 34px; }
.rh-brand-name { display: block; font-size: 17px; font-weight: 800; letter-spacing: -.01em; line-height: 1.1; }
.rh-brand-sub { display: block; font-size: 11px; color: var(--rh-ink-faint); text-transform: uppercase; letter-spacing: .1em; }
.rh-nav { display: grid; gap: 2px; padding: 4px 10px; }
.rh-nav-label { padding: 16px 10px 6px; }
.rh-nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px; border-radius: var(--rh-radius);
    color: var(--rh-ink-muted); font-weight: 500;
    transition: background .12s, color .12s;
}
.rh-nav a:hover { background: var(--rh-raised); color: var(--rh-ink); }
.rh-nav a[aria-current="page"] { background: var(--rh-accent-soft); color: var(--rh-white); box-shadow: inset 2px 0 0 var(--rh-accent); }
.rh-nav a[aria-current="page"] .rh-icon { color: var(--rh-accent); }
.rh-nav .rh-count { margin-left: auto; font: 500 11px var(--rh-mono); color: var(--rh-ink-faint); }
/* site switcher in the sidebar: scales to many sites */
.rh-site-switch { position: relative; margin: 0 10px 6px; }
.rh-site-switch summary {
    display: flex; align-items: center; gap: 8px; list-style: none; cursor: pointer;
    height: 38px; padding: 0 10px; border-radius: var(--rh-radius);
    background: var(--rh-card); border: 1px solid var(--rh-line-strong);
    color: var(--rh-white); font-weight: 600;
}
.rh-site-switch summary::-webkit-details-marker { display: none; }
.rh-site-switch summary > .rh-icon:first-child { width: 15px; height: 15px; color: var(--rh-accent); }
.rh-site-switch summary > .rh-icon:last-child { margin-left: auto; color: var(--rh-ink-faint); transition: transform .15s; }
.rh-site-switch[open] summary > .rh-icon:last-child { transform: rotate(180deg); }
.rh-site-switch summary:hover { border-color: var(--rh-ink-faint); }
.rh-site-switch-pop {
    position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px);
    padding: 8px; border-radius: var(--rh-radius);
    background: var(--rh-raised); border: 1px solid var(--rh-line-strong); box-shadow: var(--rh-shadow);
}
.rh-site-switch-pop .rh-input { height: 32px; font-size: 13px; }
.rh-site-switch-pop ul { list-style: none; margin: 6px 0 0; padding: 0; max-height: 300px; overflow-y: auto; scrollbar-width: thin; }
.rh-site-switch-pop li[hidden] { display: none; }
.rh-site-switch-pop a { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; color: var(--rh-ink-muted); font-size: 13px; }
.rh-site-switch-pop a .rh-icon { width: 13px; height: 13px; color: var(--rh-ink-faint); }
.rh-site-switch-pop a:hover, .rh-site-switch-pop a.is-active { background: var(--rh-accent-soft); color: var(--rh-white); }
.rh-site-switch-pop a[aria-current] { color: var(--rh-white); font-weight: 500; }
.rh-site-switch-pop p { padding: 6px 8px; }
.rh-sidebar-foot { margin-top: auto; padding: 14px 18px; border-top: 1px solid var(--rh-line); font-size: 12px; color: var(--rh-ink-faint); }

.rh-scrim { display: none; }
.rh-main { min-width: 0; display: flex; flex-direction: column; }
.rh-topbar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; gap: 12px;
    height: 56px; padding: 0 24px;
    background: rgba(17, 19, 23, .86);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--rh-line);
}
.rh-crumbs { display: flex; align-items: center; gap: 6px; min-width: 0; color: var(--rh-ink-faint); font-size: 13px; }
.rh-crumbs a { color: var(--rh-ink-muted); }
.rh-crumbs a:hover { color: var(--rh-ink); }
.rh-crumbs .rh-icon { width: 14px; height: 14px; }
.rh-crumbs [aria-current] { color: var(--rh-ink); }
.rh-topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.rh-btn.rh-menu-btn { display: none; }
.rh-draft-banner {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 24px; font-size: 12px;
    background: rgba(245, 158, 11, .08); color: #fcd34d;
    border-bottom: 1px solid rgba(245, 158, 11, .2);
}
.rh-draft-banner .rh-icon { width: 14px; height: 14px; }

.rh-user-switch { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.rh-user-switch .rh-select { width: auto; }
.rh-avatar {
    width: 30px; height: 30px; border-radius: 50%;
    display: grid; place-items: center;
    background: var(--rh-raised); box-shadow: 0 0 0 1px var(--rh-line-strong);
    font-weight: 700; font-size: 12px; color: var(--rh-white); text-transform: uppercase;
}

.rh-page { width: 100%; max-width: 1320px; margin: 0 auto; padding: 28px 24px 64px; }
.rh-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.rh-page-head p { margin-top: 4px; color: var(--rh-ink-muted); }
.rh-section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 32px 0 12px; }
.rh-section-title:first-child { margin-top: 0; }

/* ---------- cards */
.rh-card {
    position: relative;
    background: var(--rh-card);
    border: 1px solid var(--rh-line);
    border-radius: var(--rh-radius-lg);
    min-width: 0;
}
.rh-card::before {
    content: ""; position: absolute; left: 12px; right: 12px; top: -1px; height: 1px;
    background: linear-gradient(90deg, var(--rh-line-color, var(--rh-accent)) 0%, transparent 85%);
    opacity: .9;
}
.rh-line-ok { --rh-line-color: var(--rh-ok); }
.rh-line-warn { --rh-line-color: var(--rh-warn); }
.rh-line-danger { --rh-line-color: var(--rh-danger); }
.rh-line-info { --rh-line-color: var(--rh-info); }
.rh-line-none::before { display: none; }
.rh-card-header {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 18px; border-bottom: 1px solid var(--rh-line);
    font-weight: 600; color: var(--rh-white);
}
.rh-card-header > .rh-icon { color: var(--rh-ink-faint); }
.rh-card-header .rh-aside { margin-left: auto; font-weight: 400; }
.rh-card-body { padding: 18px; }
.rh-card-foot { padding: 12px 18px; border-top: 1px solid var(--rh-line); }
a.rh-card { display: block; color: inherit; transition: border-color .12s, transform .12s; }
a.rh-card:hover { border-color: var(--rh-line-strong); color: inherit; }

/* KPI tiles */
.rh-kpi { padding: 16px 18px; display: grid; gap: 4px; }
.rh-kpi-top { display: flex; align-items: center; gap: 8px; color: var(--rh-ink-muted); font-size: 13px; }
.rh-kpi-top .rh-icon { color: var(--rh-ink-faint); }
.rh-kpi-value { font: 700 26px/1.2 var(--rh-mono); color: var(--rh-white); letter-spacing: -.02em; }
.rh-kpi-sub { font-size: 12px; color: var(--rh-ink-faint); }

/* stat grid (from the styleguide) */
.rh-statgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1px; margin: 0; background: var(--rh-line); border: 1px solid var(--rh-line); border-radius: var(--rh-radius); overflow: hidden; }
.rh-statgrid > div { background: var(--rh-panel); padding: 12px 14px; }
.rh-statgrid dt { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--rh-ink-faint); }
.rh-statgrid dd { margin: 2px 0 0; font: 700 16px var(--rh-mono); color: var(--rh-white); }
.rh-statgrid dd + dd { font: 400 12px var(--rh-font); color: var(--rh-ink-faint); }

/* key/value list */
.rh-kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 10px 20px; margin: 0; }
.rh-kv dt { color: var(--rh-ink-faint); }
.rh-kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* meters */
.rh-meter { height: 6px; border-radius: 99px; background: var(--rh-raised); overflow: hidden; }
.rh-meter > span { display: block; height: 100%; border-radius: inherit; background: var(--rh-info); }
.rh-meter-warn > span { background: var(--rh-warn); }
.rh-meter-danger > span { background: var(--rh-danger); }
.rh-meter-ok > span { background: var(--rh-ok); }
.rh-meter-row { display: grid; gap: 6px; }
.rh-meter-row .rh-between { font-size: 13px; }

/* ---------- buttons */
.rh-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 36px; padding: 0 14px;
    border: 1px solid transparent; border-radius: var(--rh-radius);
    font: 500 14px var(--rh-font); white-space: nowrap; cursor: pointer;
    transition: background .12s, border-color .12s, color .12s;
}
.rh-btn:disabled, .rh-btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.rh-btn-primary { background: var(--rh-accent); color: #fff; }
.rh-btn-primary:hover:not(:disabled) { background: var(--rh-accent-hover); color: #fff; }
.rh-btn-secondary { background: var(--rh-raised); border-color: var(--rh-line-strong); color: var(--rh-ink); }
.rh-btn-secondary:hover:not(:disabled) { background: #2a303a; color: var(--rh-white); }
.rh-btn-ghost { background: transparent; color: var(--rh-ink-muted); }
.rh-btn-ghost:hover:not(:disabled) { background: var(--rh-raised); color: var(--rh-ink); }
.rh-btn-danger { background: rgba(239, 68, 68, .12); border-color: rgba(239, 68, 68, .35); color: #fca5a5; }
.rh-btn-danger:hover:not(:disabled) { background: var(--rh-danger); color: #fff; }
.rh-btn-danger-solid { background: var(--rh-danger); color: #fff; }
.rh-btn-danger-solid:hover:not(:disabled) { filter: brightness(1.1); color: #fff; }
.rh-btn-sm { height: 30px; padding: 0 10px; font-size: 13px; gap: 6px; }
.rh-btn-lg { height: 44px; padding: 0 20px; font-size: 15px; }
.rh-btn-icon { width: 32px; height: 32px; padding: 0; }
.rh-inline-form { display: inline; margin: 0; }

/* ---------- forms */
.rh-field { display: grid; gap: 6px; min-width: 0; }
.rh-label { font-size: 13px; font-weight: 500; color: var(--rh-ink); }
.rh-help { font-size: 12px; color: var(--rh-ink-faint); }
.rh-input, .rh-select, .rh-textarea {
    width: 100%; height: 38px; padding: 0 12px;
    background: var(--rh-panel); color: var(--rh-ink);
    border: 1px solid var(--rh-line-strong); border-radius: var(--rh-radius);
    font: 14px var(--rh-font);
    transition: border-color .12s, box-shadow .12s;
}
.rh-textarea { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; font-family: var(--rh-mono); font-size: 13px; }
.rh-input::placeholder, .rh-textarea::placeholder { color: var(--rh-ink-faint); }
.rh-input:focus, .rh-select:focus, .rh-textarea:focus { outline: none; border-color: var(--rh-accent); box-shadow: 0 0 0 3px var(--rh-accent-soft); }
.rh-input-mono { font-family: var(--rh-mono); font-size: 13px; }
.rh-select { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239aa1ad' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.rh-input-group { display: flex; }
.rh-input-group .rh-input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.rh-input-group .rh-addon { display: flex; align-items: center; padding: 0 12px; border: 1px solid var(--rh-line-strong); border-left: 0; border-radius: 0 var(--rh-radius) var(--rh-radius) 0; background: var(--rh-raised); color: var(--rh-ink-faint); font: 13px var(--rh-mono); white-space: nowrap; }
.rh-form-grid { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.rh-form-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 4px; }

.rh-toggle-row {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 14px 0; border-top: 1px solid var(--rh-line);
}
.rh-toggle-row:first-child { border-top: 0; padding-top: 0; }
.rh-toggle-row strong { display: block; font-weight: 500; color: var(--rh-ink); }
.rh-switch { position: relative; display: inline-flex; width: 40px; height: 22px; flex-shrink: 0; }
.rh-switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.rh-switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--rh-line-strong); transition: background .15s; }
.rh-switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.rh-switch input:checked + span { background: var(--rh-accent); }
.rh-switch input:checked + span::after { transform: translateX(18px); }
.rh-switch input:focus-visible + span { outline: 2px solid var(--rh-accent); outline-offset: 2px; }

/* ---------- status, pills, badges */
.rh-status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; white-space: nowrap; }
.rh-status-ok { color: #4ade80; }
.rh-status-warn { color: #fbbf24; }
.rh-status-danger { color: #f87171; }
.rh-status-info { color: #60a5fa; }
.rh-status-muted { color: var(--rh-ink-faint); }
.rh-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 18%, transparent); }
.rh-pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 99px; background: var(--rh-raised); border: 1px solid var(--rh-line); font: 12px var(--rh-mono); color: var(--rh-ink-muted); white-space: nowrap; }
.rh-badge { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 5px; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; }
.rh-badge-accent { background: var(--rh-accent-soft); color: #fca5a5; }
.rh-badge-ok { background: rgba(34, 197, 94, .12); color: #4ade80; }
.rh-badge-warn { background: rgba(245, 158, 11, .12); color: #fbbf24; }
.rh-badge-danger { background: rgba(239, 68, 68, .12); color: #f87171; }
.rh-badge-info { background: rgba(59, 130, 246, .12); color: #60a5fa; }
.rh-badge-muted { background: var(--rh-raised); color: var(--rh-ink-muted); }

/* ---------- alerts & flashes */
.rh-alert { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--rh-radius); border: 1px solid; font-size: 13px; }
.rh-alert > .rh-icon { margin-top: 2px; }
.rh-alert-info { background: rgba(59, 130, 246, .08); border-color: rgba(59, 130, 246, .3); color: #bfdbfe; }
.rh-alert-ok { background: rgba(34, 197, 94, .08); border-color: rgba(34, 197, 94, .3); color: #bbf7d0; }
.rh-alert-warn { background: rgba(245, 158, 11, .08); border-color: rgba(245, 158, 11, .3); color: #fde68a; }
.rh-alert-danger { background: rgba(239, 68, 68, .08); border-color: rgba(239, 68, 68, .3); color: #fecaca; }
.rh-alert strong { color: #fff; }
.rh-flashes { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: grid; gap: 8px; width: min(380px, calc(100vw - 40px)); }
.rh-flashes .rh-alert { background: var(--rh-raised); box-shadow: var(--rh-shadow); animation: rh-in .2s ease-out; }
@keyframes rh-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- tables */
.rh-table-wrap { overflow-x: auto; }
.rh-table { width: 100%; border-collapse: collapse; }
.rh-table th { padding: 10px 18px; text-align: left; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--rh-ink-faint); border-bottom: 1px solid var(--rh-line); white-space: nowrap; }
.rh-table td { padding: 12px 18px; border-bottom: 1px solid var(--rh-line); vertical-align: middle; }
.rh-table tbody tr:last-child td { border-bottom: 0; }
.rh-table tbody tr:hover td { background: rgba(255, 255, 255, .015); }
.rh-table .rh-right { text-align: right; }
.rh-table-compact td { padding-top: 7px; padding-bottom: 7px; }
.rh-table .rh-fill { width: 100%; max-width: 0; }
.rh-table .rh-fill .rh-truncate { display: block; }
.rh-table .rh-actions { text-align: right; white-space: nowrap; width: 1%; }
.rh-table .rh-actions > * { vertical-align: middle; }
.rh-cell-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.rh-cell-main strong { display: block; color: var(--rh-white); font-weight: 500; }
.rh-cell-main a strong:hover { color: var(--rh-accent-hover); }
.rh-site-icon {
    width: 34px; height: 34px; border-radius: var(--rh-radius); flex-shrink: 0;
    display: grid; place-items: center;
    background: var(--rh-raised); box-shadow: 0 0 0 1px var(--rh-line);
    color: var(--rh-ink-muted); font: 700 13px var(--rh-mono); text-transform: uppercase;
}
.rh-site-link { gap: 10px; }
.rh-site-link .rh-site-globe { width: 15px; height: 15px; color: var(--rh-ink-faint); }
.rh-site-link:hover .rh-site-globe { color: var(--rh-accent); }
.rh-site-card { margin-bottom: 24px; }
.rh-search { width: 260px; }
.rh-empty-row { padding: 18px; text-align: center; }
.rh-site-icon-lg { width: 52px; height: 52px; border-radius: var(--rh-radius-lg); color: var(--rh-accent); }
.rh-site-icon-lg .rh-icon { width: 24px; height: 24px; }

/* ---------- tabs */
.rh-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--rh-line); margin-bottom: 24px; overflow-x: auto; scrollbar-width: none; }
.rh-tabs a {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 14px; margin-bottom: -1px;
    border-bottom: 2px solid transparent;
    color: var(--rh-ink-muted); font-weight: 500; white-space: nowrap;
}
.rh-tabs a:hover { color: var(--rh-ink); }
.rh-tabs a[aria-current="page"] { color: var(--rh-white); border-color: var(--rh-accent); }
.rh-tabs a[aria-current="page"] .rh-icon { color: var(--rh-accent); }
.rh-segment { display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--rh-radius); background: var(--rh-panel); border: 1px solid var(--rh-line); }
.rh-segment a, .rh-segment button { height: 28px; padding: 0 12px; display: inline-flex; align-items: center; border: 0; border-radius: 6px; background: none; color: var(--rh-ink-muted); font: 500 13px var(--rh-font); cursor: pointer; }
.rh-segment [aria-current="true"], .rh-segment [aria-current="page"], .rh-segment [aria-selected="true"] { background: var(--rh-raised); color: var(--rh-white); box-shadow: 0 0 0 1px var(--rh-line-strong); }

/* ---------- code / copy boxes */
.rh-code {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 8px 8px 12px; border-radius: var(--rh-radius);
    background: var(--rh-base); border: 1px solid var(--rh-line);
    font: 13px var(--rh-mono); color: var(--rh-ink);
    min-width: 0; max-width: 100%;
}
.rh-code > span { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; scrollbar-width: thin; }
.rh-pre { margin: 0; padding: 14px 16px; border-radius: var(--rh-radius); background: var(--rh-base); border: 1px solid var(--rh-line); font: 12.5px/1.65 var(--rh-mono); color: var(--rh-ink-muted); overflow-x: auto; white-space: pre; }
.rh-pre .ok { color: #4ade80; } .rh-pre .err { color: #f87171; } .rh-pre .dim { color: var(--rh-ink-faint); } .rh-pre .hi { color: #fff; }

/* ---------- empty */
.rh-empty { display: grid; justify-items: center; gap: 10px; padding: 48px 24px; text-align: center; color: var(--rh-ink-muted); }
.rh-empty .rh-icon { width: 36px; height: 36px; color: var(--rh-ink-faint); }
.rh-empty h3 { margin-top: 4px; }

/* ---------- dialog */
.rh-dialog {
    width: min(560px, calc(100vw - 32px)); padding: 0;
    background: var(--rh-card); color: var(--rh-ink);
    border: 1px solid var(--rh-line-strong); border-radius: var(--rh-radius-lg);
    box-shadow: var(--rh-shadow);
    max-height: calc(100dvh - 32px);
}
/* Tall dialogs: head and buttons stay put, the body scrolls. */
.rh-dialog > form { display: flex; flex-direction: column; max-height: calc(100dvh - 34px); }
.rh-dialog > form > .rh-dialog-body { min-height: 0; overflow-y: auto; }
/* Themed confirm/alert popup (app.js RH.confirm / RH.alert) */
.rh-popup { width: min(440px, calc(100vw - 32px)); }
.rh-popup .rh-dialog-head { border-bottom: 0; padding-bottom: 4px; }
.rh-popup .rh-dialog-body { padding-top: 4px; }
.rh-popup-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; flex: none; }
.rh-popup-icon .rh-icon { width: 18px; height: 18px; }
.rh-popup-danger { background: rgba(239, 68, 68, .14); color: #fca5a5; }
.rh-popup-info { background: var(--rh-accent-soft); color: var(--rh-accent); }
.rh-popup-msg { margin: 0; color: var(--rh-ink-muted); line-height: 1.55; white-space: pre-line; overflow-wrap: anywhere; }
.rh-popup .rh-dialog-foot { border-top: 0; background: transparent; padding-top: 4px; }
.rh-popup-ok { background: rgba(74, 222, 128, .14); color: #4ade80; }
/* Update progress popup */
.rh-progress { width: min(500px, calc(100vw - 32px)); }
.rh-progress:focus, .rh-popup:focus { outline: none; }
.rh-progress .rh-dialog-head { border-bottom: 0; }
.rh-progress-bar { height: 6px; border-radius: 999px; background: var(--rh-line); overflow: hidden; margin-bottom: 18px; }
.rh-progress-bar span { display: block; height: 100%; width: 4%; border-radius: inherit; transition: width .6s ease;
    background: linear-gradient(90deg, var(--rh-accent), var(--rh-accent-hover), var(--rh-accent)); background-size: 200% 100%;
    animation: rh-shimmer 1.4s linear infinite; }
.rh-progress.is-ok .rh-progress-bar span { background: #4ade80; animation: none; }
.rh-progress.is-failed .rh-progress-bar span { background: var(--rh-danger); animation: none; }
.rh-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.rh-step { display: flex; gap: 12px; align-items: flex-start; padding: 8px 4px; color: var(--rh-ink-faint); transition: color .3s; }
.rh-step-label { font-weight: 500; }
.rh-step-sub { font-size: 12.5px; color: var(--rh-ink-muted); min-height: 0; }
.rh-step-sub:empty { display: none; }
.rh-step-mark { flex: none; position: relative; width: 20px; height: 20px; margin-top: 1px; border-radius: 50%; border: 2px solid var(--rh-line-strong); transition: background .3s, border-color .3s; }
.rh-step.is-active { color: var(--rh-ink); }
.rh-step.is-active .rh-step-mark { border-color: var(--rh-accent-soft); border-top-color: var(--rh-accent); animation: rh-spin .8s linear infinite; }
.rh-step.is-done { color: var(--rh-ink); }
.rh-step.is-done .rh-step-mark { background: #22c55e; border-color: #22c55e; animation: rh-pop .3s ease-out; }
.rh-step.is-done .rh-step-mark::after { content: ""; position: absolute; left: 5px; top: 1px; width: 5px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.rh-step.is-failed { color: #fca5a5; }
.rh-step.is-failed .rh-step-mark { background: var(--rh-danger); border-color: var(--rh-danger); animation: rh-pop .3s ease-out; }
.rh-step.is-failed .rh-step-mark::before, .rh-step.is-failed .rh-step-mark::after { content: ""; position: absolute; left: 7px; top: 3px; width: 2px; height: 10px; background: #fff; transform: rotate(45deg); }
.rh-step.is-failed .rh-step-mark::after { transform: rotate(-45deg); }
.rh-progress-msg { margin: 14px 0 0; color: var(--rh-ink-muted); font-size: 14px; }
@keyframes rh-spin { to { transform: rotate(360deg); } }
@keyframes rh-pop { 0% { transform: scale(.6); } 70% { transform: scale(1.15); } 100% { transform: scale(1); } }
@keyframes rh-shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .rh-step.is-active .rh-step-mark, .rh-progress-bar span, .rh-step-mark { animation: none !important; } }
.rh-db-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 16px; align-items: start; }
.rh-db-list { display: grid; padding: 6px; max-height: 70vh; overflow-y: auto; }
.rh-db-list a { display: flex; justify-content: space-between; gap: 8px; padding: 7px 10px; border-radius: 8px; color: var(--rh-ink-muted); font: 13px var(--rh-mono); }
.rh-db-list a:hover { background: rgba(255, 255, 255, .04); color: var(--rh-ink); }
.rh-db-list a[aria-current] { background: var(--rh-accent-soft); color: var(--rh-ink); }
.rh-db-sql { min-height: 96px; }
.rh-db-grid { max-height: 65vh; overflow: auto; }
.rh-db-grid td { font: 12.5px var(--rh-mono); white-space: pre-wrap; max-width: 420px; vertical-align: top; overflow-wrap: anywhere; }
.rh-db-grid th { position: sticky; top: 0; background: var(--rh-card); z-index: 1; }
@media (max-width: 900px) { .rh-db-layout { grid-template-columns: minmax(0, 1fr); } .rh-db-list { max-height: 220px; } }
.rh-btn.is-busy .rh-icon { animation: rh-spin .8s linear infinite; }
/* Release notes popup */
.rh-notes { width: min(600px, calc(100vw - 32px)); }
.rh-notes-body { max-height: 60vh; overflow-y: auto; gap: 8px; color: var(--rh-ink-muted); line-height: 1.6; }
.rh-notes-body h3 { margin: 6px 0 0; font-size: 15px; color: var(--rh-ink); }
.rh-notes-body p { margin: 0; }
.rh-notes-body ul { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.rh-notes-body strong { color: var(--rh-ink); }
/* Dashboard */
.rh-stat { padding: 18px 18px 12px; display: grid; gap: 2px; min-width: 0; }
.rh-stat-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rh-stat-label { display: inline-flex; align-items: center; gap: 8px; color: var(--rh-ink-muted); font-weight: 500; }
.rh-stat-label .rh-icon { width: 18px; height: 18px; }
.rh-stat-value { font-size: 28px; font-weight: 700; color: var(--rh-white, #fff); line-height: 1.2; margin-top: 6px; }
.rh-stat-sub { color: var(--rh-ink-muted); font-size: 14px; display: flex; gap: 14px; flex-wrap: wrap; }
.rh-stat-sub .rh-icon { width: 14px; height: 14px; vertical-align: -2px; }
.rh-stat-chart { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: stretch; height: 84px; margin-top: 10px; }
.rh-stat-meter { height: auto; display: block; margin-top: 18px; }
.rh-chart { width: 100%; height: 100%; display: block; overflow: visible; }
.rh-chart-axis { display: flex; flex-direction: column; justify-content: space-between; padding-left: 8px; border-left: 1px solid var(--rh-line); font: 11px var(--rh-mono); color: var(--rh-ink-faint); white-space: nowrap; }
.rh-trend { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border-radius: 999px; font: 600 12px var(--rh-mono); }
.rh-trend .rh-icon { width: 12px; height: 12px; }
.rh-trend-down { background: rgba(34, 197, 94, .12); color: #4ade80; }
.rh-trend-up { background: rgba(245, 158, 11, .12); color: #fbbf24; }
.rh-dash-grid { display: grid; grid-template-columns: minmax(0, 2.4fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.rh-spark { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.rh-spark > span { min-width: 50px; font-size: 13px; }
.rh-spark .rh-chart { width: 70px; height: 22px; }
.rh-deploys { display: grid; }
.rh-deploy-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto 16px; align-items: center; gap: 10px; padding: 11px 18px; border-top: 1px solid var(--rh-line); color: var(--rh-ink); }
.rh-deploy-row:first-child { border-top: 0; }
.rh-deploy-row:hover { background: rgba(255, 255, 255, .02); }
.rh-deploy-status { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }
.rh-deploy-status .rh-icon { width: 16px; height: 16px; }
.rh-rowmenu summary { padding: 4px; border-radius: 6px; }
.rh-rowmenu summary .rh-icon { width: 18px; height: 18px; color: var(--rh-ink-muted); }
.rh-rowmenu .rh-usermenu-pop { min-width: 190px; text-align: left; }
.rh-rowmenu[open] .rh-usermenu-pop { position: fixed; right: auto; width: max-content; }
@media (max-width: 1280px) { .rh-hide-md { display: none; } }
@media (max-width: 1500px) { .rh-dash-grid { grid-template-columns: minmax(0, 1fr); } }
.rh-dialog::backdrop { background: rgba(5, 6, 8, .7); backdrop-filter: blur(2px); }
.rh-dialog-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--rh-line); }
.rh-dialog-head h2 { font-size: 17px; }
.rh-dialog-head .rh-btn { margin-left: auto; }
.rh-dialog-body { padding: 20px; display: grid; gap: 16px; }
.rh-dialog-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--rh-line); background: var(--rh-panel); border-radius: 0 0 var(--rh-radius-lg) var(--rh-radius-lg); }

/* ---------- site header */
.rh-site-head { display: flex; flex-wrap: wrap; gap: 20px; align-items: center; padding: 20px; }
.rh-site-head-main { display: flex; gap: 16px; align-items: center; flex: 1; min-width: 260px; }
.rh-site-head h1 { font-size: 22px; overflow-wrap: anywhere; }

/* ---------- file manager */
.rh-fm-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 14px; border-bottom: 1px solid var(--rh-line); }
.rh-fm-path { display: flex; align-items: center; gap: 4px; flex: 1; min-width: 200px; padding: 0 10px; height: 32px; border-radius: var(--rh-radius); background: var(--rh-panel); border: 1px solid var(--rh-line); font: 13px var(--rh-mono); color: var(--rh-ink-muted); overflow-x: auto; white-space: nowrap; }
.rh-fm-path a { color: var(--rh-ink); }
.rh-fm-path .rh-icon { width: 13px; height: 13px; color: var(--rh-ink-faint); }
.rh-fm-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 420px; }
.rh-fm-tree { padding: 10px; border-right: 1px solid var(--rh-line); font-size: 13px; }
.rh-fm-tree a { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 6px; color: var(--rh-ink-muted); }
.rh-fm-tree a:hover { background: var(--rh-raised); color: var(--rh-ink); }
.rh-fm-tree a[aria-current] { background: var(--rh-accent-soft); color: var(--rh-white); }
.rh-fm-tree .rh-indent { padding-left: 26px; }
.rh-fm-list td { padding-top: 8px; padding-bottom: 8px; }
.rh-fm-list .rh-icon-folder { color: #60a5fa; }
.rh-fm-list .rh-icon-file { color: var(--rh-ink-faint); }
.rh-fm-list .rh-icon-code { color: #fbbf24; }
.rh-fm-list tr[aria-selected="true"] td { background: var(--rh-accent-soft); }
.rh-fm-drop { margin: 14px; padding: 18px; border: 1px dashed var(--rh-line-strong); border-radius: var(--rh-radius); text-align: center; color: var(--rh-ink-faint); font-size: 13px; }
.rh-fm-drop.is-over { border-color: var(--rh-accent); color: var(--rh-ink); background: var(--rh-accent-soft); }

/* ---------- terminal */
.rh-term { display: flex; flex-direction: column; height: min(640px, calc(100vh - 260px)); min-height: 360px; overflow: hidden; }
.rh-term:fullscreen { height: 100vh; border-radius: 0; }
.rh-term-bar { display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 14px; border-bottom: 1px solid var(--rh-line); background: var(--rh-panel); border-radius: var(--rh-radius-lg) var(--rh-radius-lg) 0 0; }
.rh-term-bar .rh-pill { height: 22px; }
.rh-term-screen { flex: 1; min-height: 0; padding: 8px 4px 4px 10px; background: #0c0e11; border-radius: 0 0 var(--rh-radius-lg) var(--rh-radius-lg); }
.rh-term-screen .xterm { height: 100%; }
.rh-term-screen .xterm-viewport { scrollbar-width: thin; scrollbar-color: var(--rh-line-strong) transparent; }
.rh-term-help { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; font-size: 12px; color: var(--rh-ink-faint); }
kbd { display: inline-block; padding: 1px 6px; border-radius: 4px; background: var(--rh-raised); border: 1px solid var(--rh-line-strong); border-bottom-width: 2px; font-size: 11px; color: var(--rh-ink); }
.rh-ctx { position: fixed; z-index: 200; min-width: 200px; padding: 5px; border-radius: var(--rh-radius); background: var(--rh-raised); border: 1px solid var(--rh-line-strong); box-shadow: var(--rh-shadow); }
.rh-ctx[hidden] { display: none; }
.rh-ctx button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border: 0; border-radius: 6px; background: none; color: var(--rh-ink); font: 13px var(--rh-font); text-align: left; cursor: pointer; }
.rh-ctx button:hover:not(:disabled) { background: var(--rh-accent-soft); }
.rh-ctx button:disabled { color: var(--rh-ink-faint); cursor: default; }
.rh-ctx button kbd { margin-left: auto; }
.rh-ctx hr { margin: 4px 0; border: 0; border-top: 1px solid var(--rh-line); }

/* ---------- list picker (choose a site) */
.rh-pick { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.rh-pick a.rh-card { display: flex; align-items: center; gap: 12px; padding: 14px 16px; }
.rh-pick a.rh-card > .rh-icon { margin-left: auto; color: var(--rh-ink-faint); }

/* ---------- responsive */
@media (max-width: 1100px) {
    .rh-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .rh-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
    .rh-shell { grid-template-columns: minmax(0, 1fr); }
    .rh-sidebar { position: fixed; z-index: 50; left: 0; top: 0; width: var(--rh-sidebar); transform: translateX(-100%); transition: transform .2s; box-shadow: var(--rh-shadow); }
    .rh-nav-open .rh-sidebar { transform: none; }
    .rh-nav-open .rh-scrim { display: block; position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, .5); }
    .rh-btn.rh-menu-btn { display: inline-flex; }
    .rh-topbar { padding: 0 16px; }
    .rh-page { padding: 20px 16px 48px; }
    .rh-draft-banner { padding: 6px 16px; }
    .rh-grid-2, .rh-form-grid { grid-template-columns: minmax(0, 1fr); }
    .rh-span-2 { grid-column: auto; }
    .rh-fm-layout { grid-template-columns: minmax(0, 1fr); }
    .rh-fm-tree { display: none; }
    .rh-hide-sm { display: none; }
}
@media (max-width: 560px) {
    .rh-grid-4, .rh-grid-3 { grid-template-columns: minmax(0, 1fr); }
    .rh-table th, .rh-table td { padding-left: 12px; padding-right: 12px; }
    .rh-user-switch .rh-segment a { padding: 0 8px; }
    .rh-crumbs { display: none; }
    .rh-search { width: 100%; }
    /* Several row buttons: stack them instead of pushing them off-screen. */
    .rh-table .rh-actions-stack { white-space: normal; }
    .rh-table .rh-actions-stack > * { display: flex; justify-content: flex-end; margin: 3px 0; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- login & account */
.rh-auth-body { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(1200px 600px at 50% -10%, rgba(229, 72, 59, .10), transparent 60%), var(--rh-base); }
.rh-auth { width: min(440px, 100% - 32px); display: grid; gap: 16px; padding: 40px 0; }
.rh-auth-brand { justify-content: center; padding: 0 0 8px; }
.rh-auth-foot { text-align: center; }
.rh-input-code { font: 600 22px var(--rh-mono); letter-spacing: .25em; text-align: center; height: 50px; }
.rh-steps { margin: 0; padding-left: 20px; display: grid; gap: 18px; }
.rh-steps li::marker { color: var(--rh-accent); font-weight: 700; }
.rh-qr-wrap { margin: 12px 0 10px; }
.rh-qr { width: 196px; height: 196px; padding: 6px; border-radius: var(--rh-radius); background: #fff; }
.rh-qr svg { display: block; width: 100%; height: 100%; }
.rh-narrow { max-width: 620px; }
.rh-recovery { font-size: 16px; line-height: 1.9; color: var(--rh-white); columns: 2; }
details > summary { cursor: pointer; }
.rh-dialog-danger { border-top: 1px solid var(--rh-line); gap: 10px; }

/* user menu (top bar) */
.rh-usermenu { position: relative; }
.rh-usermenu summary { display: flex; align-items: center; gap: 8px; list-style: none; padding: 3px 8px 3px 3px; border-radius: 99px; color: var(--rh-ink); font-weight: 500; }
.rh-usermenu summary::-webkit-details-marker { display: none; }
.rh-usermenu summary:hover, .rh-usermenu[open] summary { background: var(--rh-raised); }
.rh-usermenu summary > .rh-icon { color: var(--rh-ink-faint); width: 14px; height: 14px; }
.rh-usermenu-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 60; min-width: 230px; padding: 6px; border-radius: var(--rh-radius); background: var(--rh-raised); border: 1px solid var(--rh-line-strong); box-shadow: var(--rh-shadow); }
.rh-usermenu-who { display: grid; padding: 8px 10px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--rh-line); }
.rh-usermenu-pop a, .rh-usermenu-pop button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 6px; background: none; color: var(--rh-ink); font: 14px var(--rh-font); text-align: left; cursor: pointer; }
.rh-usermenu-pop a:hover, .rh-usermenu-pop button:hover { background: var(--rh-accent-soft); color: var(--rh-white); }
.rh-usermenu-pop form { margin: 0; }

@media print {
    .rh-sidebar, .rh-topbar, .rh-draft-banner, .rh-row, .rh-alert, .rh-page-head p { display: none !important; }
    body { background: #fff; color: #000; }
    .rh-shell { display: block; }
    .rh-card, .rh-pre { border: 0; background: #fff; color: #000; }
}
.rh-divider { display: flex; align-items: center; gap: 12px; color: var(--rh-ink-faint); font-size: 12px; }
.rh-divider::before, .rh-divider::after { content: ""; flex: 1; border-top: 1px solid var(--rh-line); }
.rh-input-group .rh-addon-left { order: -1; border-left: 1px solid var(--rh-line-strong); border-right: 0; border-radius: var(--rh-radius) 0 0 var(--rh-radius); }
.rh-input-group .rh-addon-left + .rh-input { border-radius: 0 var(--rh-radius) var(--rh-radius) 0; }

/* ---------- file manager & editor */
.rh-fm-path a:hover { color: var(--rh-accent-hover); }
label.rh-btn { cursor: pointer; }
label.rh-btn.is-disabled { opacity: .45; cursor: not-allowed; }
.rh-fm-list input[type="checkbox"], .rh-table thead input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--rh-accent); }
.rh-fm-list tr:has(input[data-select]:checked) td { background: var(--rh-accent-soft); }
.rh-editor { display: flex; flex-direction: column; height: calc(100vh - 290px); min-height: 420px; }
.rh-editor-text {
    flex: 1; width: 100%; margin: 0; padding: 14px 16px; resize: none;
    border: 0; border-radius: 0 0 var(--rh-radius-lg) var(--rh-radius-lg);
    background: #0c0e11; color: var(--rh-ink);
    font: 13px/1.6 var(--rh-mono); tab-size: 4; white-space: pre; overflow: auto;
}
.rh-editor-text:focus { outline: none; box-shadow: inset 0 0 0 1px var(--rh-line-strong); }
.rh-update-notes { max-height: 260px; white-space: pre-wrap; word-break: break-word; }
.rh-deploy-log { max-height: 420px; overflow: auto; white-space: pre-wrap; word-break: break-word; }
.rh-nowrap { white-space: nowrap; }
