﻿:root { color-scheme: light; --ink:#17202a; --muted:#607080; --line:#d8e0e8; --panel:#f8fafc; --brand:#146c94; --ok:#1a7f37; --wait:#9a6700; --bad:#b42318; }
    * { box-sizing: border-box; }
    body { margin: 0; font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--ink); background: #eef3f7; }
    header { height: 58px; display:flex; align-items:center; justify-content:space-between; padding:0 22px; background:#fff; border-bottom:1px solid var(--line); }
    h1 { margin:0; font-size:20px; font-weight:700; letter-spacing:0; }
    main { max-width: 1180px; margin: 0 auto; padding: 22px; display:grid; gap:18px; }
    section { background:#fff; border:1px solid var(--line); border-radius:8px; padding:18px; }
    h2 { margin:0 0 14px; font-size:16px; }
    form { display:grid; grid-template-columns: 1fr 1fr 130px 120px; gap:10px; align-items:end; }
    .add-node-form { grid-template-columns: minmax(180px, 1fr) minmax(240px, 1.3fr) 130px 120px; }
    label { display:grid; gap:6px; font-size:13px; color:var(--muted); }
    input, select { height:38px; border:1px solid var(--line); border-radius:6px; padding:0 10px; font-size:14px; background:#fff; color:var(--ink); }
    button { height:38px; border:0; border-radius:6px; padding:0 13px; background:var(--brand); color:white; font-weight:650; cursor:pointer; }
    button.secondary { background:#e7eef4; color:var(--ink); }
    button.danger { background:#fee4e2; color:var(--bad); }
    button.icon-button { width:34px; height:34px; border-radius:50%; padding:0; background:#eef3f7; color:var(--ink); font-size:20px; line-height:1; }
    button.full { width:100%; }
    table { width:100%; border-collapse:collapse; }
    th, td { padding:10px 8px; border-bottom:1px solid var(--line); text-align:left; font-size:14px; vertical-align:top; }
    th { color:var(--muted); font-size:12px; font-weight:700; text-transform:uppercase; }
    code { display:block; max-width:520px; overflow:auto; white-space:nowrap; background:var(--panel); border:1px solid var(--line); border-radius:6px; padding:8px; font-size:12px; }
    code.install-command { max-width:420px; white-space:normal; overflow-wrap:anywhere; line-height:1.45; }
    .pill { display:inline-flex; align-items:center; height:24px; border-radius:999px; padding:0 9px; font-size:12px; font-weight:700; }
    .ok { color:var(--ok); background:#dcfce7; }
    .wait { color:var(--wait); background:#fff7d6; }
    .bad { color:var(--bad); background:#fee4e2; }
    .grid { display:grid; grid-template-columns: repeat(4, 1fr); gap:12px; }
    .stat { background:var(--panel); border:1px solid var(--line); border-radius:8px; padding:14px; }
    .stat b { display:block; font-size:24px; }
    .muted { color:var(--muted); }
    .mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
    .truncate { max-width:260px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
    .node-row { cursor:pointer; }
    .node-row:hover { background:#f8fafc; }
    .row-actions { width:74px; text-align:right; }
    .badge-list { display:flex; flex-wrap:wrap; gap:6px; }
    .badge { display:inline-flex; align-items:center; min-height:24px; border:1px solid var(--line); border-radius:999px; padding:2px 8px; background:#f8fafc; color:var(--ink); font-size:12px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
    .topology { background:var(--panel); border:1px solid var(--line); border-radius:8px; padding:0; overflow:hidden; }
    .topology svg { width:100%; height:360px; display:block; background:#f7fafc; }
    .topology line { stroke:#0f766e; stroke-width:2.4; }
    .topology line.metric { stroke:#64748b; stroke-width:1.5; opacity:.45; }
    .topology line.direct { stroke:#0f766e; stroke-width:3; }
    .topology line.relay { stroke:#2563eb; stroke-dasharray:10 6; }
    .topology line.stale { stroke:var(--bad); stroke-dasharray:8 7; }
    .topology line.label-leader { stroke-width:1.4; stroke-dasharray:none; opacity:.65; }
    .topology g.dim { opacity:.16; }
    .topology g.highlight line { stroke-width:4; }
    .topology g.node { cursor:pointer; }
    .topology g.node.dim { opacity:.25; }
    .topology g.node.selected circle { fill:#ecfeff; stroke-width:4; }
    .topology circle { fill:#fff; stroke:var(--brand); stroke-width:3; }
    .topology text { font-size:13px; fill:var(--ink); text-anchor:middle; dominant-baseline:middle; font-weight:650; }
    .topology .cost { fill:var(--muted); font-size:11px; font-weight:700; paint-order:stroke; stroke:#f7fafc; stroke-width:5px; }
    .topology .cost-bg { fill:#f7fafc; stroke:#d8e0e8; stroke-width:1; opacity:.96; }
    .topology .cost-bg.direct { stroke:#0f766e; }
    .topology .cost-bg.relay { stroke:#2563eb; }
    .topology .cost-bg.stale { stroke:var(--bad); }
    .topology .ip { fill:var(--muted); font-size:11px; font-weight:500; }
    .topology .empty { padding:28px; color:var(--muted); }
    .topology-legend { display:flex; flex-wrap:wrap; gap:14px; align-items:center; padding:10px 12px; border-top:1px solid var(--line); background:#fff; color:var(--muted); font-size:12px; }
    .topology-legend span { display:inline-flex; align-items:center; gap:7px; white-space:nowrap; }
    .topology-status { padding:10px 12px; border-top:1px solid var(--line); background:#fff; color:var(--muted); font-size:13px; }
    .decision-panel { padding:12px; border-top:1px solid var(--line); background:#fff; }
    .decision-summary { display:grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap:8px; margin-bottom:10px; color:var(--muted); font-size:13px; }
    .decision-summary span { border:1px solid var(--line); border-radius:6px; padding:7px 8px; background:var(--panel); }
    .decision-summary strong { color:var(--ink); }
    .decision-title { margin:4px 0 6px; color:var(--ink); font-size:12px; font-weight:700; text-transform:uppercase; }
    .decision-table th, .decision-table td { padding:7px 8px; font-size:12px; }
    .legend-line { width:34px; height:0; border-top:3px solid #0f766e; }
    .legend-line.metric { border-top-color:#64748b; opacity:.65; }
    .legend-line.direct { border-top-color:#0f766e; }
    .legend-line.relay { border-top-color:#2563eb; border-top-style:dashed; }
    .legend-line.stale { border-top-color:var(--bad); border-top-style:dashed; }
    .offline-list { display:flex; flex-wrap:wrap; gap:8px; padding:12px; border-top:1px solid var(--line); background:#fff; }
    .offline-list span { border:1px solid var(--line); border-radius:999px; padding:5px 9px; color:var(--muted); font-size:12px; }
    .settings-grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap:10px; align-items:end; }
    .cost-grid { display:grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap:12px; align-items:end; margin:12px 0 16px; }
    .cost-grid label span { color:var(--ink); font-weight:650; }
    .cost-grid label small { color:var(--muted); line-height:1.35; }
    .formula { margin:0 0 12px; padding:12px 14px; border:1px solid var(--line); border-radius:6px; background:var(--panel); color:var(--muted); font-size:13px; line-height:1.5; }
    .formula-title { display:block; margin-bottom:8px; color:var(--ink); font-weight:700; }
    .formula-eq { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; color:var(--ink); }
    .formula-terms { display:flex; flex-wrap:wrap; gap:8px; margin-top:8px; }
    .formula-terms span { display:inline-flex; border:1px solid var(--line); border-radius:6px; padding:4px 7px; background:#fff; }
    .subhead { margin:14px 0 8px; color:var(--ink); font-size:13px; font-weight:700; }
    .compact-input { width:100%; min-width:92px; }
    .inline-edit { display:grid; grid-template-columns:minmax(140px, 1fr) auto; gap:6px; align-items:center; }
    .hidden { display:none !important; }
    .modal { position:fixed; inset:0; z-index:50; display:grid; place-items:center; padding:24px; background:rgba(15, 23, 42, .38); }
    .modal-panel { width:min(760px, 100%); max-height:calc(100vh - 48px); overflow:auto; background:#fff; border:1px solid var(--line); border-radius:8px; box-shadow:0 22px 60px rgba(15, 23, 42, .22); }
    .modal-head { display:flex; align-items:flex-start; justify-content:space-between; gap:14px; padding:18px 20px; border-bottom:1px solid var(--line); }
    .modal-head h2 { margin:0 0 6px; font-size:18px; }
    .modal-meta-text { margin-left:10px; }
    #nodeModalBody { display:grid; gap:16px; padding:18px 20px 20px; }
    .detail-grid { display:grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap:10px; }
    .detail-item { min-width:0; border:1px solid var(--line); border-radius:8px; padding:10px 12px; background:#f8fafc; }
    .detail-item span { display:block; margin-bottom:4px; color:var(--muted); font-size:12px; }
    .detail-item strong { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:14px; }
    .modal-section { display:grid; gap:8px; }
    .modal-section label span, .field-title { color:var(--ink); font-size:13px; font-weight:700; }
    .modal-section label small { color:var(--muted); line-height:1.35; }
    .modal-section input { width:100%; }
    #nodeModal .install-command, .modal-code { max-width:none; }
    .button-row, .modal-actions { display:flex; justify-content:flex-end; gap:8px; flex-wrap:wrap; }
    @media (max-width: 980px) { .cost-grid { grid-template-columns: repeat(2, minmax(150px, 1fr)); } }
    @media (max-width: 820px) { form, .add-node-form, .grid, .cost-grid, .detail-grid { grid-template-columns:1fr; } header { padding:0 14px; } main { padding:14px; } .modal { padding:12px; } }
