:root {
  color-scheme: light;
  --ink: #1f2933;
  --muted: #6d7883;
  --faint: #9aa4ad;
  --line: #e1e6ea;
  --line-strong: #cfd7dd;
  --panel: #fff;
  --canvas: #f7f8f9;
  --accent: #2e6f86;
  --accent-strong: #21586d;
  --accent-soft: #edf5f7;
  --green: #27775c;
  --amber: #a96e1f;
  --red: #b24747;
  --radius: 5px;
  font-family: Inter, "Segoe UI", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--canvas); }
body { margin: 0; color: var(--ink); background: var(--canvas); font-size: 14px; line-height: 1.45; }
button, input, select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.app-shell { min-height: 100vh; }

.topbar { position: sticky; top: 0; z-index: 5; min-height: 64px; padding: 0 42px; display: flex; align-items: center; justify-content: space-between; gap: 24px; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--line); backdrop-filter: blur(12px); }
.brand { display: flex; align-items: center; gap: 11px; min-width: 245px; }
.brand-mark { width: 30px; height: 30px; display: grid; place-items: center; color: #fff; background: var(--accent); border-radius: 5px; font-weight: 800; letter-spacing: 0; }
.brand-name { color: #18232c; font-size: 15px; font-weight: 700; letter-spacing: .01em; }
.brand-meta { margin-top: 1px; color: var(--muted); font-size: 11px; }
.top-actions { display: flex; align-items: center; justify-content: flex-end; gap: 7px; }

.button { display: inline-flex; min-height: 34px; align-items: center; justify-content: center; padding: 0 12px; border: 1px solid transparent; border-radius: var(--radius); color: var(--ink); background: transparent; text-decoration: none; transition: background .15s ease, border-color .15s ease, color .15s ease; }
.button:hover { border-color: var(--line-strong); background: #f3f6f7; }
.button:focus-visible, .tab:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 1px; }
.button:disabled { cursor: wait; opacity: .55; }
.button-primary { color: #fff; background: var(--accent); }
.button-primary:hover { border-color: var(--accent-strong); background: var(--accent-strong); }
.button-dark { color: #fff; background: #35444e; }
.button-dark:hover { border-color: #293740; background: #293740; }
.button-quiet { border-color: var(--line); background: #fff; }
.button-small { min-height: 29px; padding: 0 9px; font-size: 12px; }

.main-content { width: min(1220px, calc(100% - 64px)); margin: 0 auto; padding: 38px 0 74px; }
.page-heading, .panel-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 26px; }
.page-heading { margin-bottom: 22px; }
.eyebrow, .section-kicker { color: var(--accent); font-size: 10px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
h1, h2, h3, p { margin: 0; }
h1 { margin-top: 5px; color: #17222b; font-size: 28px; letter-spacing: -.025em; }
h2 { margin-top: 4px; color: #1b2831; font-size: 19px; letter-spacing: -.015em; }
h3 { color: #24333d; font-size: 14px; }
.subheading { margin-top: 7px; color: var(--muted); font-size: 13px; }
.validation-chip { padding: 7px 11px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: #fff; font-size: 12px; white-space: nowrap; }
.validation-chip.ok { color: var(--green); border-color: #c4ded2; background: #f1f8f4; }
.validation-chip.error { color: var(--red); border-color: #e6c4c4; background: #fff6f6; }

.summary-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 1px; margin: 0 0 28px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--line); }
.summary-card { min-height: 86px; padding: 14px 16px; background: #fff; }
.summary-label { color: var(--muted); font-size: 11px; }
.summary-value { margin-top: 6px; color: #24333d; font-size: 22px; font-weight: 700; line-height: 1; }
.summary-note { margin-top: 6px; color: var(--faint); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.summary-ready .summary-value { color: var(--green); }
.summary-error .summary-value { color: var(--red); }

.tabs { display: flex; gap: 4px; padding: 0 4px; border-bottom: 1px solid var(--line); }
.tab { position: relative; padding: 11px 14px 12px; border: 0; color: var(--muted); background: transparent; font-size: 13px; }
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--accent-strong); font-weight: 700; }
.tab.is-active::after { content: ""; position: absolute; right: 12px; bottom: -1px; left: 12px; height: 2px; background: var(--accent); }
.tab-panel { display: none; padding-top: 24px; }
.tab-panel.is-active { display: block; }

.panel-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.form-card { min-height: 188px; padding: 19px 20px; }
.card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.card-heading h2, .card-heading h3 { display: inline-block; margin-left: 8px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
label { display: flex; flex-direction: column; gap: 5px; color: var(--muted); font-size: 12px; }
input[type="text"], input[type="number"], select { width: 100%; height: 35px; padding: 0 9px; border: 1px solid var(--line-strong); border-radius: 4px; color: var(--ink); background: #fff; outline: none; }
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.check-label { flex-direction: row; align-items: center; gap: 8px; min-height: 35px; color: var(--ink); }
.check-label input { width: 15px; height: 15px; accent-color: var(--accent); }
.note { margin-top: 16px; padding-top: 11px; border-top: 1px solid #eef1f3; color: var(--muted); font-size: 12px; }
.note-warn { color: var(--amber); }
.security-card { grid-column: span 2; }
.status-dot { width: 7px; height: 7px; margin-top: 5px; border-radius: 50%; background: var(--green); }

.panel-header { min-height: 44px; align-items: center; }
.panel-header > p { max-width: 540px; color: var(--muted); font-size: 12px; text-align: right; }
.legend { display: flex; gap: 14px; color: var(--muted); font-size: 12px; }
.legend-item { display: flex; align-items: center; gap: 6px; }
.legend-item i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.legend-on { background: var(--green); }
.legend-off { background: #c7d0d5; }

.service-table-wrap { margin-top: 14px; overflow: hidden; }
.service-matrix { width: 100%; overflow-x: auto; }
.service-row { display: grid; grid-template-columns: minmax(230px, 1.5fr) repeat(3, 112px) 92px; align-items: center; min-width: 700px; border-bottom: 1px solid #edf0f2; }
.service-row:last-child { border-bottom: 0; }
.service-row > div { padding: 12px 15px; }
.service-head { color: var(--muted); background: #fbfcfc; font-size: 11px; font-weight: 700; }
.service-name { display: flex; align-items: center; gap: 9px; }
.service-id { color: var(--accent); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; }
.service-title { font-weight: 600; }
.service-fixed { color: var(--muted); font-size: 11px; }
.service-row input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--accent); }
.service-row input[disabled] { opacity: .35; }
.service-row select { height: 29px; font-size: 12px; }
.service-warning { display: flex; gap: 12px; margin-top: 13px; padding: 13px 15px; color: var(--muted); font-size: 12px; }
.service-warning strong { color: var(--amber); white-space: nowrap; }

.table-card { overflow: hidden; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 640px; }
th, td { padding: 11px 15px; border-bottom: 1px solid #edf0f2; text-align: left; }
th { color: var(--muted); background: #fbfcfc; font-size: 11px; font-weight: 700; letter-spacing: .03em; }
td { color: #394751; font-size: 13px; }
td code { color: var(--accent-strong); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
td small { color: var(--muted); }
.empty-row { color: var(--muted); text-align: center; }
.inline-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 13px; margin-top: 13px; padding: 17px 18px; }
.inline-form-title { width: 100%; color: #33424c; font-size: 13px; font-weight: 700; }
.inline-form .form-grid { flex: 1 1 100%; }
.inline-form > .check-label { width: auto; }
.two-column { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.two-column .table-card { min-height: 244px; }
.table-footer { display: flex; align-items: center; gap: 9px; padding: 11px 15px; color: var(--muted); font-size: 12px; }
.table-footer input { width: 70px; height: 28px; margin: 0 3px; text-align: center; }
.form-actions { display: flex; gap: 8px; }
.security-level-table-wrap { margin-top: 14px; overflow-x: auto; }
.security-level-table-wrap table { min-width: 650px; }
.security-level-form { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.security-level-add { align-self: end; }
.storage-heading { margin-top: 28px; }
.storage-heading > label { min-width: 260px; }
.storage-heading > p { flex: 1; }
.storage-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 14px; }
.storage-card { min-width: 0; }
.storage-card table { min-width: 540px; }
.storage-usage { color: var(--accent-strong); font-size: 12px; white-space: nowrap; }
.storage-form { margin: 0 15px; padding: 15px 0; border-top: 1px solid var(--line); }
.storage-form-wide { grid-column: span 2; }
.storage-add { align-self: end; }
.storage-capacity { justify-content: space-between; flex-wrap: wrap; border-top: 1px solid #edf0f2; }
.storage-capacity label { flex-direction: row; align-items: center; }
.storage-capacity input { width: 88px; }

.output-map { display: grid; grid-template-columns: minmax(150px, 1fr) 24px minmax(220px, 1.4fr) 24px minmax(180px, 1.1fr); align-items: stretch; gap: 8px; margin-top: 14px; }
.output-node { display: flex; min-height: 86px; flex-direction: column; justify-content: center; gap: 4px; padding: 13px 15px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.output-node-main { border-color: #c8dce2; background: #f1f7f8; }
.output-node-delivery { border-color: #c9dfd3; background: #f3f9f5; }
.output-node-label { color: var(--accent); font-size: 10px; font-weight: 800; letter-spacing: .08em; }
.output-node strong { font-size: 13px; }
.output-node small { color: var(--muted); font-size: 11px; }
.output-arrow { display: grid; place-items: center; color: var(--faint); font-size: 17px; }
.output-grid { display: grid; grid-template-columns: 340px 1fr; gap: 14px; margin-top: 14px; }
.validation-card, .files-card { min-height: 390px; padding: 17px; }
.validation-item { display: flex; gap: 9px; padding: 9px 0; border-bottom: 1px solid #edf0f2; color: var(--muted); font-size: 12px; line-height: 1.45; }
.validation-item:last-child { border-bottom: 0; }
.validation-item .issue-icon { flex: 0 0 auto; font-weight: 800; }
.validation-item.error .issue-icon { color: var(--red); }
.validation-item.warning .issue-icon { color: var(--amber); }
.validation-empty { color: var(--green); font-size: 13px; }
.files-card pre { height: 292px; margin: 0 0 11px; padding: 13px; overflow: auto; border: 1px solid #e5eaed; border-radius: 4px; color: #3b4a54; background: #fafbfb; font: 12px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; }
.files-card select { width: auto; max-width: 250px; height: 29px; font-size: 12px; }
.toast { position: fixed; right: 22px; bottom: 22px; padding: 10px 13px; border: 1px solid #bfdace; border-radius: var(--radius); color: #21674e; background: #f0f8f4; opacity: 0; transform: translateY(8px); pointer-events: none; transition: opacity .2s ease, transform .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 980px) {
  .topbar { padding: 0 20px; }
  .top-actions .button-quiet { display: none; }
  .main-content { width: min(100% - 32px, 760px); }
  .summary-grid { grid-template-columns: repeat(3, 1fr); }
  .panel-grid, .two-column, .output-grid, .output-map, .storage-grid { grid-template-columns: 1fr; }
  .security-card { grid-column: auto; }
  .output-arrow { min-height: 18px; transform: rotate(90deg); }
  .form-grid-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel-header { align-items: flex-start; flex-wrap: wrap; }
  .panel-header > p { width: 100%; max-width: none; text-align: left; }
}
@media (max-width: 560px) {
  .topbar { min-height: 62px; padding: 11px 14px; gap: 10px; align-items: flex-start; }
  .brand { min-width: 0; }
  .brand-meta { display: none; }
  .top-actions .button-primary { padding: 0 10px; }
  .main-content { width: calc(100% - 24px); padding-top: 25px; }
  h1 { font-size: 25px; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .summary-card { min-height: 78px; padding: 12px; }
  .tabs { overflow-x: auto; padding: 0; }
  .tab { flex: 0 0 auto; padding-inline: 11px; }
  .form-grid, .form-grid-3, .form-grid-5 { grid-template-columns: 1fr; }
  .storage-form-wide { grid-column: auto; }
  .storage-capacity { align-items: flex-start; flex-direction: column; }
  .storage-heading > label { width: 100%; }
  .security-level-add { width: 100%; }
  .page-heading { align-items: flex-start; flex-direction: column; gap: 12px; }
}
