:root {
  --bg: #07111f;
  --bg-deep: #040b14;
  --surface: #0c1827;
  --surface-2: #101f31;
  --surface-3: #14263a;
  --line: #20364b;
  --line-soft: rgba(148, 174, 198, .14);
  --text: #f3f8fc;
  --muted: #8fa5ba;
  --muted-2: #657d94;
  --primary: #2d7df6;
  --primary-2: #5da2ff;
  --success: #31d18b;
  --warning: #f6b94a;
  --danger: #f36c75;
  --cyan: #26c6da;
  --sidebar: 236px;
  --topbar: 68px;
  --radius: 14px;
  --shadow: 0 18px 48px rgba(0, 0, 0, .22);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: radial-gradient(circle at 70% -10%, rgba(36, 95, 160, .18), transparent 32%), var(--bg-deep); color: var(--text); font-family: Inter, "SF Pro Display", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif; font-size: 14px; line-height: 1.5; }
button, input, select { font: inherit; }
button { color: inherit; }
button, select { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 2px solid var(--primary-2); outline-offset: 2px; }
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.skip-link { position: fixed; left: 16px; top: -60px; z-index: 999; padding: 10px 16px; color: white; background: var(--primary); border-radius: 8px; transition: top .2s; }
.skip-link:focus { top: 16px; }

.app-shell { display: flex; min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 20; width: var(--sidebar); display: flex; flex-direction: column; background: rgba(7, 17, 31, .97); border-right: 1px solid var(--line-soft); backdrop-filter: blur(18px); }
.brand { height: var(--topbar); display: flex; align-items: center; gap: 11px; padding: 0 20px; border-bottom: 1px solid var(--line-soft); }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid #5b9cfb; border-radius: 10px 10px 4px 10px; color: white; background: linear-gradient(145deg, #2877ef, #154eab); font-weight: 800; box-shadow: 0 0 22px rgba(45,125,246,.34); }
.brand strong { display: block; font-size: 14px; letter-spacing: .13em; }
.brand span { display: block; margin-top: 1px; color: var(--muted-2); font-size: 9px; font-weight: 700; letter-spacing: .16em; }
.nav-list { padding: 14px 10px; overflow-y: auto; }
.nav-label { margin: 13px 12px 7px; color: #536b83; font-size: 10px; font-weight: 800; letter-spacing: .16em; }
.nav-item { width: 100%; min-height: 42px; display: flex; align-items: center; gap: 11px; padding: 8px 11px; border: 1px solid transparent; border-radius: 9px; background: transparent; color: #88a0b6; text-align: left; transition: color .18s, background .18s, border-color .18s, transform .18s; }
.nav-item:hover { color: #dceafb; background: rgba(69, 117, 166, .08); }
.nav-item:active { transform: scale(.98); }
.nav-item.active { color: white; background: linear-gradient(90deg, rgba(45, 125, 246, .2), rgba(45, 125, 246, .07)); border-color: rgba(72, 145, 252, .18); box-shadow: inset 3px 0 var(--primary); }
.nav-item svg { width: 17px; }
.nav-item em { min-width: 22px; margin-left: auto; padding: 1px 6px; border-radius: 20px; color: #b7d6ff; background: rgba(45,125,246,.2); font-size: 10px; font-style: normal; text-align: center; }
.nav-item em.warn { color: #ffd98f; background: rgba(246,185,74,.18); }
.sidebar-footer { margin-top: auto; padding: 12px 10px 14px; border-top: 1px solid var(--line-soft); }
.server-mini { display: flex; align-items: center; gap: 8px; margin: 0 5px 12px; padding: 10px; border: 1px solid rgba(49,209,139,.12); border-radius: 10px; background: rgba(49,209,139,.04); }
.server-mini > i { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 10px var(--success); }
.server-mini div { min-width: 0; flex: 1; }
.server-mini strong, .server-mini span { display: block; }
.server-mini strong { font-size: 11px; }
.server-mini span { color: var(--muted-2); font-size: 9px; }
.server-mini b { color: var(--success); font: 500 10px ui-monospace, monospace; }
.profile { width: 100%; display: flex; align-items: center; gap: 9px; padding: 8px; border: 0; border-radius: 10px; background: transparent; text-align: left; }
.profile:hover { background: rgba(255,255,255,.04); }
.profile > span { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; color: #dbeaff; background: #17365d; font-weight: 700; }
.profile div { flex: 1; }
.profile strong, .profile small { display: block; }
.profile strong { font-size: 11px; }
.profile small { color: var(--muted-2); font-size: 9px; }
.profile svg { width: 13px; transform: rotate(90deg); color: var(--muted-2); }

.main-wrap { width: calc(100% - var(--sidebar)); margin-left: var(--sidebar); }
.topbar { position: sticky; top: 0; z-index: 15; height: var(--topbar); display: flex; align-items: center; justify-content: space-between; padding: 0 26px; border-bottom: 1px solid var(--line-soft); background: rgba(7, 17, 31, .82); backdrop-filter: blur(18px); }
.breadcrumb { display: flex; align-items: center; gap: 9px; font-size: 12px; }
.breadcrumb span { color: var(--muted-2); }
.breadcrumb b { color: #33495f; }
.breadcrumb strong { font-weight: 600; }
.top-actions { display: flex; align-items: center; gap: 9px; }
.role-control { position: relative; }
.role-button { height: 36px; display: flex; align-items: center; gap: 7px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; color: #a9bed2; background: rgba(10,25,41,.7); font-size: 10px; }
.role-button:hover { border-color: #3a5875; background: var(--surface-2); }
.role-button > svg { width: 14px; color: #79adf6; }.role-button .role-arrow { width: 11px; margin-left: 2px; transform: rotate(90deg); color: var(--muted-2); }
.role-menu { position: absolute; top: 44px; right: 0; z-index: 50; width: 230px; padding: 6px; border: 1px solid #29445e; border-radius: 11px; background: #0c1928; box-shadow: var(--shadow); animation: modal-in .18s ease; }
.role-menu[hidden] { display: none; }
.role-menu button { width: 100%; display: flex; align-items: center; gap: 9px; padding: 10px; border: 0; border-radius: 8px; color: #8298ad; background: transparent; text-align: left; }
.role-menu button:hover { background: rgba(67,112,155,.1); }.role-menu button.active { color: #dceaff; background: rgba(45,125,246,.1); }
.role-menu button span { flex: 1; }.role-menu b,.role-menu small { display: block; }.role-menu b { font-size: 10px; }.role-menu small { margin-top: 2px; color: var(--muted-2); font-size: 8px; }
.role-menu button > svg { width: 14px; color: var(--success); opacity: 0; }.role-menu button.active > svg { opacity: 1; }
[data-admin-only][hidden] { display: none; }
.search, .inline-search { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 11px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted-2); background: rgba(10, 25, 41, .7); }
.search { width: 230px; }
.search svg, .inline-search svg { width: 15px; }
.search input, .inline-search input { width: 100%; padding: 0; border: 0; outline: 0; color: var(--text); background: transparent; font-size: 12px; }
.search:focus-within, .inline-search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(45,125,246,.1); }
.icon-button { position: relative; width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: rgba(10, 25, 41, .7); color: var(--muted); transition: .18s; }
.icon-button:hover { color: white; border-color: #3a5875; background: var(--surface-2); }
.has-dot::after { content: ""; position: absolute; top: 8px; right: 8px; width: 5px; height: 5px; border: 2px solid var(--bg); border-radius: 50%; background: var(--danger); }
.primary-button, .ghost-button, .text-button { min-height: 36px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 0 14px; border-radius: 8px; font-weight: 650; font-size: 12px; transition: transform .16s, background .18s, border-color .18s, box-shadow .18s; }
.primary-button { border: 1px solid #377fdf; color: white; background: linear-gradient(180deg, #3483f4, #246bd2); box-shadow: 0 7px 18px rgba(45,125,246,.17); }
.primary-button:hover { background: linear-gradient(180deg, #438ffb, #2b72d9); box-shadow: 0 9px 24px rgba(45,125,246,.26); }
.primary-button:active, .ghost-button:active { transform: scale(.97); }
.primary-button svg { width: 15px; }
.ghost-button { border: 1px solid var(--line); background: var(--surface-2); color: #bdd0e2; }
.ghost-button { text-decoration: none; }
.ghost-button:hover { border-color: #3b5874; background: var(--surface-3); }
.text-button { padding: 0 3px; border: 0; background: transparent; color: #70aaff; }
.text-button:hover { color: #a8cdff; }
.text-button svg { width: 13px; }
.mobile-menu { display: none; }

main { padding: 28px 28px 56px; }
.view { display: none; max-width: 1540px; margin: 0 auto; animation: reveal .3s ease both; }
.view.active { display: block; }
@keyframes reveal { from { opacity: 0; transform: translateY(5px); } }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.page-heading h1 { margin: 3px 0 2px; font-size: clamp(23px, 2vw, 29px); line-height: 1.2; letter-spacing: -.03em; }
.page-heading p { margin: 0; color: var(--muted); font-size: 12px; }
.eyebrow { display: flex; align-items: center; gap: 7px; color: #5d8ec5 !important; font-size: 9px !important; font-weight: 800; letter-spacing: .17em; }
.eyebrow i { width: 17px; height: 1px; background: var(--primary); box-shadow: 0 0 8px var(--primary); }
.heading-actions { display: flex; align-items: center; gap: 10px; }
.sync-status { display: inline-flex; align-items: center; gap: 6px; color: var(--muted-2); font-size: 10px; }
.sync-status svg { width: 13px; color: var(--success); }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; margin-bottom: 13px; }
.metric-card, .panel { border: 1px solid var(--line-soft); background: linear-gradient(145deg, rgba(15, 32, 50, .92), rgba(10, 23, 38, .94)); box-shadow: 0 12px 30px rgba(0,0,0,.1); }
.metric-card { min-height: 108px; display: flex; align-items: center; gap: 13px; padding: 16px; border-radius: 12px; overflow: hidden; }
.metric-icon { width: 36px; height: 36px; display: grid; flex: 0 0 auto; place-items: center; border-radius: 10px; }
.metric-icon.blue { color: #78afff; background: rgba(45,125,246,.14); }
.metric-icon.green { color: #6be4aa; background: rgba(49,209,139,.12); }
.metric-icon.amber { color: #ffd073; background: rgba(246,185,74,.12); }
.metric-icon.cyan { color: #6be2ee; background: rgba(38,198,218,.12); }
.metric-copy { min-width: 76px; }
.metric-copy > span { display: block; color: var(--muted); font-size: 10px; }
.metric-copy strong { display: inline-block; margin-top: 2px; font-size: 24px; letter-spacing: -.04em; }
.metric-copy small { margin-left: 5px; color: var(--muted-2); font-size: 9px; }
.metric-copy .positive { color: var(--success); }
.metric-copy .warning { color: var(--warning); }
.spark { height: 32px; flex: 1; display: flex; align-items: flex-end; gap: 3px; opacity: .72; }
.spark i { flex: 1; min-width: 3px; border-radius: 2px 2px 0 0; background: linear-gradient(to top, rgba(45,125,246,.12), #377ee9); }
.green-spark i { background: linear-gradient(to top, rgba(49,209,139,.1), #38bd83); }
.spark i:nth-child(1) { height: 23%; }.spark i:nth-child(2) { height: 40%; }.spark i:nth-child(3) { height: 35%; }.spark i:nth-child(4) { height: 64%; }.spark i:nth-child(5) { height: 57%; }.spark i:nth-child(6) { height: 84%; }.spark i:nth-child(7) { height: 72%; }
.metric-detail { display: grid; gap: 3px; margin-left: auto; color: var(--muted-2); font-size: 9px; }
.ring { --p: 92; width: 44px; height: 44px; display: grid; place-items: center; margin-left: auto; border-radius: 50%; background: conic-gradient(var(--cyan) calc(var(--p)*1%), #17293c 0); position: relative; }
.ring::before { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: var(--surface); }
.ring span { position: relative; color: #9deef5; font-size: 9px; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.62fr) minmax(300px, .88fr); gap: 13px; margin-bottom: 13px; }
.panel { border-radius: var(--radius); }
.panel-head { min-height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 18px; border-bottom: 1px solid var(--line-soft); }
.panel-head h2 { margin: 0 0 2px; font-size: 13px; font-weight: 700; }
.panel-head p { margin: 0; color: var(--muted-2); font-size: 10px; }
.status-badge { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: 23px; padding: 2px 8px; border: 1px solid transparent; border-radius: 20px; font-size: 9px; font-weight: 700; white-space: nowrap; }
.status-badge.running { color: #92bdff; border-color: rgba(45,125,246,.2); background: rgba(45,125,246,.12); }
.status-badge.success { color: #76e4b1; border-color: rgba(49,209,139,.18); background: rgba(49,209,139,.09); }
.status-badge.warning { color: #ffd179; border-color: rgba(246,185,74,.2); background: rgba(246,185,74,.1); }
.status-badge.danger { color: #ff9ca4; border-color: rgba(243,108,117,.2); background: rgba(243,108,117,.1); }
.status-badge.running i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; animation: blink 1.4s infinite; }
@keyframes blink { 50% { opacity: .25; } }
.mode-switch { width: max-content; display: flex; gap: 3px; margin: 14px 18px 6px; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: rgba(5,13,23,.52); }
.mode-switch button { min-width: 108px; padding: 6px 11px; border: 0; border-radius: 6px; color: var(--muted-2); background: transparent; font-size: 10px; font-weight: 700; }
.mode-switch button small { display: block; font-size: 8px; font-weight: 500; }
.mode-switch button.active { color: #dceaff; background: #19385f; box-shadow: 0 3px 10px rgba(0,0,0,.16); }
.flow-track { display: grid; grid-template-columns: auto 1fr auto 1fr auto 1fr auto 1fr auto; align-items: start; padding: 20px 20px 15px; }
.flow-track > b { height: 2px; margin-top: 15px; background: #20364a; }
.flow-track > b.done-line { background: var(--success); box-shadow: 0 0 8px rgba(49,209,139,.3); }
.flow-step { min-width: 74px; display: grid; justify-items: center; gap: 5px; text-align: center; }
.flow-step span { width: 31px; height: 31px; display: grid; place-items: center; border: 1px solid #2a435b; border-radius: 50%; color: #69839b; background: #0c1928; font: 700 10px ui-monospace, monospace; }
.flow-step span svg { width: 14px; }
.flow-step strong { font-size: 10px; }
.flow-step small { color: var(--muted-2); font-size: 8px; }
.flow-step.done span { color: var(--success); border-color: rgba(49,209,139,.42); background: rgba(49,209,139,.1); }
.flow-step.active span { color: #9fc7ff; border-color: var(--primary); background: rgba(45,125,246,.14); box-shadow: 0 0 0 5px rgba(45,125,246,.07), 0 0 20px rgba(45,125,246,.2); }
.flow-step.active small { color: #75a8ea; }
.live-event { display: flex; align-items: center; gap: 10px; margin: 0 18px 14px; padding: 11px 12px; border: 1px solid rgba(45,125,246,.13); border-radius: 9px; background: rgba(45,125,246,.055); }
.pulse-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--primary-2); box-shadow: 0 0 0 5px rgba(45,125,246,.1); }
.live-event div { flex: 1; }
.live-event strong, .live-event p { display: block; margin: 0; }
.live-event strong { font-size: 10px; }
.live-event p { color: var(--muted-2); font-size: 9px; }
.live-event time { color: var(--muted-2); font-size: 9px; }
.flow-actions { display: flex; gap: 8px; padding: 0 18px 17px; }

.resource-row { display: flex; align-items: center; gap: 10px; padding: 12px 16px 7px; }
.resource-symbol { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 8px; color: #75aafa; background: rgba(45,125,246,.1); }
.resource-symbol svg { width: 15px; }
.resource-row > div:nth-child(2) { min-width: 0; flex: 1; }
.resource-row strong, .resource-row span { display: block; }
.resource-row strong { font-size: 10px; }
.resource-row span { color: var(--muted-2); font-size: 9px; }
.resource-bars { padding: 0 16px 4px 57px; }
.resource-bars > span { display: block; height: 3px; overflow: hidden; border-radius: 3px; background: #1c3044; }
.resource-bars > span i { display: block; width: var(--w); height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary), var(--success)); }
.resource-bars div { display: flex; justify-content: space-between; margin-top: 5px; color: var(--muted-2); font-size: 8px; }
.sim-slots { display: grid; grid-template-columns: repeat(16, 1fr); gap: 3px; padding: 3px 16px 3px 57px; }
.sim-slots i { height: 12px; border-radius: 2px; background: #23384b; }
.sim-slots i.on { background: rgba(49,209,139,.8); box-shadow: 0 0 6px rgba(49,209,139,.18); }
.sim-slots i.warn { background: rgba(246,185,74,.8); }
.latency { display: flex; align-items: center; gap: 7px; margin: 4px 16px 15px 57px; color: var(--muted-2); font: 700 8px ui-monospace, monospace; }
.latency i { height: 1px; flex: 1; background: repeating-linear-gradient(90deg, #2c516e 0 4px, transparent 4px 7px); }
.latency b { color: var(--success); font-weight: 600; }

.task-table-panel { overflow: hidden; }
.table-actions { display: flex; align-items: center; gap: 14px; }
.segmented { display: flex; gap: 2px; padding: 2px; border-radius: 7px; background: #091522; }
.segmented button { padding: 4px 9px; border: 0; border-radius: 5px; color: var(--muted-2); background: transparent; font-size: 9px; }
.segmented button.active { color: white; background: #1b3046; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th { padding: 9px 14px; color: #5f7890; background: rgba(7, 16, 27, .38); font-size: 8px; font-weight: 800; letter-spacing: .08em; text-align: left; }
td { padding: 11px 14px; border-top: 1px solid var(--line-soft); color: #9eb1c2; font-size: 9px; }
tbody tr { transition: background .16s; }
tbody tr:hover { background: rgba(54,100,145,.055); }
td code { color: #86b5f4; font: 600 9px ui-monospace, monospace; }
td strong, td span { display: block; }
td strong { margin-bottom: 2px; color: #dfeaf4; font-size: 10px; }
td > span:not(.status-badge):not(.mode-pill):not(.node-progress) { color: var(--muted-2); font-size: 8px; }
.mode-pill { width: max-content; padding: 3px 7px; border-radius: 5px; font-size: 8px; font-weight: 700; }
.mode-pill.auto { color: #87b7fa; background: rgba(45,125,246,.1); }
.mode-pill.self { color: #bc9cff; background: rgba(130,80,230,.11); }
.node-progress { width: 82px; height: 3px; margin-bottom: 4px; overflow: hidden; border-radius: 4px; background: #203346; }
.node-progress i { display: block; width: var(--w); height: 100%; background: var(--primary); }
.node-progress.complete i { background: var(--success); }.node-progress.danger i { background: var(--warning); }

.module-heading { align-items: center; }
.module-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; margin-bottom: 13px; }
.module-stat { min-height: 88px; padding: 14px 16px; border: 1px solid var(--line-soft); border-radius: 12px; background: linear-gradient(145deg, rgba(15,32,50,.92), rgba(10,23,38,.94)); }
.module-stat span { display: block; color: var(--muted-2); font-size: 9px; }
.module-stat strong { display: block; margin: 3px 0; font-size: 21px; }
.module-stat small { color: var(--success); font-size: 8px; }
.module-panel { overflow: hidden; }
.inline-search { width: 200px; height: 32px; }
.module-panel td { height: 48px; }
.empty-row td { padding: 48px 20px; color: var(--muted-2); text-align: center; }
.pagination { min-height: 54px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--line-soft); color: var(--muted-2); font-size: 9px; }
.pagination label { display: flex; align-items: center; gap: 6px; }
.pagination select { min-height: 30px; padding: 0 28px 0 9px; font-size: 9px; }
.page-buttons { display: flex; align-items: center; gap: 9px; }
.page-buttons .ghost-button { min-height: 30px; padding: 0 10px; font-size: 9px; }
.page-buttons button:disabled { cursor: not-allowed; opacity: .38; transform: none; }
.field-help { color: var(--muted-2); font-size: 9px; line-height: 1.5; }
.field-help a { color: #70aaff; text-decoration: none; }
.field-help a:hover { color: #a8cdff; text-decoration: underline; }

.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgba(2,7,13,.72); backdrop-filter: blur(7px); }
.modal-backdrop[hidden] { display: none; }
.modal { width: min(580px, 100%); max-height: calc(100vh - 40px); overflow-x: hidden; overflow-y: auto; border: 1px solid #29455f; border-radius: 16px; background: #0c1928; box-shadow: 0 28px 90px rgba(0,0,0,.5); animation: modal-in .24s cubic-bezier(.16,1,.3,1); }
@keyframes modal-in { from { opacity: 0; transform: translateY(14px) scale(.97); } }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; padding: 20px 22px 15px; border-bottom: 1px solid var(--line-soft); }
.modal-head h2 { margin: 4px 0 0; font-size: 18px; }
.modal form { padding: 20px 22px 22px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.form-grid label, fieldset { display: grid; gap: 6px; }
.form-grid label > span, legend { color: #a9bbcc; font-size: 10px; font-weight: 650; }
.form-grid .full { grid-column: 1 / -1; }
input, select { min-height: 40px; padding: 0 11px; border: 1px solid var(--line); border-radius: 8px; color: var(--text); background: #091522; }
input::placeholder { color: #526a81; }
input:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(45,125,246,.1); }
fieldset { margin: 17px 0 0; padding: 0; border: 0; }
.radio-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.radio-cards label { position: relative; }
.radio-cards input { position: absolute; opacity: 0; pointer-events: none; }
.radio-cards span { display: block; min-height: 72px; padding: 13px; border: 1px solid var(--line); border-radius: 9px; background: #091522; transition: .18s; cursor: pointer; }
.radio-cards input:checked + span { border-color: var(--primary); background: rgba(45,125,246,.09); box-shadow: inset 0 0 0 1px rgba(45,125,246,.22); }
.radio-cards input:focus-visible + span { outline: 2px solid var(--primary-2); outline-offset: 2px; }
.radio-cards b, .radio-cards small { display: block; }
.radio-cards b { margin-bottom: 4px; font-size: 11px; }
.radio-cards small { color: var(--muted-2); font-size: 9px; }
.resource-preview { display: flex; gap: 11px; margin-top: 16px; padding: 12px; border: 1px solid rgba(49,209,139,.13); border-radius: 9px; color: var(--success); background: rgba(49,209,139,.04); }
.resource-preview svg { flex: 0 0 auto; margin-top: 2px; }
.resource-preview strong { display: block; color: #bfe7d5; font-size: 10px; }
.resource-preview p { margin: 2px 0 0; color: #729888; font-size: 9px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 20px; }
.authorization-check { display: flex; align-items: flex-start; gap: 9px; margin-top: 14px; color: #a9bbcc; font-size: 10px; line-height: 1.5; }
.authorization-check input { width: 16px; min-height: 16px; margin-top: 1px; accent-color: var(--primary); }
.bulk-summary { margin-top: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 9px; color: #a9bbcc; background: #091522; font-size: 10px; line-height: 1.6; }
.bulk-summary.success { border-color: rgba(49,209,139,.3); color: #bfe7d5; background: rgba(49,209,139,.05); }
.bulk-summary.error { border-color: rgba(255,98,110,.3); color: #ffadb4; background: rgba(255,98,110,.05); }
.manual-content { padding: 20px 22px 22px; }
.manual-content > p { margin: 0 0 14px; color: #afc1d2; font-size: 11px; line-height: 1.7; }
.live-browser-link { width: 100%; margin-bottom: 14px; }
.manual-preview { display: block; margin-bottom: 15px; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: #050b12; }
.manual-preview img { display: block; width: 100%; max-height: 380px; object-fit: contain; }
.manual-content label { display: grid; gap: 6px; }
.manual-content label > span { color: #a9bbcc; font-size: 10px; font-weight: 650; }
.task-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 0 14px; }
.task-detail-grid > div { padding: 11px; border: 1px solid var(--line); border-radius: 8px; background: #091522; }
.task-detail-grid dt { color: var(--muted-2); font-size: 8px; }
.task-detail-grid dd { margin: 4px 0 0; color: #dceafb; font-size: 10px; overflow-wrap: anywhere; }
.failure-reason { padding: 13px; border: 1px solid rgba(243,108,117,.25); border-radius: 9px; background: rgba(243,108,117,.06); }
.failure-reason strong { color: #ffabb2; font-size: 10px; }
.failure-reason p { margin: 5px 0 0; color: #d9adb1; font-size: 10px; line-height: 1.6; overflow-wrap: anywhere; }
.security-note { margin: 12px 0 0 !important; color: var(--muted-2) !important; font-size: 9px !important; }
.row-actions { display: flex; align-items: center; gap: 8px; }
.row-actions .text-button.danger { color: #ff9ca4; }
.failure-cell { max-width: 300px; overflow: hidden; text-overflow: ellipsis; }

.login-gate { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 20px; background: radial-gradient(circle at 50% 10%, #173458 0, #07111f 48%, #040a12 100%); }
.login-gate[hidden] { display: none; }
.login-card { width: min(390px, 100%); display: grid; gap: 15px; padding: 30px; border: 1px solid #29445e; border-radius: 18px; background: rgba(10, 24, 40, .96); box-shadow: 0 35px 100px rgba(0,0,0,.48); }
.login-card .brand-mark { width: 44px; height: 44px; }
.login-card h1 { margin: 0; font-size: 24px; }
.login-card > p:not(.eyebrow) { margin: -9px 0 5px; color: var(--muted); font-size: 11px; }
.login-card label { display: grid; gap: 7px; }
.login-card label span { color: #afc1d2; font-size: 10px; font-weight: 700; }
.login-card button { width: 100%; margin-top: 4px; }
.login-card > small { min-height: 16px; color: #ff9ca4; font-size: 10px; text-align: center; }
.production-offline { color: var(--danger) !important; }
.toast-region { position: fixed; right: 20px; bottom: 20px; z-index: 150; display: grid; gap: 8px; }
.toast { min-width: 280px; display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid rgba(49,209,139,.22); border-radius: 10px; color: #d9f6e9; background: #10271f; box-shadow: var(--shadow); animation: toast-in .25s ease; }
.toast svg { color: var(--success); }.toast div { flex: 1; }.toast strong,.toast small { display: block; }.toast strong { font-size: 10px; }.toast small { color: #83a797; font-size: 9px; }
@keyframes toast-in { from { opacity: 0; transform: translateX(18px); } }

@media (max-width: 1120px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .resource-panel { display: grid; grid-template-columns: 1fr 1fr; }
  .resource-panel .panel-head { grid-column: 1 / -1; }
  .module-stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 780px) {
  :root { --topbar: 60px; }
  .sidebar { transform: translateX(-100%); transition: transform .22s ease; box-shadow: 24px 0 60px rgba(0,0,0,.42); }
  .sidebar.open { transform: translateX(0); }
  .main-wrap { width: 100%; margin-left: 0; }
  .mobile-menu { display: grid; }
  .topbar { padding: 0 14px; }
  .breadcrumb, .search, .role-control, .top-actions .has-dot { display: none; }
  .top-actions { margin-left: auto; }
  main { padding: 22px 14px 44px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .heading-actions { width: 100%; justify-content: space-between; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .resource-panel { display: block; }
  .flow-track { grid-template-columns: 1fr; gap: 8px; align-items: center; }
  .flow-track > b { width: 2px; height: 18px; margin: -5px auto; }
  .flow-step { grid-template-columns: 35px 1fr; grid-template-rows: auto auto; justify-items: start; min-width: 0; text-align: left; }
  .flow-step span { grid-row: 1 / 3; }
  .flow-step strong { align-self: end; }.flow-step small { align-self: start; }
  .panel-head { align-items: flex-start; }
  .task-table-panel .panel-head { flex-direction: column; }
  .table-actions { width: 100%; justify-content: space-between; }
}
@media (max-width: 520px) {
  .metric-grid, .module-stats { grid-template-columns: 1fr; }
  .page-heading { margin-bottom: 17px; }
  .sync-status { display: none; }
  .flow-actions { flex-direction: column; }
  .form-grid, .radio-cards { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
  .modal form { padding: 16px; }
  .modal-head { padding: 17px 16px 13px; }
  .inline-search { width: 150px; }
  .module-panel .panel-head { align-items: flex-start; flex-direction: column; }
  .pagination { align-items: flex-start; flex-direction: column; }
  .pagination label { order: 3; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
