:root {
  --bg: #f3f5f7;
  --surface: #ffffff;
  --surface-soft: #f8fafb;
  --ink: #17212b;
  --muted: #65717d;
  --line: #dce2e7;
  --line-strong: #c5cdd5;
  --blue: #2463eb;
  --blue-soft: #eaf0ff;
  --green: #147a5a;
  --green-soft: #e8f6f0;
  --orange: #ad5b13;
  --orange-soft: #fff1e1;
  --red: #b83838;
  --red-soft: #fdecec;
  --violet: #6a4cc3;
  --violet-soft: #f0ebff;
  --sidebar: #18222c;
  --sidebar-soft: #263441;
  --shadow: 0 8px 24px rgba(18, 31, 43, 0.07);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-synthesis: none;
}

* { box-sizing: border-box; }

body { margin: 0; min-width: 320px; background: var(--bg); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.52; }
.is-hidden { display: none !important; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 228px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 24px 14px; background: var(--sidebar); color: #fff; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 10px 26px; }
.brand-mark { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 6px; background: #fff; color: var(--sidebar); font-weight: 800; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 17px; }
.brand small { margin-top: 2px; color: #aebbc6; font-size: 12px; }
.nav-list { display: grid; gap: 5px; }
.nav-item { width: 100%; border: 0; border-radius: 6px; padding: 11px 12px; background: transparent; color: #bfccd6; text-align: left; font-weight: 650; }
.nav-item:hover, .nav-item:focus-visible { background: var(--sidebar-soft); color: #fff; }
.nav-item.is-active { background: #fff; color: var(--sidebar); }
.sidebar-foot { margin-top: auto; display: flex; align-items: center; gap: 8px; padding: 15px 10px 4px; color: #aebbc6; font-size: 12px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #8a98a5; }
.status-dot.is-online { background: #4bd3a0; box-shadow: 0 0 0 4px rgba(75, 211, 160, 0.12); }

.main-area { min-width: 0; padding: 28px 34px 48px; }
.topbar { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.eyebrow, .section-kicker { margin: 0 0 5px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: 0; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 27px; line-height: 1.15; letter-spacing: 0; }
h2 { margin-bottom: 0; font-size: 17px; line-height: 1.25; letter-spacing: 0; }
.connection-bar { display: flex; align-items: end; gap: 8px; }
.token-field { display: grid; gap: 5px; }
.token-field span, .field > span, .field-group legend { color: var(--muted); font-size: 11px; font-weight: 700; }
.token-field input { width: 220px; }

input, textarea, select { width: 100%; border: 1px solid var(--line-strong); border-radius: 5px; background: #fff; color: var(--ink); outline: none; }
input, select { height: 40px; padding: 0 11px; }
textarea { padding: 10px 11px; resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(36, 99, 235, 0.12); }

.button { min-height: 40px; border: 1px solid transparent; border-radius: 5px; padding: 0 15px; font-weight: 750; white-space: nowrap; }
.button-primary { background: var(--blue); color: #fff; }
.button-primary:hover { background: #164fc9; }
.button-secondary { border-color: var(--line-strong); background: #fff; color: var(--ink); }
.button-secondary:hover { border-color: #8b98a4; background: var(--surface-soft); }
.button-danger { background: var(--red); color: #fff; }
.text-button { border: 0; background: transparent; color: var(--blue); font-weight: 750; }

.notice { margin-bottom: 18px; border: 1px solid #b9d0ff; border-radius: 6px; padding: 11px 14px; background: var(--blue-soft); color: #17428f; font-size: 13px; }
.notice.is-error { border-color: #efb9b9; background: var(--red-soft); color: #8d2929; }
.notice.is-success { border-color: #a8d9c5; background: var(--green-soft); color: #0d664a; }

.view { display: none; }
.view.is-active { display: grid; gap: 18px; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.metric { min-height: 126px; border: 1px solid var(--line); border-top: 4px solid var(--line-strong); border-radius: 7px; padding: 18px; background: var(--surface); box-shadow: var(--shadow); }
.metric > span, .metric small { display: block; color: var(--muted); }
.metric > span { font-size: 12px; font-weight: 750; }
.metric strong { display: block; margin: 9px 0 4px; font-size: 26px; line-height: 1; }
.metric small { font-size: 11px; }
.metric-green { border-top-color: var(--green); }
.metric-blue { border-top-color: var(--blue); }
.metric-orange { border-top-color: var(--orange); }
.metric-violet { border-top-color: var(--violet); }

.panel { min-width: 0; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); box-shadow: var(--shadow); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 68px; padding: 16px 19px; border-bottom: 1px solid var(--line); }
.panel-heading .section-kicker { display: block; }
.badge { display: inline-flex; align-items: center; min-height: 25px; border-radius: 999px; padding: 3px 9px; font-size: 11px; font-weight: 800; white-space: nowrap; }
.badge-neutral { background: #edf0f2; color: #4e5a64; }
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-blue { background: var(--blue-soft); color: var(--blue); }
.badge-orange { background: var(--orange-soft); color: var(--orange); }
.badge-red { background: var(--red-soft); color: var(--red); }
.badge-violet { background: var(--violet-soft); color: var(--violet); }

.pipeline-flow { display: grid; grid-template-columns: repeat(7, minmax(105px, 1fr)); overflow-x: auto; padding: 20px; }
.pipeline-step { position: relative; min-width: 105px; padding-right: 24px; }
.pipeline-step:not(:last-child)::after { content: ""; position: absolute; top: 15px; right: 7px; width: 18px; border-top: 1px solid var(--line-strong); }
.pipeline-step b { width: 31px; height: 31px; display: grid; place-items: center; margin-bottom: 9px; border-radius: 50%; background: var(--ink); color: #fff; font-size: 10px; }
.pipeline-step span, .pipeline-step small { display: block; }
.pipeline-step span { font-size: 12px; font-weight: 800; }
.pipeline-step small { margin-top: 2px; color: var(--muted); font-size: 10px; }

.two-column { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.definition-list { margin: 0; padding: 8px 19px 15px; }
.definition-list > div { display: flex; justify-content: space-between; gap: 24px; padding: 11px 0; border-bottom: 1px solid #edf0f2; }
.definition-list > div:last-child { border-bottom: 0; }
.definition-list dt { color: var(--muted); font-size: 12px; }
.definition-list dd { margin: 0; max-width: 65%; overflow-wrap: anywhere; text-align: right; font-size: 12px; font-weight: 750; }
.endpoint-list { padding: 10px 19px 17px; }
.endpoint-item { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; padding: 10px 0; border-bottom: 1px solid #edf0f2; }
.endpoint-item:last-child { border-bottom: 0; }
.endpoint-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.endpoint-heading .badge { flex-shrink: 0; }
.endpoint-item b { overflow-wrap: normal; word-break: normal; font-size: 11px; text-transform: uppercase; }
.endpoint-item code { color: var(--muted); overflow-wrap: anywhere; font-size: 11px; }

.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { padding: 12px 16px; border-bottom: 1px solid #edf0f2; text-align: left; vertical-align: middle; }
th { background: #fafbfc; color: var(--muted); font-size: 10px; text-transform: uppercase; }
tbody tr[data-id] { cursor: pointer; }
tbody tr[data-id]:hover { background: #f7f9fb; }
.empty-cell { height: 90px; color: var(--muted); text-align: center; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; }

.workspace-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.8fr); gap: 18px; align-items: start; }
.form-panel { overflow: hidden; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; padding: 19px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field-wide { grid-column: 1 / -1; }
.switch-field { display: flex; align-items: center; gap: 10px; min-height: 40px; color: var(--ink); font-size: 12px; font-weight: 700; }
.switch-field input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none; clip-path: inset(50%); }
.switch { position: relative; width: 38px; height: 22px; flex: 0 0 auto; border-radius: 999px; background: #b9c2ca; transition: background 0.15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform 0.15s; }
.switch-field input:checked + .switch { background: var(--blue); }
.switch-field input:checked + .switch::after { transform: translateX(16px); }
.switch-field input:focus-visible + .switch { box-shadow: 0 0 0 3px rgba(36, 99, 235, 0.18); }
.form-actions { display: flex; justify-content: flex-end; gap: 9px; padding: 15px 19px 19px; border-top: 1px solid var(--line); }

.estimate-panel { position: sticky; top: 20px; }
.estimate-total { padding: 24px 19px 20px; background: var(--ink); color: #fff; }
.estimate-total span { display: block; color: #b6c1ca; font-size: 11px; }
.estimate-total strong { display: block; margin-top: 7px; font-size: 31px; }
.estimate-lines { padding: 10px 19px; }
.estimate-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 10px 0; border-bottom: 1px solid #edf0f2; }
.estimate-line span { overflow-wrap: anywhere; font-size: 11px; }
.estimate-line b { font-size: 11px; }
.estimate-meta { display: flex; justify-content: space-between; gap: 12px; padding: 12px 19px 16px; color: var(--muted); font-size: 10px; }
.empty-state { margin: 0; padding: 18px 0; color: var(--muted); font-size: 12px; text-align: center; }
.panel-note { margin: 0 0 12px; color: var(--muted); font-size: 11px; line-height: 1.6; }

.toolbar-heading { align-items: end; }
.toolbar { display: flex; gap: 8px; }
.toolbar select { width: 145px; }

.cost-bars { display: grid; gap: 13px; padding: 20px; }
.cost-row { display: grid; grid-template-columns: 190px minmax(120px, 1fr) 74px; align-items: center; gap: 16px; font-size: 12px; }
.cost-row > div { height: 8px; border-radius: 999px; background: #e7ebef; overflow: hidden; }
.cost-row i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--green), var(--blue)); }
.cost-fill-36 { width: 36%; }
.cost-fill-41 { width: 41%; }
.cost-fill-60 { width: 60%; }
.cost-fill-67 { width: 67%; }
.cost-fill-93 { width: 93%; }
.cost-fill-100 { width: 100%; }
.cost-row b { text-align: right; }

.deployment-grid { grid-template-columns: minmax(0, 1.6fr) minmax(330px, 0.8fr); }
.field-group { margin: 0; padding: 19px 19px 0; border: 0; }
.field-group legend { padding: 0; }
.segmented { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 7px; border: 1px solid var(--line-strong); border-radius: 6px; overflow: hidden; }
.segmented label { min-width: 0; }
.segmented input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none; clip-path: inset(50%); }
.segmented span { min-height: 39px; display: grid; place-items: center; padding: 6px 9px; background: #fff; color: var(--muted); font-size: 11px; font-weight: 800; text-align: center; }
.segmented label:not(:last-child) span { border-right: 1px solid var(--line-strong); }
.segmented input:checked + span { background: var(--ink); color: #fff; }
.segmented input:focus-visible + span { box-shadow: inset 0 0 0 2px var(--blue); }
.validation-list { margin: 0 19px 15px; border: 1px solid #efb9b9; border-radius: 5px; padding: 10px 12px; background: var(--red-soft); color: #8d2929; font-size: 11px; }
.validation-list p { margin: 4px 0; }
.config-preview-panel { position: sticky; top: 20px; overflow: hidden; }
.secret-checklist { display: grid; gap: 8px; padding: 15px 19px; border-bottom: 1px solid var(--line); }
.secret-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 11px; }
.secret-item span:last-child { font-weight: 800; }
.secret-item .is-set { color: var(--green); }
.secret-item .is-missing { color: var(--orange); }
.config-preview { min-height: 380px; max-height: 620px; margin: 0; padding: 18px 19px; overflow: auto; background: #111a22; color: #d7e3ec; font: 11px/1.65 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }

.policy-list { display: grid; padding: 8px 19px 17px; }
.policy-list div { display: grid; gap: 4px; padding: 13px 0; border-bottom: 1px solid #edf0f2; }
.policy-list div:last-child { border-bottom: 0; }
.policy-list b { font-size: 12px; }
.policy-list span { color: var(--muted); font-size: 11px; line-height: 1.5; }

.detail-dialog { width: min(860px, calc(100vw - 32px)); max-height: calc(100vh - 42px); border: 1px solid var(--line-strong); border-radius: 7px; padding: 0; box-shadow: 0 24px 80px rgba(0, 0, 0, 0.24); }
.detail-dialog::backdrop { background: rgba(14, 22, 29, 0.62); }
.dialog-heading { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; padding: 17px 19px; border-bottom: 1px solid var(--line); background: #fff; }
.dialog-close { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 5px; background: #fff; color: var(--ink); font-size: 22px; line-height: 1; }
.dialog-content { display: grid; gap: 16px; padding: 19px; }
.detail-section { border-top: 1px solid var(--line); padding-top: 14px; }
.detail-section:first-child { border-top: 0; padding-top: 0; }
.detail-section h3 { margin: 0 0 10px; font-size: 13px; }
.event-list, .artifact-list { display: grid; gap: 7px; }
.event-item, .artifact-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid var(--line); border-radius: 5px; padding: 9px 11px; font-size: 11px; }
.artifact-item > div:first-child { min-width: 0; display: grid; gap: 3px; }
.artifact-item small { color: var(--muted); overflow-wrap: anywhere; }
.artifact-item a { color: var(--blue); font-weight: 750; }
.inline-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 6px; }
.button-small { min-height: 30px; padding: 0 10px; font-size: 11px; }
.detail-definitions { padding: 0; }
.detail-json { max-height: 260px; margin: 10px 0 0; overflow: auto; border-radius: 5px; padding: 12px; background: #111a22; color: #d7e3ec; font: 10px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.reconciliation-form { display: grid; grid-template-columns: minmax(110px, 0.7fr) minmax(110px, 0.8fr) minmax(220px, 1.6fr) auto; align-items: end; gap: 8px; margin-bottom: 9px; border: 1px solid var(--line); border-radius: 5px; padding: 11px; }
.reconciliation-heading { grid-column: 1 / -1; display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 11px; }
.reconciliation-heading b { color: var(--ink); }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 8px; }

@media (max-width: 1080px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workspace-grid, .deployment-grid { grid-template-columns: 1fr; }
  .estimate-panel, .config-preview-panel { position: static; }
}

@media (max-width: 780px) {
  .app-shell { display: block; }
  .sidebar { position: static; width: 100%; height: auto; padding: 12px; }
  .brand { padding: 2px 4px 12px; }
  .brand-mark { width: 34px; height: 34px; }
  .nav-list { display: flex; overflow-x: auto; padding-bottom: 2px; }
  .nav-item { width: auto; flex: 0 0 auto; padding: 9px 11px; }
  .sidebar-foot { display: none; }
  .main-area { padding: 20px 14px 36px; }
  .topbar { display: grid; align-items: start; }
  .connection-bar { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; }
  .token-field input { width: 100%; }
  .two-column { grid-template-columns: 1fr; }
  .pipeline-flow { padding: 16px; }
  .toolbar-heading { align-items: start; flex-direction: column; }
  .toolbar { width: 100%; }
  .toolbar select { flex: 1; width: auto; }
  .cost-row { grid-template-columns: 120px minmax(90px, 1fr) 62px; gap: 9px; }
  .reconciliation-form { grid-template-columns: 1fr 1fr; }
  .reconciliation-form input:nth-of-type(2) { grid-column: 1 / -1; }
}

@media (max-width: 520px) {
  .metric-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .metric { min-height: 112px; padding: 14px; }
  .metric strong { font-size: 22px; }
  h1 { font-size: 23px; }
  .connection-bar { grid-template-columns: 1fr 1fr; }
  .token-field { grid-column: 1 / -1; }
  .form-grid { grid-template-columns: 1fr; }
  .field-wide { grid-column: auto; }
  .segmented { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .segmented label:not(:last-child) span { border-right: 0; border-bottom: 1px solid var(--line-strong); }
  .form-actions, .deployment-actions { display: grid; grid-template-columns: 1fr; }
  .cost-row { grid-template-columns: 1fr 58px; }
  .cost-row > div { grid-column: 1 / -1; grid-row: 2; }
  .cost-row b { grid-column: 2; grid-row: 1; }
  .artifact-item { align-items: flex-start; flex-direction: column; }
  .inline-actions { justify-content: flex-start; }
  .reconciliation-form { grid-template-columns: 1fr; }
  .reconciliation-form input:nth-of-type(2) { grid-column: auto; }
}

/* 入库体检结论。结论字显示在 .estimate-total 的深色底上，
   不能用 --green / --red（那套是给白底用的，压在深色上读不出来）。 */
.verdict-ok { color: #5fd3a6; }
.verdict-blocked { color: #ff8f8f; }
.estimate-list { margin: 0; padding: 16px 19px; }
.estimate-list > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
}
.estimate-list > div:last-child { border-bottom: none; }
.estimate-list dt { color: var(--muted); margin: 0; }
.estimate-list dd { margin: 0; color: var(--ink); font-weight: 600; }
.problem-title {
  margin: 14px 0 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.02em;
}
.problem-list { margin: 0; padding-left: 0; list-style: none; }
.problem-list li {
  margin-bottom: 6px;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 11px;
  line-height: 1.6;
}
/* 红=还没花钱但也开不了跑；橙=能跑，但成片上看得见 */
.problem-list li.is-blocker {
  background: var(--red-soft);
  border-left: 3px solid var(--red);
  color: var(--ink);
}
.problem-list li.is-warning {
  background: var(--orange-soft);
  border-left: 3px solid var(--orange);
  color: var(--ink);
}

.console-link{display:block;text-decoration:none;margin:16px 0;background:var(--blue);color:#fff}.deployment-actions,.segmented{flex-wrap:wrap}.deployment-actions .button{white-space:normal;min-width:0}.deployment-grid>*{min-width:0}#credentialStoreNote{padding:0 24px}.is-expired,.metric .is-expired{color:#b42318}.is-warning,.metric .is-warning{color:#a86400}

@media (max-width: 639px) {
  .segmented { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: 1fr; }
}
