:root {
  color-scheme: dark;
  --bg: #07101b;
  --panel: #0c1b2a;
  --panel-2: #101f2e;
  --panel-3: #142535;
  --line: #294052;
  --line-soft: #1f3445;
  --text: #e7eef8;
  --muted: #9eb1c7;
  --muted-2: #70869d;
  --accent: #2dd0b3;
  --accent-dim: rgba(45, 208, 179, .16);
  --accent-line: rgba(45, 208, 179, .55);
  --blue: #5cb6ff;
  --red: #ff657b;
  --amber: #efbd62;
  --shadow: 0 30px 90px rgba(0, 0, 0, .32);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { margin: 0; min-width: 320px; min-height: 100vh; color: var(--text); background: var(--bg); font-size: 14px; line-height: 1.45; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
.ambient { position: fixed; inset: 0; pointer-events: none; background: linear-gradient(90deg, rgba(28, 77, 122, .55) 0%, rgba(10, 27, 43, .12) 43%, rgba(6, 14, 23, 0) 69%, rgba(20, 94, 82, .45) 100%); }
.ambient::after { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 20% 80%, rgba(35, 112, 174, .16), transparent 38%), radial-gradient(circle at 92% 5%, rgba(20, 146, 118, .16), transparent 36%); }
.shell { position: relative; width: min(960px, calc(100% - 32px)); margin: 0 auto; padding: 34px 0 76px; }
.hidden { display: none !important; }

.brand-card { position: relative; min-height: 108px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 16px; background: rgba(8, 22, 35, .92); box-shadow: 0 12px 38px rgba(0, 0, 0, .12); }
.brand-center { text-align: center; }
.brand-line { display: flex; align-items: center; justify-content: center; gap: 10px; }
.brand-mark { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 10px; background: linear-gradient(145deg, #28d1b2, #3b89df); color: #04141a; font-size: 18px; font-weight: 900; box-shadow: 0 8px 24px rgba(43, 209, 179, .18); }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 25px; letter-spacing: .03em; }
.brand-center > p { margin-top: 9px; color: var(--muted); }
.service-status { position: absolute; top: 14px; left: 16px; display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; }
.service-status span { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 10px currentColor; }
.service-status.online span { background: var(--accent); }
.service-status.offline span { background: var(--red); }
#logout-btn { position: absolute; right: 14px; top: 12px; }

.login-card { margin-top: 28px; display: grid; grid-template-columns: 1.05fr .95fr; gap: 50px; align-items: center; padding: 42px; border: 1px solid var(--line); border-radius: 16px; background: rgba(10, 27, 42, .95); box-shadow: var(--shadow); }
.eyebrow { color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .14em; }
.login-copy h2 { margin: 8px 0 10px; font-size: 30px; }
.login-copy > p:last-child { color: var(--muted); }
.login-form { display: grid; gap: 14px; }
label { display: grid; gap: 7px; color: #c4d1df; font-size: 12px; font-weight: 700; }
input, select, textarea { width: 100%; border: 1px solid #283d4e; border-radius: 8px; outline: none; background: #07131f; color: var(--text); padding: 10px 12px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent-line); box-shadow: 0 0 0 3px rgba(45, 208, 179, .09); }
input:disabled, select:disabled, textarea:disabled { border-color: #263541; background: #101b25; color: var(--muted-2); cursor: not-allowed; opacity: .78; }
input.invalid, select.invalid, textarea.invalid { border-color: var(--red); box-shadow: 0 0 0 3px rgba(255, 101, 123, .08); }
textarea { resize: vertical; min-height: 108px; line-height: 1.5; }
input[type="checkbox"] { width: 15px; height: 15px; margin: 0; accent-color: var(--accent); box-shadow: none; }
.form-error { min-height: 18px; color: var(--red); font-size: 12px; }

.main-tabs { display: flex; align-items: center; gap: 8px; margin-top: 23px; padding: 0 0 9px; border-bottom: 1px solid var(--line-soft); }
.main-tab { border: 0; border-radius: 9px; padding: 10px 16px; background: transparent; color: var(--muted); cursor: pointer; font-weight: 750; }
.main-tab:hover { color: var(--text); }
.main-tab.active { background: var(--accent-dim); color: var(--accent); }
.badge { display: inline-grid; min-width: 19px; height: 19px; margin-left: 4px; padding: 0 5px; place-items: center; border-radius: 99px; background: #26394a; color: #b7c8d8; font-size: 10px; }
.pane { display: none; margin-top: 24px; }
.pane.active { display: block; }
.card { border: 1px solid var(--line); border-radius: 16px; background: rgba(9, 26, 41, .95); padding: 24px; box-shadow: 0 15px 45px rgba(0, 0, 0, .08); }
.card + .card { margin-top: 22px; }
.card h2 { font-size: 18px; }
.quick-card h2 { margin-bottom: 16px; }
.button-row, .card-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 39px; border: 1px solid transparent; border-radius: 8px; padding: 9px 17px; color: #e9f1fa; cursor: pointer; font-weight: 750; text-decoration: none; transition: border-color .15s, background .15s, opacity .15s, transform .15s; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:disabled { cursor: wait; opacity: .5; }
.button.primary { background: var(--accent); color: #042019; }
.button.secondary, .button.subtle { border-color: #2b3d4e; background: #243344; color: #dce6f1; }
.button.secondary:hover { border-color: #466078; background: #2b3c4e; }
.button.danger { border-color: rgba(255, 101, 123, .8); background: transparent; color: var(--red); }
.button.danger:hover { background: rgba(255, 101, 123, .1); }
.button.small { min-height: 34px; padding: 7px 12px; font-size: 12px; }
.link-button { width: auto; }

.card-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.inline-stats { display: flex; gap: 22px; margin-top: 24px; color: var(--muted); font-size: 12px; }
.inline-stats strong { color: var(--text); }
.credit-summary { margin-top: 8px; text-align: right; color: var(--muted); font-size: 12px; }
.credit-summary strong { color: var(--text); font-size: 15px; }
.table-wrap { overflow: auto; margin-top: 14px; }
.data-table { width: 100%; border-collapse: collapse; table-layout: auto; }
.data-table th { padding: 12px 10px; border-bottom: 1px solid var(--line); color: var(--muted); text-align: left; font-size: 11px; font-weight: 800; white-space: nowrap; }
.data-table td { padding: 13px 10px; border-bottom: 1px solid var(--line-soft); color: #b8c8d9; font-size: 12px; vertical-align: top; }
.data-table tbody tr:hover { background: rgba(59, 113, 147, .055); }
.data-table td strong { color: var(--text); }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.muted { color: var(--muted-2); }
.account-cell { min-width: 142px; }
.account-cell span { display: block; max-width: 180px; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; }
.status-pill { display: inline-flex; align-items: center; gap: 5px; border: 1px solid rgba(45, 208, 179, .3); border-radius: 99px; padding: 3px 8px; background: var(--accent-dim); color: var(--accent); font-size: 10px; font-weight: 800; white-space: nowrap; word-break: keep-all; writing-mode: horizontal-tb; }
.status-pill.warning { border-color: rgba(239, 189, 98, .4); background: rgba(239, 189, 98, .1); color: var(--amber); }
.status-pill.failed { border-color: rgba(255, 101, 123, .45); background: rgba(255, 101, 123, .1); color: var(--red); }
.switch { position: relative; width: 39px; height: 22px; display: inline-block; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch span { position: absolute; inset: 0; border: 1px solid #405366; border-radius: 99px; background: #243442; cursor: pointer; }
.switch span::after { content: ""; position: absolute; width: 16px; height: 16px; left: 2px; top: 2px; border-radius: 50%; background: #bdc9d7; transition: .18s; }
.switch input:checked + span { border-color: #2ba991; background: rgba(45, 208, 179, .3); }
.switch input:checked + span::after { transform: translateX(17px); background: #e7fff9; }
.row-actions { display: grid; grid-template-columns: repeat(2, max-content); gap: 5px; min-width: 132px; }
.registration-create-row { display: grid; grid-template-columns: 140px 80px minmax(170px, 1fr) minmax(170px, 1fr) 120px 92px; gap: 10px; align-items: end; margin-top: 18px; }
.registration-create-row > * { min-width: 0; }
.registration-create-row label { display: grid; gap: 7px; color: var(--muted); font-size: 11px; font-weight: 750; }
.registration-notice { margin-top: 14px; border-left: 3px solid var(--amber); padding: 10px 13px; background: rgba(239, 189, 98, .08); color: #d7c393; font-size: 12px; line-height: 1.65; }
.registration-table { min-width: 900px; table-layout: fixed; }
.registration-table th:nth-child(1), .registration-table td:nth-child(1) { width: 32px; }
.registration-table th:nth-child(2), .registration-table td:nth-child(2) { width: 180px; overflow-wrap: anywhere; }
.registration-table th:nth-child(3), .registration-table td:nth-child(3) { width: 72px; }
.registration-table th:nth-child(4), .registration-table td:nth-child(4) { width: 105px; white-space: nowrap; }
.registration-table th:nth-child(5), .registration-table td:nth-child(5) { width: 55px; white-space: nowrap; }
.registration-table th:nth-child(6), .registration-table td:nth-child(6) { width: 105px; white-space: nowrap; }
.registration-table th:nth-child(7), .registration-table td:nth-child(7) { width: 155px; }
.registration-table th:nth-child(8), .registration-table td:nth-child(8) { width: 195px; }
.registration-table td { vertical-align: middle; }
.registration-table .row-actions { grid-template-columns: repeat(2, max-content); min-width: 195px; }
.registration-email { display: block; margin-bottom: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.registration-detail { display: -webkit-box; overflow: hidden; overflow-wrap: anywhere; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; }
@media (max-width: 760px) { .registration-create-row { grid-template-columns: 1fr; } }
.mini-btn { border: 1px solid var(--accent-line); border-radius: 5px; padding: 4px 7px; background: rgba(45, 208, 179, .12); color: var(--accent); cursor: pointer; font-size: 10px; font-weight: 800; }
.mini-btn.danger { border-color: rgba(255, 101, 123, .55); background: transparent; color: var(--red); }
.empty { padding: 35px 10px 18px; color: var(--muted); text-align: center; }

.config-card { padding: 24px; }
.config-title-row { align-items: center; }
.config-title-row .help { margin-top: 4px; }
.config-runtime-status { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.config-runtime-status span { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 9px rgba(45, 208, 179, .55); }
.config-runtime-status.production span { background: var(--amber); box-shadow: 0 0 9px rgba(239, 189, 98, .55); }
.sub-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 17px; padding: 8px; border: 1px solid var(--line); border-radius: 11px; background: rgba(18, 35, 51, .72); }
.sub-tab { border: 1px solid transparent; border-radius: 8px; padding: 8px 12px; background: #283849; color: #c1cede; cursor: pointer; font-weight: 750; }
.sub-tab.active { border-color: var(--accent-line); background: var(--accent-dim); color: var(--accent); }
.config-pane { display: none; margin-top: 16px; }
.config-pane.active { display: block; }
.config-group { display: grid; gap: 0; padding: 4px 18px; border: 1px solid var(--line-soft); border-radius: 8px; background: rgba(15, 33, 48, .78); }
.config-section { display: grid; gap: 11px; padding: 19px 0 22px; border-bottom: 1px solid var(--line-soft); }
.config-section:last-child { border-bottom: 0; }
.config-section-head { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 14px; }
.config-section-head h3 { font-size: 14px; }
.config-section-head > span { overflow-wrap: anywhere; color: var(--muted); font-size: 11px; font-weight: 600; text-align: right; }
.config-section-head > span b { color: var(--text); }
.warning-text { color: var(--amber) !important; }
.field-with-action { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: end; }
.field-with-action .button { min-width: 112px; }
.config-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }
.managed-note { border-left: 3px solid var(--blue); padding: 8px 11px; background: rgba(92, 182, 255, .08); color: #b9d7ee; font-size: 11px; line-height: 1.6; }
.help { color: var(--muted); font-size: 11px; font-weight: 500; }
.check-line { display: flex; grid-template-columns: none; align-items: center; gap: 9px; }
.check-line:has(input:disabled) { color: var(--muted-2); }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.inline-result { color: var(--muted); font-size: 11px; }
.inline-result.success { color: var(--accent); }
.inline-result.failed { color: var(--red); }
.storage-note { margin-top: 7px; padding: 13px; border: 1px solid #2d4658; border-radius: 9px; background: #0b1925; }
.storage-note strong { color: var(--accent); }
.storage-note p { margin-top: 4px; color: var(--muted); font-size: 11px; }
.storage-note.warning-note { border-color: rgba(239, 189, 98, .45); background: rgba(92, 61, 18, .16); }
.storage-note.warning-note strong { color: var(--amber); }
.storage-report { margin-top: 10px; padding: 9px; border: 1px solid var(--line-soft); border-radius: 7px; color: #cfe1ec; font: 11px/1.7 ui-monospace, SFMono-Regular, Consolas, monospace; }
.storage-report span { margin-right: 8px; }
.storage-cleanup-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px 14px; margin-top: 11px; }
.compact-check { margin: 0; color: var(--muted); font-size: 11px; }
.config-save-row { display: flex; align-items: center; gap: 12px; margin-top: 18px; padding-top: 4px; }
.save-config { margin-top: 0; }
.config-save-row .inline-result { margin-left: 0; }

.queue-summary { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); margin-top: 18px; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; }
.queue-summary div { min-height: 86px; padding: 13px; border-right: 1px solid var(--line); background: rgba(12, 28, 43, .9); }
.queue-summary div:last-child { border-right: 0; }
.queue-summary span { display: block; color: var(--muted); font-size: 11px; }
.queue-summary strong { display: block; margin-top: 14px; font-size: 22px; }
.queue-table-wrap { margin-top: 18px; }
.task-id { display: block; max-width: 230px; overflow: hidden; color: var(--blue); text-overflow: ellipsis; white-space: nowrap; }
.prompt-preview { display: -webkit-box; max-width: 270px; margin-top: 4px; overflow: hidden; color: var(--muted); -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

.logs-title { align-items: center; padding-bottom: 16px; border-bottom: 1px solid var(--line-soft); }
.compact-label { display: flex; grid-template-columns: none; align-items: center; gap: 8px; color: var(--muted); white-space: nowrap; }
.compact-label select { width: 120px; padding: 8px 10px; }
.log-filters { display: grid; grid-template-columns: 1fr auto auto; gap: 16px; align-items: end; margin-top: 16px; padding-bottom: 15px; border-bottom: 1px solid var(--line-soft); }
.filter-label { display: block; margin-bottom: 7px; color: var(--muted); font-size: 11px; font-weight: 700; }
.segment { display: flex; padding: 3px; border: 1px solid var(--line); border-radius: 8px; background: #07131f; }
.segment button { border: 0; border-radius: 6px; padding: 7px 14px; background: transparent; color: var(--muted); cursor: pointer; font-size: 11px; font-weight: 750; }
.segment button.active { background: var(--accent-dim); color: var(--accent); }
.log-count { align-self: center; color: var(--muted); white-space: nowrap; }
.log-metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.log-metrics div { padding: 13px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); }
.log-metrics span { display: block; color: var(--muted); font-size: 11px; }
.log-metrics strong { display: block; margin-top: 4px; font-size: 24px; }
.section-heading { margin-top: 14px; font-size: 13px; }
.compact-table td, .compact-table th { padding: 9px 10px; }
.stats-updated { margin-top: 10px; }
.logs-table-wrap { max-height: 630px; margin-top: 18px; }
.logs-table { min-width: 1680px; }
.logs-table .prompt-log { max-width: 260px; white-space: normal; word-break: break-word; }
.logs-table .prompt-fold { max-width: 260px; }
.logs-table .prompt-fold summary { cursor: pointer; color: #b9d5ea; list-style: none; }
.logs-table .prompt-fold summary::-webkit-details-marker { display: none; }
.logs-table .prompt-fold summary::before { content: "▸ "; color: var(--accent); }
.logs-table .prompt-fold[open] summary::before { content: "▾ "; }
.logs-table .prompt-fold div { margin-top: 6px; white-space: pre-wrap; color: #d9e8f2; }
.logs-table .params-log { max-width: 320px; white-space: normal; word-break: break-word; }
.logs-table .account-log { max-width: 170px; overflow-wrap: anywhere; }
.progress-text { display: block; margin-top: 3px; color: var(--accent); font-size: 10px; }
.input-count { display: inline-block; border: 1px solid var(--line); border-radius: 6px; padding: 4px 7px; color: var(--blue); white-space: nowrap; }
.log-preview-btn { display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 8px; padding: 4px 7px; background: #243548; color: #e8f2fb; cursor: pointer; }
.log-preview-btn img { width: 38px; height: 38px; border-radius: 6px; object-fit: cover; background: #07131f; }
.log-preview-btn:hover { background: #30465c; }
.preview-video-icon { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 6px; background: #07131f; color: var(--accent); }
.error-detail-btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid rgba(255, 101, 123, .55); border-radius: 99px; padding: 4px 8px; background: rgba(255, 101, 123, .11); color: #ff9baa; cursor: pointer; font-size: 10px; font-weight: 800; }
.error-detail-btn:hover { background: rgba(255, 101, 123, .18); }
.success-state { color: var(--accent); font-weight: 750; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 16px; color: var(--muted); font-size: 12px; }

.modal-backdrop, .trace-backdrop, .preview-backdrop { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; padding: 18px; background: rgba(2, 8, 14, .82); backdrop-filter: blur(3px); }
.modal { width: min(680px, 100%); padding: 22px; border: 1px solid #315064; border-radius: 13px; background: #0b1c2b; box-shadow: var(--shadow); }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 7px; }
.modal-head h2 { font-size: 19px; }
.icon-button { width: 32px; height: 32px; border: 0; border-radius: 7px; background: #2a3949; color: #dce7f2; cursor: pointer; font-size: 20px; }
.modal textarea { margin-top: 13px; }
.file-row { margin-top: 13px; }
.file-row input { padding: 8px; }
.modal-actions { display: flex; gap: 8px; margin-top: 14px; }
.import-progress { display: flex; align-items: center; gap: 9px; margin-top: 12px; color: var(--muted); font-size: 11px; }
.import-progress span { width: 14px; height: 14px; border: 2px solid #345066; border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; z-index: 160; right: 24px; bottom: 22px; max-width: 380px; padding: 11px 15px; border: 1px solid #365166; border-radius: 9px; background: #142737; color: #e9f2fb; box-shadow: 0 18px 55px rgba(0, 0, 0, .4); opacity: 0; transform: translateY(14px); pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: none; }
.toast.failed { border-color: rgba(255, 101, 123, .65); color: #ffb0bc; }

.trace-backdrop { z-index: 130; padding: 4px; }
.preview-backdrop { z-index: 140; }
.preview-dialog { width: min(1180px, calc(100vw - 24px)); max-height: calc(100vh - 24px); overflow: auto; border: 1px solid #315064; border-radius: 13px; background: #081824; box-shadow: 0 35px 100px rgba(0, 0, 0, .6); }
.preview-head { position: sticky; z-index: 2; top: 0; display: flex; align-items: center; justify-content: space-between; padding: 15px 18px; border-bottom: 1px solid var(--line); background: #0d1e2d; }
.preview-head p { color: var(--accent); font-size: 10px; font-weight: 900; letter-spacing: .08em; }
.preview-head h2 { margin-top: 3px; font-size: 17px; }
.preview-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; padding: 1px; background: var(--line); }
.preview-meta div { min-width: 0; padding: 11px 15px; background: #0c1c2a; }
.preview-meta span { display: block; color: var(--muted); font-size: 10px; }
.preview-meta b { display: block; margin-top: 4px; overflow-wrap: anywhere; }
.preview-content { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; padding: 16px; }
.preview-content img, .preview-content video { width: 100%; max-height: 72vh; border-radius: 10px; object-fit: contain; background: #02080e; }
.trace-dialog { --trace-scale: 1; width: min(1560px, calc(100vw - 16px)); height: min(900px, calc(100vh - 16px)); display: grid; grid-template-rows: auto auto 1fr; overflow: hidden; border: 1px solid #2a485c; border-radius: 12px; background: #071622; box-shadow: 0 35px 100px rgba(0, 0, 0, .55); font-size: calc(12px * var(--trace-scale)); }
.trace-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 17px; border-bottom: 1px solid var(--line); background: #0d1e2d; }
.trace-head p { color: #43e2c3; font-size: 10px; font-weight: 900; letter-spacing: .08em; }
.trace-head h2 { margin-top: 2px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 16px; }
.trace-tools { display: flex; gap: 6px; }
.trace-tools button { min-width: 34px; height: 32px; border: 0; border-radius: 7px; background: #2a3a49; color: #d9e4ef; cursor: pointer; font-size: 11px; font-weight: 800; }
.trace-tools button:hover { background: #354a5d; }
.trace-summary { display: grid; grid-template-columns: 1.25fr 1fr 1fr .8fr .9fr; border-bottom: 1px solid var(--line); }
.trace-summary-item { min-width: 0; padding: 12px 16px; border-right: 1px solid var(--line); }
.trace-summary-item:last-child { border-right: 0; }
.trace-summary-label { display: block; color: var(--muted); font-size: .78em; }
.trace-summary-value { display: block; margin-top: 5px; overflow: hidden; color: #e7eef8; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.trace-summary-value.failed { color: var(--red); }
.trace-content { overflow: auto; padding: 9px 24px 28px; }
.trace-loading, .trace-empty { padding: 45px; color: var(--muted); text-align: center; }
.trace-timeline { position: relative; }
.trace-stage { position: relative; margin-left: calc(var(--depth, 0) * 22px); padding: 0 0 0 28px; border-left: 1px solid #294559; }
.trace-stage::before { content: ""; position: absolute; top: 20px; left: -6px; width: 10px; height: 10px; border: 2px solid #8bcfff; border-radius: 50%; background: #1d78ae; box-shadow: 0 0 0 3px #0b1b28; }
.trace-stage.failed::before { border-color: #ff9aaa; background: var(--red); }
.trace-stage.succeeded::before { border-color: #72e7cf; background: var(--accent); }
.trace-stage > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 55px; padding: 11px 10px; border-bottom: 1px solid #1d3445; cursor: pointer; list-style: none; }
.trace-stage > summary::-webkit-details-marker { display: none; }
.trace-stage-title strong { display: block; color: #e8f0f9; font-size: 1em; }
.trace-stage-meta { display: block; margin-top: 3px; color: #72bdfa; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .76em; }
.trace-badges { display: flex; gap: 7px; }
.trace-badge { border: 1px solid #31536a; border-radius: 4px; padding: 3px 7px; color: #a9cce2; font-size: .7em; font-weight: 750; }
.trace-badge.failed { border-color: rgba(255, 101, 123, .6); color: #ff97a7; }
.trace-stage-body { padding: 8px 12px 14px; }
.trace-payload { margin: 8px 0; border-left: 2px solid #1e6a5d; background: #06131e; }
.trace-payload > summary { padding: 8px 11px; color: #92c7e5; cursor: pointer; font-weight: 750; }
.trace-payload.failed { border-left-color: var(--red); }
.trace-payload pre { max-height: 420px; margin: 0; overflow: auto; padding: 11px; color: #9fe7c2; font: .78em/1.55 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; word-break: break-word; }

@media (max-width: 900px) {
  .shell { width: min(100% - 20px, 960px); padding-top: 16px; }
  .card-title-row { align-items: stretch; flex-direction: column; }
  .credit-summary { text-align: left; }
  .queue-summary { grid-template-columns: repeat(3, 1fr); }
  .queue-summary div:nth-child(3) { border-right: 0; }
  .queue-summary div:nth-child(-n+3) { border-bottom: 1px solid var(--line); }
  .log-filters { grid-template-columns: 1fr 1fr; }
  .log-count { grid-column: 1 / -1; }
  .trace-summary { grid-template-columns: repeat(2, 1fr); }
  .trace-summary-item { border-bottom: 1px solid var(--line); }
}

@media (max-width: 650px) {
  .brand-card { min-height: 126px; padding: 43px 10px 15px; }
  .brand-mark { display: none; }
  h1 { font-size: 21px; }
  .service-status { display: none; }
  .login-card { grid-template-columns: 1fr; gap: 25px; padding: 25px; }
  .login-copy h2 { font-size: 25px; }
  .main-tabs { overflow-x: auto; }
  .main-tab { flex: 0 0 auto; padding: 9px 11px; }
  .card { padding: 17px; border-radius: 13px; }
  .config-card { padding: 17px 13px; }
  .config-title-row { align-items: flex-start; }
  .sub-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 6px; }
  .sub-tab { width: 100%; min-width: 0; padding: 8px 7px; }
  .config-group { padding: 2px 13px; }
  .config-section { padding: 17px 0 20px; }
  .config-section-head { align-items: flex-start; flex-direction: column; gap: 4px; }
  .config-section-head > span { text-align: left; }
  .field-with-action { grid-template-columns: 1fr; }
  .field-with-action .button { width: 100%; }
  .config-actions .button { width: 100%; }
  .config-save-row { align-items: stretch; flex-direction: column; }
  .config-save-row .button { width: 100%; }
  .card-actions, .button-row { align-items: stretch; }
  .button-row .button { flex: 1 1 140px; }
  .field-grid { grid-template-columns: 1fr; }
  .queue-summary, .log-metrics { grid-template-columns: repeat(2, 1fr); }
  .queue-summary div { border-bottom: 1px solid var(--line); }
  .queue-summary div:nth-child(2n) { border-right: 0; }
  .queue-summary div:nth-last-child(-n+2) { border-bottom: 0; }
  .log-filters { grid-template-columns: 1fr; }
  .compact-label { align-items: stretch; flex-direction: column; }
  .compact-label select { width: 100%; }
  .logs-title .card-actions { width: 100%; }
  .trace-head { align-items: flex-start; }
  .trace-tools { flex-wrap: wrap; justify-content: flex-end; }
  .trace-tools button:nth-child(3), .trace-tools button:nth-child(4) { display: none; }
  .trace-summary { grid-template-columns: 1fr; max-height: 170px; overflow: auto; }
  .trace-summary-item { padding: 8px 12px; border-right: 0; }
  .trace-content { padding-left: 12px; padding-right: 12px; }
  .trace-stage { margin-left: calc(var(--depth, 0) * 10px); padding-left: 18px; }
}
