:root {
  --bg: #090d14;
  --panel: #101722;
  --panel-2: #151e2c;
  --line: #233044;
  --text: #f3f7fc;
  --muted: #8795aa;
  --accent: #6de5be;
  --accent-2: #56a9ff;
  --danger: #ff6b7b;
  --warning: #f5c469;
  --radius: 18px;
  font-family: Inter, "SF Pro Display", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body { min-height: 100vh; }
button, input, select { font: inherit; }
button { color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.eyebrow { margin: 0 0 10px; color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .18em; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(26px, 4vw, 36px); letter-spacing: -.035em; }
h2 { margin-bottom: 6px; font-size: 21px; }
h3 { margin-bottom: 6px; }

.login-view { min-height: 100vh; display: grid; place-items: center; overflow: hidden; position: relative; padding: 24px; }
.login-view::before { content: ""; position: fixed; inset: 0; background-image: linear-gradient(#ffffff08 1px, transparent 1px), linear-gradient(90deg, #ffffff08 1px, transparent 1px); background-size: 48px 48px; mask-image: radial-gradient(circle at center, #000, transparent 75%); }
.login-glow { position: absolute; width: 540px; height: 540px; border-radius: 50%; background: #41d9ac18; filter: blur(70px); }
.login-card { z-index: 1; width: min(430px, 100%); padding: 44px; background: #101722e8; border: 1px solid #29374d; border-radius: 28px; box-shadow: 0 40px 100px #0009; backdrop-filter: blur(20px); }
.login-card h1 { margin-top: 24px; }
.login-form { margin-top: 30px; }
.brand-mark { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 15px; color: #07110e; background: linear-gradient(135deg, var(--accent), #a4f2d8); font-weight: 950; letter-spacing: -.08em; box-shadow: 0 10px 35px #55e3b438; }
.brand-mark.small { width: 38px; height: 38px; border-radius: 11px; font-size: 13px; }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; z-index: 20; inset: 0 auto 0 0; display: flex; flex-direction: column; width: 242px; padding: 26px 18px 20px; background: #0c111a; border-right: 1px solid #1c2635; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 9px 34px; }
.brand > div:last-child { display: flex; flex-direction: column; }
.brand strong { font-size: 17px; letter-spacing: .03em; }
.brand span { color: var(--muted); font-size: 12px; }
nav { display: grid; gap: 6px; }
.nav-item { display: flex; align-items: center; gap: 13px; width: 100%; padding: 12px 14px; border: 0; border-radius: 12px; background: transparent; color: #8491a4; text-align: left; cursor: pointer; transition: .2s ease; }
.nav-item span { width: 20px; color: #69788d; font-size: 18px; text-align: center; }
.nav-item:hover { color: var(--text); background: #141c28; }
.nav-item.active { color: var(--text); background: #172231; box-shadow: inset 3px 0 var(--accent); }
.nav-item.active span { color: var(--accent); }
.sidebar-foot { margin-top: auto; }
.admin-pill { display: flex; align-items: center; gap: 10px; margin: 0 9px 12px; padding: 12px; border: 1px solid var(--line); border-radius: 13px; background: #111823; }
.admin-pill div { display: flex; flex-direction: column; }
.admin-pill small { color: var(--muted); }
.admin-pill strong { font-size: 13px; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #5b687a; box-shadow: 0 0 0 4px #5b687a18; }
.status-dot.online { background: var(--accent); box-shadow: 0 0 0 4px #6de5be18, 0 0 14px #6de5be66; }
.status-dot.warning { background: var(--warning); }
.status-dot.danger { background: var(--danger); }
.workspace { margin-left: 242px; min-height: 100vh; padding: 48px clamp(24px, 4.5vw, 72px); background: radial-gradient(circle at 92% -5%, #16324a44, transparent 35%), var(--bg); }
.page-header { display: flex; align-items: end; justify-content: space-between; gap: 20px; max-width: 1440px; margin: auto auto 32px; }
.page-header p:last-child { margin-bottom: 0; }
.page-content { max-width: 1440px; margin: auto; }
.mobile-header { display: none; }

.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 9px 15px; border: 1px solid var(--line); border-radius: 11px; background: #172131; color: var(--text); font-weight: 700; cursor: pointer; transition: transform .15s ease, border-color .15s ease, background .15s ease; }
.button:hover { transform: translateY(-1px); border-color: #3d506b; background: #1b293c; }
.button.primary { color: #07110e; border-color: transparent; background: var(--accent); }
.button.primary:hover { background: #88eccb; }
.button.danger { color: #ff9daa; border-color: #5a2b35; background: #2b171e; }
.button.ghost { background: transparent; }
.button.small { min-height: 32px; padding: 6px 10px; font-size: 12px; }
.button.wide { width: 100%; }
.button:disabled { transform: none; cursor: wait; opacity: .55; }
.icon-button { display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: #151e2b; cursor: pointer; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
.metric-card, .panel { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(145deg, #121a26, #0f151f); box-shadow: 0 14px 35px #0002; }
.metric-card { min-height: 150px; padding: 22px; }
.metric-card::after { content: ""; position: absolute; right: -22px; bottom: -30px; width: 100px; height: 100px; border-radius: 50%; background: var(--card-glow, #6de5be0b); }
.metric-top { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 13px; }
.metric-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: var(--accent); background: #6de5be12; }
.metric-value { margin-top: 23px; font-size: 29px; font-weight: 850; letter-spacing: -.035em; }
.metric-note { margin-top: 5px; color: var(--muted); font-size: 12px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(300px, .7fr); gap: 18px; }
.panel { padding: 22px; }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.panel-header h2 { margin-bottom: 3px; }
.panel-header p { margin-bottom: 0; font-size: 12px; }
.chart-wrap { height: 245px; }
canvas { width: 100%; height: 100%; }

.node-list, .account-list { display: grid; gap: 12px; }
.node-row, .account-row { display: grid; align-items: center; gap: 16px; padding: 17px 18px; border: 1px solid var(--line); border-radius: 15px; background: #111923; }
.node-row { grid-template-columns: minmax(170px, 1.4fr) repeat(5, minmax(80px, .65fr)) auto; }
.account-row { grid-template-columns: minmax(170px, 1.25fr) minmax(120px, .7fr) minmax(130px, 1fr) minmax(110px, .8fr) auto; }
.entity-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.entity-title h3 { overflow: hidden; margin: 0 0 3px; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.entity-title p, .cell-label { margin: 0; color: var(--muted); font-size: 11px; }
.cell strong { display: block; margin-top: 3px; font-size: 13px; }
.actions { display: flex; justify-content: flex-end; gap: 7px; flex-wrap: wrap; }
.badge { display: inline-flex; align-items: center; gap: 6px; width: max-content; padding: 5px 8px; border-radius: 999px; color: #9aa8b9; background: #202b3b; font-size: 11px; font-weight: 700; }
.badge.good { color: var(--accent); background: #14342d; }
.badge.bad { color: #ff9daa; background: #351b22; }
.progress { width: 100%; height: 6px; margin-top: 7px; overflow: hidden; border-radius: 9px; background: #253044; }
.progress > span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent-2), var(--accent)); }
.progress > span.p-5 { width: 5%; }
.progress > span.p-10 { width: 10%; }
.progress > span.p-15 { width: 15%; }
.progress > span.p-20 { width: 20%; }
.progress > span.p-25 { width: 25%; }
.progress > span.p-30 { width: 30%; }
.progress > span.p-35 { width: 35%; }
.progress > span.p-40 { width: 40%; }
.progress > span.p-45 { width: 45%; }
.progress > span.p-50 { width: 50%; }
.progress > span.p-55 { width: 55%; }
.progress > span.p-60 { width: 60%; }
.progress > span.p-65 { width: 65%; }
.progress > span.p-70 { width: 70%; }
.progress > span.p-75 { width: 75%; }
.progress > span.p-80 { width: 80%; }
.progress > span.p-85 { width: 85%; }
.progress > span.p-90 { width: 90%; }
.progress > span.p-95 { width: 95%; }
.progress > span.p-100 { width: 100%; }
.empty { display: grid; place-items: center; min-height: 280px; padding: 32px; border: 1px dashed #2b3a50; border-radius: var(--radius); color: var(--muted); text-align: center; }
.empty-icon { margin-bottom: 14px; color: var(--accent); font-size: 34px; }
.loading { padding: 70px; color: var(--muted); text-align: center; }

.traffic-filter { display: flex; align-items: end; gap: 10px; margin-bottom: 18px; padding: 16px; border: 1px solid var(--line); border-radius: 15px; background: #101721; }
.traffic-filter label { flex: 1; }
.traffic-list { display: grid; gap: 8px; }
.traffic-row { display: grid; grid-template-columns: 150px 1fr 1fr 120px 120px; gap: 12px; align-items: center; padding: 12px 14px; border-bottom: 1px solid #202b3a; font-size: 13px; }
.traffic-row.header { color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.up { color: var(--accent-2); }
.down { color: var(--accent); }

.deploy-grid { display: grid; grid-template-columns: minmax(320px, .72fr) minmax(440px, 1.28fr); gap: 18px; align-items: start; }
.deploy-form-panel { position: sticky; top: 28px; }
.deployment-security-note { display: flex; align-items: flex-start; gap: 11px; margin-top: 20px; padding: 13px 14px; border: 1px solid #27453e; border-radius: 12px; background: #0d201b; }
.deployment-security-note > span { font-size: 15px; }
.deployment-security-note p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.65; }
.deployment-security-note strong { color: #b9f4df; font-size: 12px; }
.deployment-status-panel { min-height: 522px; }
.deployment-empty { display: grid; place-items: center; min-height: 475px; padding: 38px; color: var(--muted); text-align: center; }
.deployment-empty h2 { color: var(--text); }
.deployment-empty > p { max-width: 440px; margin-bottom: 10px; line-height: 1.7; }
.deployment-hint { padding: 10px 13px; border-radius: 10px; background: #151e2b; font-size: 11px; }
.deployment-heading { align-items: flex-start; }
.deployment-heading .eyebrow { margin-bottom: 7px; }
.deployment-state { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 8px; padding: 8px 11px; border: 1px solid #3d4b60; border-radius: 999px; color: #a8b4c4; background: #182130; font-size: 11px; font-weight: 800; }
.deployment-state i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 4px #ffffff0b; }
.deployment-state.queued { color: var(--warning); border-color: #5c4b2a; background: #292313; }
.deployment-state.running { color: var(--accent-2); border-color: #2c4e72; background: #122438; }
.deployment-state.succeeded { color: var(--accent); border-color: #2b5a4d; background: #123027; }
.deployment-state.failed { color: #ff9daa; border-color: #63303a; background: #331921; }
.deployment-stage { position: relative; overflow: hidden; margin-bottom: 14px; padding: 18px 20px; border: 1px solid #2b3b50; border-radius: 14px; background: linear-gradient(120deg, #101d2a, #0d151f); }
.deployment-stage > span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 11px; }
.deployment-stage > strong { font-size: 18px; }
.deployment-pulse { position: absolute; top: 50%; right: 20px; display: flex; gap: 5px; transform: translateY(-50%); }
.deployment-pulse i { width: 6px; height: 6px; border-radius: 50%; background: #526175; }
.deployment-pulse.running i { background: var(--accent-2); animation: deployment-pulse 1.15s ease-in-out infinite; }
.deployment-pulse.running i:nth-child(2) { animation-delay: .14s; }
.deployment-pulse.running i:nth-child(3) { animation-delay: .28s; }
.deployment-pulse.succeeded i { background: var(--accent); }
.deployment-pulse.failed i { background: var(--danger); }
.deployment-pulse.queued i { background: var(--warning); opacity: .7; }
@keyframes deployment-pulse { 0%, 60%, 100% { transform: translateY(0); opacity: .35; } 30% { transform: translateY(-5px); opacity: 1; } }
.deployment-fingerprint { display: grid; gap: 8px; margin-bottom: 14px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 12px; background: #0d141e; }
.deployment-fingerprint span { color: var(--muted); font-size: 11px; }
.deployment-fingerprint code { overflow-wrap: anywhere; color: #c2d2e7; }
.deployment-fingerprint em { color: #657287; font-size: 12px; font-style: normal; }
.deployment-error { margin-bottom: 14px; padding: 13px 15px; border: 1px solid #5a2b35; border-radius: 12px; background: #2b171e; }
.deployment-error strong { color: #ff9daa; font-size: 12px; }
.deployment-error p { margin: 7px 0 0; color: #f0b9c0; font-size: 12px; line-height: 1.55; word-break: break-word; }
.deployment-log-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 18px 0 9px; }
.deployment-log-header > div { display: flex; flex-direction: column; gap: 3px; }
.deployment-log-header strong { font-size: 13px; }
.deployment-log-header span:not(.badge) { color: var(--muted); font-size: 10px; }
.deployment-log { height: 246px; max-height: 246px; margin: 0; color: #b8c8d9; line-height: 1.65; word-break: break-word; }
.deployment-poll-error { margin-top: 9px; }

.modal { width: 100%; max-width: none; height: 100%; max-height: none; margin: 0; padding: 22px; border: 0; background: #05080db5; color: var(--text); backdrop-filter: blur(10px); }
.modal[open] { display: grid; place-items: center; }
.modal::backdrop { background: transparent; }
.modal-card { position: relative; width: min(590px, 100%); max-height: calc(100vh - 44px); overflow: auto; padding: 30px; border: 1px solid #2b3b51; border-radius: 22px; background: #111925; box-shadow: 0 40px 100px #000b; }
.modal-close { position: absolute; top: 18px; right: 18px; font-size: 22px; }
.modal h2 { padding-right: 45px; }
.modal-intro { margin-bottom: 24px; color: var(--muted); font-size: 13px; }
.stack { display: grid; gap: 17px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.telemetry-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; overflow: hidden; margin: 14px 0 20px; border: 1px solid var(--line); border-radius: 13px; background: var(--line); }
.telemetry-grid > div { min-width: 0; padding: 13px; background: #0d141e; }
.telemetry-grid span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 11px; }
.telemetry-grid strong { display: block; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.node-metric-grid { margin-top: 14px; }
.node-metric-grid .metric-card { min-height: 132px; padding: 18px; }
.node-metric-grid .metric-value { margin-top: 17px; font-size: 24px; }
label { display: grid; gap: 7px; color: #aeb9c8; font-size: 12px; font-weight: 700; }
input, select { width: 100%; min-height: 43px; padding: 10px 12px; border: 1px solid #2a394e; outline: 0; border-radius: 11px; background: #0c121b; color: var(--text); }
input:focus, select:focus { border-color: #4f9b87; box-shadow: 0 0 0 3px #6de5be12; }
input[type="checkbox"] { width: 17px; min-height: 17px; accent-color: var(--accent); }
.check-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; max-height: 190px; overflow: auto; }
.check-item { display: flex; align-items: center; gap: 9px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: #0d141e; }
.switch-label { display: flex; align-items: center; gap: 9px; }
.form-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 7px; }
.form-error { min-height: 18px; margin: 0; color: var(--danger); font-size: 12px; }
.secret-box { margin: 20px 0; padding: 16px; border: 1px solid #3c665c; border-radius: 13px; background: #10251f; }
.secret-box strong { display: block; margin-bottom: 7px; color: var(--accent); }
.code-line { display: flex; align-items: center; gap: 8px; margin-top: 9px; }
code, pre { color: #b8f4df; font-family: "SFMono-Regular", Consolas, monospace; font-size: 12px; }
.code-line code { flex: 1; overflow: hidden; padding: 11px; border: 1px solid #29463f; border-radius: 9px; background: #09130f; text-overflow: ellipsis; white-space: nowrap; }
pre { max-height: 220px; overflow: auto; margin: 10px 0 0; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: #090e15; white-space: pre-wrap; word-break: break-all; }
.link-list { display: grid; gap: 9px; margin-top: 15px; }
.link-item { display: flex; align-items: center; gap: 8px; }
.link-item code { flex: 1; overflow: hidden; padding: 10px; border-radius: 8px; background: #0b1119; text-overflow: ellipsis; white-space: nowrap; }
.toast { position: fixed; z-index: 100; right: 24px; bottom: 24px; transform: translateY(20px); padding: 12px 16px; border: 1px solid #345448; border-radius: 11px; background: #14251f; color: #cbfbea; opacity: 0; pointer-events: none; transition: .2s ease; box-shadow: 0 15px 45px #0008; }
.toast.show { transform: translateY(0); opacity: 1; }
.danger-text { color: var(--danger); }

@media (max-width: 1120px) {
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .deploy-grid { grid-template-columns: 1fr; }
  .deploy-form-panel { position: static; }
  .node-row { grid-template-columns: minmax(160px, 1.3fr) repeat(2, minmax(90px, .7fr)) auto; }
  .node-row .optional-cell { display: none; }
  .account-row { grid-template-columns: minmax(160px, 1.2fr) minmax(120px, .8fr) minmax(130px, 1fr) auto; }
  .account-row .optional-cell { display: none; }
}
@media (max-width: 760px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
  .sidebar.open { transform: translateX(0); box-shadow: 30px 0 80px #000b; }
  .mobile-header { position: sticky; z-index: 10; top: 0; display: flex; align-items: center; justify-content: space-between; height: 62px; padding: 10px 18px; border-bottom: 1px solid var(--line); background: #0b1018e8; backdrop-filter: blur(15px); }
  .mobile-header .brand { padding: 0; }
  .workspace { margin-left: 0; padding: 28px 17px; }
  .page-header { align-items: flex-start; }
  .page-header .button { font-size: 0; }
  .page-header .button::first-letter { font-size: 18px; }
  .metric-grid { gap: 10px; }
  .metric-card { min-height: 130px; padding: 16px; }
  .metric-value { margin-top: 17px; font-size: 23px; }
  .node-row, .account-row { grid-template-columns: 1fr auto; }
  .node-row .cell, .account-row .cell { display: none; }
  .traffic-filter { align-items: stretch; flex-direction: column; }
  .traffic-row { grid-template-columns: 1fr 90px 90px; }
  .traffic-row > :nth-child(2), .traffic-row > :nth-child(3) { display: none; }
  .deployment-status-panel { min-height: 430px; }
  .deployment-empty { min-height: 380px; padding: 24px 8px; }
  .deployment-heading { align-items: flex-start; }
  .deployment-stage { padding-right: 75px; }
  .deployment-log { height: 210px; max-height: 210px; }
  .modal-card { padding: 24px 19px; }
  .form-grid, .check-grid, .telemetry-grid { grid-template-columns: 1fr; }
  .login-card { padding: 32px 25px; }
}
