:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --surface: #ffffff;
  --surface-2: #f8fafb;
  --surface-3: #eef2f4;
  --text: #172127;
  --text-2: #42515a;
  --muted: #77858d;
  --line: #dfe5e8;
  --line-strong: #cbd4d9;
  --black: #11191e;
  --blue: #1769e0;
  --blue-soft: #eaf2ff;
  --green: #0a8f62;
  --green-soft: #e8f7f1;
  --amber: #a66a00;
  --amber-soft: #fff4dc;
  --red: #c63d4b;
  --red-soft: #fff0f1;
  --violet: #6c4ccf;
  --violet-soft: #f0ecff;
  --shadow: 0 12px 30px rgba(29, 45, 55, 0.08);
  font-family: Inter, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { min-width: 320px; min-height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font-size: 14px; letter-spacing: 0; }
button, input, textarea, select { font: inherit; color: inherit; letter-spacing: 0; }
button, a { -webkit-tap-highlight-color: transparent; }
button { border: 0; }
a { color: inherit; text-decoration: none; }
svg { width: 17px; height: 17px; stroke-width: 1.8; flex: 0 0 auto; }
[hidden] { display: none !important; }

.app-shell { min-height: 100vh; }
.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) auto minmax(300px, 1fr);
  align-items: center;
  min-height: 72px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(18px);
}

.brand-block { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-block h1 { margin: 0; font-size: 16px; line-height: 1.2; font-weight: 760; }
.brand-block p { margin: 3px 0 0; color: var(--muted); font-size: 9px; font-weight: 700; }
.brand-symbol { position: relative; width: 34px; height: 34px; border-radius: 7px; background: var(--black); }
.brand-symbol span { position: absolute; width: 7px; height: 7px; border-radius: 2px; background: #fff; }
.brand-symbol span:nth-child(1) { left: 8px; top: 8px; }
.brand-symbol span:nth-child(2) { right: 8px; top: 8px; background: #77e0bd; }
.brand-symbol span:nth-child(3) { left: 13px; bottom: 8px; width: 13px; background: #79aef8; }

.workspace-tabs { display: flex; align-items: center; gap: 2px; padding: 4px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-2); }
.workspace-tab { position: relative; display: flex; align-items: center; gap: 7px; height: 36px; padding: 0 12px; border-radius: 5px; background: transparent; color: var(--text-2); cursor: pointer; white-space: nowrap; }
.workspace-tab:hover { background: var(--surface); color: var(--text); }
.workspace-tab.active { background: var(--surface); color: var(--black); box-shadow: 0 1px 5px rgba(26, 40, 48, 0.1); }
.workspace-tab span { font-size: 12px; font-weight: 650; }
.workspace-tab b { min-width: 17px; height: 17px; padding: 0 4px; border-radius: 5px; background: var(--surface-3); color: var(--muted); font-size: 9px; line-height: 17px; text-align: center; }
.workspace-tab.active b { background: var(--black); color: #fff; }

.header-actions { display: flex; justify-content: flex-end; align-items: center; gap: 7px; min-width: 0; }
.service-pill { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--text-2); font-size: 11px; white-space: nowrap; }
.service-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.icon-command, .text-command, .primary-command, .secondary-command {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 34px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}
.icon-command { position: relative; width: 34px; padding: 0; border: 1px solid var(--line); background: #fff; color: var(--text-2); }
.icon-command:hover { border-color: var(--line-strong); background: var(--surface-2); color: var(--black); }
.icon-command.small { width: 30px; min-height: 30px; }
.icon-command.small svg { width: 15px; height: 15px; }
.text-command { padding: 0 4px; background: transparent; color: var(--text-2); font-size: 12px; }
.text-command:hover { color: var(--blue); }
.primary-command { padding: 0 14px; background: var(--black); color: #fff; font-size: 12px; font-weight: 680; }
.primary-command:hover { background: #27343c; }
.secondary-command { padding: 0 13px; border: 1px solid var(--line-strong); background: #fff; color: var(--text-2); font-size: 12px; font-weight: 620; }
.secondary-command:hover { border-color: var(--black); color: var(--black); }
.primary-command:disabled, .secondary-command:disabled, .icon-command:disabled { opacity: 0.45; cursor: default; }
#eventUnread { position: absolute; right: 7px; top: 6px; width: 6px; height: 6px; border: 2px solid #fff; border-radius: 50%; background: var(--red); }

.workspace-main { width: min(1680px, 100%); margin: 0 auto; padding: 30px 28px 56px; }
.workspace-view { display: none; }
.workspace-view.active { display: block; animation: view-in 160ms ease-out; }
@keyframes view-in { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: translateY(0); } }
.view-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; min-height: 86px; padding-bottom: 22px; }
.compact-heading { min-height: 72px; }
.eyebrow { display: block; margin-bottom: 7px; color: var(--muted); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.view-heading h2 { margin: 0; font-size: 27px; line-height: 1.15; font-weight: 760; }
.view-heading p { max-width: 700px; margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.heading-meta { display: flex; align-items: center; gap: 10px; }
.heading-meta code { max-width: 320px; overflow: hidden; color: var(--text-2); font-family: Consolas, monospace; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }

.metric-ribbon { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.metric-ribbon > div { min-width: 0; padding: 20px 22px; border-right: 1px solid var(--line); }
.metric-ribbon > div:last-child { border-right: 0; }
.metric-ribbon span, .metric-ribbon small { display: block; color: var(--muted); font-size: 10px; }
.metric-ribbon strong { display: block; margin: 9px 0 7px; font-size: 27px; line-height: 1; font-weight: 740; }
.metric-ribbon small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.overview-layout { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(320px, 0.65fr); gap: 18px; margin-top: 18px; }
.overview-stream, .overview-activity { min-height: 360px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 67px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.section-title h3 { margin: 0; font-size: 14px; font-weight: 720; }
.section-title p { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.active-task-list { display: grid; }
.active-task-item { display: grid; grid-template-columns: minmax(180px, 1.5fr) 100px minmax(130px, 0.7fr) minmax(150px, 0.8fr); align-items: center; gap: 18px; min-height: 86px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.active-task-item:last-child { border-bottom: 0; }
.active-task-item h4 { overflow: hidden; margin: 0 0 6px; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.active-task-item p { overflow: hidden; margin: 0; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.engine-badge, .status-badge, .mode-chip { display: inline-flex; align-items: center; justify-content: center; width: fit-content; height: 22px; padding: 0 7px; border-radius: 5px; font-size: 9px; font-weight: 780; }
.engine-badge.api, .mode-chip.api { background: var(--blue-soft); color: var(--blue); }
.engine-badge.browser, .mode-chip.browser { background: var(--violet-soft); color: var(--violet); }
.engine-badge.auto, .mode-chip.hybrid { background: var(--green-soft); color: var(--green); }
.task-progress-view { min-width: 0; }
.task-progress-view div { display: flex; justify-content: space-between; margin-bottom: 7px; color: var(--text-2); font-size: 10px; }
.task-progress-view progress { display: block; width: 100%; height: 5px; overflow: hidden; border: 0; border-radius: 3px; background: var(--surface-3); }
.task-progress-view progress::-webkit-progress-bar { background: var(--surface-3); }
.task-progress-view progress::-webkit-progress-value { background: var(--blue); }
.task-progress-view progress::-moz-progress-bar { background: var(--blue); }
.active-task-meta { min-width: 0; color: var(--text-2); font-size: 10px; line-height: 1.7; }

.blank-state { display: flex; min-height: 260px; flex-direction: column; align-items: center; justify-content: center; padding: 34px; color: var(--muted); text-align: center; }
.blank-state svg { width: 27px; height: 27px; margin-bottom: 14px; color: var(--line-strong); }
.blank-state strong { color: var(--text-2); font-size: 12px; }
.blank-state span { max-width: 360px; margin-top: 6px; font-size: 10px; line-height: 1.6; }
.compact-event-list, .event-list { display: grid; }
.compact-event { display: grid; grid-template-columns: 8px minmax(0, 1fr); gap: 10px; padding: 13px 17px; border-bottom: 1px solid var(--line); }
.compact-event:last-child { border-bottom: 0; }
.compact-event i { width: 7px; height: 7px; margin-top: 4px; border-radius: 50%; background: var(--blue); }
.compact-event.warning i { background: var(--amber); }
.compact-event.error i { background: var(--red); }
.compact-event.success i { background: var(--green); }
.compact-event p { margin: 0; color: var(--text-2); font-size: 10px; line-height: 1.45; }
.compact-event time { display: block; margin-top: 5px; color: var(--muted); font-size: 9px; }

.list-toolbar, .channel-summary-line { display: flex; align-items: center; gap: 10px; min-height: 58px; padding: 10px 12px; border: 1px solid var(--line); border-bottom: 0; border-radius: 7px 7px 0 0; background: var(--surface); }
.search-control { display: flex; flex: 1; align-items: center; gap: 9px; min-width: 220px; height: 36px; padding: 0 11px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-2); }
.search-control svg { width: 15px; height: 15px; color: var(--muted); }
.search-control input { width: 100%; border: 0; outline: 0; background: transparent; font-size: 11px; }
.segmented-filter { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-2); }
.segmented-filter button { min-height: 27px; padding: 0 9px; border-radius: 4px; background: transparent; color: var(--muted); font-size: 10px; cursor: pointer; }
.segmented-filter button:hover { color: var(--text); }
.segmented-filter button.active { background: #fff; color: var(--black); box-shadow: 0 1px 4px rgba(23, 33, 39, 0.1); }

.data-table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 0 0 7px 7px; background: var(--surface); }
.data-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.data-table th { height: 37px; padding: 0 12px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 9px; font-weight: 760; text-align: left; text-transform: uppercase; }
.data-table td { height: 78px; padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #fbfcfd; }
.task-table th:nth-child(1) { width: 27%; }
.task-table th:nth-child(2) { width: 17%; }
.task-table th:nth-child(3) { width: 13%; }
.task-table th:nth-child(4) { width: 12%; }
.task-table th:nth-child(5) { width: 13%; }
.task-table th:nth-child(6) { width: 10%; }
.task-table th:nth-child(7) { width: 92px; }
.task-title { min-width: 0; }
.task-title strong { display: block; overflow: hidden; font-family: Consolas, monospace; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.task-title p { display: -webkit-box; overflow: hidden; margin: 6px 0 0; color: var(--text-2); font-size: 10px; line-height: 1.4; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.task-status-cell { min-width: 0; }
.status-badge { margin-bottom: 7px; background: var(--surface-3); color: var(--text-2); }
.status-badge.completed { background: var(--green-soft); color: var(--green); }
.status-badge.failed, .status-badge.cancelled { background: var(--red-soft); color: var(--red); }
.status-badge.processing, .status-badge.submitting, .status-badge.downloading { background: var(--blue-soft); color: var(--blue); }
.status-badge.queued, .status-badge.waiting_account { background: var(--amber-soft); color: var(--amber); }
.task-status-cell p, .task-meta-lines { margin: 0; color: var(--muted); font-size: 9px; line-height: 1.55; }
.task-engine-cell { display: grid; gap: 6px; }
.task-engine-cell span:last-child { overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.task-output-link { color: var(--blue); font-size: 10px; font-weight: 650; }
.task-output-link:hover { text-decoration: underline; }
.task-actions { display: flex; justify-content: flex-end; gap: 4px; }
.task-actions button { width: 29px; height: 29px; border: 1px solid var(--line); border-radius: 5px; background: #fff; color: var(--text-2); cursor: pointer; }
.task-actions button:hover { border-color: var(--blue); color: var(--blue); }
.task-actions button.danger:hover { border-color: var(--red); color: var(--red); }
.task-actions svg { width: 14px; height: 14px; }
.table-blank { min-height: 280px; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 7px 7px; background: var(--surface); }

.channel-summary-line { justify-content: space-between; border-bottom: 1px solid var(--line); border-radius: 7px; }
.channel-summary-line > div:first-child { color: var(--muted); font-size: 10px; }
.channel-grid { display: grid; grid-template-columns: repeat(4, minmax(250px, 1fr)); gap: 12px; margin-top: 14px; }
.channel-card { position: relative; display: flex; min-width: 0; min-height: 278px; flex-direction: column; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); transition: border-color 120ms ease, box-shadow 120ms ease; }
.channel-card:hover { border-color: var(--line-strong); box-shadow: 0 10px 22px rgba(31, 47, 56, 0.06); }
.channel-card.disabled { opacity: 0.65; }
.channel-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 15px 15px 12px; }
.channel-identity { min-width: 0; }
.channel-identity strong { display: block; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.channel-identity span { display: block; overflow: hidden; margin-top: 5px; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.channel-mode-stack { display: flex; gap: 4px; }
.channel-health { display: flex; align-items: center; gap: 7px; margin: 0 15px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface-2); color: var(--text-2); font-size: 9px; }
.channel-health i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.channel-health.warning i { background: var(--amber); }
.channel-health.error i { background: var(--red); }
.channel-health b { margin-left: auto; color: var(--text); font-weight: 700; }
.ck-health { display: flex; align-items: center; gap: 7px; margin: 7px 15px 0; padding: 7px 10px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface-2); color: var(--text-2); font-size: 9px; }
.ck-health i { width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; background: var(--muted); }
.ck-health.ok i { background: var(--green); animation: ck-status-pulse 1.6s ease-in-out infinite; }
.ck-health.error i { background: var(--red); animation: ck-status-pulse 1s ease-in-out infinite; }
.ck-health.checking i { background: var(--amber); animation: ck-status-pulse .75s ease-in-out infinite; }
.ck-health b { margin-left: auto; color: var(--text); font-weight: 700; }
@keyframes ck-status-pulse { 0%, 100% { opacity: .35; transform: scale(.82); } 50% { opacity: 1; transform: scale(1.18); } }
.channel-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 13px 15px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.channel-metrics div { min-width: 0; padding: 12px 8px; border-right: 1px solid var(--line); text-align: center; }
.channel-metrics div:last-child { border-right: 0; }
.channel-metrics span { display: block; color: var(--muted); font-size: 8px; }
.channel-metrics strong { display: block; margin-top: 5px; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.quota-block { padding: 13px 15px; }
.quota-block div { display: flex; justify-content: space-between; margin-bottom: 7px; color: var(--muted); font-size: 9px; }
.quota-block b { color: var(--text-2); }
.quota-track { width: 100%; height: 5px; overflow: hidden; border-radius: 3px; background: var(--surface-3); }
.quota-track i { display: block; height: 100%; background: var(--green); }
.quota-track.warning i { background: var(--amber); }
.quota-track.error i { background: var(--red); }
.channel-card-footer { display: flex; align-items: center; gap: 5px; margin-top: auto; padding: 10px 12px; border-top: 1px solid var(--line); }
.channel-card-footer button { display: inline-flex; align-items: center; justify-content: center; width: 29px; height: 29px; border: 1px solid transparent; border-radius: 5px; background: transparent; color: var(--muted); cursor: pointer; }
.channel-card-footer button:hover { border-color: var(--line); background: var(--surface-2); color: var(--black); }
.channel-card-footer button.danger { margin-left: auto; }
.channel-card-footer button.danger:hover { color: var(--red); }
.channel-card-footer svg { width: 14px; height: 14px; }

.worker-board { display: grid; gap: 10px; }
.worker-row { display: grid; grid-template-columns: minmax(220px, 1.2fr) 130px 140px minmax(180px, 1fr) 170px 42px; align-items: center; gap: 18px; min-height: 86px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.worker-name { min-width: 0; }
.worker-name strong { display: block; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.worker-name code { display: block; overflow: hidden; margin-top: 6px; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.worker-state { display: inline-flex; align-items: center; gap: 7px; color: var(--text-2); font-size: 10px; }
.worker-state i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.worker-state.offline i { background: var(--muted); }
.worker-state.disabled i { background: var(--red); }
.worker-stat { min-width: 0; }
.worker-stat span { display: block; color: var(--muted); font-size: 8px; }
.worker-stat strong { display: block; margin-top: 5px; overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.worker-capabilities { display: flex; flex-wrap: wrap; gap: 4px; }
.worker-capabilities span { padding: 4px 6px; border-radius: 4px; background: var(--surface-3); color: var(--text-2); font-size: 8px; font-weight: 720; }

.storage-band { display: grid; grid-template-columns: 64px minmax(0, 1fr) minmax(160px, auto); align-items: center; gap: 18px; min-height: 118px; margin-bottom: 12px; padding: 20px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.storage-visual { display: grid; width: 54px; height: 54px; place-items: center; border-radius: 7px; background: var(--green-soft); color: var(--green); }
.storage-visual.output { background: var(--blue-soft); color: var(--blue); }
.storage-visual svg { width: 25px; height: 25px; }
.storage-band span { color: var(--muted); font-size: 9px; }
.storage-band strong { display: block; margin-top: 4px; font-size: 14px; }
.storage-band p { margin: 6px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.storage-status { text-align: right; }
.storage-status b { display: block; color: var(--green); font-size: 11px; }
.storage-status small { display: block; margin-top: 5px; color: var(--muted); font-size: 9px; }
.asset-policy-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 18px; }
.asset-policy-grid > div { display: grid; grid-template-columns: 34px minmax(0, 1fr); align-items: center; gap: 2px 10px; min-height: 72px; padding: 12px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.asset-policy-grid svg { grid-row: 1 / 3; color: var(--blue); }
.asset-policy-grid strong { font-size: 11px; }
.asset-policy-grid span { color: var(--muted); font-size: 9px; }

.capture-console { border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.capture-url-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: end; gap: 9px; padding: 18px; }
.capture-url-row label { display: grid; gap: 7px; }
.capture-url-row label span { color: var(--muted); font-size: 9px; font-weight: 700; }
.capture-url-row input { width: 100%; height: 37px; padding: 0 11px; border: 1px solid var(--line); border-radius: 6px; outline: 0; font-size: 11px; }
.capture-url-row input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.capture-live-strip { display: grid; grid-template-columns: 110px 90px 90px minmax(0, 1fr); border-top: 1px solid var(--line); background: var(--surface-2); }
.capture-live-strip div { min-width: 0; padding: 13px 16px; border-right: 1px solid var(--line); }
.capture-live-strip div:last-child { border-right: 0; }
.capture-live-strip span { display: block; color: var(--muted); font-size: 8px; }
.capture-live-strip strong, .capture-live-strip code { display: block; overflow: hidden; margin-top: 5px; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.capture-history-heading { margin-top: 18px; border: 1px solid var(--line); border-radius: 7px 7px 0 0; background: var(--surface); }
.capture-history { border: 1px solid var(--line); border-top: 0; border-radius: 0 0 7px 7px; background: var(--surface); }
.capture-record { display: grid; grid-template-columns: minmax(200px, 1.5fr) 110px 110px 140px auto; align-items: center; gap: 16px; min-height: 65px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.capture-record:last-child { border-bottom: 0; }
.capture-record strong { display: block; overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.capture-record span, .capture-record time { color: var(--muted); font-size: 9px; }

.event-drawer { position: fixed; z-index: 70; top: 0; right: 0; width: min(430px, 92vw); height: 100vh; overflow: hidden; border-left: 1px solid var(--line); background: var(--surface); box-shadow: -18px 0 40px rgba(27, 42, 51, 0.1); transform: translateX(105%); transition: transform 180ms ease; }
.event-drawer.open { transform: translateX(0); }
.drawer-heading { display: flex; align-items: center; justify-content: space-between; min-height: 72px; padding: 0 17px; border-bottom: 1px solid var(--line); }
.drawer-heading h2 { margin: 0; font-size: 17px; }
.drawer-filter { display: flex; gap: 4px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.drawer-filter button { min-height: 27px; padding: 0 10px; border-radius: 5px; background: transparent; color: var(--muted); font-size: 10px; cursor: pointer; }
.drawer-filter button.active { background: var(--surface-3); color: var(--text); }
.event-list { height: calc(100vh - 122px); overflow: auto; }
.event-entry { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; padding: 14px; border-bottom: 1px solid var(--line); }
.event-entry-icon { display: grid; width: 28px; height: 28px; place-items: center; border-radius: 6px; background: var(--blue-soft); color: var(--blue); }
.event-entry.warning .event-entry-icon { background: var(--amber-soft); color: var(--amber); }
.event-entry.error .event-entry-icon { background: var(--red-soft); color: var(--red); }
.event-entry.success .event-entry-icon { background: var(--green-soft); color: var(--green); }
.event-entry-icon svg { width: 14px; height: 14px; }
.event-entry p { margin: 0; color: var(--text-2); font-size: 10px; line-height: 1.5; word-break: break-word; }
.event-entry time { display: block; margin-top: 6px; color: var(--muted); font-size: 9px; }
.drawer-backdrop { position: fixed; z-index: 65; inset: 0; display: none; background: rgba(17, 25, 30, 0.18); cursor: default; }
.event-drawer.open + .drawer-backdrop { display: block; }

.app-dialog { width: min(780px, calc(100vw - 32px)); max-height: calc(100vh - 34px); padding: 0; overflow: hidden; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); }
.app-dialog::backdrop { background: rgba(17, 25, 30, 0.24); backdrop-filter: blur(3px); }
.wide-dialog { width: min(1080px, calc(100vw - 32px)); }
.settings-dialog { width: min(720px, calc(100vw - 32px)); }
.api-token-dialog { width: min(420px, calc(100vw - 32px)); }
.api-token-dialog .dialog-footer { grid-template-columns: minmax(0, 1fr); }
.api-token-dialog .primary-command { justify-self: end; }
.dialog-layout { display: flex; max-height: calc(100vh - 36px); flex-direction: column; }
.dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 19px 20px 16px; border-bottom: 1px solid var(--line); }
.dialog-header h2 { margin: 0; font-size: 19px; }
.dialog-header p { margin: 6px 0 0; color: var(--muted); font-size: 10px; }
.dialog-body { overflow: auto; padding: 18px 20px 22px; }
.dialog-footer { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 8px; min-height: 62px; padding: 10px 20px; border-top: 1px solid var(--line); background: var(--surface-2); }
.dialog-footer > span { color: var(--muted); font-size: 9px; }
.prompt-control { display: grid; gap: 7px; }
.prompt-control > span, .form-grid label > span, .task-option-grid label > span { display: flex; justify-content: space-between; color: var(--text-2); font-size: 9px; font-weight: 700; }
.prompt-control b { color: var(--muted); font-weight: 550; }
.prompt-control textarea { width: 100%; min-height: 108px; resize: vertical; padding: 11px 12px; border: 1px solid var(--line); border-radius: 6px; outline: 0; font-size: 11px; line-height: 1.6; }
.prompt-control textarea:focus, .form-grid input:focus, .form-grid select:focus, .task-option-grid input:focus, .task-option-grid select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.task-option-grid, .form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 15px; }
.task-option-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.task-option-grid label, .form-grid label { display: grid; gap: 7px; min-width: 0; }
.task-option-grid input, .task-option-grid select, .form-grid input, .form-grid select { width: 100%; height: 36px; min-width: 0; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px; outline: 0; background: #fff; font-size: 10px; }
.task-option-grid input:disabled { background: var(--surface-2); color: var(--muted); }
.span-2 { grid-column: span 2; }
.asset-editor { margin-top: 17px; border-top: 1px solid var(--line); padding-top: 16px; }
.asset-editor-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 11px; }
.asset-editor-heading h3 { margin: 0; font-size: 12px; }
.asset-editor-heading p { margin: 4px 0 0; color: var(--muted); font-size: 9px; }
.asset-editor-heading > span { color: var(--muted); font-size: 9px; }
.asset-editor-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: 10px; }
.asset-editor-grid.pixverse-assets { grid-template-columns: 1fr; }
.asset-bucket { min-width: 0; padding: 11px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-2); }
.asset-bucket > div:first-child { display: flex; justify-content: space-between; align-items: center; }
.asset-bucket strong { font-size: 10px; }
.asset-bucket span { color: var(--muted); font-size: 8px; }
.asset-bucket > label { display: flex; align-items: center; justify-content: center; gap: 6px; height: 30px; margin-top: 9px; border: 1px dashed var(--line-strong); border-radius: 5px; background: #fff; color: var(--text-2); font-size: 9px; cursor: pointer; }
.asset-bucket > label:hover { border-color: var(--blue); color: var(--blue); }
.asset-bucket > label svg { width: 14px; height: 14px; }
.asset-slot-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; margin-top: 8px; }
.asset-slot-grid.image { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.asset-slot { position: relative; display: grid; min-width: 0; height: 46px; place-items: center; overflow: hidden; border: 1px solid var(--line); border-radius: 5px; background: #fff; }
.asset-slot img, .asset-slot video { width: 100%; height: 100%; object-fit: cover; }
.asset-slot span { max-width: 90%; overflow: hidden; color: var(--text-2); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.asset-slot button { position: absolute; top: 2px; right: 2px; display: grid; width: 18px; height: 18px; place-items: center; border-radius: 4px; background: rgba(17, 25, 30, 0.78); color: #fff; cursor: pointer; }
.asset-slot button svg { width: 11px; height: 11px; }

.channel-dialog-body { display: grid; gap: 14px; }
.channel-base-grid { margin-top: 0; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.config-section { padding: 14px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-2); }
.config-section-heading { display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.config-section-heading > div { display: flex; align-items: center; gap: 9px; }
.config-section-heading > div > svg { color: var(--blue); }
.config-section-heading span span { display: grid; }
.config-section-heading strong { font-size: 11px; }
.config-section-heading small { display: block; margin-top: 3px; color: var(--muted); font-size: 8px; }
.method-url { grid-column: span 2; grid-template-columns: 80px minmax(0, 1fr); }
.method-url > span { grid-column: span 2; }
.method-url select { grid-column: 1; }
.method-url input { grid-column: 2; }
.toggle-row { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.toggle-row input { width: 16px; height: 16px; accent-color: var(--black); }
.toggle-row span { display: grid; gap: 3px; }
.toggle-row b { font-size: 10px; }
.toggle-row small { color: var(--muted); font-size: 8px; }
.settings-tabs { margin-bottom: 14px; }
.settings-panel { display: none; }
.settings-panel.active { display: block; }
.settings-panel .form-grid { margin-top: 0; }
.deployment-role-selector { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
.deployment-role-selector button { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--muted); font-size: 10px; font-weight: 700; cursor: pointer; }
.deployment-role-selector button:hover { border-color: var(--line-strong); color: var(--text); }
.deployment-role-selector button.active { border-color: var(--black); background: var(--black); color: #fff; }
.deployment-role-selector svg { width: 15px; height: 15px; }
.connection-strip { display: grid; grid-template-columns: 8px minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 52px; margin-bottom: 14px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-2); }
.connection-strip > i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.connection-strip.connected > i { background: var(--green); }
.connection-strip.error > i { background: var(--red); }
.connection-strip div { display: grid; gap: 3px; min-width: 0; }
.connection-strip strong { font-size: 10px; }
.connection-strip span { overflow: hidden; color: var(--muted); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.compact-command { min-height: 32px; padding: 0 10px; }
.network-toggle { margin-top: 14px; }
.runtime-toggle { margin-top: 14px; }
.control-access-fields { display: grid; gap: 12px; }
.control-access-fields label { display: grid; gap: 7px; min-width: 0; }
.control-access-fields label > span { color: var(--text-2); font-size: 9px; font-weight: 700; }
.control-access-fields label > div { display: grid; grid-template-columns: minmax(0, 1fr) 36px; gap: 7px; }
.control-access-fields label > div.three-actions { grid-template-columns: minmax(0, 1fr) 36px 36px 36px; }
.control-access-fields input { width: 100%; height: 36px; min-width: 0; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px; outline: 0; background: var(--surface-2); font-family: Consolas, monospace; font-size: 10px; }
.control-access-fields .icon-command { width: 36px; height: 36px; }

.toast { position: fixed; z-index: 100; left: 50%; bottom: 26px; min-width: 220px; max-width: min(460px, calc(100vw - 32px)); padding: 11px 14px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--black); color: #fff; font-size: 10px; text-align: center; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transform: translate(-50%, 8px); transition: opacity 150ms ease, transform 150ms ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--red); }

@media (max-width: 1320px) {
  .app-header { grid-template-columns: 210px minmax(0, 1fr) auto; padding: 0 17px; }
  .workspace-tab { padding: 0 9px; }
  .workspace-tab span { display: none; }
  .service-pill { display: none; }
  .channel-grid { grid-template-columns: repeat(3, minmax(240px, 1fr)); }
}

@media (max-width: 980px) {
  .app-header { grid-template-columns: minmax(180px, 1fr) auto; grid-template-areas: "brand actions" "tabs tabs"; min-height: 112px; padding: 10px 14px 8px; }
  .brand-block { grid-area: brand; }
  .header-actions { grid-area: actions; }
  .workspace-tabs { grid-area: tabs; justify-content: center; overflow-x: auto; }
  .workspace-tab span { display: inline; }
  .workspace-main { padding: 22px 16px 42px; }
  .metric-ribbon { grid-template-columns: repeat(3, 1fr); }
  .metric-ribbon > div { border-bottom: 1px solid var(--line); }
  .metric-ribbon > div:nth-child(3) { border-right: 0; }
  .metric-ribbon > div:nth-child(n + 4) { border-bottom: 0; }
  .overview-layout { grid-template-columns: 1fr; }
  .channel-grid { grid-template-columns: repeat(2, minmax(240px, 1fr)); }
  .worker-row { grid-template-columns: minmax(200px, 1.2fr) 110px 120px minmax(150px, 1fr); }
  .worker-row > :nth-child(5), .worker-row > :nth-child(6) { display: none; }
  .task-option-grid { grid-template-columns: repeat(2, 1fr); }
  .asset-editor-grid { grid-template-columns: 1fr; }
  .asset-slot-grid.image { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
  .asset-slot-grid.image { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .app-header { grid-template-columns: 1fr auto; }
  .brand-block p, .header-actions .icon-command:nth-of-type(2), .header-actions .icon-command:nth-of-type(3) { display: none; }
  .header-actions .settings-command { display: inline-flex !important; }
  .primary-command span { display: none; }
  .workspace-tabs { justify-content: flex-start; }
  .workspace-tab span { display: none; }
  .view-heading { align-items: flex-start; flex-direction: column; }
  .heading-meta { width: 100%; justify-content: space-between; }
  .metric-ribbon { grid-template-columns: repeat(2, 1fr); }
  .metric-ribbon > div { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  .metric-ribbon > div:nth-child(even) { border-right: 0; }
  .metric-ribbon > div:last-child { grid-column: span 2; border-bottom: 0; }
  .active-task-item { grid-template-columns: 1fr 88px; }
  .active-task-meta, .active-task-item > .engine-badge { display: none; }
  .list-toolbar { align-items: stretch; flex-wrap: wrap; }
  .search-control { flex-basis: 100%; }
  .segmented-filter { max-width: 100%; overflow-x: auto; }
  .channel-grid { grid-template-columns: 1fr; }
  .channel-summary-line { align-items: stretch; flex-direction: column; }
  .worker-row { grid-template-columns: 1fr 90px; }
  .worker-row > :nth-child(n + 3) { display: none; }
  .storage-band { grid-template-columns: 50px minmax(0, 1fr); }
  .storage-status { grid-column: 2; text-align: left; }
  .asset-policy-grid { grid-template-columns: repeat(2, 1fr); }
  .capture-url-row { grid-template-columns: 1fr auto auto; }
  .capture-url-row label { grid-column: 1 / -1; }
  .capture-live-strip { grid-template-columns: repeat(3, 1fr); }
  .capture-live-strip div:last-child { grid-column: 1 / -1; border-top: 1px solid var(--line); }
  .capture-record { grid-template-columns: minmax(0, 1fr) auto; }
  .capture-record > :nth-child(2), .capture-record > :nth-child(3), .capture-record > :nth-child(4) { display: none; }
  .task-option-grid, .form-grid, .channel-base-grid { grid-template-columns: 1fr; }
  .deployment-role-selector { grid-template-columns: 1fr; }
  .span-2, .method-url { grid-column: span 1; }
  .method-url { grid-template-columns: 72px minmax(0, 1fr); }
  .dialog-footer { grid-template-columns: 1fr auto auto; padding: 9px 12px; }
  .dialog-footer > span { display: none; }
  .dialog-footer .primary-command span { display: inline; }
  .dialog-header, .dialog-body { padding-left: 14px; padding-right: 14px; }
}
