:root {
  color-scheme: dark;
  --bg: #0c0e10;
  --surface: #131619;
  --surface-2: #191d21;
  --surface-3: #20252a;
  --line: #2a3036;
  --line-strong: #3a424a;
  --text: #f2f4f5;
  --muted: #949da6;
  --muted-2: #6f7881;
  --green: #3ddc97;
  --green-bg: #123326;
  --red: #ff6b6b;
  --red-bg: #3a191d;
  --amber: #f5bd4f;
  --amber-bg: #382d13;
  --blue: #72a7ff;
  --blue-bg: #172a47;
  --cyan: #56d4dd;
  --shadow: 0 18px 60px rgba(0, 0, 0, .34);
  font-family: Inter, "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

* { box-sizing: border-box; letter-spacing: 0; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body { min-width: 320px; overflow-x: hidden; }
button, input, select { font: inherit; }
button { color: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
button:disabled { opacity: .5; cursor: not-allowed; }
.hidden { display: none !important; }
svg { width: 18px; height: 18px; stroke-width: 1.8; flex: 0 0 auto; }

.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #0a0c0e; }
.login-screen::before { content: ""; position: fixed; inset: 0; opacity: .14; pointer-events: none; background-image: linear-gradient(#fff 1px, transparent 1px), linear-gradient(90deg, #fff 1px, transparent 1px); background-size: 52px 52px; mask-image: linear-gradient(to bottom, transparent, black 30%, transparent); }
.login-panel { width: min(400px, 100%); position: relative; padding: 30px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.login-brand, .brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid #347359; border-radius: 6px; color: var(--green); background: #10291f; }
.brand-mark svg { width: 21px; height: 21px; }
.login-brand strong, .brand strong { display: block; font-size: 15px; }
.login-brand span:not(.brand-mark), .brand-text span { display: block; color: var(--muted-2); font-size: 11px; margin-top: 2px; }
.login-copy { margin: 42px 0 28px; }
.login-copy h1 { margin: 0 0 8px; font-size: 24px; }
.login-copy p { margin: 0; color: var(--muted); }
.field-label { display: block; color: #bbc1c6; font-size: 12px; margin-bottom: 8px; }
.input-with-icon, .search-field { display: flex; align-items: center; gap: 9px; height: 42px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 5px; background: #0e1113; color: var(--muted); }
.input-with-icon input, .search-field input { width: 100%; min-width: 0; border: 0; outline: 0; color: var(--text); background: transparent; }
.input-with-icon:focus-within, .search-field:focus-within { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(114, 167, 255, .12); }
.form-error { min-height: 19px; margin: 8px 0; color: var(--red); font-size: 12px; }
.login-hint { margin: 18px 0 0; color: var(--muted-2); text-align: center; font-size: 12px; }
code { font-family: "Cascadia Mono", Consolas, monospace; }

.button, .icon-button, .nav-item, .scenario-control button { border: 0; cursor: pointer; transition: background .15s ease, border-color .15s ease, color .15s ease, opacity .15s ease; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 0 14px; border-radius: 5px; font-weight: 600; white-space: nowrap; }
.button.primary { color: #07130e; background: var(--green); }
.button.primary:hover { background: #66e7ae; }
.button.ghost { border: 1px solid var(--line-strong); background: var(--surface-2); color: #d8dcdf; }
.button.ghost:hover { border-color: #5a646d; background: var(--surface-3); }
.button.danger { border: 1px solid #76333b; background: var(--red-bg); color: #ff9da3; }
.button.text { min-height: 30px; padding: 0 4px; color: var(--blue); background: transparent; }
.button.text:hover { color: #a7c7ff; }
.button.compact { min-height: 34px; padding: 0 11px; font-size: 12px; }
.button.full { width: 100%; }
.icon-button { display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 1px solid var(--line); border-radius: 5px; color: var(--muted); background: transparent; }
.icon-button:hover { color: var(--text); background: var(--surface-3); }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 224px minmax(0, 1fr); }
.sidebar { position: fixed; z-index: 20; inset: 0 auto 0 0; width: 224px; display: flex; flex-direction: column; padding: 20px 14px 16px; border-right: 1px solid var(--line); background: #0f1214; }
.brand { height: 42px; padding: 0 8px; }
.brand-text { min-width: 0; }
.nav { display: grid; gap: 4px; margin-top: 32px; }
.nav-item { position: relative; width: 100%; height: 42px; display: flex; align-items: center; gap: 11px; padding: 0 12px; border-radius: 5px; color: var(--muted); background: transparent; text-align: left; }
.nav-item:hover { color: #d9dddf; background: var(--surface-2); }
.nav-item.active { color: var(--text); background: #1d2423; }
.nav-item.active::before { content: ""; position: absolute; left: 0; width: 3px; height: 20px; border-radius: 2px; background: var(--green); }
.nav-item b { min-width: 20px; margin-left: auto; padding: 2px 5px; border-radius: 8px; color: #b8c0c6; background: #2b3035; font: 600 10px/1.2 "Cascadia Mono", Consolas, monospace; text-align: center; }
.sidebar-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; padding: 14px 8px 0; border-top: 1px solid var(--line); }
.server-state { display: flex; align-items: center; gap: 9px; }
.server-state strong, .server-state span { display: block; }
.server-state strong { font-size: 11px; }
.server-state div > span { margin-top: 2px; color: var(--muted-2); font: 10px "Cascadia Mono", Consolas, monospace; }
.pulse-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(61, 220, 151, .1); }

.main-area { grid-column: 2; width: 100%; min-width: 0; padding: 0 34px 48px; }
.topbar { height: 92px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); }
.eyebrow { margin: 0 0 5px; color: var(--muted-2); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.topbar h1 { margin: 0; font-size: 20px; line-height: 1.2; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.status-chip { display: inline-flex; align-items: center; gap: 7px; min-height: 28px; padding: 0 9px; border: 1px solid var(--line); border-radius: 5px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.status-chip.muted { color: var(--muted); background: var(--surface); }
.status-chip.success { color: #7debb8; border-color: #285842; background: var(--green-bg); }
.status-chip.warning { color: #ffd37a; border-color: #665021; background: var(--amber-bg); }
.status-chip.error { color: #ff9ca3; border-color: #693037; background: var(--red-bg); }
.status-chip.info { color: #a9c7ff; border-color: #2b4e80; background: var(--blue-bg); }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.risk-banner, .notice-banner { min-height: 54px; display: flex; align-items: center; gap: 12px; margin-top: 18px; padding: 10px 13px; border: 1px solid #5c4921; border-radius: 6px; color: #f3cc7c; background: #292313; }
.risk-banner > div { min-width: 0; flex: 1; }
.risk-banner strong, .risk-banner span { display: block; }
.risk-banner strong { font-size: 12px; }
.risk-banner span { margin-top: 3px; color: #c1ab7e; font-size: 11px; line-height: 1.5; }
.risk-banner .icon-button { margin-left: auto; border: 0; }
.notice-banner { color: #ffc2c5; border-color: #613138; background: var(--red-bg); }
.notice-banner > span { flex: 1; font-size: 12px; }

.view { display: none; padding-top: 24px; }
.view.active { display: block; }
.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.metric { min-height: 108px; display: flex; align-items: center; gap: 15px; padding: 17px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.metric-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 6px; }
.metric-icon.green { color: var(--green); background: var(--green-bg); }
.metric-icon.blue { color: var(--blue); background: var(--blue-bg); }
.metric-icon.cyan { color: var(--cyan); background: #123136; }
.metric-icon.amber { color: var(--amber); background: var(--amber-bg); }
.metric span, .metric strong, .metric small { display: block; }
.metric span { color: var(--muted); font-size: 11px; }
.metric strong { margin-top: 3px; font: 700 23px/1.1 "Cascadia Mono", Consolas, monospace; }
.metric small { margin-top: 4px; color: var(--muted-2); font-size: 10px; }

.section-block { margin-top: 28px; }
.section-heading { min-height: 42px; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.section-heading h2 { margin: 0; font-size: 15px; }
.section-heading p { margin: 5px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.button-row { display: flex; flex-wrap: wrap; gap: 8px; }

.table-wrap { position: relative; min-height: 132px; overflow-x: auto; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.table-wrap.always { min-height: 220px; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th, td { height: 46px; padding: 0 14px; border-bottom: 1px solid var(--line); text-align: left; }
th { height: 38px; color: var(--muted-2); background: #101315; font-size: 10px; font-weight: 700; text-transform: uppercase; }
td { color: #d7dbde; font-size: 12px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .12s ease; }
tbody tr:hover { background: #181c20; }
td.numeric, th.numeric { text-align: right; font-family: "Cascadia Mono", Consolas, monospace; font-variant-numeric: tabular-nums; }
.mono { font-family: "Cascadia Mono", Consolas, monospace; font-variant-numeric: tabular-nums; }
.profit { color: var(--green) !important; }
.loss { color: var(--red) !important; }
.tag { display: inline-flex; align-items: center; min-height: 22px; padding: 0 7px; border: 1px solid var(--line); border-radius: 4px; font: 700 10px "Cascadia Mono", Consolas, monospace; }
.tag.long, .tag.open, .tag.add, .tag.delivered { color: var(--green); border-color: #275b43; background: var(--green-bg); }
.tag.short, .tag.close, .tag.failed { color: var(--red); border-color: #71323a; background: var(--red-bg); }
.tag.reduce, .tag.retrying { color: var(--amber); border-color: #685121; background: var(--amber-bg); }
.tag.created, .tag.pending { color: var(--blue); border-color: #2e4e7a; background: var(--blue-bg); }
.tag.disabled { color: var(--muted); background: var(--surface-3); }
.empty-state { position: absolute; inset: 38px 0 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 24px; color: var(--muted-2); text-align: center; }
.empty-state svg { width: 24px; height: 24px; margin-bottom: 3px; }
.empty-state strong { color: #c5cacf; font-size: 12px; }
.empty-state span { font-size: 11px; }
.compact-empty { position: static; min-height: 116px; border: 1px dashed var(--line); border-radius: 6px; }

.signal-feed { display: grid; gap: 7px; }
.signal-row { display: grid; grid-template-columns: 34px minmax(120px, 1fr) minmax(150px, .8fr) minmax(130px, .6fr) 110px; align-items: center; gap: 12px; min-height: 58px; padding: 0 14px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); cursor: pointer; }
.signal-row:hover { border-color: var(--line-strong); background: #171b1e; }
.signal-symbol { display: flex; align-items: center; gap: 8px; min-width: 0; }
.signal-symbol strong { font-size: 12px; }
.signal-row p, .signal-row small { margin: 0; }
.signal-row p { color: #ccd1d4; font: 12px "Cascadia Mono", Consolas, monospace; }
.signal-row small { color: var(--muted-2); font-size: 10px; }
.event-icon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 5px; color: var(--blue); background: var(--blue-bg); }
.event-icon.open, .event-icon.add { color: var(--green); background: var(--green-bg); }
.event-icon.close { color: var(--red); background: var(--red-bg); }
.event-icon.reduce { color: var(--amber); background: var(--amber-bg); }

.page-grid { display: grid; gap: 14px; }
.monitor-grid { grid-template-columns: minmax(0, 1.45fr) minmax(310px, .75fr); }
.settings-grid { grid-template-columns: minmax(320px, .8fr) minmax(320px, 1.2fr); }
.gate-console-grid { grid-template-columns: minmax(340px, .9fr) minmax(360px, 1.1fr); align-items: start; margin-top: 14px; }
.tool-panel { padding: 20px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 22px; }
.panel-heading > div { display: flex; align-items: center; gap: 11px; }
.panel-heading h2, .panel-heading p { margin: 0; }
.panel-heading h2 { font-size: 14px; }
.panel-heading p { margin-top: 4px; color: var(--muted); font-size: 10px; }
.panel-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 5px; color: var(--blue); background: var(--blue-bg); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px 12px; }
.form-grid label, .stacked-fields label { min-width: 0; }
.form-grid label > span, .stacked-fields label > span { display: block; margin-bottom: 7px; color: #aeb5ba; font-size: 11px; }
input, select { width: 100%; height: 39px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: 4px; outline: 0; color: var(--text); background: #0f1214; }
input::placeholder { color: #596168; }
input:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(114, 167, 255, .1); }
select { cursor: pointer; }
.input-suffix { display: flex; align-items: center; height: 39px; padding-right: 10px; border: 1px solid var(--line-strong); border-radius: 4px; background: #0f1214; }
.input-suffix:focus-within { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(114, 167, 255, .1); }
.input-suffix input { height: 37px; border: 0; box-shadow: none; }
.input-suffix b { color: var(--muted-2); font-size: 10px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.mode-fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.mode-fieldset legend { margin-bottom: 7px; color: #aeb5ba; font-size: 11px; }
.segmented-control { height: 39px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px; padding: 3px; border: 1px solid var(--line-strong); border-radius: 4px; background: #0f1214; }
.segmented-control label { cursor: pointer; }
.segmented-control input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.segmented-control span { height: 31px; display: flex; align-items: center; justify-content: center; gap: 7px; border-radius: 3px; color: var(--muted); font: 700 10px "Cascadia Mono", Consolas, monospace; }
.segmented-control input:checked + span { color: #dff9ed; background: #254c3c; }
.segmented-control input[value="LIVE"]:checked + span { color: #ffe0a3; background: #533f16; }
.segmented-control svg { width: 15px; height: 15px; }
.secure-state { min-height: 34px; display: flex; align-items: center; gap: 8px; margin-top: 14px; padding: 0 10px; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); background: #101315; font-size: 10px; }
.secure-state.ok { color: #83e8ba; border-color: #285842; background: var(--green-bg); }
.secure-state.warning { color: #ffd37a; border-color: #665021; background: var(--amber-bg); }
.secure-state svg { width: 15px; height: 15px; }
.account-values { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.account-values > div { min-width: 0; min-height: 88px; padding: 15px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #101315; }
.account-values span, .account-values strong, .account-values small { display: block; }
.account-values span { color: var(--muted); font-size: 10px; }
.account-values strong { overflow: hidden; margin-top: 8px; font: 700 18px "Cascadia Mono", Consolas, monospace; text-overflow: ellipsis; }
.account-values small { margin-top: 4px; color: var(--muted-2); font-size: 9px; }
.gate-runtime-list { margin-top: 14px; }
.gate-runtime-list > div { min-height: 39px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); }
.gate-runtime-list > div:last-child { border-bottom: 0; }
.gate-runtime-list span { color: var(--muted); font-size: 10px; }
.gate-runtime-list strong { max-width: 60%; overflow: hidden; color: #d3d8db; font: 10px "Cascadia Mono", Consolas, monospace; text-overflow: ellipsis; white-space: nowrap; }
.gate-events-table tbody tr { cursor: pointer; }
.table-subtext { display: block; margin-top: 3px; color: var(--muted-2); font: 9px "Cascadia Mono", Consolas, monospace; }
.tag.planned, .tag.tested { color: var(--blue); border-color: #2e4e7a; background: var(--blue-bg); }
.tag.executed { color: var(--green); border-color: #275b43; background: var(--green-bg); }
.tag.skipped, .tag.paused, .tag.pending_sequence { color: var(--amber); border-color: #685121; background: var(--amber-bg); }
.tag.rejected, .tag.blocked { color: var(--red); border-color: #71323a; background: var(--red-bg); }
.tag.public, .tag.active { color: var(--green); border-color: #275b43; background: var(--green-bg); }
.tag.private { color: var(--amber); border-color: #685121; background: var(--amber-bg); }
.tag.unknown, .tag.ended { color: var(--muted); border-color: var(--line-strong); background: var(--surface-3); }
.browser-section { min-width: 0; }
.browser-frame-shell { position: relative; width: 100%; min-height: 420px; max-height: 760px; aspect-ratio: 8 / 5; overflow: hidden; border: 1px solid var(--line-strong); border-radius: 6px; background: #080a0b; }
.browser-frame-shell iframe { display: block; width: 100%; height: 100%; border: 0; background: #080a0b; }
.browser-frame-overlay { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 8px; padding: 24px; color: var(--muted); text-align: center; background: #0d1012; }
.browser-frame-overlay svg { width: 32px; height: 32px; color: var(--blue); }
.browser-frame-overlay strong { color: #d7dbde; font-size: 13px; }
.browser-frame-overlay span { color: var(--muted-2); font-size: 10px; }
.account-project-table { min-width: 980px; }
.project-editor { min-width: 0; }
.project-editor-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 9px; }
.project-editor-heading > div { min-width: 0; }
.project-editor-heading strong, .project-editor-heading span { display: block; }
.project-editor-heading strong { color: #aeb5ba; font-size: 11px; }
.project-editor-heading span { margin-top: 3px; color: var(--muted-2); font-size: 9px; }
.project-rows { display: grid; border: 1px solid var(--line); border-radius: 5px; overflow: hidden; }
.project-row { display: grid; grid-template-columns: 28px minmax(120px, .85fr) minmax(190px, 1.25fr) 90px 34px; align-items: center; gap: 8px; min-height: 54px; padding: 7px 8px; border-bottom: 1px solid var(--line); background: #0f1214; }
.project-row:last-child { border-bottom: 0; }
.project-row input { height: 36px; }
.project-enabled { display: grid; place-items: center; }
.project-enabled input { width: 15px; height: 15px; accent-color: var(--green); }
.project-row .status-chip { justify-self: start; max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-row-empty { min-height: 62px; display: grid; place-items: center; color: var(--muted-2); font-size: 10px; background: #0f1214; }
.capability-list { display: grid; }
.capability-list > div { min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--line); }
.capability-list span { display: flex; align-items: center; gap: 9px; color: #c5cacf; font-size: 11px; }
.capability-list svg { color: var(--muted-2); }
.cap { font-size: 10px; }
.cap.ok { color: var(--green); }
.cap.no { color: var(--red); }
.cap.unknown { color: var(--muted-2); }
.probe-note { display: flex; align-items: flex-start; gap: 9px; margin-top: 18px; padding: 11px; border-radius: 5px; color: #c7b682; background: #292412; font-size: 10px; line-height: 1.55; }
.probe-note svg { margin-top: 1px; color: var(--amber); }

.monitor-control { padding: 20px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.runtime-strip { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-radius: 5px; background: #0f1214; }
.runtime-strip > div { min-width: 0; padding: 13px 15px; border-right: 1px solid var(--line); }
.runtime-strip > div:last-child { border-right: 0; }
.runtime-strip span, .runtime-strip strong { display: block; }
.runtime-strip span { color: var(--muted-2); font-size: 10px; }
.runtime-strip strong { overflow: hidden; margin-top: 5px; color: #d9dde0; font: 600 11px "Cascadia Mono", Consolas, monospace; text-overflow: ellipsis; }
.demo-lab { padding: 20px; border: 1px solid #34443d; border-radius: 6px; background: #111815; }
.scenario-control { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 5px; overflow: hidden; }
.scenario-control button { min-height: 48px; display: flex; align-items: center; justify-content: center; gap: 7px; border-right: 1px solid var(--line); color: #b9c0c4; background: var(--surface); }
.scenario-control button:last-child { border-right: 0; }
.scenario-control button:hover { color: var(--text); background: var(--surface-3); }

.filter-bar { display: grid; grid-template-columns: minmax(220px, 1fr) repeat(3, 150px) 34px; gap: 8px; }
.filter-bar select { height: 38px; color: #cbd0d3; font-size: 11px; }
.search-field { height: 38px; }
.table-section { margin-top: 18px; }
.signals-table tbody tr { cursor: pointer; }
.signals-table td:first-child { font-weight: 700; }

.webhook-form { max-width: 980px; }
.webhook-fields { grid-template-columns: minmax(240px, 1.4fr) minmax(190px, 1fr) 160px 150px; }
.span-2 { grid-column: span 2; }
.switch { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.switch input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.switch > span { position: relative; width: 34px; height: 19px; border-radius: 12px; background: #3a4147; transition: background .15s ease; }
.switch > span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 13px; height: 13px; border-radius: 50%; background: #d5dade; transition: transform .15s ease; }
.switch input:checked + span { background: #237d56; }
.switch input:checked + span::after { transform: translateX(15px); }
.switch b { color: var(--muted); font-size: 11px; }
.signature-preview { display: flex; align-items: center; gap: 12px; margin-top: 16px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 5px; background: #0e1113; overflow: hidden; }
.signature-preview span { color: var(--muted-2); font-size: 10px; white-space: nowrap; }
.signature-preview code { overflow: hidden; color: #afc9f6; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }

.stacked-fields { display: grid; gap: 14px; }
.definition-list { margin: 0; }
.definition-list > div { display: flex; align-items: center; justify-content: space-between; min-height: 44px; border-bottom: 1px solid var(--line); }
.definition-list > div:last-child { border-bottom: 0; }
.definition-list dt { color: var(--muted); font-size: 11px; }
.definition-list dd { margin: 0; color: #d2d6d9; font: 11px "Cascadia Mono", Consolas, monospace; }
.audit-list { overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.audit-item { min-height: 52px; display: grid; grid-template-columns: 170px 180px 1fr; align-items: center; gap: 12px; padding: 0 14px; border-bottom: 1px solid var(--line); }
.audit-item:last-child { border-bottom: 0; }
.audit-item time { color: var(--muted-2); font: 10px "Cascadia Mono", Consolas, monospace; }
.audit-item strong { font-size: 11px; }
.audit-item span { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }

.drawer { position: fixed; z-index: 51; top: 0; right: 0; bottom: 0; width: min(480px, 100%); padding: 22px; border-left: 1px solid var(--line); background: #111416; box-shadow: var(--shadow); transform: translateX(102%); transition: transform .2s ease; overflow-y: auto; }
.drawer.open { transform: translateX(0); }
.drawer-backdrop { position: fixed; z-index: 50; inset: 0; visibility: hidden; background: rgba(0, 0, 0, .48); opacity: 0; transition: opacity .2s ease; }
.drawer-backdrop.open { visibility: visible; opacity: 1; }
.drawer-header { display: flex; align-items: flex-start; justify-content: space-between; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.drawer-header h2 { margin: 0; font-size: 18px; }
.drawer-content { padding-top: 18px; }
.detail-group { margin-bottom: 24px; }
.detail-group h3 { margin: 0 0 10px; color: var(--muted); font-size: 10px; text-transform: uppercase; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; overflow: hidden; border: 1px solid var(--line); border-radius: 5px; background: var(--line); }
.detail-grid > div { min-width: 0; padding: 11px; background: var(--surface); }
.detail-grid span, .detail-grid strong { display: block; }
.detail-grid span { color: var(--muted-2); font-size: 9px; }
.detail-grid strong { overflow: hidden; margin-top: 5px; color: #d9dde0; font: 11px "Cascadia Mono", Consolas, monospace; text-overflow: ellipsis; }
.json-view { max-height: 360px; margin: 0; padding: 14px; overflow: auto; border: 1px solid var(--line); border-radius: 5px; color: #b9c9d7; background: #090b0c; font: 10px/1.65 "Cascadia Mono", Consolas, monospace; white-space: pre-wrap; word-break: break-word; }

.toast-region { position: fixed; z-index: 100; top: 18px; right: 18px; display: grid; gap: 8px; width: min(360px, calc(100vw - 36px)); }
.toast { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: 6px; color: #dce0e2; background: #20252a; box-shadow: var(--shadow); animation: toast-in .18s ease both; }
.toast.success { border-color: #2d684c; }
.toast.error { border-color: #74323a; }
.toast svg { margin-top: 1px; }
.toast.success svg { color: var(--green); }
.toast.error svg { color: var(--red); }
.toast div { min-width: 0; }
.toast strong, .toast span { display: block; }
.toast strong { font-size: 11px; }
.toast span { margin-top: 3px; color: var(--muted); font-size: 10px; line-height: 1.5; }
@keyframes toast-in { from { transform: translateY(-8px); opacity: 0; } }

.loading { pointer-events: none; opacity: .65; }
.loading svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1180px) {
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .monitor-grid { grid-template-columns: 1fr; }
  .gate-console-grid { grid-template-columns: 1fr; }
  .filter-bar { grid-template-columns: minmax(200px, 1fr) repeat(3, 130px) 34px; }
  .webhook-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .signal-row { grid-template-columns: 34px 1fr .8fr 110px; }
  .signal-row > :nth-child(4) { display: none; }
}

@media (max-width: 820px) {
  .app-shell { display: block; padding-bottom: 68px; }
  .sidebar { inset: auto 0 0; width: auto; height: 64px; display: block; padding: 0; border-top: 1px solid var(--line); border-right: 0; }
  .sidebar .brand, .sidebar-foot { display: none; }
  .nav { height: 63px; grid-template-columns: repeat(7, 1fr); gap: 0; margin: 0; }
  .nav-item { height: 63px; flex-direction: column; justify-content: center; gap: 4px; padding: 0 4px; border-radius: 0; font-size: 9px; }
  .nav-item.active::before { top: 0; left: 50%; width: 22px; height: 2px; transform: translateX(-50%); }
  .nav-item b { position: absolute; top: 7px; left: calc(50% + 5px); min-width: 15px; padding: 1px 3px; }
  .main-area { width: 100%; padding: 0 16px 36px; }
  .topbar { height: 74px; }
  .top-actions .status-chip, .top-actions .button.ghost { display: none; }
  .topbar h1 { font-size: 18px; }
  .risk-banner { align-items: flex-start; }
  .risk-banner > svg { margin-top: 2px; }
  .metrics-grid { gap: 8px; }
  .metric { min-height: 96px; padding: 13px; }
  .metric-icon { width: 34px; height: 34px; }
  .metric strong { font-size: 20px; }
  .section-block { margin-top: 22px; }
  .table-wrap { min-height: 154px; }
  .signal-row { grid-template-columns: 30px 1fr 90px; padding: 0 10px; gap: 9px; }
  .signal-row > :nth-child(3), .signal-row > :nth-child(4) { display: none; }
  .settings-grid { grid-template-columns: 1fr; }
  .filter-bar { grid-template-columns: 1fr 1fr 1fr; }
  .filter-bar .search-field { grid-column: span 2; }
  .filter-bar #signalStatusFilter { display: none; }
  .runtime-strip { grid-template-columns: repeat(2, 1fr); }
  .runtime-strip > div:nth-child(2) { border-right: 0; }
  .runtime-strip > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .scenario-control { grid-template-columns: repeat(5, minmax(64px, 1fr)); overflow-x: auto; }
  .scenario-control button { min-width: 64px; flex-direction: column; gap: 3px; font-size: 9px; }
  .audit-item { grid-template-columns: 125px 1fr; }
  .audit-item span { display: none; }
  .project-row { grid-template-columns: 28px minmax(110px, .8fr) minmax(170px, 1.2fr) 34px; }
  .project-row .status-chip { display: none; }
  .gate-events-table { min-width: 920px; }
  .browser-frame-shell { min-height: 300px; }
}

@media (max-width: 520px) {
  .login-panel { padding: 24px; }
  .topbar .button.compact span { display: none; }
  .topbar .button.compact { width: 34px; padding: 0; }
  .risk-banner span { line-height: 1.4; }
  .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric { min-width: 0; gap: 10px; }
  .metric-icon { display: none; }
  .metric strong { font-size: 19px; }
  .section-heading { align-items: flex-start; }
  .section-heading .button.text { font-size: 10px; }
  .form-grid, .webhook-fields { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .tool-panel, .monitor-control, .demo-lab { padding: 15px; }
  .panel-heading { margin-bottom: 18px; }
  .monitor-control .section-heading { display: block; }
  .monitor-control .button-row { margin-top: 12px; }
  .monitor-control .button-row .button { flex: 1 1 42%; padding: 0 8px; }
  .filter-bar { grid-template-columns: 1fr 1fr 34px; }
  .filter-bar .search-field { grid-column: span 2; }
  .filter-bar #signalSideFilter { display: none; }
  .signature-preview { display: block; }
  .signature-preview code { display: block; margin-top: 6px; }
  .definition-list dd { max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .drawer { padding: 18px 15px; }
  .detail-grid { grid-template-columns: 1fr 1fr; }
  .project-row { grid-template-columns: 24px 1fr 34px; gap: 6px; }
  .project-row .project-id { grid-column: 2 / 4; grid-row: 2; }
  .account-values strong { font-size: 16px; }
  .browser-frame-shell { min-height: 220px; }
}
