:root {
  color-scheme: light;
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  color: #20242b;
  background: #f3f5f8;
  --accent: #ed2557;
  --accent-hover: #d91f4e;
  --accent-soft: #fff0f4;
  --line: #e1e5ea;
  --line-strong: #d4d9e0;
  --muted: #68717d;
  --surface: #ffffff;
  --surface-subtle: #f8f9fb;
  --sidebar: #1d2128;
  --sidebar-hover: #292e36;
  --shadow: 0 1px 2px #181d2408, 0 6px 20px #181d2408;
}

* { box-sizing: border-box; }
html { background: #f3f5f8; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: #f3f5f8; line-height: 1.45; }
button, input, textarea, select { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
svg { display: block; }
button svg, .button-link svg, .nav-item svg, .page-kicker svg, h3 svg, .status-list svg { width: 17px; height: 17px; flex: 0 0 17px; stroke-width: 2; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 232px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--sidebar); color: #f7f8fa; border-right: 1px solid #171a1e; }
.brand { min-height: 82px; display: flex; align-items: center; gap: 12px; padding: 15px 18px; border-bottom: 1px solid #343941; }
.brand img { width: 42px; height: 42px; object-fit: contain; image-rendering: auto; filter: drop-shadow(0 3px 10px #ed255733); }
.brand strong, .brand span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand strong { max-width: 150px; font-size: 15px; }
.brand span { margin-top: 3px; color: #aeb4bd; font-size: 12px; }
nav { display: grid; gap: 4px; padding: 15px 10px; }
.nav-item { height: 42px; display: grid; grid-template-columns: 20px minmax(0, 1fr); align-items: center; gap: 10px; padding: 0 13px; border: 0; border-left: 3px solid transparent; border-radius: 6px; background: transparent; color: #c8cdd4; text-align: left; transition: background-color 140ms ease, color 140ms ease; }
.nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item.active { border-left-color: var(--accent); background: #323741; color: #fff; font-weight: 600; }
.nav-item svg { width: 18px; height: 18px; }
.sidebar-footer { margin-top: auto; display: flex; align-items: center; gap: 8px; min-height: 56px; padding: 0 18px; border-top: 1px solid #343941; color: #b5bbc3; font-size: 12px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #8a9099; }
.status-dot.online { background: #35b779; }

.main-area { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 20; min-height: 82px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 11px 30px; background: #ffffffee; border-bottom: 1px solid var(--line); backdrop-filter: blur(14px); }
.topbar-copy { min-width: 0; }
.page-kicker { display: flex; align-items: center; gap: 6px; margin-bottom: 2px; color: var(--accent); font-size: 11px; font-weight: 700; }
.page-kicker svg { width: 14px; height: 14px; }
.topbar h1 { margin: 0; font-size: 21px; line-height: 1.2; }
.topbar p { max-width: 720px; margin: 4px 0 0; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.connection-state { color: #68707a; font-size: 12px; }
.connection-pill { min-height: 34px; display: inline-flex; align-items: center; gap: 7px; padding: 0 11px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface-subtle); white-space: nowrap; }

.view { display: none; padding: 24px 30px 40px; }
.view.active { display: block; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(140px, 1fr)); gap: 12px; margin-bottom: 18px; }
.metric { min-height: 100px; display: flex; align-items: center; gap: 14px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.metric > div { min-width: 0; }
.metric span { color: var(--muted); font-size: 12px; }
.metric strong { display: block; margin-top: 7px; overflow: hidden; color: #252a31; font-size: 23px; line-height: 1.1; text-overflow: ellipsis; white-space: nowrap; }
.metric-icon { width: 38px; height: 38px; display: grid; place-items: center; flex: 0 0 38px; border-radius: 8px; }
.metric-icon svg { width: 19px; height: 19px; }
.metric-icon.rose { color: #d92653; background: #fff0f4; }
.metric-icon.green { color: #218267; background: #eaf7f2; }
.metric-icon.blue { color: #287ca7; background: #eaf5fb; }
.metric-icon.amber { color: #a3691b; background: #fff6e8; }
.metric:nth-child(2) strong { color: #2d7d6e; }
.metric:nth-child(3) strong { color: #2979a9; }

.section-block { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; box-shadow: var(--shadow); }
.narrow-block { max-width: 840px; }
.storage-block { max-width: 980px; }
.section-heading { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 17px; border-bottom: 1px solid var(--line); }
.section-heading h2 { margin: 0; font-size: 16px; }
.section-heading p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.section-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 8px; background: var(--accent-soft); color: var(--accent); }
.section-icon svg { width: 18px; height: 18px; }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 16px; border-bottom: 1px solid #edf0f2; text-align: left; font-size: 13px; white-space: nowrap; }
th { background: #f7f8fa; color: #606975; font-size: 12px; font-weight: 700; }
tbody tr:hover { background: #fafbfc; }
tbody tr:last-child td { border-bottom: 0; }
.muted { color: var(--muted); }

button.primary, button.secondary, .button-link { min-height: 36px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border-radius: 6px; padding: 0 14px; border: 1px solid transparent; font-weight: 600; white-space: nowrap; transition: background-color 130ms ease, border-color 130ms ease, box-shadow 130ms ease; }
button.primary { background: var(--accent); color: #fff; }
button.primary:hover { background: var(--accent-hover); box-shadow: 0 4px 12px #ed25572e; }
button.secondary, .button-link.secondary { border-color: #d9dde2; background: #f3f5f7; color: #343a42; }
button.secondary:hover, .button-link.secondary:hover { background: #e8ebee; }
button:disabled { cursor: wait; opacity: .58; }
.button-link { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; font-size: 13px; white-space: nowrap; }
.icon-button { width: 36px; min-width: 36px; padding: 0 !important; }
button.table-action { min-height: 30px; display: inline-flex; align-items: center; gap: 5px; border: 0; border-radius: 5px; background: transparent; color: #287fae; padding: 4px 7px; font-weight: 600; }
button.table-action:hover { background: #edf6fa; }
button.table-action svg { width: 15px; height: 15px; }

.policy-list { display: grid; gap: 0; }
.policy-option { display: grid; grid-template-columns: 24px minmax(120px, 180px) 1fr auto; align-items: center; gap: 12px; min-height: 70px; padding: 12px 17px; border-bottom: 1px solid #edf0f2; transition: background-color 130ms ease; }
.policy-option:hover { background: #fafbfc; }
.policy-option strong, .policy-option span { display: block; }
.policy-option span { color: var(--muted); font-size: 12px; }
.policy-order { font-family: Consolas, monospace; color: #4a515b; font-size: 12px; }
.policy-proxy { padding: 4px 8px; border-radius: 10px; background: #fff4f5; color: #a83c50; font-size: 11px; white-space: nowrap; }
.form-actions { display: flex; justify-content: flex-end; gap: 9px; padding: 14px 17px; border-top: 1px solid var(--line); }
.sticky-actions { position: sticky; bottom: 0; z-index: 8; background: #ffffffee; backdrop-filter: blur(12px); }

.empty-state { min-height: 280px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--muted); }
.empty-state strong { color: #454b54; font-size: 16px; }
.empty-state span { font-size: 13px; }
.empty-icon { width: 48px; height: 48px; display: grid; place-items: center; margin-bottom: 4px; border-radius: 50%; background: #f0f2f5; color: #7b8490; }
.empty-icon svg { width: 23px; height: 23px; }
.node-list { display: grid; }

.settings-form { padding: 17px; }
.settings-form label, .publish-form label, .distribution-form label, .workspace-pane label, .modal label { display: grid; gap: 6px; margin-bottom: 13px; color: #555c65; font-size: 12px; font-weight: 600; }
input, textarea, select { width: 100%; min-height: 38px; padding: 8px 11px; border: 1px solid #d6dbe2; border-radius: 6px; outline: none; background: #fff; color: #292e35; transition: border-color 130ms ease, box-shadow 130ms ease; }
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 2px #ffe3ea; }
.form-section-label { display: flex; align-items: center; gap: 7px; min-height: 32px; margin: 3px 0 12px; padding-bottom: 9px; border-bottom: 1px solid #edf0f2; color: #30363e; font-size: 12px; font-weight: 700; }
.form-section-label:not(:first-child) { margin-top: 8px; }
.form-section-label svg { width: 16px; height: 16px; color: var(--accent); }
.storage-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin-top: 18px; border: 1px solid var(--line); background: var(--line); }
.storage-summary div { min-width: 0; padding: 12px; background: #f8f9fa; }
.storage-summary span, .storage-summary strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.storage-summary span { color: var(--muted); font-size: 11px; }
.storage-summary strong { margin-top: 4px; font-size: 13px; }

.toolbar-heading { align-items: flex-end; }
.inline-field { min-width: 230px; margin: 0 !important; }
.split-workspace { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); }
.workspace-pane { min-width: 0; padding: 17px; }
.workspace-pane + .workspace-pane { border-left: 1px solid var(--line); }
.workspace-pane h3 { display: flex; align-items: center; gap: 7px; margin: 0 0 14px; font-size: 14px; }
.workspace-pane h3 svg { color: var(--accent); }
.compact-form { background: #fafbfc; }
.form-actions.flush { margin: 0 -17px -17px; }
.border-top { border-top: 1px solid var(--line); }
.padded-grid { padding: 17px 17px 4px; }
.file-picker-row { display: flex; align-items: center; gap: 12px; padding: 14px 17px; border-top: 1px solid var(--line); background: #fafbfc; color: var(--muted); font-size: 12px; }
.file-picker-row span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress-panel { padding: 14px 17px; border-top: 1px solid var(--line); background: #f7f9fb; }
.progress-panel > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 12px; }
.progress-panel progress { width: 100%; height: 10px; margin-top: 10px; accent-color: var(--accent); }
.progress-panel p { margin: 7px 0 0; color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.form-message { min-height: 0; margin: 0; padding: 0 17px; }
.selection-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.selection-option { display: flex !important; grid-template-columns: none !important; flex-direction: row; align-items: center; gap: 10px !important; min-height: 62px; margin: 0 !important; padding: 10px 17px; border-bottom: 1px solid #edf0f2; transition: background-color 130ms ease; }
.selection-option:hover { background: #fafbfc; }
.selection-option:nth-child(odd) { border-right: 1px solid #edf0f2; }
.selection-option input, .checkbox-row input { width: 16px; min-height: 16px; flex: 0 0 16px; }
.selection-option span, .selection-option strong, .selection-option small { display: block; min-width: 0; }
.selection-option strong { color: #343a42; font-size: 13px; }
.selection-option small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.checkbox-row { display: flex !important; flex-direction: row; align-items: center; gap: 9px !important; min-height: 36px; }
.checkbox-row > span { min-width: 0; }
.checkbox-row strong, .checkbox-row small { display: block; }
.checkbox-row strong { color: #343a42; font-size: 12px; }
.checkbox-row small { margin-top: 2px; color: var(--muted); font-size: 11px; font-weight: 400; }
.important-toggle { min-height: 54px; margin: 2px 0 0 !important; padding: 8px 11px; border: 1px solid #dce8e4; border-radius: 6px; background: #f2f8f6; }
.advanced-settings { margin-top: 16px; border-top: 1px solid #edf0f2; }
.advanced-settings summary { min-height: 44px; display: flex; align-items: center; gap: 8px; color: #4b535d; cursor: pointer; list-style: none; font-size: 12px; font-weight: 700; }
.advanced-settings summary::-webkit-details-marker { display: none; }
.advanced-settings summary > svg { width: 16px; height: 16px; color: #68717d; }
.advanced-settings .summary-chevron { margin-left: auto; transition: transform 140ms ease; }
.advanced-settings[open] .summary-chevron { transform: rotate(180deg); }
.advanced-fields { padding-top: 8px; }
.cos-status-band { display: grid; grid-template-columns: 42px minmax(200px, 1fr) minmax(360px, 1.45fr); align-items: center; gap: 12px; min-height: 88px; padding: 13px 17px; border-top: 1px solid var(--line); background: #f7f9fb; }
.cos-status-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 8px; background: #e9edf2; color: #65707d; }
.cos-status-icon svg { width: 19px; height: 19px; }
.cos-status-copy { min-width: 0; }
.cos-status-copy strong, .cos-status-copy span { display: block; }
.cos-status-copy strong { font-size: 13px; }
.cos-status-copy span { margin-top: 4px; color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.cos-status-facts { min-width: 0; display: grid; grid-template-columns: 1.4fr .8fr .9fr; gap: 1px; border-left: 1px solid var(--line); }
.cos-status-facts div { min-width: 0; padding: 4px 11px; }
.cos-status-facts span, .cos-status-facts strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cos-status-facts span { color: var(--muted); font-size: 10px; }
.cos-status-facts strong { margin-top: 4px; color: #343a42; font-size: 11px; }
.cos-status-band[data-state="ready"] { background: #f0f8f5; }
.cos-status-band[data-state="ready"] .cos-status-icon { background: #dff2eb; color: #218267; }
.cos-status-band[data-state="ready"] .cos-status-copy strong { color: #1d765e; }
.cos-status-band[data-state="error"] { background: #fff5f6; }
.cos-status-band[data-state="error"] .cos-status-icon { background: #ffe3e8; color: #bd3d52; }
.cos-status-band[data-state="error"] .cos-status-copy strong { color: #a93349; }
.toggle-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 17px; padding-top: 15px; border-top: 1px solid var(--line); }
.status-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.status-list div { min-width: 0; padding: 16px 17px; border-right: 1px solid var(--line); }
.status-list div:last-child { border-right: 0; }
.status-list span, .status-list strong { display: block; }
.status-list span { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; }
.status-list span svg { width: 14px; height: 14px; }
.status-list strong { margin-top: 6px; font-size: 14px; }
.status-value.success { color: #218267; }
.table-empty { height: 96px; color: var(--muted); text-align: center; }

.modal { width: min(430px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 18px 60px #15181d40; }
.wide-modal { width: min(680px, calc(100vw - 32px)); }
.modal::backdrop { background: #16191e99; }
.modal form { padding: 20px; }
.modal h2 { margin: 0 0 18px; font-size: 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 17px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.span-two { grid-column: span 2; }
.field-error { min-height: 18px; margin: 3px 0 0; color: #c83b52; font-size: 12px; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 80; max-width: min(420px, calc(100vw - 44px)); padding: 11px 14px; border-radius: 6px; background: #252a31; color: #fff; opacity: 0; transform: translateY(8px); pointer-events: none; transition: 160ms ease; font-size: 13px; box-shadow: 0 10px 32px #171a1f38; }
.toast.visible { opacity: 1; transform: translateY(0); }
.toast.error { background: #bd3d52; }

@media (max-width: 820px) {
  .app-shell { grid-template-columns: 78px minmax(0, 1fr); }
  .brand { justify-content: center; padding: 12px 8px; }
  .brand img { width: 38px; height: 38px; }
  .brand div, .sidebar-footer span:not(.status-dot) { display: none; }
  .nav-item { height: 50px; display: flex; flex-direction: column; justify-content: center; gap: 3px; padding: 0 5px; text-align: center; font-size: 10px; }
  .nav-item svg { width: 17px; height: 17px; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .topbar, .view { padding-left: 16px; padding-right: 16px; }
  .connection-pill { display: none; }
  .split-workspace { grid-template-columns: 1fr; }
  .workspace-pane + .workspace-pane { border-top: 1px solid var(--line); border-left: 0; }
  .toggle-list { grid-template-columns: 1fr; }
  .cos-status-band { grid-template-columns: 42px minmax(0, 1fr); }
  .cos-status-facts { grid-column: 1 / -1; border-top: 1px solid var(--line); border-left: 0; padding-top: 9px; }
}

@media (max-width: 560px) {
  .app-shell { display: block; }
  .sidebar { position: static; width: 100%; height: auto; }
  .brand { justify-content: flex-start; min-height: 64px; }
  .brand div { display: block; }
  nav { grid-template-columns: repeat(5, minmax(66px, 1fr)); gap: 2px; overflow-x: auto; padding: 6px 7px; scrollbar-width: none; }
  nav::-webkit-scrollbar { display: none; }
  .nav-item { height: 44px; flex-direction: row; gap: 5px; padding: 0 7px; white-space: nowrap; font-size: 11px; }
  .nav-item svg { width: 15px; height: 15px; }
  .sidebar-footer { display: none; }
  .topbar { position: static; min-height: 72px; align-items: flex-start; flex-wrap: wrap; padding-top: 12px; padding-bottom: 12px; }
  .page-kicker { margin-bottom: 3px; }
  .topbar h1 { font-size: 21px; }
  .topbar p { white-space: normal; }
  .top-actions { width: 100%; justify-content: flex-end; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .metric { min-height: 94px; gap: 10px; padding: 14px; }
  .metric-icon { width: 34px; height: 34px; flex-basis: 34px; }
  .metric strong { font-size: 20px; }
  .section-heading { align-items: flex-start; }
  .toolbar-heading { display: grid; grid-template-columns: minmax(0, 1fr); align-items: stretch; }
  .toolbar-heading > div { min-width: 0; }
  .inline-field { width: 100%; min-width: 0; }
  .form-grid, .storage-summary { grid-template-columns: 1fr; }
  .span-two { grid-column: span 1; }
  .policy-option { grid-template-columns: 24px 1fr; }
  .policy-order, .policy-proxy { grid-column: 2; }
  .responsive-table thead { display: none; }
  .responsive-table, .responsive-table tbody, .responsive-table tr, .responsive-table td { display: block; width: 100%; }
  .responsive-table tr { padding: 8px 0; border-bottom: 1px solid #edf0f2; }
  .responsive-table tr:last-child { border-bottom: 0; }
  .responsive-table td {
    display: grid;
    grid-template-columns: 86px minmax(0, 1fr);
    gap: 10px;
    padding: 6px 16px;
    border: 0;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .responsive-table td::before { content: attr(data-label); color: var(--muted); font-size: 11px; font-weight: 600; }
  .responsive-table tbody tr:hover { background: transparent; }
  .selection-list, .status-list { grid-template-columns: 1fr; }
  .selection-option:nth-child(odd), .status-list div { border-right: 0; }
  .status-list div { min-height: 72px; }
  .file-picker-row { align-items: flex-start; flex-direction: column; }
  .cos-status-facts { grid-template-columns: 1fr; }
  .cos-status-facts div { padding: 6px 0; }
  .cos-status-facts span, .cos-status-facts strong { white-space: normal; overflow-wrap: anywhere; }
  .form-actions { flex-wrap: wrap; }
  .file-picker-row span { white-space: normal; }
  .sticky-actions { bottom: 0; }
}
