:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  color: #1c2a32;
  background: #f2f5f4;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --ink: #1c2a32;
  --muted: #718087;
  --line: #dce4e1;
  --surface: #fff;
  --green: #087f63;
  --green-dark: #08624e;
  --green-soft: #e5f4ef;
  --amber: #a45b12;
  --red: #b73c38;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
button, input { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.login-layout { display: grid; min-height: 100vh; place-items: center; padding: 24px; background: #eef4f1; }
.login-panel { width: min(100%, 380px); padding: 32px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); box-shadow: 0 12px 32px rgba(23,48,40,.07); }
.brand-mark { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 5px; background: var(--green); color: #fff; font-size: 13px; font-weight: 800; }
.eyebrow { margin: 0 0 6px; color: var(--green); font-size: 10px; font-weight: 800; line-height: 1.4; text-transform: uppercase; }
.login-panel .eyebrow { margin-top: 20px; }
h1, h2, h3, p { margin-top: 0; }
.login-panel h1 { margin-bottom: 24px; font-size: 24px; line-height: 1.25; }
.field-label { display: block; margin-bottom: 8px; color: #435159; font-size: 13px; font-weight: 700; }
.login-panel input { width: 100%; height: 42px; padding: 0 11px; border: 1px solid #bfcac5; border-radius: 4px; background: #fff; outline: none; }
.login-panel input:focus, .number-input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(8,127,99,.12); }

.button { display: inline-flex; min-height: 36px; align-items: center; justify-content: center; padding: 0 13px; border: 1px solid transparent; border-radius: 4px; font-size: 12px; font-weight: 700; }
.button-primary { background: var(--green); color: #fff; }
.button-primary:hover { background: var(--green-dark); }
.button-secondary { border-color: #cbd7d2; background: #fff; color: #32434b; }
.button-secondary:hover, .button-quiet:hover { background: #f0f4f2; }
.button-quiet { border-color: transparent; background: transparent; color: #516168; }
.button-wide { width: 100%; margin-top: 16px; }
.button:disabled { cursor: wait; opacity: .6; }
.form-message { min-height: 18px; margin: 0; color: var(--muted); font-size: 12px; }
.form-message.error { color: var(--red); }
.form-message.success { color: var(--green-dark); }

.update-dialog { width: min(680px, calc(100vw - 28px)); max-height: calc(100dvh - 28px); padding: 0; overflow: auto; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); background: var(--surface); box-shadow: 0 22px 70px rgba(16, 35, 29, .24); }
.update-dialog::backdrop { background: rgba(17, 31, 27, .48); }
.update-dialog-content { display: grid; gap: 16px; padding: 21px; }
.update-dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.update-dialog-heading .eyebrow { margin-bottom: 3px; }
.update-dialog-heading h2 { margin: 0; color: var(--ink); font-size: 19px; line-height: 1.25; }
.update-status { min-height: 18px; margin: 0; color: var(--muted); font-size: 12px; }
.version-summary { display: grid; grid-template-columns: minmax(0, 1fr); gap: 5px; padding: 17px; border: 1px solid var(--line); border-radius: 4px; background: #f8faf9; text-align: center; }
.version-summary span { color: var(--muted); font-size: 10px; }
.version-summary strong { overflow-wrap: anywhere; color: var(--ink); font-size: 24px; font-weight: 800; line-height: 1.2; }
.version-summary .latest-version { color: var(--green-dark); }
.version-summary #latest-version-label { margin-top: 7px; }
.release-history { min-width: 0; }
.release-history-heading { display: flex; min-height: 30px; align-items: center; justify-content: space-between; gap: 12px; }
.release-history-heading h3 { margin: 0; color: #435159; font-size: 12px; }
.release-table-wrap { max-height: 230px; overflow: auto; border: 1px solid var(--line); border-radius: 4px; }
.release-table { min-width: 460px; }
.release-table th:first-child, .release-table td:first-child { width: 22%; }
.release-table th:nth-child(2), .release-table td:nth-child(2) { width: 48%; white-space: nowrap; }
.release-table th:last-child, .release-table td:last-child { width: 30%; text-align: right; }
.release-version-label { display: inline-flex; align-items: center; gap: 7px; color: var(--ink); font-weight: 700; white-space: nowrap; }
.release-prerelease { padding: 3px 6px; border-radius: 10px; background: #fbf0d9; color: #97680e; font-size: 9px; font-weight: 600; }
.release-view-button { min-height: 25px; padding: 0 8px; font-size: 10px; }
.release-notes-dialog { width: min(520px, calc(100vw - 28px)); max-height: calc(100dvh - 28px); padding: 0; overflow: auto; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); background: var(--surface); box-shadow: 0 22px 70px rgba(16, 35, 29, .24); }
.release-notes-dialog::backdrop { background: rgba(17, 31, 27, .48); }
.release-notes-content { display: grid; gap: 14px; padding: 20px; }
.release-notes-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.release-notes-heading .eyebrow { margin-bottom: 3px; }
.release-notes-heading h2 { margin: 0; font-size: 18px; }
.release-notes-date { margin: 0; color: var(--muted); font-size: 11px; }
.release-notes-body { max-height: 52vh; overflow: auto; padding: 12px; border: 1px solid var(--line); border-radius: 4px; background: #f8faf9; color: #34434a; font-size: 12px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.release-details-link { width: fit-content; color: var(--green-dark); font-size: 12px; }
.update-notice { display: flex; min-width: 0; align-items: center; gap: 11px; padding: 12px 14px; border: 1px solid #e8d5b5; border-radius: 5px; background: #fbf3e8; color: #6f5124; }
.update-notice-mark { display: grid; width: 38px; height: 38px; flex: 0 0 auto; place-items: center; border-radius: 50%; background: #f1e2ce; color: #a66313; font-size: 21px; line-height: 1; }
.update-notice > div { display: grid; min-width: 0; gap: 3px; }
.update-notice strong { font-size: 12px; }
.update-notice > div > span { color: #95702e; font-size: 12px; }
.proxy-fieldset { min-width: 0; margin: 0; padding: 12px 0 0; border: 0; border-top: 1px solid var(--line); }
.proxy-fieldset legend { padding: 0 8px 0 0; color: #435159; font-size: 12px; font-weight: 700; }
.proxy-options { display: grid; }
.proxy-option-row, .proxy-option { display: flex; min-height: 38px; align-items: center; gap: 11px; }
.proxy-option-row { display: grid; grid-template-columns: minmax(0, 1fr) 118px; column-gap: 10px; justify-content: initial; }
.proxy-test-row { grid-template-columns: minmax(0, 1fr) auto 118px; }
.proxy-option { min-width: 0; color: #34434a; cursor: pointer; font-size: 12px; }
.proxy-option span { overflow-wrap: anywhere; }
.proxy-result { display: flex; width: 118px; min-height: 24px; align-items: center; justify-content: flex-start; gap: 5px; }
.proxy-result:empty { visibility: hidden; }
.proxy-result-badge { display: inline-flex; min-height: 22px; align-items: center; padding: 0 7px; border-radius: 11px; font-size: 10px; line-height: 1; white-space: nowrap; }
.proxy-result-available { background: #e3f3e9; color: #277544; }
.proxy-result-unavailable { background: #fae9e8; color: #a9403a; }
.proxy-result-pending { background: #eef1f0; color: #647177; }
.proxy-result-latency { background: #e1f3f2; color: #137c77; font-variant-numeric: tabular-nums; }
.proxy-option input { width: 17px; height: 17px; flex: 0 0 auto; margin: 0; accent-color: var(--green); }
.proxy-option input:focus-visible { outline: 3px solid rgba(8,127,99,.18); outline-offset: 2px; }
.proxy-test-button { min-height: 30px; padding: 0 9px; font-size: 10px; white-space: nowrap; }
.rollback-action { padding-top: 14px; border-top: 1px solid var(--line); }
.rollback-action .field-label { margin-bottom: 7px; }
.rollback-controls { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.version-select { width: 100%; min-width: 0; height: 36px; padding: 0 9px; border: 1px solid #cbd5d1; border-radius: 4px; background: #fff; color: var(--ink); font: inherit; font-size: 12px; }
.version-select:focus-visible { border-color: var(--green); outline: 3px solid rgba(8,127,99,.12); }
.update-action-message { min-height: 18px; }
.update-progress-panel { display: grid; gap: 8px; padding: 12px; border: 1px solid #cfe2da; border-radius: 4px; background: #f3f8f5; }
.update-progress-heading { display: flex; min-width: 0; align-items: baseline; justify-content: space-between; gap: 12px; }
.update-progress-heading strong { min-width: 0; color: #25473b; font-size: 12px; }
.update-progress-heading span { flex: 0 0 auto; color: #47685d; font-size: 11px; font-variant-numeric: tabular-nums; }
.update-progress-track { position: relative; height: 8px; overflow: hidden; border-radius: 4px; background: #dce8e2; }
.update-progress-track > span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--green); transition: width .25s ease; }
.update-progress-track.is-indeterminate > span { width: 34%; animation: update-progress-sweep 1.3s ease-in-out infinite alternate; }
.update-progress-detail { min-height: 14px; margin: 0; color: #65756e; font-size: 10px; font-variant-numeric: tabular-nums; }
@keyframes update-progress-sweep { from { transform: translateX(-105%); } to { transform: translateX(305%); } }

.app-shell { min-height: 100vh; }
.topbar { display: flex; min-height: 66px; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 24px; border-bottom: 1px solid var(--line); background: var(--surface); }
.brand-lockup { display: flex; align-items: center; gap: 11px; }
.brand-lockup .eyebrow { margin-bottom: 2px; }
.brand-lockup h1 { margin: 0; font-size: 16px; line-height: 1.25; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.updated-at { margin-right: 8px; color: var(--muted); font-size: 11px; }
.workspace { display: grid; min-height: calc(100vh - 66px); grid-template-columns: 204px minmax(0, 1fr); }
.sidebar { display: flex; flex-direction: column; padding: 20px 12px; border-right: 1px solid #d5e0dc; background: #e9efec; }
.nav-caption { margin: 0 10px 8px; color: #7b8985; font-size: 10px; font-weight: 800; }
.sidebar-nav { display: grid; gap: 4px; }
.nav-item { display: flex; min-height: 40px; align-items: center; padding: 0 11px; border: 0; border-radius: 4px; background: transparent; color: #4e5e59; font-size: 13px; font-weight: 650; text-align: left; }
.nav-item:hover { background: #dfe8e4; color: #243c34; }
.nav-item.is-active { background: var(--green-soft); color: var(--green-dark); box-shadow: inset 3px 0 0 var(--green); }
.sidebar-foot { display: flex; align-items: center; gap: 8px; margin: auto 9px 0; padding-top: 22px; color: #697873; font-size: 10px; }
.status-dot { display: inline-block; width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: #1f9c72; box-shadow: 0 0 0 3px rgba(31,156,114,.13); }
.main-panel { width: min(100%, 1480px); min-width: 0; padding: 24px clamp(18px, 3vw, 40px) 60px; }
.page-view { display: block; }
.page-heading { display: flex; min-height: 54px; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 17px; }
.page-heading .eyebrow { margin-bottom: 3px; }
.page-heading h2 { margin: 0; color: var(--ink); font-size: 21px; line-height: 1.25; }
.section-state { color: var(--muted); font-size: 11px; }
.service-badge { display: inline-flex; align-items: center; gap: 8px; padding: 7px 10px; border: 1px solid #d2e4dc; border-radius: 4px; background: #f1f8f4; color: var(--green-dark); font-size: 11px; font-weight: 700; }

.metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.metric { display: flex; min-height: 105px; flex-direction: column; justify-content: space-between; padding: 14px 15px; border: 1px solid var(--line); border-top: 3px solid #8ba89d; border-radius: 5px; background: var(--surface); }
.metric-status { border-top-color: var(--green); }
.metric-label { color: #66757b; font-size: 11px; font-weight: 650; }
.metric-value { color: var(--ink); font-size: 25px; font-variant-numeric: tabular-nums; line-height: 1; }
.metric-value-positive { color: var(--green-dark); }
.metric-value-alert { color: var(--red); }
.metric-foot { color: #89969a; font-size: 10px; }

.settings-section, .activity-section, .status-detail { border: 1px solid var(--line); border-radius: 5px; background: var(--surface); }
.settings-section { padding: 18px; }
.page-section { margin-top: 0; }
.section-subheading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-subheading h3 { margin: 0; color: #2d3b42; font-size: 13px; }
.section-subheading > span { color: #849096; font-size: 10px; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.setting-row { position: relative; display: flex; min-height: 62px; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.setting-row:nth-child(odd) { border-right: 1px solid var(--line); }
.setting-copy { display: flex; min-width: 0; flex-direction: column; gap: 3px; }
.setting-copy strong { color: #2d3b42; font-size: 12px; }
.setting-copy small { color: #849096; font-size: 10px; line-height: 1.3; }
.setting-row input[type="checkbox"] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.switch { position: relative; width: 34px; height: 19px; flex: 0 0 auto; border-radius: 12px; background: #c6d0cc; transition: background .15s ease; }
.switch::after { position: absolute; top: 2px; left: 2px; width: 15px; height: 15px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.18); content: ""; transition: transform .15s ease; }
.setting-row input:checked + .switch { background: var(--green); }
.setting-row input:checked + .switch::after { transform: translateX(15px); }
.setting-row input:focus-visible + .switch { outline: 3px solid rgba(8,127,99,.2); outline-offset: 2px; }
.number-input { width: 98px; height: 34px; padding: 0 8px; border: 1px solid #cbd5d1; border-radius: 4px; color: var(--ink); font-variant-numeric: tabular-nums; outline: none; }
.form-footer { display: flex; min-height: 48px; align-items: end; justify-content: space-between; gap: 12px; padding-top: 12px; }

.activity-section { margin-top: 16px; overflow: hidden; }
.section-heading-compact { display: flex; min-height: 55px; align-items: center; justify-content: space-between; padding: 11px 15px; }
.section-heading-compact .eyebrow { margin-bottom: 2px; }
.section-heading-compact h3 { margin: 0; color: #2d3b42; font-size: 13px; }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th { padding: 9px 12px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #f8faf9; color: #708087; font-size: 10px; font-weight: 700; white-space: nowrap; }
td { max-width: 260px; padding: 10px 12px; border-bottom: 1px solid #edf1ef; color: #425159; font-size: 11px; line-height: 1.4; vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td.cell-title { max-width: 190px; color: #26353c; font-weight: 700; }
td.cell-muted { color: #809096; }
td.cell-error { color: var(--red); }
td.empty-cell { height: 58px; color: #8a979b; text-align: center; vertical-align: middle; }
.status-pill { display: inline-block; padding: 3px 6px; border-radius: 3px; background: #edf2f0; color: #52635e; font-size: 10px; white-space: nowrap; }
.status-pill.completed { background: var(--green-soft); color: var(--green-dark); }
.status-pill.failed { background: #fbebea; color: var(--red); }
.level-error { color: var(--red); font-weight: 700; }
.level-warn { color: var(--amber); font-weight: 700; }
.runtime-log-view { overflow: hidden; border: 1px solid #343b42; border-radius: 5px; background: #202429; }
.log-toolbar { display: flex; min-height: 52px; align-items: center; justify-content: space-between; gap: 14px; padding: 8px 12px; border-bottom: 1px solid #3a4249; background: #292e34; }
.log-level-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.log-level-filter { display: inline-flex; min-height: 27px; align-items: center; gap: 5px; padding: 0 8px; border: 1px solid #485159; border-radius: 4px; color: #c2c9cd; cursor: pointer; font-size: 10px; font-weight: 750; }
.log-level-filter input, .log-auto-scroll input { width: 14px; height: 14px; margin: 0; accent-color: #9aa7ad; }
.log-level-filter input:focus-visible, .log-auto-scroll input:focus-visible { outline: 2px solid #a4d9c9; outline-offset: 2px; }
.log-level-info span { color: #75c6d3; }
.log-level-warn span { color: #efc06b; }
.log-level-error span { color: #f0837d; }
.log-level-critical span { color: #ef83a3; }
.log-auto-scroll { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 7px; color: #d3d9dc; cursor: pointer; font-size: 11px; white-space: nowrap; }
.runtime-log-stream { height: clamp(320px, 65vh, 720px); overflow: auto; padding: 8px 10px; background: #1d2126; color: #d3d9dc; font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace; font-size: 12px; line-height: 1.55; scrollbar-color: #586169 #24292e; }
.runtime-log-entry { display: grid; grid-template-columns: 132px 76px 110px minmax(0, 1fr); gap: 8px; align-items: start; padding: 5px 7px; border-radius: 3px; overflow-wrap: anywhere; }
.runtime-log-entry:hover { background: #282e34; }
.runtime-log-time { color: #829197; font-variant-numeric: tabular-nums; white-space: nowrap; }
.runtime-log-level { font-weight: 800; white-space: nowrap; }
.runtime-log-entry.log-debug .runtime-log-level { color: #9aa4aa; }
.runtime-log-entry.log-info .runtime-log-level { color: #72c4d2; }
.runtime-log-entry.log-warn .runtime-log-level { color: #efc06b; }
.runtime-log-entry.log-error .runtime-log-level { color: #f0837d; }
.runtime-log-entry.log-critical .runtime-log-level { color: #ef83a3; }
.runtime-log-source { color: #a6b1b6; overflow-wrap: anywhere; }
.runtime-log-message { min-width: 0; color: #d3d9dc; white-space: pre-wrap; overflow-wrap: anywhere; }
.log-empty { margin: 0; padding: 18px 8px; color: #99a4a9; text-align: center; }
.status-detail { display: grid; gap: 8px; width: min(100%, 440px); padding: 18px; }
.status-detail strong { color: var(--ink); font-size: 20px; font-variant-numeric: tabular-nums; }

@media (max-width: 900px) {
  .workspace { grid-template-columns: 174px minmax(0, 1fr); }
  .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .topbar { align-items: flex-start; flex-direction: column; padding: 12px 16px; }
  .top-actions { width: 100%; justify-content: flex-end; }
  .updated-at { margin-right: auto; }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: sticky; top: 0; z-index: 5; overflow-x: auto; padding: 7px 10px; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav-caption, .sidebar-foot { display: none; }
  .sidebar-nav { display: flex; min-width: max-content; gap: 3px; }
  .nav-item { min-height: 36px; padding: 0 12px; }
  .nav-item.is-active { box-shadow: inset 0 -2px 0 var(--green); }
  .main-panel { padding: 18px 14px 42px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .metric { min-height: 90px; padding: 12px; }
  .metric-value { font-size: 22px; }
  .settings-section { padding: 14px 11px; }
  .settings-grid { grid-template-columns: 1fr; }
  .setting-row:nth-child(odd) { border-right: 0; }
  .form-footer { align-items: center; }
  .update-dialog-content { gap: 13px; padding: 16px; }
  .version-summary { padding: 14px 10px; }
  .version-summary strong { font-size: 22px; }
  .proxy-test-row { grid-template-columns: minmax(0, 1fr) 118px; row-gap: 4px; }
  .proxy-test-row .proxy-option { grid-column: 1 / -1; }
  .proxy-test-row .proxy-test-button { grid-column: 1; grid-row: 2; justify-self: start; }
  .proxy-test-row .proxy-result { grid-column: 2; grid-row: 2; }
  .rollback-controls { grid-template-columns: minmax(0, 1fr); }
  .rollback-controls .button { width: 100%; }
  .log-toolbar { align-items: flex-start; flex-direction: column; }
  .runtime-log-stream { height: 62vh; min-height: 300px; }
  .runtime-log-entry { grid-template-columns: 104px 64px minmax(0, 1fr); gap: 5px; }
  .runtime-log-source { grid-column: 3; }
  .runtime-log-message { grid-column: 1 / -1; }
}
