:root {
    --bg: #f6f8fc;
    --panel: #ffffff;
    --panel-soft: #f9fbff;
    --ink: #111827;
    --ink-soft: #344054;
    --muted: #718096;
    --line: #e2e8f2;
    --line-strong: #d4ddec;
    --primary: #2f66f6;
    --primary-dark: #1f52d6;
    --primary-soft: #edf3ff;
    --violet: #7258f5;
    --cyan: #16a7c8;
    --danger: #c9384a;
    --danger-soft: #fff0f2;
    --success: #0b936c;
    --success-soft: #e9faf4;
    --warning: #b66b05;
    --warning-soft: #fff7e6;
    --sidebar-width: 276px;
    --radius: 18px;
    --radius-sm: 11px;
    --shadow: 0 10px 30px rgba(25, 45, 85, .06), 0 2px 7px rgba(25, 45, 85, .04);
    --shadow-hover: 0 16px 38px rgba(36, 71, 140, .1), 0 3px 9px rgba(25, 45, 85, .05);
}

* { box-sizing: border-box; }
html { font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
body { margin: 0; min-width: 320px; font-size: 15px; line-height: 1.5; }
body.menu-open { overflow: hidden; }
a { color: var(--primary); text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 3px solid rgba(47, 102, 246, .2); outline-offset: 2px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: .5rem; font-size: clamp(1.9rem, 3vw, 2.65rem); line-height: 1.08; letter-spacing: -.045em; }
h2 { font-size: 1.14rem; line-height: 1.3; letter-spacing: -.015em; }
h3 { letter-spacing: -.01em; }
code { padding: .15rem .36rem; border: 1px solid var(--line); border-radius: 6px; background: #f7f9fc; color: #3b4a64; font-size: .86em; overflow-wrap: anywhere; }
pre code { border: 0; padding: 0; background: none; }
.icon { width: 20px; height: 20px; flex: 0 0 auto; }
.muted { color: var(--muted); }
.eyebrow { margin-bottom: .55rem; color: var(--primary); font-size: .72rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 40; display: flex; width: var(--sidebar-width); flex-direction: column; overflow-y: auto; border-right: 1px solid var(--line); background: #fff; padding: 22px 15px 17px; color: var(--ink); }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 0 7px; }
.brand { display: flex; align-items: center; gap: 11px; color: #46536a; font-size: 1.23rem; font-weight: 800; letter-spacing: -.025em; }
.brand-mark { display: grid; width: 40px; height: 40px; place-items: center; border-radius: 12px; background: linear-gradient(145deg, #2e67f6 5%, #704ce9 95%); box-shadow: 0 10px 22px rgba(65, 86, 230, .25); color: #fff; font-size: 1.1rem; }
.workspace-label { margin: 30px 12px 8px; color: #9aa6ba; font-size: .66rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.nav { display: grid; gap: 4px; }
.nav a { position: relative; display: flex; min-height: 45px; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; color: #52617a; font-size: .9rem; font-weight: 600; transition: background .18s ease, color .18s ease, transform .18s ease; }
.nav a:hover { background: #f5f7fb; color: var(--ink); transform: translateX(2px); }
.nav a.active { background: linear-gradient(100deg, #eaf0ff, #f2f5ff); color: var(--primary); }
.nav a.active::before { position: absolute; inset: 8px auto 8px -15px; width: 3px; border-radius: 0 5px 5px 0; background: var(--primary); content: ""; }
.nav a .icon { width: 19px; height: 19px; }
.sidebar-user { display: flex; align-items: center; gap: 10px; margin-top: auto; border-top: 1px solid var(--line); padding: 18px 7px 4px; }
.user-avatar { display: grid; width: 36px; height: 36px; flex: 0 0 auto; place-items: center; border: 1px solid #cbd9fa; border-radius: 50%; background: #f2f6ff; color: var(--primary); font-size: .75rem; font-weight: 800; }
.user-details { min-width: 0; flex: 1; }
.user-details strong, .user-details small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-details strong { font-size: .83rem; }
.user-details small { margin-top: 1px; color: var(--muted); font-size: .68rem; }
.link-button, .sidebar-close, .menu-button { display: inline-grid; border: 0; background: none; color: #65748c; cursor: pointer; place-items: center; }
.link-button { width: 34px; height: 34px; border-radius: 9px; }
.link-button:hover { background: var(--danger-soft); color: var(--danger); }
.app-version { margin: 8px 7px 0; color: #a0abba; font-size: .65rem; }
.sidebar-close { display: none; width: 38px; height: 38px; border-radius: 10px; }
.sidebar-backdrop { display: none; }
.main-wrap { min-height: 100vh; margin-left: var(--sidebar-width); }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; height: 76px; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, .88); padding: 0 34px; backdrop-filter: blur(16px); }
.topbar-title { display: flex; align-items: center; gap: 12px; }
.topbar-title strong, .topbar-title small { display: block; }
.topbar-title strong { font-size: .9rem; }
.topbar-title small { margin-top: 1px; color: #8b98aa; font-size: .7rem; }
.topbar-account { display: flex; align-items: center; gap: 9px; color: var(--ink-soft); font-size: .82rem; font-weight: 600; }
.topbar-account .user-avatar { width: 34px; height: 34px; }
.menu-button { display: none; width: 40px; height: 40px; border-radius: 10px; }
.menu-button:hover, .sidebar-close:hover { background: #f1f4f9; color: var(--ink); }
.content { width: min(100%, 1510px); margin: auto; padding: 34px; }

.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.page-heading > div { max-width: 850px; }
.page-heading p { margin-bottom: 0; }
.panel, .stat-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); }
.panel { margin-bottom: 22px; padding: 24px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.panel-heading h2, .panel-heading p { margin-bottom: 0; }
.panel-heading > span { color: var(--muted); font-size: .82rem; }

.button { display: inline-flex; min-height: 40px; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line-strong); border-radius: 10px; background: #fff; padding: 9px 15px; color: var(--ink-soft); font-size: .86rem; font-weight: 700; line-height: 1.2; white-space: nowrap; cursor: pointer; box-shadow: 0 2px 5px rgba(22, 39, 75, .04); transition: border .18s ease, background .18s ease, color .18s ease, transform .18s ease, box-shadow .18s ease; }
.button:hover { border-color: #bac6da; background: #fafcff; color: var(--ink); transform: translateY(-1px); box-shadow: 0 5px 12px rgba(28, 51, 98, .08); }
.button .icon { width: 17px; height: 17px; }
.button.primary { border-color: var(--primary); background: linear-gradient(135deg, #3470ff, #285ce8); color: #fff; box-shadow: 0 8px 18px rgba(47, 102, 246, .2); }
.button.primary:hover { border-color: var(--primary-dark); background: linear-gradient(135deg, #2b63ee, #204fd1); color: #fff; }
.button.small { min-height: 34px; padding: 7px 10px; font-size: .78rem; }
.button.danger { border-color: #f0cbd1; color: var(--danger); }
.button.danger:hover { border-color: #e8abb4; background: var(--danger-soft); color: #a72839; }
.button:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 17px; margin-bottom: 22px; }
.stat-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat-card { position: relative; min-width: 0; overflow: hidden; padding: 20px; transition: box-shadow .2s ease, transform .2s ease; }
.stat-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.stat-card > span, .stat-card > small { display: block; color: var(--muted); }
.stat-card > span { font-size: .79rem; font-weight: 600; }
.stat-card > strong { display: block; margin: .42rem 0 .08rem; font-size: 1.65rem; line-height: 1.2; letter-spacing: -.035em; }
.stat-card > small { font-size: .72rem; }
.stat-card.has-icon { min-height: 112px; padding-left: 77px; }
.stat-icon { position: absolute; top: 22px; left: 20px; display: grid; width: 42px; height: 42px; place-items: center; border-radius: 12px; background: var(--primary-soft); color: var(--primary); }
.stat-card > .stat-icon { display: grid; color: var(--primary); }
.stat-icon.violet { background: #f1eeff; color: var(--violet); }
.stat-icon.green { background: var(--success-soft); color: var(--success); }
.stat-icon.amber { background: var(--warning-soft); color: var(--warning); }
.stat-card > .stat-icon.violet { color: var(--violet); }
.stat-card > .stat-icon.green { color: var(--success); }
.stat-card > .stat-icon.amber { color: var(--warning); }
.stat-icon .icon { width: 21px; height: 21px; }
.stat-progress { height: 5px; overflow: hidden; margin-top: 12px; border-radius: 99px; background: #edf0f5; }
.stat-progress > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary), #6e7ff5); }

.hero-panel { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 28px; overflow: hidden; margin-bottom: 22px; border: 1px solid #cddafd; border-radius: 24px; background: linear-gradient(115deg, #fff 10%, #f7f9ff 58%, #eaf0ff 100%); padding: clamp(25px, 4vw, 42px); box-shadow: 0 15px 38px rgba(60, 89, 155, .08); }
.hero-panel::after { position: absolute; top: -140px; right: -70px; width: 340px; height: 340px; border-radius: 50%; background: rgba(75, 112, 246, .08); content: ""; }
.hero-content { position: relative; z-index: 1; align-self: center; }
.hero-content h1 { max-width: 820px; font-size: clamp(2rem, 4vw, 3.1rem); }
.hero-content p { max-width: 720px; color: var(--muted); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.hero-meter { position: relative; z-index: 1; display: flex; min-width: 280px; align-items: center; gap: 18px; border: 1px solid rgba(255,255,255,.8); border-radius: 20px; background: rgba(255,255,255,.8); padding: 20px; box-shadow: 0 12px 30px rgba(44, 70, 129, .09); backdrop-filter: blur(10px); }
.ring { --value: 0; --ring-color: var(--primary); position: relative; display: grid; width: 94px; height: 94px; flex: 0 0 auto; place-items: center; border-radius: 50%; background: conic-gradient(var(--ring-color) calc(var(--value) * 1%), #e9edf4 0); }
.ring::before { position: absolute; width: 72px; height: 72px; border-radius: 50%; background: #fff; content: ""; box-shadow: inset 0 0 0 1px #edf0f5; }
.ring-value { position: relative; z-index: 1; font-size: 1.15rem; font-weight: 800; letter-spacing: -.04em; }
.ring-copy span, .ring-copy strong, .ring-copy small { display: block; }
.ring-copy span { color: var(--muted); font-size: .7rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.ring-copy strong { margin: 3px 0 1px; font-size: 1.45rem; letter-spacing: -.04em; }
.ring-copy small { color: var(--muted); font-size: .72rem; }
.ring.green { --ring-color: #12a879; }
.ring.violet { --ring-color: #7657f5; }
.ring.amber { --ring-color: #e69a16; }
.chart-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, .7fr); gap: 22px; }
.ring-overview { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; padding: 22px 0 5px; }
.ring-item { text-align: center; }
.ring-item .ring { margin: 0 auto 12px; }
.ring-item strong, .ring-item small { display: block; }
.ring-item small { color: var(--muted); font-size: .75rem; }
.shortcut-list { display: grid; gap: 2px; }
.shortcut { display: flex; align-items: center; gap: 12px; border-radius: 12px; padding: 10px; color: var(--ink); transition: background .18s ease; }
.shortcut:hover { background: #f6f8fc; }
.shortcut-icon { display: grid; width: 39px; height: 39px; flex: 0 0 auto; place-items: center; border: 1px solid var(--line); border-radius: 11px; color: var(--primary); }
.shortcut-copy { min-width: 0; flex: 1; }
.shortcut-copy strong, .shortcut-copy small { display: block; }
.shortcut-copy strong { font-size: .84rem; }
.shortcut-copy small { color: var(--muted); font-size: .7rem; }
.shortcut > .icon { width: 16px; color: var(--muted); }

.bar-chart { display: flex; height: 230px; align-items: end; gap: clamp(5px, 1.3vw, 14px); padding: 28px 6px 0; border-bottom: 1px solid var(--line); background: repeating-linear-gradient(to bottom, transparent 0, transparent 54px, #eef1f6 55px); }
.bar-column { display: flex; min-width: 0; flex: 1; flex-direction: column; align-items: center; justify-content: flex-end; gap: 7px; height: 100%; }
.bar { position: relative; width: min(100%, 34px); min-height: 3px; border-radius: 7px 7px 2px 2px; background: linear-gradient(180deg, #668bf7, #3267ed); box-shadow: 0 5px 12px rgba(47, 102, 246, .16); }
.bar:hover::after { position: absolute; bottom: calc(100% + 6px); left: 50%; z-index: 5; padding: 4px 7px; border-radius: 6px; background: var(--ink); color: #fff; content: attr(data-value); font-size: .66rem; white-space: nowrap; transform: translateX(-50%); }
.bar-column small { overflow: hidden; width: 100%; color: #8a96a9; font-size: .62rem; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.chart-legend { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .72rem; }
.chart-legend::before { width: 9px; height: 9px; border-radius: 3px; background: var(--primary); content: ""; }

.callout { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.callout p { max-width: 750px; margin: 0; color: var(--muted); }
.status-dot { color: var(--success); font-size: .82rem; font-weight: 700; white-space: nowrap; }
.status-dot::before { display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: #21b887; box-shadow: 0 0 0 5px #e4f8f1; content: ""; }

.alert { margin-bottom: 20px; border: 1px solid; border-radius: 12px; padding: 13px 15px; }
.alert.success { border-color: #bcebdc; background: var(--success-soft); color: #087456; }
.alert.error { border-color: #f2c9cf; background: var(--danger-soft); color: #a52d3d; }
.alert ul { margin: 0; padding-left: 20px; }
.alert.compact { margin: 20px 0 0; font-size: .82rem; }
.badge { display: inline-flex; align-items: center; border-radius: 99px; background: #eef2f7; padding: 4px 9px; color: #536176; font-size: .72rem; font-weight: 800; line-height: 1.35; }
.badge.active, .badge.completed, .badge.ready { background: var(--success-soft); color: #087657; }
.badge.paused, .badge.warning, .badge.queued, .badge.running, .badge.partial, .badge.processing, .badge.pending { background: var(--warning-soft); color: #9a5a03; }
.badge.error, .badge.critical, .badge.failed, .badge.disabled, .badge.cancelled { background: var(--danger-soft); color: #ad3041; }
.badge.info { background: var(--primary-soft); color: #2859ce; }

.table-wrap { overflow-x: auto; scrollbar-width: thin; }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th { border-bottom: 1px solid var(--line); background: #f8fafd; padding: 11px 12px; color: #66758c; font-size: .7rem; font-weight: 800; letter-spacing: .06em; text-align: left; text-transform: uppercase; white-space: nowrap; }
th:first-child { border-radius: 9px 0 0 9px; }
th:last-child { border-radius: 0 9px 9px 0; }
td { border-bottom: 1px solid var(--line); padding: 14px 12px; vertical-align: middle; }
tbody tr { transition: background .15s ease; }
tbody tr:hover { background: #fbfcff; }
tr:last-child td { border-bottom: 0; }
td small { display: block; margin-top: 3px; color: #8490a3; }
.actions { display: flex; align-items: center; justify-content: flex-end; gap: 7px; }
.actions form { margin: 0; }
.empty { padding: 48px 20px; color: var(--muted); text-align: center; }
.empty h3 { color: var(--ink); }
.compact-empty { padding: 26px 10px; }

.form-panel { max-width: 940px; }
.form-stack, .form-grid { display: grid; gap: 17px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-panel > label, .form-panel > .form-grid { margin-bottom: 18px; }
label { display: grid; gap: 7px; color: var(--ink-soft); font-size: .82rem; font-weight: 700; }
label small { color: var(--muted); font-weight: 400; }
input, select, textarea { width: 100%; border: 1px solid var(--line-strong); border-radius: 10px; background: #fff; padding: 10px 12px; color: var(--ink); transition: border .18s ease, box-shadow .18s ease; }
input:hover, select:hover, textarea:hover { border-color: #bdc8db; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 4px rgba(47, 102, 246, .1); }
input[type="color"] { min-height: 43px; padding: 5px; cursor: pointer; }
textarea { resize: vertical; }
textarea[readonly], input[readonly] { background: #f7f9fc; color: #58667c; }
hr { margin: 26px 0; border: 0; border-top: 1px solid var(--line); }
.form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.inline-form { display: flex; align-items: center; gap: 7px; }
.inline-form select { min-width: 120px; }
.check-label { display: flex; align-items: center; gap: 9px; }
.check-label input { width: auto; }
.filter-bar { display: flex; align-items: end; gap: 10px; margin-bottom: 16px; padding: 14px; box-shadow: none; }
.filter-bar > input { flex: 1; }
.filter-bar > select { max-width: 190px; }
.filter-bar label { min-width: 280px; }

.admin-grid { display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 22px; }
.sticky-panel { position: sticky; top: 98px; align-self: start; }
.allocation-form { display: grid; min-width: 500px; gap: 7px; }
.allocation-form > select { max-width: 220px; }
.allocation-fields { display: grid; grid-template-columns: repeat(5, minmax(90px, 1fr)); gap: 6px; }
.allocation-fields input { padding: 7px; font-size: .76rem; }
.plan-create-panel { margin-bottom: 20px; }
.plan-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.plan-card { display: flex; flex-direction: column; gap: 18px; }
.plan-card.is-archived { background: #fafbfc; }
.plan-card-actions { margin-top: auto; border-top: 1px solid var(--line); padding-top: 16px; }
.plan-card .panel-heading h2 { margin: 12px 0 2px; }
.credential-status { display: flex; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 13px; background: #f7f9fc; padding: 14px; }
.credential-status > span { width: 10px; height: 10px; flex: 0 0 auto; border-radius: 50%; background: #aeb5c3; }
.credential-status.configured > span { background: #1aaa7d; box-shadow: 0 0 0 5px #dcf5ec; }
.credential-status small { display: block; margin-top: 3px; color: var(--muted); }
.feature-list { display: grid; gap: 9px; padding-left: 20px; color: var(--muted); }

.tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 16px; padding: 3px; }
.tabs a { border: 1px solid transparent; border-radius: 10px; padding: 9px 13px; color: var(--muted); font-size: .82rem; font-weight: 700; white-space: nowrap; }
.tabs a:hover { background: #fff; color: var(--ink); }
.tabs a.active { border-color: var(--line); background: #fff; color: var(--primary); box-shadow: var(--shadow); }
.log-list { padding: 0; }
.log-row { display: grid; grid-template-columns: 180px 1fr; gap: 20px; border-bottom: 1px solid var(--line); padding: 18px 22px; }
.log-row:last-child { border-bottom: 0; }
.log-row p { margin: 5px 0; color: var(--muted); }
.log-row small, .log-meta time { color: #8a93a5; }
.log-meta { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.log-row details { margin-top: 9px; }
.log-row summary, details > summary { color: var(--primary); font-size: .82rem; cursor: pointer; }
.log-row pre, .agent-site-card pre { overflow: auto; border-radius: 9px; background: #172033; padding: 12px; color: #d8dfed; font-size: .75rem; white-space: pre-wrap; }

.guest-body { display: grid; min-height: 100vh; place-items: center; overflow: hidden; background: radial-gradient(circle at 12% 18%, rgba(64, 109, 246, .16), transparent 30%), radial-gradient(circle at 86% 88%, rgba(113, 77, 232, .12), transparent 28%), #f7f9fd; padding: 30px; }
.guest-body::before { position: fixed; inset: 0; background-image: linear-gradient(#e8edf7 1px, transparent 1px), linear-gradient(90deg, #e8edf7 1px, transparent 1px); background-size: 48px 48px; content: ""; opacity: .35; pointer-events: none; }
.guest-shell { position: relative; width: min(100%, 430px); }
.brand-large { justify-content: center; margin-bottom: 24px; }
.auth-card { border: 1px solid var(--line); border-radius: 24px; background: rgba(255,255,255,.95); padding: 36px; box-shadow: 0 26px 70px rgba(37, 62, 111, .14); backdrop-filter: blur(12px); }
.auth-card .button { width: 100%; margin-top: 4px; }
.error-page { padding: 80px 20px; text-align: center; }
.error-page > span { color: #dbe3f2; font-size: 5rem; font-weight: 900; }
.error-page p { margin-bottom: 24px; color: var(--muted); }

.migration-list { display: grid; gap: 8px; margin-bottom: 22px; padding-left: 20px; }
.history-list, .diagnostic-list { display: grid; }
.history-list > div, .diagnostic-list > div { display: flex; align-items: center; justify-content: space-between; gap: 15px; border-bottom: 1px solid var(--line); padding: 11px 0; }
.history-list time, .diagnostic-list span { color: var(--muted); font-size: .78rem; }
.diagnostic-list strong { font-size: .8rem; text-align: right; }
.file-list, .issue-list { display: grid; }
.file-list > div { display: flex; justify-content: space-between; gap: 15px; border-bottom: 1px solid var(--line); padding: 11px 0; }
.ok-text { color: var(--success); }
.danger-text { color: var(--danger); }
.manifest-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.manifest-grid > div { border: 1px solid var(--line); border-radius: 11px; background: var(--panel-soft); padding: 13px; }
.manifest-grid span, .manifest-grid strong { display: block; }
.manifest-grid span { color: var(--muted); font-size: .72rem; }
.manifest-grid strong { margin-top: 5px; font-size: 1.2rem; }
.import-action { display: flex; align-items: center; justify-content: space-between; }
.import-action h2, .import-action p { margin-bottom: 4px; }
.import-progress { margin-top: 22px; }
.progress-track { height: 9px; overflow: hidden; margin-bottom: 22px; border-radius: 99px; background: #eceff5; }
.progress-track span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), #5e77ef); transition: width .3s; }
.step-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 20px; }
.step-grid > div { border: 1px solid transparent; border-radius: 10px; background: var(--panel-soft); padding: 12px; }
.step-grid > div.current { border-color: #b9cbfa; background: var(--primary-soft); }
.step-grid span, .step-grid strong, .step-grid small { display: block; }
.step-grid span { font-weight: 700; }
.step-grid strong { margin: 4px 0; font-size: 1.15rem; }
.step-grid small { color: var(--muted); }
.issue-list > div { display: grid; grid-template-columns: 80px 1fr; gap: 12px; border-bottom: 1px solid var(--line); padding: 14px 0; }
.issue-list p { margin: 4px 0; color: var(--muted); }

.agent-site-list, .site-grid { display: grid; gap: 20px; }
.agent-site-heading, .site-summary-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.agent-site-heading h2, .site-summary-heading h2 { display: inline-block; margin: 0 0 4px 8px; }
.agent-site-heading p, .site-summary-heading p { margin: 0; }
.agent-site-stats { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: flex-end; gap: 8px; }
.agent-site-stats span { border: 1px solid var(--line); border-radius: 8px; background: var(--panel-soft); padding: 6px 9px; color: var(--muted); font-size: .73rem; }
.instruction-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 22px; border-top: 1px solid var(--line); padding-top: 20px; }
.usage-panel { padding: 0; }
.usage-table { min-width: 1280px; }
.usage-table td { white-space: nowrap; }
.usage-table td:first-child { min-width: 240px; white-space: normal; }
.usage-table td:first-child small { max-width: 310px; overflow: hidden; text-overflow: ellipsis; }
.usage-table td:nth-child(3) > strong, .usage-table td:nth-child(4) > strong, .usage-table td:nth-child(5) > strong { font-variant-numeric: tabular-nums; }
.usage-table th:first-child, .usage-table td:first-child { padding-left: 22px; }
.usage-table th:last-child, .usage-table td:last-child { padding-right: 22px; }
.stat-grid.compact { margin: 22px 0; }
.stat-grid.compact .stat-card { padding: 15px; box-shadow: none; }
.stat-grid.compact .stat-card strong { font-size: 1.25rem; }
.run-summary { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; border: 1px solid #edf0f5; border-radius: 11px; background: #f8fafd; padding: 12px 14px; color: var(--muted); font-size: .79rem; }
.run-summary strong { color: var(--ink); }
.run-summary small { margin-left: auto; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 7px; flex-wrap: wrap; margin-top: 20px; color: var(--muted); font-size: .8rem; }
.conversation-detail { display: grid; gap: 15px; background: #f9fbfe; }
.conversation-message { max-width: min(850px, 88%); border: 1px solid var(--line); border-radius: 15px 15px 15px 4px; background: #fff; padding: 15px 17px; box-shadow: 0 4px 12px rgba(30, 51, 94, .04); }
.conversation-message.user { margin-left: auto; border-color: #cedafb; border-radius: 15px 15px 4px 15px; background: #edf3ff; }
.conversation-message header { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 10px; font-size: .78rem; }
.conversation-message header span, .conversation-message footer { color: var(--muted); }
.conversation-message footer { margin-top: 10px; font-size: .72rem; }

.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.live-page-heading { align-items: center; }
.live-connection { display: inline-flex; align-items: center; gap: 9px; border: 1px solid #bcebdc; border-radius: 999px; background: var(--success-soft); padding: 8px 13px; color: #087456; font-size: .78rem; }
.live-connection > span { width: 8px; height: 8px; border-radius: 50%; background: #19a77a; box-shadow: 0 0 0 5px rgba(25, 167, 122, .12); }
.live-connection.offline { border-color: #f0cbd1; background: var(--danger-soft); color: var(--danger); }
.live-connection.offline > span { background: var(--danger); box-shadow: 0 0 0 5px rgba(201, 56, 74, .1); }
.live-chat-app { display: grid; grid-template-columns: minmax(270px, 330px) minmax(0, 1fr); gap: 18px; height: var(--live-workspace-height, min(660px, calc(100dvh - 240px))); min-height: 320px; }
.live-chat-app > .panel { min-height: 0; margin: 0; }
.live-roster { display: flex; flex-direction: column; overflow: hidden; padding: 0; }
.live-panel-title { display: flex; align-items: center; justify-content: space-between; padding: 20px 20px 13px; }
.live-panel-title h2, .live-panel-title p { margin: 0; }
.live-panel-title p { margin-top: 2px; color: var(--muted); font-size: .75rem; }
.live-pulse { width: 10px; height: 10px; border-radius: 50%; background: #18aa7b; box-shadow: 0 0 0 6px #e5f8f1; }
.live-search { padding: 0 16px 13px; }
.live-search input { min-height: 38px; background: #f8fafd; font-size: .78rem; }
.live-visitor-list { flex: 1; overflow-y: auto; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 8px; scrollbar-width: thin; }
.live-visitor { display: grid; width: 100%; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; border: 0; border-radius: 12px; background: transparent; padding: 10px; color: var(--ink); text-align: left; cursor: pointer; }
.live-visitor:hover { background: #f4f7fc; }
.live-visitor-avatar { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 12px; background: linear-gradient(145deg, #eaf0ff, #f0edff); color: #365ed8; font-size: .69rem; font-weight: 850; }
.live-visitor-avatar.large { width: 43px; height: 43px; border-radius: 14px; }
.live-visitor-copy { min-width: 0; }
.live-visitor-copy strong, .live-visitor-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-visitor-copy strong { font-size: .79rem; }
.live-visitor-copy small { margin-top: 2px; color: var(--muted); font-size: .67rem; }
.live-visitor-copy .live-url { color: #93a0b2; }
.live-card-status { border-radius: 99px; background: var(--primary-soft); padding: 3px 7px; color: var(--primary); font-size: .61rem; font-weight: 800; }
.live-card-status.human { background: var(--success-soft); color: var(--success); }
.live-list-empty { padding: 30px 16px; color: var(--muted); font-size: .78rem; text-align: center; }
.live-list-empty.compact { padding: 15px; }
.live-recent-heading { display: flex; align-items: center; justify-content: space-between; padding: 15px 18px 8px; }
.live-recent-heading h3 { margin: 0; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; }
.live-recent-heading span { color: var(--muted); font-size: .72rem; }
.live-recent-list { max-height: 175px; overflow-y: auto; padding: 0 8px 10px; scrollbar-width: thin; }
.live-recent { display: flex; width: 100%; align-items: center; gap: 9px; border: 0; border-radius: 10px; background: transparent; padding: 8px 10px; color: var(--ink); text-align: left; cursor: pointer; }
.live-recent:hover { background: #f4f7fc; }
.live-recent > span:nth-child(2) { min-width: 0; }
.live-recent strong, .live-recent small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-recent strong { font-size: .74rem; }
.live-recent small { color: var(--muted); font-size: .64rem; }
.live-recent-dot, .live-tab-dot { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: #aab4c2; }
.live-recent-dot.online, .live-tab-dot.online { background: #15aa79; box-shadow: 0 0 0 3px #e4f8f0; }
.live-desk { display: flex; flex-direction: column; overflow: hidden; padding: 0; }
.live-tabs { display: flex; min-height: 54px; align-items: end; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); background: #f8fafd; padding: 8px 10px 0; scrollbar-width: thin; }
.live-tab { display: inline-flex; max-width: 230px; min-width: 145px; height: 45px; align-items: center; gap: 8px; border: 1px solid transparent; border-bottom: 0; border-radius: 11px 11px 0 0; background: transparent; padding: 0 10px; color: #607087; font-size: .72rem; font-weight: 700; cursor: pointer; }
.live-tab > span:nth-child(2) { overflow: hidden; flex: 1; text-overflow: ellipsis; white-space: nowrap; }
.live-tab.active { border-color: var(--line); background: #fff; color: var(--ink); }
.live-tab-close { display: grid; width: 20px; height: 20px; flex: 0 0 auto; place-items: center; border-radius: 6px; color: #8a96a8; font-size: 1rem; }
.live-tab-close:hover { background: #eef1f6; color: var(--ink); }
.live-unread { min-width: 19px; border-radius: 99px; background: var(--primary); padding: 2px 5px; color: #fff; font-size: .6rem; text-align: center; }
.live-stage { display: flex; min-height: 0; flex: 1; flex-direction: column; }
.live-welcome { display: grid; max-width: 520px; margin: auto; place-items: center; padding: 35px; color: var(--muted); text-align: center; }
.live-welcome h2 { margin: 14px 0 7px; color: var(--ink); }
.live-welcome p { margin: 0; }
.live-welcome-icon, .live-welcome-symbol { display: grid; width: 68px; height: 68px; place-items: center; border-radius: 21px; background: linear-gradient(145deg, #edf3ff, #f1edff); color: var(--primary); font-size: 1.6rem; }
.live-welcome-icon .icon { width: 30px; height: 30px; }
.live-conversation-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); padding: 15px 18px; }
.live-conversation-identity { display: flex; min-width: 0; align-items: center; gap: 11px; }
.live-conversation-identity > div { min-width: 0; }
.live-conversation-identity h2, .live-conversation-identity p { overflow: hidden; margin: 0; text-overflow: ellipsis; white-space: nowrap; }
.live-conversation-identity h2 { font-size: .95rem; }
.live-conversation-identity p { color: var(--muted); font-size: .7rem; }
.live-conversation-actions { display: flex; gap: 7px; }
.live-context-bar { display: flex; min-height: 43px; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); background: #fbfcff; padding: 7px 18px; }
.live-inline-status { color: var(--muted); font-size: .69rem; font-weight: 700; }
.live-inline-status::before { display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 50%; background: #aab4c2; content: ""; }
.live-inline-status.online::before { background: #17a97a; }
.live-current-page { min-width: 0; overflow: hidden; margin-left: auto; color: #65758c; font-size: .68rem; text-overflow: ellipsis; white-space: nowrap; }
.live-messages { display: flex; min-height: 0; flex: 1; flex-direction: column; gap: 10px; overflow-y: auto; background: #f8fafd; padding: 20px; scrollbar-width: thin; }
.live-chat-empty { margin: auto; color: var(--muted); font-size: .8rem; text-align: center; }
.live-message { max-width: min(76%, 720px); align-self: flex-start; }
.live-message header { margin: 0 0 4px 4px; color: #8591a4; font-size: .63rem; }
.live-message > div { border: 1px solid var(--line); border-radius: 15px 15px 15px 4px; background: #fff; padding: 10px 13px; white-space: pre-wrap; overflow-wrap: anywhere; box-shadow: 0 3px 9px rgba(25, 45, 85, .04); }
.live-message.operator { align-self: flex-end; }
.live-message.operator header { text-align: right; }
.live-message.operator > div { border-color: #2f66f6; border-radius: 15px 15px 4px 15px; background: #2f66f6; color: #fff; }
.live-message.bot > div { border-color: #d9d3fc; background: #f3f0ff; }
.live-peer-typing { display: flex; align-items: center; align-self: flex-start; gap: 5px; min-height: 18px; border: 1px solid var(--line); border-radius: 15px 15px 15px 4px; background: #fff; padding: 11px 14px; }
.live-peer-typing span { width: 7px; height: 7px; border-radius: 50%; background: #8b97aa; animation: live-typing 1.2s ease-in-out infinite; }
.live-peer-typing span:nth-child(2) { animation-delay: .16s; }
.live-peer-typing span:nth-child(3) { animation-delay: .32s; }
.live-tab-typing { display: inline-flex; align-items: center; gap: 3px; margin-left: 2px; }
.live-tab-typing i { width: 4px; height: 4px; border-radius: 50%; background: currentColor; animation: live-typing 1.2s ease-in-out infinite; }
.live-tab-typing i:nth-child(2) { animation-delay: .16s; }
.live-tab-typing i:nth-child(3) { animation-delay: .32s; }
.live-visitor-left { align-self: center; border-radius: 999px; background: #f1f3f7; padding: 7px 12px; color: #68758a; font-size: .75rem; font-weight: 700; }
@keyframes live-typing { 0%, 60%, 100% { transform: translateY(0); opacity: .45; } 30% { transform: translateY(-4px); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .live-peer-typing span, .live-tab-typing i { animation: none; } .live-peer-typing span:nth-child(2), .live-tab-typing i:nth-child(2) { opacity: .7; } }
.live-composer { display: flex; align-items: end; gap: 9px; border-top: 1px solid var(--line); padding: 12px 15px; }
.live-composer textarea { min-height: 42px; max-height: 110px; resize: none; }
.live-composer .button { min-height: 42px; }

@media (max-width: 1050px) {
    .live-chat-app { grid-template-columns: minmax(240px, 290px) minmax(0, 1fr); }
}

@media (max-width: 800px) {
    .live-chat-app { display: flex; height: auto; min-height: 0; flex-direction: column; }
    .live-roster { height: 360px; flex: 0 0 auto; }
    .live-desk { height: min(620px, calc(100dvh - 96px)); min-height: 420px; }
    .live-page-heading { align-items: flex-start; }
    .live-message { max-width: 88%; }
}

@media (max-width: 560px) {
    .live-desk { height: min(590px, calc(100dvh - 72px)); min-height: 390px; }
    .live-conversation-head { align-items: flex-start; flex-direction: column; }
    .live-conversation-actions, .live-conversation-actions .button { width: 100%; }
    .live-context-bar { align-items: flex-start; flex-wrap: wrap; }
    .live-current-page { width: 100%; margin-left: 0; }
    .live-tabs { min-height: 50px; }
    .live-tab { min-width: 135px; }
    .live-message { max-width: 94%; }
    .live-composer { align-items: stretch; flex-direction: column; }
}

@media (max-width: 1220px) {
    .plan-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .hero-meter { min-width: 250px; }
}

@media (max-width: 1080px) {
    :root { --sidebar-width: 252px; }
    .content { padding: 28px; }
    .stat-grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .admin-grid, .instruction-grid, .chart-grid { grid-template-columns: 1fr; }
    .sticky-panel { position: static; }
    .ring-overview { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 800px) {
    .sidebar { width: min(88vw, 296px); transform: translateX(-103%); transition: transform .24s ease; }
    .sidebar.open { transform: translateX(0); box-shadow: 20px 0 50px rgba(26, 40, 72, .18); }
    .sidebar-close { display: inline-grid; }
    .sidebar-backdrop { position: fixed; inset: 0; z-index: 35; display: block; visibility: hidden; border: 0; background: rgba(18, 29, 52, .36); opacity: 0; transition: opacity .22s ease, visibility .22s ease; }
    body.menu-open .sidebar-backdrop { visibility: visible; opacity: 1; }
    .main-wrap { margin-left: 0; }
    .topbar { height: 68px; padding: 0 18px; }
    .menu-button { display: inline-grid; }
    .topbar-account > span:last-child { display: none; }
    .content { padding: 22px 18px 34px; }
    .page-heading, .site-summary-heading, .agent-site-heading { flex-direction: column; }
    .page-heading { margin-bottom: 22px; }
    .page-heading > .button { width: 100%; }
    .hero-panel { grid-template-columns: 1fr; padding: 26px 22px; }
    .hero-meter { width: 100%; min-width: 0; }
    .stat-grid, .stat-grid.four, .form-grid.two, .manifest-grid, .step-grid { grid-template-columns: 1fr; }
    .plan-grid { grid-template-columns: 1fr; }
    .ring-overview { gap: 10px; }
    .actions { width: 100%; justify-content: flex-start; flex-wrap: wrap; }
    .callout, .import-action { align-items: flex-start; flex-direction: column; }
    .filter-bar { align-items: stretch; flex-direction: column; }
    .filter-bar > select { max-width: none; }
    .filter-bar label { min-width: 0; }
    .log-row { grid-template-columns: 1fr; }
    .log-meta { flex-direction: row; align-items: center; }
    .allocation-form { min-width: 440px; }
    .allocation-fields { grid-template-columns: repeat(2, minmax(130px, 1fr)); }
    .agent-site-stats { justify-content: flex-start; }
    .run-summary small { width: 100%; margin-left: 0; }
    .conversation-message { max-width: 95%; }
}

@media (max-width: 560px) {
    h1 { font-size: 1.85rem; }
    .panel { padding: 19px 16px; border-radius: 15px; }
    .topbar-title small { display: none; }
    .hero-actions { display: grid; grid-template-columns: 1fr; }
    .hero-actions .button { width: 100%; }
    .hero-meter { align-items: flex-start; }
    .ring { width: 82px; height: 82px; }
    .ring::before { width: 62px; height: 62px; }
    .ring-overview { grid-template-columns: 1fr; }
    .ring-item { display: flex; align-items: center; gap: 16px; text-align: left; }
    .ring-item .ring { margin: 0; }
    .stat-grid.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stat-grid.compact .stat-card { padding: 13px; }
    .stat-grid.compact .stat-card strong { font-size: 1.05rem; }
    .allocation-form { min-width: 320px; }
    .allocation-fields { grid-template-columns: 1fr; }
    .form-actions { align-items: stretch; flex-direction: column; }
    .form-actions .button, .form-actions form, .form-actions form .button { width: 100%; }
    .auth-card { padding: 28px 22px; }
    .bar-chart { gap: 4px; }
    .bar-column small { font-size: .56rem; transform: rotate(-35deg); transform-origin: center; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
