/* Partnership Bot dashboard: AutoMsg layout and tokens. Dark only. */

:root {
    --bg-black: #000; --bg-surface: #0a0a0c; --bg-card: #101014; --bg-card-hover: #15161b; --bg-input: #070709;
    --border: #1b1c22; --border-focus: #2a2b33;
    --text-main: #f4f4f5; --text-secondary: #a1a1aa; --text-dim: #71717a;
    --aqua: #A0E0EF; --primary: #A0E0EF; --primary-hover: #7FD0E3; --aqua-bg: rgba(160, 224, 239, 0.12);
    --emerald: #10b981; --emerald-bg: rgba(16, 185, 129, 0.1);
    --rose: #ef4444; --rose-bg: rgba(239, 68, 68, 0.1); --rose-text: #fecaca;
    --amber: #f59e0b; --amber-bg: rgba(245, 158, 11, 0.1);
    --sky: rgb(56, 189, 248); --sky-bg: rgba(56, 189, 248, 0.12);
    --violet: #a78bfa;
    --radius: 8px;
    --t: background-color .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease, filter .18s ease, opacity .18s ease, transform .18s ease;
    --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
    /* aliases used by the login section and older markup */
    --text: var(--text-main); --muted: var(--text-secondary); --dim: var(--text-dim);
    --side: 240px; --rail: 268px; --header-h: 56px; --topbar-h: 52px; --bottomnav-h: 64px;
    color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
    font-family: Inter, system-ui, sans-serif; color: var(--text-main); background: var(--bg-black);
    -webkit-font-smoothing: antialiased; font-size: 13px; line-height: 1.45;
}
body.app { overflow: hidden; }
a { color: var(--aqua); text-decoration: none; }
a:hover { color: var(--primary-hover); }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
::selection { background: rgba(160, 224, 239, 0.28); }
:focus-visible { outline: 2px solid rgba(160, 224, 239, 0.7); outline-offset: 2px; }
* { scrollbar-width: thin; scrollbar-color: #27272a transparent; }
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-thumb { background: #27272a; border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

.mono, time, code, kbd { font-family: var(--mono); }
.mono { font-size: 0.94em; }
.muted { color: var(--text-secondary); }
.dim { color: var(--text-dim); }
.small { font-size: 11.5px; }
.rose-text { color: var(--rose-text); }
.pad { padding: 18px; }
[hidden] { display: none !important; }
.tone-emerald, .tone-ok { color: var(--emerald); }
.tone-rose, .tone-err { color: var(--rose); }
.tone-amber, .tone-warn { color: var(--amber); }
.tone-aqua { color: var(--aqua); }
.tone-info, .tone-sky { color: var(--sky); }
.tone-dim { color: var(--text-dim); }

/* =========================================================== boot overlay */

.boot { position: fixed; inset: 0; z-index: 2000; background: #000; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; transition: opacity .25s ease; }
.boot.done { opacity: 0; pointer-events: none; }
.boot-spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(160, 224, 239, 0.15); border-top-color: var(--aqua); animation: spin .8s linear infinite; }
.boot-text { font-size: 13px; font-weight: 600; color: var(--aqua); }
@keyframes spin { to { transform: rotate(360deg); } }

/* =========================================================== shell */

.app-shell { display: flex; height: 100vh; height: 100dvh; width: 100%; overflow: hidden; }

.sidebar { width: var(--side); flex: none; display: flex; flex-direction: column; background: var(--bg-surface); border-right: 1px solid var(--border); min-height: 0; }
.brand-section { display: flex; align-items: center; gap: 11px; padding: 20px 18px; border-bottom: 1px solid var(--border); color: var(--text-main); }
.brand-section:hover { color: var(--text-main); }
.logo-box { width: 32px; height: 32px; border-radius: 8px; background: #000; border: 1px solid rgba(160, 224, 239, 0.35); display: grid; place-items: center; overflow: hidden; flex: none; }
.logo-box img { width: 100%; height: 100%; display: block; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-size: 14px; font-weight: 700; letter-spacing: -0.2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text small { font-size: 11px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.nav-container { display: flex; flex-direction: column; gap: 4px; padding: 12px 10px; flex: 1; overflow-y: auto; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; font-size: 13px; font-weight: 500; color: var(--text-secondary); border: 1px solid transparent; transition: var(--t); }
.nav-link:hover { background: var(--bg-card); color: var(--aqua); border-color: rgba(160, 224, 239, 0.25); }
.nav-link.active { background: var(--aqua-bg); color: var(--aqua); border-color: rgba(160, 224, 239, 0.35); }
.nav-link .icon { flex: none; }
.nav-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-badge { font: 600 11px/1.4 var(--mono); background: var(--bg-input); color: var(--text-dim); border: 1px solid var(--border); border-radius: 20px; padding: 1px 7px; }
.nav-badge.tone-aqua.is-hot { color: #000; background: var(--aqua); border-color: var(--aqua); }
.nav-badge.tone-rose.is-hot { color: #fff; background: var(--rose); border-color: var(--rose); }

.nav-footer { padding: 12px 10px 14px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.bot-chip { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; background: var(--bg-card); border: 1px solid var(--border); }
.bot-chip:empty { display: none; }
.bot-avatar { width: 28px; height: 28px; border-radius: 50%; flex: none; object-fit: cover; background: #1e1f24; }
.bot-avatar-fallback { display: grid; place-items: center; color: var(--aqua); font-weight: 700; font-size: 12px; }
.bot-meta { display: flex; flex-direction: column; min-width: 0; }
.bot-name { font-weight: 600; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bot-state { display: flex; align-items: center; gap: 6px; font: 10.5px var(--mono); color: var(--text-dim); }
.bot-state .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-dim); }
.bot-state.is-ready .dot { background: var(--emerald); box-shadow: 0 0 6px var(--emerald); }
.bot-state.is-down .dot { background: var(--amber); }
.user-line { padding: 0 2px; }
.user-name { font: 11px var(--mono); color: var(--text-dim); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-block { width: 100%; }

.content-frame { flex: 1; min-width: 0; overflow-y: auto; overflow-x: hidden; scrollbar-width: none; position: relative; }
.content-frame::-webkit-scrollbar { display: none; }
.top-header {
    position: sticky; top: 0; z-index: 50; height: var(--header-h); display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 0 24px; background: var(--bg-surface); border-bottom: 1px solid var(--border);
}
.status-indicator { display: flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 500; color: var(--text-secondary); min-width: 0; }
.status-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-text strong { color: var(--text-main); font-weight: 600; }
.status-text .countdown { color: var(--aqua); font-weight: 600; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--text-dim); }
.live-dot.is-live { background: var(--emerald); box-shadow: 0 0 8px rgba(16, 185, 129, 0.8); animation: glow 2s ease-in-out infinite; }
.live-dot.is-warn { background: var(--amber); box-shadow: 0 0 8px rgba(245, 158, 11, 0.7); }
.live-dot.is-off { background: var(--rose); box-shadow: 0 0 8px rgba(239, 68, 68, 0.6); }
@keyframes glow { 50% { box-shadow: 0 0 2px rgba(16, 185, 129, 0.4); } }
.action-group { display: flex; gap: 8px; flex: none; }

.tab-view { padding: 24px; max-width: 1280px; margin: 0 auto; outline: none; }
.page { display: flex; flex-direction: column; gap: 22px; animation: page-in .2s ease-out; min-width: 0; }
@keyframes page-in { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

/* right rail */
.right-rail { width: var(--rail); flex: none; background: var(--bg-surface); border-left: 1px solid var(--border); overflow-y: auto; padding: 12px 10px 20px; display: flex; flex-direction: column; gap: 6px; }
.rail-head { display: flex; align-items: baseline; justify-content: space-between; padding: 2px 4px 6px; gap: 8px; }
.rail-head-2 { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.rail-title { font: 700 11px var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-meta { font: 10.5px var(--mono); color: var(--text-dim); flex: none; }
.rail-pools { display: flex; flex-direction: column; gap: 5px; }
.right-pool-btn {
    display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px; border-radius: 7px; border: 1px solid var(--border);
    border-left: 3px solid var(--text-dim); background: rgba(255, 255, 255, 0.02); font-size: 12px; font-weight: 600; color: var(--text-main);
    cursor: pointer; text-align: left; transition: var(--t);
}
.right-pool-btn:hover { background: var(--bg-card-hover); }
.right-pool-btn.selected { background: rgba(56, 189, 248, 0.12); border-color: rgba(56, 189, 248, 0.55); }
.rp-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: currentColor; }
.rp-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-tag { font: 700 10px var(--mono); padding: 1px 6px; border-radius: 4px; flex: none; }
.right-pool-btn.tone-emerald { border-left-color: var(--emerald); }
.right-pool-btn.tone-emerald .rp-dot { color: var(--emerald); box-shadow: 0 0 6px var(--emerald); }
.right-pool-btn.tone-emerald .rp-tag { color: var(--emerald); background: rgba(16, 185, 129, 0.14); }
.right-pool-btn.tone-aqua { border-left-color: var(--aqua); }
.right-pool-btn.tone-aqua .rp-dot { color: var(--aqua); box-shadow: 0 0 6px var(--aqua); }
.right-pool-btn.tone-aqua .rp-tag { color: var(--aqua); background: rgba(160, 224, 239, 0.14); }
.right-pool-btn.tone-amber { border-left-color: var(--amber); }
.right-pool-btn.tone-amber .rp-dot { color: var(--amber); box-shadow: 0 0 6px var(--amber); }
.right-pool-btn.tone-amber .rp-tag { color: var(--amber); background: rgba(245, 158, 11, 0.14); }
.right-pool-btn.tone-rose { border-left-color: var(--rose); }
.right-pool-btn.tone-rose .rp-dot { color: var(--rose); box-shadow: 0 0 6px var(--rose); }
.right-pool-btn.tone-rose .rp-tag { color: #fca5a5; background: rgba(239, 68, 68, 0.14); }
.rail-empty { font-size: 11.5px; color: var(--text-dim); padding: 4px; }
.rail-servers { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.right-server-tab { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; border: 1px solid var(--border); font-size: 12px; color: var(--text-secondary); transition: var(--t); }
.right-server-tab:hover { color: var(--text-main); background: var(--bg-card-hover); }
.right-server-tab.is-host { background: rgba(56, 189, 248, 0.18); border-color: rgba(56, 189, 248, 0.72); color: var(--text-main); box-shadow: 0 0 12px rgba(56, 189, 248, 0.25); }
.right-server-tab.is-off { opacity: .45; }
.right-server-num { display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 4px; border-radius: 4px; background: rgba(255, 255, 255, 0.06); font: 10.5px var(--mono); color: var(--text-secondary); flex: none; }
.rs-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.host-pill { display: inline-flex; align-items: center; font: 700 9.5px var(--mono); letter-spacing: .05em; padding: 1px 6px; border-radius: 4px; color: #000; background: var(--emerald); flex: none; }

/* mobile chrome (hidden on desktop) */
.mobile-topbar, .bottom-nav, .fab, .drawer-backdrop { display: none; }

/* =========================================================== page heads / panels */

.page-head, .section-title-bar, .section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.section-title-bar, .section-head { margin-bottom: 14px; align-items: center; }
.page-titles { max-width: 760px; min-width: 0; }
.page-head h1, .detail-head h1 { font-size: 16px; font-weight: 600; letter-spacing: -0.1px; }
.page-head p { font-size: 12px; color: var(--text-dim); margin-top: 3px; }
.section-title, .section-head h2 { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 7px; }
.section-desc, .section-head p { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.page-actions { margin-left: auto; }
.page-actions, .section-actions, .toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.toolbar { margin-top: 6px; }
.sub-h { font: 600 10.5px var(--mono); color: var(--text-dim); margin-bottom: 8px; text-transform: uppercase; letter-spacing: .06em; }

.panel, .card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius); min-width: 0; }
.panel, .card.pad { padding: 18px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-lg { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.narrow { max-width: 760px; }
.card.pad > p, .panel > p { margin-bottom: 12px; }
.card.pad > .field, .card.pad > .grid-2, .card.pad > .toggle, .panel > .field, .panel > .grid-2 { margin-bottom: 14px; }

.notice { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg-card); color: var(--text-secondary); font-size: 12px; }
.notice .icon { color: var(--aqua); flex: none; }
.error-box { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 8px; background: rgba(239, 68, 68, 0.12); border: 1px solid rgba(239, 68, 68, 0.28); color: var(--rose-text); font-size: 12.5px; }
.error-box .icon { flex: none; margin-top: 1px; }
.error-box strong { color: #fff; }

.loading { display: flex; align-items: center; gap: 10px; color: var(--text-dim); font-size: 12.5px; padding: 24px 4px; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(160, 224, 239, 0.15); border-top-color: var(--aqua); animation: spin .7s linear infinite; }

.empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 36px 20px; gap: 6px; }
.empty-icon { width: 40px; height: 40px; border-radius: 8px; display: grid; place-items: center; color: var(--aqua); background: var(--bg-card); border: 1px solid var(--border); margin-bottom: 6px; }
.empty h3 { font-size: 13.5px; font-weight: 600; }
.empty p { color: var(--text-dim); font-size: 12.5px; max-width: 440px; }
.empty .btn { margin-top: 10px; }

/* =========================================================== buttons */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 14px; min-height: 40px; border-radius: 8px;
    border: 1px solid transparent; font-size: 12.5px; font-weight: 600; white-space: nowrap; cursor: pointer; transition: var(--t);
    touch-action: manipulation; user-select: none; background: none;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.is-busy { cursor: wait; opacity: .7; }
.btn.is-busy .icon { animation: spin .9s linear infinite; }
.btn-sm { min-height: 32px; padding: 6px 11px; font-size: 12px; gap: 6px; }
.btn-xs { min-height: 26px; padding: 3px 9px; font-size: 11.5px; gap: 5px; border-radius: 6px; }
.btn-sm:has(> .icon:only-child), .btn-xs:has(> .icon:only-child) { padding-left: 0; padding-right: 0; aspect-ratio: 1; }
.btn-primary { background: var(--aqua); color: #000; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); color: #000; }
.btn-secondary { background: var(--bg-card); border-color: var(--border); color: var(--text-main); }
.btn-secondary:hover:not(:disabled) { border-color: rgba(160, 224, 239, 0.45); color: var(--aqua); }
.btn-ghost { color: var(--text-secondary); }
.btn-ghost:hover:not(:disabled) { background: var(--bg-card); color: var(--text-main); }
.btn-danger { background: var(--rose-bg); color: var(--rose); border-color: rgba(239, 68, 68, 0.2); }
.btn-danger:hover:not(:disabled) { background: var(--rose); color: #fff; }
.btn-emerald { background: var(--emerald); color: #000; font-weight: 700; }
.btn-emerald:hover:not(:disabled) { filter: brightness(1.1); color: #000; }
.icon-btn { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 6px; border: none; background: transparent; color: var(--text-secondary); cursor: pointer; transition: var(--t); }
.icon-btn:hover { background: var(--bg-card-hover); color: var(--text-main); }

/* =========================================================== forms */

.field, .field-wrap { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field-wrap > label { font-size: 11px; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: .5px; }
.field > label .mono, .field-wrap > label .mono { text-transform: none; letter-spacing: 0; color: var(--text-main); }
.hint { font-size: 11px; color: var(--text-dim); }
.field-meta { display: flex; justify-content: flex-end; margin-top: -2px; }
.counter { font-size: 10.5px; color: var(--text-dim); }
.counter.over { color: var(--rose); }

.input {
    width: 100%; min-height: 38px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg-input); color: var(--text-main);
    padding: 9px 12px; font-size: 13px; outline: none; transition: var(--t); min-width: 0;
}
.input::placeholder { color: #52525b; }
.input:focus { border-color: var(--aqua); box-shadow: 0 0 0 3px rgba(160, 224, 239, 0.15); }
.input.invalid { border-color: rgba(239, 68, 68, 0.5); }
.input:disabled { opacity: .55; }
.input[type="number"] { font-family: var(--mono); }
.input-sm { min-height: 32px; padding: 6px 10px; font-size: 12px; }
.textarea { min-height: 92px; resize: vertical; line-height: 1.5; }
.textarea-tall { min-height: 160px; }
.select {
    appearance: none; padding-right: 34px; cursor: pointer;
    background-image: linear-gradient(45deg, transparent 50%, var(--text-dim) 50%), linear-gradient(135deg, var(--text-dim) 50%, transparent 50%);
    background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px; background-repeat: no-repeat;
}
.select option, .select optgroup { background: #101014; color: var(--text-main); }

.toggle { display: inline-flex; align-items: center; gap: 11px; cursor: pointer; user-select: none; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-track { position: relative; width: 36px; height: 20px; border-radius: 999px; background: var(--bg-card-hover); border: 1px solid var(--border-focus); transition: var(--t); flex: none; }
.toggle-thumb { position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--text-secondary); transition: transform .18s ease, background .18s ease; }
.toggle input:checked + .toggle-track { background: rgba(16, 185, 129, 0.2); border-color: rgba(16, 185, 129, 0.6); }
.toggle input:checked + .toggle-track .toggle-thumb { transform: translateX(16px); background: var(--emerald); }
.toggle input:focus-visible + .toggle-track { box-shadow: 0 0 0 3px rgba(160, 224, 239, 0.15); }
.toggle-text { display: flex; flex-direction: column; font-size: 12.5px; font-weight: 600; }
.toggle-text small { font-size: 11px; color: var(--text-dim); font-weight: 400; }

.segmented { display: inline-flex; padding: 3px; gap: 3px; border-radius: 8px; background: var(--bg-input); border: 1px solid var(--border); flex: none; }
.segmented button { min-height: 30px; padding: 0 12px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--text-secondary); font-size: 12px; font-weight: 600; cursor: pointer; transition: var(--t); }
.segmented button:hover { color: var(--text-main); }
.segmented button.on { background: var(--aqua-bg); border-color: rgba(160, 224, 239, 0.35); color: var(--aqua); }

.filters { display: flex; gap: 10px; flex-wrap: wrap; }
.filters .select { width: auto; min-width: 180px; }
.search { position: relative; flex: 1; min-width: 220px; max-width: 460px; }
.search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-dim); pointer-events: none; }
.search .input { padding-left: 36px; }
.inline-form { display: flex; align-items: flex-end; gap: 10px; }
.inline-form .field { width: 160px; }
.color-row { display: flex; gap: 8px; }
.color-swatch { width: 38px; height: 38px; flex: none; border-radius: 8px; border: 1px solid var(--border); background: var(--bg-input); padding: 5px; cursor: pointer; }
.color-swatch::-webkit-color-swatch-wrapper { padding: 0; }
.color-swatch::-webkit-color-swatch { border: none; border-radius: 4px; }
.color-swatch::-moz-color-swatch { border: none; border-radius: 4px; }

/* =========================================================== pills / tags / badges */

.pill { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap; border: 1px solid; flex: none; }
.pill-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-neutral { color: var(--text-secondary); background: rgba(255, 255, 255, 0.03); border-color: var(--border); }
.pill-cyan { color: var(--emerald); background: rgba(16, 185, 129, 0.12); border-color: rgba(16, 185, 129, 0.3); }
.pill-cyan .pill-dot { box-shadow: 0 0 6px var(--emerald); }
.pill-blue { color: var(--aqua); background: var(--aqua-bg); border-color: rgba(160, 224, 239, 0.3); }
.pill-amber { color: var(--amber); background: rgba(245, 158, 11, 0.12); border-color: rgba(245, 158, 11, 0.3); }
.pill-green { color: var(--emerald); background: rgba(16, 185, 129, 0.12); border-color: rgba(16, 185, 129, 0.3); }
.pill-rose { color: #f87171; background: rgba(239, 68, 68, 0.12); border-color: rgba(239, 68, 68, 0.3); }

.tag { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: 4px; font: 600 10.5px var(--mono); color: var(--text-secondary); background: var(--bg-card); border: 1px solid var(--border); white-space: nowrap; }
.tag-cyan, .tag-aqua { color: var(--aqua); border-color: rgba(160, 224, 239, 0.3); background: var(--aqua-bg); }
.tag-emerald { color: var(--emerald); border-color: rgba(16, 185, 129, 0.3); background: var(--emerald-bg); }

.badge { display: inline-flex; align-items: center; justify-content: center; font: 700 10px var(--mono); text-transform: uppercase; padding: 2px 6px; border-radius: 4px; border: 1px solid; letter-spacing: .03em; }
.badge-ok { color: var(--emerald); background: rgba(16, 185, 129, 0.12); border-color: rgba(16, 185, 129, 0.3); }
.badge-error, .badge-err { color: #f87171; background: rgba(239, 68, 68, 0.12); border-color: rgba(239, 68, 68, 0.3); }
.badge-warn { color: var(--amber); background: rgba(245, 158, 11, 0.12); border-color: rgba(245, 158, 11, 0.3); }
.badge-info { color: var(--sky); background: rgba(56, 189, 248, 0.12); border-color: rgba(56, 189, 248, 0.3); }
.badge-step { color: var(--aqua); background: rgba(160, 224, 239, 0.12); border-color: rgba(160, 224, 239, 0.3); }

.status-mono { font: 600 11.5px var(--mono); text-transform: uppercase; letter-spacing: .02em; }

.chips, .chip-list { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; }
.chip { display: inline-flex; align-items: center; min-height: 26px; padding: 2px 9px; border-radius: 6px; background: var(--bg-input); border: 1px solid var(--border); font-size: 12px; color: var(--text-main); }
.chip a { color: var(--text-main); }
.chip-btn { cursor: pointer; font-size: 11.5px; color: var(--aqua); transition: var(--t); }
.chip-btn:hover { border-color: rgba(160, 224, 239, 0.45); background: var(--aqua-bg); }

.countdown { font-variant-numeric: tabular-nums; }
.countdown-strong { color: var(--aqua); font-weight: 600; }
time.t { font-size: 11.5px; color: var(--text-secondary); white-space: nowrap; }

/* =========================================================== dashboard */

.metrics-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.metric-card { display: flex; flex-direction: column; gap: 6px; padding: 18px; border-radius: 8px; background: var(--bg-surface); border: 1px solid var(--border); color: var(--text-main); transition: var(--t); min-width: 0; }
a.metric-card:hover { border-color: var(--border-focus); background: var(--bg-card); color: var(--text-main); }
.metric-title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .6px; color: var(--text-dim); }
.metric-value { font: 700 24px/1.2 var(--mono); letter-spacing: -0.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.metric-value .countdown { color: inherit; }
.metric-footer { font-size: 11px; color: var(--text-secondary); }

.link-ext { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.msg-line { font: 11.5px var(--mono); color: var(--text-secondary); }
.dir-out { color: var(--sky); }
.dir-in { color: var(--violet); }
.cell-msg { max-width: 420px; }
.cell-msg .msg-line { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-strong { color: var(--text-main); font-weight: 600; }
a.cell-strong:hover { color: var(--aqua); }

/* feeds (server detail) */
.feed { list-style: none; }
.feed-row { display: flex; align-items: center; justify-content: space-between; gap: 6px 12px; flex-wrap: wrap; padding: 9px 0; border-top: 1px solid var(--border); }
.feed-row:first-child { border-top: none; }
.feed-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.feed-meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.feed-meta:empty { display: none; }
.feed-side { display: flex; align-items: center; gap: 12px; flex: none; }
.route { display: inline-flex; align-items: center; gap: 7px; min-width: 0; font-weight: 550; flex-wrap: wrap; }
.route .icon { color: var(--aqua); flex: none; }
.route-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }

/* =========================================================== partner network */

.pool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 14px; align-items: start; }
.pool-card { display: flex; flex-direction: column; gap: 12px; padding: 14px; border-radius: 8px; background: var(--bg-card); border: 1px solid var(--border); transition: var(--t); min-width: 0; }
.pool-card.selected { border-color: rgba(56, 189, 248, 0.55); box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.2); }
.pool-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pool-card-title { display: flex; align-items: center; gap: 8px; min-width: 0; border: none; background: none; cursor: pointer; text-align: left; padding: 0; color: var(--text-main); }
.pool-card-title:hover .pool-card-name { color: var(--aqua); }
.pool-chip { font: 600 10.5px var(--mono); color: #c4b5fd; background: rgba(139, 92, 246, 0.14); border: 1px solid rgba(139, 92, 246, 0.35); padding: 1px 6px; border-radius: 4px; flex: none; }
.pool-card-name { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: var(--t); }
.label-mono { display: block; font: 600 10px var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--text-dim); }
.phase { display: flex; flex-direction: column; gap: 6px; }
.phase-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.phase-label { font: 600 11px var(--mono); text-align: right; }
.phase-bar { height: 4px; border-radius: 4px; background: rgba(255, 255, 255, 0.06); overflow: hidden; position: relative; }
.phase-fill { display: block; height: 100%; border-radius: 4px; background: currentColor; transition: width .6s ease; }
.phase-bar.is-indeterminate .phase-fill { width: 35%; position: absolute; animation: slide 1.4s ease-in-out infinite; }
@keyframes slide { from { left: -35%; } to { left: 100%; } }
.pool-box { background: var(--bg-input); border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px; display: flex; flex-direction: column; gap: 10px; }
.pool-box-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.mono-val { display: block; font: 600 12.5px var(--mono); color: var(--text-main); margin-top: 2px; overflow-wrap: anywhere; }
.pool-box-foot { display: flex; flex-direction: column; align-items: center; gap: 5px; padding-top: 8px; border-top: 1px solid var(--border); }
.onoff { font: 700 10px var(--mono); padding: 2px 9px; border-radius: 20px; color: var(--text-dim); border: 1px solid var(--border-focus); background: var(--bg-card); }
.onoff.on { color: var(--emerald); border-color: rgba(16, 185, 129, 0.4); background: var(--emerald-bg); }
.pool-servers { display: flex; flex-direction: column; gap: 7px; }
.server-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.server-chip { font: 11px var(--mono); color: var(--text-secondary); background: var(--bg-input); border: 1px solid var(--border); border-radius: 4px; padding: 2px 7px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: var(--t); }
.server-chip:hover { color: var(--aqua); border-color: rgba(160, 224, 239, 0.35); }
.server-chip.is-host { color: var(--sky); border-color: rgba(56, 189, 248, 0.6); background: rgba(56, 189, 248, 0.1); }
.server-chip.is-off { opacity: .45; }
.pool-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.pool-actions:empty { display: none; }

.rotation-grid { display: grid; grid-template-columns: minmax(240px, 300px) minmax(0, 1fr); gap: 14px; align-items: start; }
.primary-panel {
    display: flex; flex-direction: column; gap: 14px; padding: 16px; border-radius: 8px;
    background: linear-gradient(180deg, rgba(16, 185, 129, 0.08), rgba(12, 12, 14, 0.95)); border: 1.5px solid rgba(16, 185, 129, 0.35);
}
.primary-pill { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; font: 700 10px var(--mono); text-transform: uppercase; letter-spacing: .05em; color: var(--emerald); background: rgba(16, 185, 129, 0.12); border: 1px solid rgba(16, 185, 129, 0.35); padding: 3px 8px; border-radius: 4px; }
.primary-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--emerald); box-shadow: 0 0 6px var(--emerald); }
.primary-id { display: flex; align-items: center; gap: 12px; min-width: 0; }
.primary-id > div { display: flex; flex-direction: column; min-width: 0; }
.primary-id .mono { overflow-wrap: anywhere; }
.avatar-box { width: 46px; height: 46px; border-radius: 8px; display: grid; place-items: center; flex: none; font: 700 15px var(--mono); color: var(--emerald); background: rgba(16, 185, 129, 0.12); border: 1px solid rgba(16, 185, 129, 0.35); }
.primary-name { font-size: 16px; font-weight: 700; color: var(--text-main); overflow-wrap: anywhere; }
.primary-text { font-size: 12px; color: var(--text-secondary); }
.primary-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding-top: 12px; border-top: 1px solid rgba(16, 185, 129, 0.2); }
.rotation-table { max-height: 520px; overflow-y: auto; }
.row-host td { background: rgba(56, 189, 248, 0.08); }
.row-actions { display: inline-flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.table td .host-pill, .table td .tag { margin-right: 6px; }

/* =========================================================== tables */

.table-wrapper, .table-card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.table th { text-align: left; padding: 10px 14px; background: var(--bg-card); color: var(--text-dim); font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); color: var(--text-secondary); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr { transition: var(--t); }
.table tbody tr:hover td { background: var(--bg-card-hover); color: var(--text-main); }
.row-link { cursor: pointer; }
.row-link:focus-visible { outline: 2px solid rgba(160, 224, 239, 0.6); outline-offset: -2px; }
.cell-name { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.cell-name strong { font-weight: 600; color: var(--text-main); }
.cell-end { text-align: right; }
.table td .mono, .table td .status-mono { white-space: nowrap; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.pager-btns { display: flex; gap: 8px; }
.pager-info { margin-top: 10px; }

/* =========================================================== server detail */

.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--text-secondary); font-size: 12.5px; font-weight: 500; align-self: flex-start; }
.back-link:hover { color: var(--aqua); }
.detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; flex-wrap: wrap; margin-top: -8px; }
.detail-title { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.detail-title h1 { font-size: 18px; font-weight: 700; overflow-wrap: anywhere; }
.detail-pills { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 18px; align-items: start; }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); background: var(--bg-input); border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.facts > div { padding: 10px 12px; min-width: 0; box-shadow: 1px 0 0 var(--border), 0 1px 0 var(--border); }
.facts dt { font: 600 10px var(--mono); color: var(--text-dim); text-transform: uppercase; letter-spacing: .05em; }
.facts dd { font-size: 12.5px; font-weight: 550; margin-top: 3px; overflow-wrap: anywhere; color: var(--text-main); }
.facts-tight { margin-top: 14px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-top: 1px solid var(--border); }
.setting-row:first-of-type { border-top: none; padding-top: 0; }
.setting-row p { margin-top: 2px; }

.ad-list, .rule-list { list-style: none; display: flex; flex-direction: column; }
.ad-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; padding: 14px 0; border-top: 1px solid var(--border); }
.ad-row:first-child { border-top: none; padding-top: 0; }
.ad-row-main { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.ad-row-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ad-snippet { color: var(--text-secondary); font-size: 12.5px; overflow-wrap: anywhere; }
.rule { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.rule:first-child { border-top: none; padding-top: 0; }
.rule strong { font-weight: 600; }
.preview-meta { display: flex; gap: 8px; flex-wrap: wrap; }

/* =========================================================== ignore rules */

.picker-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 14px 0; }
.picker-col { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 8px; background: var(--bg-card); border: 1px solid var(--border); min-width: 0; }
.picker-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 12.5px; }
.list-count { font-size: 10.5px; color: var(--text-dim); }
.check-list { display: flex; flex-direction: column; max-height: 260px; overflow-y: auto; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-input); }
.check-row { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-bottom: 1px solid var(--border); cursor: pointer; font-size: 12.5px; transition: var(--t); }
.check-row:last-child { border-bottom: none; }
.check-row:hover { background: var(--bg-card-hover); }
.check-row input { accent-color: var(--emerald); width: 15px; height: 15px; flex: none; }
.check-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.check-meta { font-size: 10.5px; color: var(--text-dim); flex: none; max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.check-add { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border: none; border-bottom: 1px solid var(--border); background: var(--aqua-bg); color: var(--aqua); font-size: 12px; font-weight: 600; cursor: pointer; text-align: left; }
.list-empty { padding: 14px 10px; color: var(--text-dim); font-size: 12px; text-align: center; }
.rule-rows { list-style: none; }
.rule-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.rule-row:last-child { border-bottom: none; }
.rule-row:hover { background: var(--bg-card-hover); }
.rule-main { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; flex-wrap: wrap; }
.rule-chip { font: 600 11px var(--mono); padding: 2px 8px; border-radius: 4px; border: 1px solid; overflow-wrap: anywhere; }
.chip-rose { color: #f87171; background: rgba(239, 68, 68, 0.12); border-color: rgba(239, 68, 68, 0.3); }
.chip-amber { color: var(--amber); background: rgba(245, 158, 11, 0.12); border-color: rgba(245, 158, 11, 0.3); }
.rule-date { flex: none; }
.section-actions .input-sm { width: auto; }
.section-actions input.input-sm { width: 220px; max-width: 100%; }

/* =========================================================== console */

.console-panel { background: var(--bg-surface); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; display: flex; flex-direction: column; }
.console-toolbar { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.live-pill { display: inline-flex; align-items: center; gap: 6px; font: 700 11px var(--mono); padding: 4px 9px; border-radius: 20px; color: var(--emerald); background: rgba(16, 185, 129, 0.12); border: 1px solid rgba(16, 185, 129, 0.35); flex: none; }
.live-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 6px currentColor; animation: glow 2s ease-in-out infinite; }
.live-pill.is-paused { color: var(--amber); background: rgba(245, 158, 11, 0.12); border-color: rgba(245, 158, 11, 0.35); }
.live-pill.is-paused .dot { animation: none; }
.console-filters { display: flex; gap: 4px; flex-wrap: wrap; }
.filter-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 4px 10px; border-radius: 6px; border: 1px solid transparent; background: transparent; color: var(--text-secondary); font-size: 12px; font-weight: 600; cursor: pointer; transition: var(--t); }
.filter-btn:hover { background: var(--bg-card); color: var(--text-main); }
.filter-btn.active { background: var(--aqua-bg); color: var(--aqua); border-color: rgba(160, 224, 239, 0.35); }
.fcount { font-size: 10.5px; color: var(--text-dim); }
.filter-btn.active .fcount { color: var(--aqua); }
.console-tools { display: flex; gap: 6px; margin-left: auto; align-items: center; flex-wrap: wrap; }
.console-search { width: 240px; }
.console-log { background: #050507; height: min(62vh, 640px); min-height: 280px; overflow-y: auto; padding: 6px 0; font: 11.5px/1.5 var(--mono); }
.log-row { display: grid; grid-template-columns: 64px 64px minmax(90px, 140px) minmax(0, 1fr); gap: 10px; align-items: start; padding: 5px 12px 5px 10px; border-left: 2px solid transparent; }
.log-row:hover { background: rgba(255, 255, 255, 0.025); }
.log-row .badge { justify-self: start; }
.lv-ok { border-left-color: var(--emerald); }
.lv-error { border-left-color: var(--rose); background: rgba(239, 68, 68, 0.05); }
.lv-warn { border-left-color: var(--amber); }
.lv-step { border-left-color: var(--aqua); }
.lv-info { border-left-color: var(--sky); }
.log-time { color: var(--text-dim); }
.log-tag { color: var(--text-main); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-msg { color: var(--text-secondary); overflow-wrap: anywhere; white-space: pre-wrap; }
.lv-error .log-msg { color: #fca5a5; }
.log-route { color: var(--text-dim); }
.log-empty { padding: 30px; text-align: center; color: var(--text-dim); font-family: Inter, system-ui, sans-serif; font-size: 12.5px; }
.console-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 12px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-dim); }

/* =========================================================== review / reports */

.review-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 460px), 1fr)); gap: 14px; align-items: start; }
.review-list > p { grid-column: 1 / -1; }
.review-card, .report-card { padding: 16px; display: flex; flex-direction: column; gap: 14px; transition: opacity .25s, transform .25s; }
.is-done { opacity: 0; transform: scale(0.98); }
.review-head, .report-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.review-head h2, .report-head h2 { font-size: 14px; font-weight: 600; }
.review-head h2 a, .report-head h2 a { color: var(--text-main); }
.review-head h2 a:hover, .report-head h2 a:hover { color: var(--aqua); }
.review-meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 4px; }
.review-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding-top: 14px; border-top: 1px solid var(--border); }
.review-btns { display: flex; gap: 8px; margin-left: auto; }
.report-reason { border-left: 2px solid var(--rose); padding: 10px 14px; background: rgba(239, 68, 68, 0.08); border-radius: 0 6px 6px 0; color: #fde2e2; font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }
.report-card .facts-tight { margin-top: 0; }

/* =========================================================== welcome */

.welcome-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; margin-bottom: 18px; }
.welcome-preview .sticky { position: sticky; top: calc(var(--header-h) + 16px); display: flex; flex-direction: column; gap: 10px; }
.welcome-preview .section-head { margin-bottom: 0; }
.preview-host { display: flex; flex-direction: column; gap: 10px; }

/* =========================================================== dialog */

.dialog {
    margin: auto; width: min(580px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); border-radius: 8px; border: 1px solid var(--border-focus);
    background: var(--bg-surface); color: var(--text-main); box-shadow: 0 16px 40px rgba(0, 0, 0, 0.8); padding: 0; display: flex; flex-direction: column;
}
.dialog:not([open]) { display: none; }
.dialog[open] { animation: dlg-in .18s ease-out; }
.dialog-wide { width: min(760px, calc(100vw - 24px)); }
.dialog::backdrop { background: rgba(0, 0, 0, 0.85); backdrop-filter: blur(4px); }
@keyframes dlg-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px 12px 20px; border-bottom: 1px solid var(--border); }
.dialog-head h2 { font-size: 15px; font-weight: 600; }
.dialog-body { padding: 18px 20px; overflow-y: auto; }
.dialog-text { color: var(--text-secondary); font-size: 12.5px; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--border); background: var(--bg-card); flex-wrap: wrap; }
.dialog-foot .btn { min-width: 90px; }

/* =========================================================== toasts */

.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 1100; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.toast {
    pointer-events: auto; display: flex; align-items: flex-start; gap: 10px; max-width: 420px; padding: 10px 10px 10px 16px; border-radius: 8px;
    background: var(--bg-card); border: 1px solid var(--border-focus); box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6); font-size: 12.5px;
    opacity: 0; transform: translateY(10px); transition: opacity .2s ease, transform .2s ease;
}
.toast.in { opacity: 1; transform: none; }
.toast.out { opacity: 0; transform: translateY(4px); }
.toast-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex: none; background: var(--aqua); }
.toast-success .toast-dot { background: var(--emerald); box-shadow: 0 0 6px var(--emerald); }
.toast-error { border-color: rgba(239, 68, 68, 0.4); color: var(--rose-text); }
.toast-error .toast-dot { background: var(--rose); }
.toast-msg { flex: 1; line-height: 1.4; }
.toast-x { width: 22px; height: 22px; border: none; background: transparent; color: var(--text-dim); cursor: pointer; display: grid; place-items: center; border-radius: 4px; flex: none; }
.toast-x:hover { color: var(--text-main); background: var(--bg-card-hover); }

/* =========================================================== responsive */

@media (max-width: 1119px) {
    .right-rail { display: none; }
}

@media (max-width: 1180px) {
    .welcome-grid, .detail-grid { grid-template-columns: minmax(0, 1fr); }
    .welcome-preview { order: -1; }
    .welcome-preview .sticky { position: static; }
}

@media (max-width: 1000px) {
    .rotation-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 899px) {
    .app-shell { flex-direction: column; }
    .mobile-topbar {
        display: flex; align-items: center; gap: 12px; height: calc(var(--topbar-h) + env(safe-area-inset-top, 0px)); flex: none;
        padding: env(safe-area-inset-top, 0px) 14px 0; background: var(--bg-surface); border-bottom: 1px solid var(--border); z-index: 120;
    }
    .mobile-brand { display: flex; }
    .mobile-title { flex: 1; font-size: 14px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .hamburger { width: 40px; height: 40px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg-card); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; cursor: pointer; }
    .hamburger span { display: block; width: 16px; height: 1.5px; border-radius: 2px; background: var(--text-main); transition: transform .2s, opacity .2s; }
    .drawer-open .hamburger span:nth-child(1) { transform: translateY(5.5px) rotate(45deg); }
    .drawer-open .hamburger span:nth-child(2) { opacity: 0; }
    .drawer-open .hamburger span:nth-child(3) { transform: translateY(-5.5px) rotate(-45deg); }

    .sidebar {
        position: fixed; top: 0; left: 0; bottom: 0; width: min(280px, 86vw); z-index: 200; transform: translateX(-102%);
        transition: transform .22s ease; box-shadow: 0 0 40px rgba(0, 0, 0, 0.6); padding-top: env(safe-area-inset-top, 0px);
    }
    .drawer-open .sidebar { transform: none; }
    .drawer-backdrop { display: block; position: fixed; inset: 0; z-index: 150; background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(2px); }
    .nav-link { padding: 11px 12px; font-size: 14px; }

    .content-frame { flex: 1; min-height: 0; }
    .top-header { height: 40px; padding: 0 16px; }
    .action-group { display: none; }
    .status-indicator { font-size: 12px; }
    .tab-view { padding: 16px 16px 96px; }

    .bottom-nav {
        display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px; flex: none; min-height: var(--bottomnav-h);
        padding: 6px 4px max(6px, env(safe-area-inset-bottom, 0px)); background: var(--bg-surface); border-top: 1px solid var(--border); z-index: 140;
    }
    .bn-item { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 44px; border-radius: 8px; font-size: 10px; font-weight: 600; color: var(--text-dim); -webkit-tap-highlight-color: transparent; }
    .bn-item.active { color: var(--aqua); background: rgba(160, 224, 239, 0.1); }
    .bn-badge { position: absolute; top: 3px; left: calc(50% + 6px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; font: 700 9.5px/16px var(--mono); text-align: center; background: var(--aqua); color: #000; }
    .bn-badge[data-tone="rose"] { background: var(--rose); color: #fff; }
    .fab {
        display: grid; place-items: center; position: fixed; right: max(16px, env(safe-area-inset-right, 0px));
        bottom: calc(var(--bottomnav-h) + env(safe-area-inset-bottom, 0px) + 16px); z-index: 130; width: 56px; height: 56px; border-radius: 50%;
        border: none; background: var(--aqua); color: #000; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45); cursor: pointer; touch-action: manipulation;
    }
    .fab[hidden] { display: none; }
    .fab:disabled { opacity: .6; }
    body.drawer-open .fab { display: none; }

    .input, .select, .textarea { font-size: 16px; }
    .input-sm { font-size: 14px; }
    .toasts { left: 12px; right: 12px; bottom: calc(var(--bottomnav-h) + env(safe-area-inset-bottom, 0px) + 12px); align-items: stretch; }
    .toast { max-width: none; }
}

@media (max-width: 720px) {
    .page { gap: 18px; }
    .metrics-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .metric-card { padding: 14px; }
    .metric-value { font-size: 20px; }
    .grid-2, .picker-grid { grid-template-columns: minmax(0, 1fr); }
    .panel, .card.pad { padding: 14px; }
    .search { max-width: none; min-width: 0; flex-basis: 100%; }
    .filters .select { flex: 1; min-width: 0; }
    .setting-row { flex-direction: column; align-items: flex-start; }
    .review-actions { flex-direction: column; align-items: stretch; }
    .review-btns { margin-left: 0; }
    .review-btns .btn { flex: 1; }
    .inline-form .field { flex: 1; width: auto; }
    .hide-sm { display: none; }
    .section-actions { width: 100%; }
    .section-actions input.input-sm, .section-actions .select { flex: 1; width: auto; }
    .page-actions .btn, .pool-actions .btn { flex: 1 1 auto; }
    .rule-row { flex-wrap: wrap; }
    .rule-date { order: 3; flex-basis: 100%; }
    .console-tools { margin-left: 0; width: 100%; }
    .console-search { flex: 1 1 100%; width: auto; }
    .console-tools .btn { flex: 1; }
    .log-row { grid-template-columns: 56px auto minmax(0, 1fr); gap: 4px 8px; }
    .log-msg { grid-column: 1 / -1; }
    .cell-msg { max-width: none; }

    /* tables become cards (mf-card-table) */
    .table-wrapper, .table-card { background: transparent; border: none; overflow: visible; }
    .table-stack thead { display: none; }
    .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
    .table-stack tbody { display: flex; flex-direction: column; gap: 10px; }
    .table-stack tr { background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 6px 12px; }
    .table-stack tbody tr:hover td { background: transparent; }
    .table-stack td { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--border); text-align: right; min-width: 0; }
    .table-stack tbody tr td:last-child { border-bottom: none; }
    .table-stack td::before { content: attr(data-label); flex: 0 0 34%; max-width: 34%; font-size: 11px; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: .04em; text-align: left; }
    .table-stack td > * { min-width: 0; max-width: 66%; overflow-wrap: anywhere; }
    .table-stack td.cell-primary { display: block; text-align: left; }
    .table-stack td.cell-primary::before { display: none; }
    .table-stack td.cell-primary > * { max-width: 100%; }
    .table-stack td.cell-msg .msg-line { white-space: normal; text-align: right; }
    .row-host td { background: transparent; }
    .rotation-table { max-height: none; }
    .dialog-foot .btn { flex: 1; }
}

@media (max-width: 400px) {
    .metric-value { font-size: 17px; }
    .pool-box-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* =========================================================== login (verbatim from AutoMsg) */

body.login { display: grid; place-items: center; padding: 20px; }
.login .login-shell { width: 100%; max-width: 420px; }
.login .brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; justify-content: center; }
.brand-mark { width: 42px; height: 42px; border-radius: 10px; background: rgb(0, 0, 0); border: 1px solid rgba(160, 224, 239, 0.35); display: grid; place-items: center; overflow: hidden; flex: none; }
.brand-mark img { width: 100%; height: 100%; display: block; object-fit: cover; }
.login .brand h1 { font-size: 18px; font-weight: 700; letter-spacing: -0.3px; }
.login .brand p { font-size: 12px; color: var(--dim); margin-top: 2px; }
.login .card { background: rgb(10, 10, 12); border: 1px solid rgb(27, 28, 34); border-radius: 12px; padding: 28px 24px; box-shadow: rgba(0, 0, 0, 0.45) 0px 24px 60px; }
.login .card h2 { font-size: 20px; font-weight: 650; margin-bottom: 6px; }
.login .card .sub { font-size: 13px; color: var(--muted); margin-bottom: 22px; line-height: 1.45; }
.login label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 7px; }
.login .field { margin-bottom: 14px; }
.login input { width: 100%; height: 46px; border-radius: 10px; border: 1px solid #23232d; background: rgb(7, 7, 11); color: var(--text); padding: 0 14px; font-size: 14px; outline: none; transition: border-color 0.15s, box-shadow 0.15s; }
.login input:focus { border-color: rgba(160, 224, 239, 0.75); box-shadow: rgba(160, 224, 239, 0.18) 0px 0px 0px 3px; }
.login button { width: 100%; height: 46px; margin-top: 6px; border: none; border-radius: 10px; background: rgb(160, 224, 239); color: rgb(0, 0, 0); font-size: 14px; font-weight: 700; cursor: pointer; transition: background 0.15s, transform 0.1s; touch-action: manipulation; }
.login button:hover { background: rgb(127, 208, 227); }
.login button:active { transform: translateY(1px); }
.login button:disabled { opacity: 0.65; cursor: wait; }
.login .error { display: none; margin-top: 14px; padding: 10px 12px; border-radius: 8px; background: rgba(239, 68, 68, 0.12); border: 1px solid rgba(239, 68, 68, 0.28); color: rgb(254, 202, 202); font-size: 12.5px; line-height: 1.4; }
.login .error.show { display: block; }
.login .foot { margin-top: 16px; text-align: center; font-size: 11px; color: var(--dim); font-family: var(--mono); }
@media (max-width: 420px) {
    body.login { padding: max(24px, env(safe-area-inset-top)) 14px 14px; align-items: flex-start; }
    .login .card { padding: 22px 16px; }
}


/* =========================================================== Discord preview */

.dc-frame { border-radius: 8px; overflow: hidden; border: 1px solid #1e1f22; background: #313338; color: #dbdee1; font-family: "gg sans", "Noto Sans", Inter, system-ui, sans-serif; }
.dc-frame-head { display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 16px; border-bottom: 1px solid #26272b; background: #313338; font-weight: 600; font-size: 14px; color: #f2f3f5; box-shadow: 0 1px 0 rgba(4, 4, 5, 0.2); }
.dc-hash { color: #80848e; font-size: 20px; font-weight: 500; line-height: 1; }
.dc-frame-body { padding: 14px 0 16px; }
.dc-msg { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 16px; padding: 2px 16px; }
.dc-msg:hover { background: #2e3035; }
.dc-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: #5865f2; }
.dc-avatar-fallback { display: grid; place-items: center; color: #fff; font-weight: 700; }
.dc-body { min-width: 0; }
.dc-header { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; line-height: 22px; }
.dc-name { font-weight: 500; color: #f2f3f5; font-size: 15px; }
.dc-bot { display: inline-flex; align-items: center; height: 15px; padding: 0 4.5px; border-radius: 3px; background: #5865f2; color: #fff; font-size: 10px; font-weight: 600; letter-spacing: 0.02em; }
.dc-time { font-size: 12px; color: #949ba4; margin-left: 2px; }
.dc-content { font-size: 15px; line-height: 1.375; overflow-wrap: anywhere; }
.dc-empty { color: #949ba4; font-style: italic; }
.dc-attachments { margin-top: 6px; }
.dc-attachment { max-width: min(100%, 400px); max-height: 300px; border-radius: 8px; display: block; object-fit: contain; background: #2b2d31; }
.img-broken { display: none; }

.dc-embed { margin-top: 6px; max-width: 520px; border-radius: 4px; background: #2b2d31; border-left: 4px solid #1e1f22; padding: 8px 16px 16px 12px; display: flex; flex-direction: column; gap: 8px; }
.dc-embed-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; }
.dc-embed-main { display: flex; flex-direction: column; gap: 8px; min-width: 0; padding-top: 8px; }
.dc-embed-author { font-size: 14px; font-weight: 600; color: #f2f3f5; }
.dc-embed-title { font-size: 16px; font-weight: 600; color: #f2f3f5; }
.dc-embed-title.is-link { color: #00a8fc; }
.dc-embed-desc { font-size: 14px; line-height: 1.375; overflow-wrap: anywhere; }
.dc-embed-thumb { width: 80px; height: 80px; border-radius: 4px; object-fit: cover; margin-top: 8px; }
.dc-embed-image { max-width: 100%; max-height: 300px; border-radius: 4px; object-fit: contain; align-self: flex-start; }
.dc-embed-footer { font-size: 12px; color: #dbdee1; opacity: 0.85; }

.md-p { white-space: pre-wrap; }
.md-p:empty { min-height: 1.375em; }
.md strong { font-weight: 700; color: inherit; }
.md-code { font-family: "gg mono", Consolas, var(--mono); font-size: 0.85em; background: #2b2d31; border: 1px solid #1e1f22; border-radius: 4px; padding: 0.1em 0.3em; }
.dc-embed .md-code { background: #1e1f22; }
.md-pre { font-family: "gg mono", Consolas, var(--mono); font-size: 0.875em; background: #2b2d31; border: 1px solid #1e1f22; border-radius: 4px; padding: 8px; margin: 4px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.md-link { color: #00a8fc; }
.md-link:hover { color: #00a8fc; }
.md-mention { background: rgba(88, 101, 242, 0.3); color: #c9cdfb; border-radius: 3px; padding: 0 2px; font-weight: 500; }
.md-time { background: rgba(255, 255, 255, 0.06); border-radius: 3px; padding: 0 2px; }
.md-spoiler { background: #1e1f22; color: transparent; border-radius: 3px; cursor: pointer; }
.md-spoiler.open { background: rgba(255, 255, 255, 0.1); color: inherit; }
.md-sub { font-size: 12px; color: #949ba4; line-height: 1.33; }
.md-sub .md-link { color: #00a8fc; }
.md-h1 { font-size: 1.5em; font-weight: 700; margin: 8px 0 4px; color: #f2f3f5; }
.md-h2 { font-size: 1.25em; font-weight: 700; margin: 8px 0 4px; color: #f2f3f5; }
.md-h3 { font-size: 1em; font-weight: 700; margin: 8px 0 4px; color: #f2f3f5; }
.md-quote { border-left: 4px solid #4e5058; padding: 0 8px 0 12px; margin: 2px 0; white-space: pre-wrap; }
.md-ul, .md-ol { padding-left: 1.4em; margin: 2px 0; }
.md-emoji { color: #949ba4; }


@media (max-width: 720px) {
    .dc-msg { grid-template-columns: 36px minmax(0, 1fr); gap: 12px; padding: 2px 12px; }
    .dc-avatar { width: 36px; height: 36px; }
    .dc-embed { padding: 6px 12px 12px 10px; }
    .dc-embed-thumb { width: 56px; height: 56px; }
}
.page > div:empty { display: none; }
