:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #15191f;
  color: #c9d0d8;
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; }
button, input, select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }

.app-shell { display: grid; grid-template-columns: 308px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 9px 15px 18px 9px;
  background: linear-gradient(160deg, #0b2028, #111820 65%, #12181f);
  border-right: 1px solid #252e37;
}
.sidebar::before { display: none; }
.brand { display: flex; align-items: center; gap: 12px; height: 68px; padding: 0 24px; margin-bottom: 2px; }
.brand strong { display: block; color: #47c7dd; font-size: 20px; font-weight: 800; letter-spacing: -.7px; line-height: 1.1; }
.brand small { display: block; color: #8997a4; font-size: 10px; font-weight: 700; letter-spacing: .15em; text-transform: uppercase; margin-top: 5px; }
.brand-mark { display: flex; gap: 3px; align-items: center; justify-content: center; width: 30px; height: 38px; flex: none; }
.brand-mark i { display: block; width: 4px; border-radius: 9px; background: #31c7de; box-shadow: 0 0 10px #13a6c641; }
.brand-mark i:nth-child(1), .brand-mark i:nth-child(5) { height: 13px; }
.brand-mark i:nth-child(2), .brand-mark i:nth-child(4) { height: 26px; }
.brand-mark i:nth-child(3) { height: 36px; }
.brand-mark.large { width: 42px; height: 48px; margin-bottom: 22px; }
.brand-mark.large i:nth-child(1), .brand-mark.large i:nth-child(5) { height: 17px; }
.brand-mark.large i:nth-child(2), .brand-mark.large i:nth-child(4) { height: 33px; }
.brand-mark.large i:nth-child(3) { height: 45px; }
.sidebar nav { padding: 0 15px; }
.nav-group { padding: 18px 2px 20px; border-top: 1px dashed #265260; }
.nav-group > span { display: block; color: #8897a4; font-size: 12px; letter-spacing: .09em; font-weight: 800; padding: 0 14px 13px; }
.nav-group > span::before { content: ""; display: inline-block; width: 3px; height: 11px; border-radius: 2px; background: #37c5dc; margin-right: 12px; vertical-align: -1px; }
.nav-item { display: flex; align-items: center; gap: 11px; min-height: 42px; padding: 8px 13px; color: #aebcc8; font-size: 14px; border-radius: 8px; border-left: 3px solid transparent; }
.nav-item + .nav-item { margin-top: 3px; }
.nav-item:hover { background: #19333c; color: #67d6e8; }
.nav-item.active { background: linear-gradient(90deg, #0e424f, #07343f); border-color: #39c9e0; color: #4cd0e4; box-shadow: inset -2px 0 #31c5de; }
.nav-icon { width: 20px; flex: none; text-align: center; font-size: 20px; line-height: 1; }
.nav-arrow { margin-left: auto; font-size: 23px; font-weight: 300; }
.sidebar-bottom { margin: auto 15px 0; padding: 18px 12px 0; border-top: 1px dashed #265260; color: #8c9aa6; font-size: 12px; line-height: 1.6; }
.sidebar-bottom a { display: block; margin-top: 8px; color: #4ecbde; }
.tiny-dot { display: inline-block; width: 7px; height: 7px; border-radius: 100%; background: #30c5d9; margin-right: 5px; box-shadow: 0 0 8px #30c5d9; }

.main { min-width: 0; }
.topbar { height: 70px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 38px; }
.crumb { color: #a6b1bb; font-size: 13px; font-weight: 600; }
.crumb span { color: #58636c; margin: 0 7px; }
.top-actions { display: flex; align-items: center; gap: 9px; }
.version-badge, .top-icon { display: inline-flex; align-items: center; justify-content: center; min-height: 43px; border: 1px solid #3a434c; border-radius: 15px; background: #1c2026; }
.version-badge { color: #37cde4; border-color: #228ca0; padding: 0 13px; font-size: 12px; font-weight: 700; gap: 7px; }
.wave-mini { font-size: 17px; }
.top-icon { width: 43px; color: #c4cdd5; font-size: 20px; }
.top-icon:hover { border-color: #35c4dc; color: #48cee1; }

#dashboard { padding: 12px 38px 70px; max-width: 1690px; margin: 0 auto; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 25px; margin-bottom: 35px; }
.eyebrow { color: #36bed2; font-size: 11px; font-weight: 800; letter-spacing: .12em; margin: 0 0 10px; }
h1 { color: #d3d9e1; font-size: 28px; line-height: 1.2; letter-spacing: -.7px; margin: 0 0 7px; }
h2 { color: #cdd4dd; font-size: 18px; line-height: 1.3; letter-spacing: -.3px; margin: 0; }
h3 { color: #d4dbe3; font-size: 15px; margin: 0 0 4px; }
.group-title { margin-bottom: 12px; }
.muted { color: #8d99a6; font-size: 13px; line-height: 1.5; margin: 0; }
.primary, .secondary { min-height: 40px; border-radius: 9px; padding: 9px 15px; font-size: 12px; font-weight: 700; transition: background .15s, border-color .15s, transform .15s; }
.primary { color: #092128; background: #3dc6da; border: 1px solid #3dc6da; }
.primary:hover { background: #66d9e9; transform: translateY(-1px); }
.secondary { color: #bfcad3; background: #1d2229; border: 1px solid #3a444e; }
.secondary:hover { color: #d7e0e8; border-color: #4fc3d4; }
.primary:disabled, .secondary:disabled { opacity: .6; cursor: wait; transform: none; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 27px; }
.stat { display: flex; align-items: center; gap: 16px; min-width: 0; min-height: 84px; padding: 14px 16px; background: #1c2026; border: 1px solid #343940; border-radius: 9px; }
.stat-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; flex: none; font-size: 21px; }
.stat-icon.cyan { color: #37b8e5; background: #142e3f; border: 1px solid #1c5f84; }
.stat-icon.green { color: #4acb8a; background: #173728; border: 1px solid #246343; }
.stat-icon.blue { color: #36bcd4; background: #12343b; border: 1px solid #1b6672; }
.stat span:not(.stat-icon), .stat small { display: block; color: #8e9aa6; font-size: 12px; line-height: 1.25; }
.stat strong { display: block; color: #cbd3dc; font-size: 19px; letter-spacing: -.25px; line-height: 1.15; margin: 3px 0; font-weight: 800; }
.stat strong.state-label { font-size: 16px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 12px; }
.section-heading .muted { margin-top: 3px; }
.panel-heading { margin-top: 27px; }
.panel-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(275px, 1fr)); gap: 10px; margin-bottom: 27px; }
.panel-card { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 13px 15px; background: #1c2026; border: 1px solid #343940; border-radius: 9px; }
.panel-card > div { min-width: 0; flex: 1; }
.panel-card strong, .panel-card small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.panel-card strong { color: #dce3e9; font-size: 13px; }
.panel-card small { color: #8b98a4; font-size: 11px; margin-top: 3px; }
.panel-empty { grid-column: 1 / -1; padding: 22px; color: #8d9aa6; background: #1c2026; border: 1px dashed #3a444d; border-radius: 9px; font-size: 13px; }
#panel-dialog .dialog-content { display: grid; gap: 16px; }
.tool-card { display: flex; align-items: center; gap: 14px; padding: 17px; margin-bottom: 30px; color: #aebac4; background: #1c2026; border: 1px solid #343940; border-radius: 9px; font-size: 13px; line-height: 1.5; }
.tool-card a, #installer-dialog .note a { color: #48c5da; text-decoration: underline; text-underline-offset: 3px; }
.terminal-output { min-height: 280px; max-height: 420px; overflow: auto; padding: 16px; color: #d2e8dc; background: #0b1117; border: 1px solid #35444a; border-radius: 8px; font: 12px/1.5 Consolas, Monaco, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.terminal-input { display: flex; align-items: end; gap: 10px; margin-bottom: 12px; }
.terminal-input label { flex: 1; }
#installer-connect > .primary { margin-top: 14px; }
.node-list { display: grid; gap: 9px; }
.node-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 18px; padding: 17px 17px; background: #1c2026; border: 1px solid #343940; border-radius: 9px; }
.node-main { display: flex; align-items: center; gap: 14px; min-width: 0; }
.server-icon { display: grid; place-items: center; width: 43px; height: 43px; flex: none; border: 1px solid #216478; border-radius: 13px; background: #10303a; color: #46c8df; font-size: 22px; }
.node-name { color: #d4dbe4; font-weight: 750; font-size: 14px; }
.node-meta { color: #8c99a6; font-size: 11px; line-height: 1.5; margin-top: 4px; overflow-wrap: anywhere; }
.node-meta span { color: #586775; margin: 0 4px; }
.node-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
.pill { color: #36c5d9; background: #103641; border: 1px solid #1d6675; border-radius: 6px; padding: 5px 8px; font-size: 11px; font-weight: 750; }
.pill.warning { color: #ecae58; background: #3b2a19; border-color: #79502a; }
.action-button { color: #bdc6ce; background: #22272e; border: 1px solid #3b444d; border-radius: 7px; padding: 7px 9px; font-size: 11px; font-weight: 650; }
.action-button:hover { border-color: #3cbfd3; color: #55cbda; }
.action-button.danger { color: #ef8790; }
.action-button.danger:hover { border-color: #b64c59; }
.node-output { grid-column: 1 / -1; max-height: 260px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; padding: 13px; color: #a2c9d0; background: #141a20; border: 1px solid #303a43; border-radius: 7px; font: 11px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace; }
.empty { min-height: 260px; display: grid; justify-items: center; align-content: center; padding: 35px; text-align: center; color: #8d9aa6; background: #1c2026; border: 1px dashed #3a444d; border-radius: 9px; }
.empty-icon { font-size: 34px; color: #35bdd1; }
.empty h3 { margin: 11px 0 5px; }
.empty p { font-size: 12px; margin: 0 0 19px; }

.login-wrap { min-height: calc(100vh - 70px); display: grid; place-items: center; padding: 26px; }
.login-card { width: min(100%, 420px); padding: 30px; border-radius: 12px; background: #1c2026; border: 1px solid #353d46; box-shadow: 0 22px 65px #0004; }
.login-card h1 { font-size: 26px; }
.login-card .muted { margin-bottom: 25px; }
.login-card form { display: grid; gap: 20px; }
.full { width: 100%; display: flex; align-items: center; justify-content: space-between; }
label { display: grid; gap: 7px; color: #bfc8d0; font-size: 12px; font-weight: 650; }
label small { color: #8997a4; font-size: 11px; font-weight: 400; }
input, select { min-height: 42px; width: 100%; padding: 9px 11px; color: #d5dde6; background: #171c22; border: 1px solid #414b54; border-radius: 7px; outline: none; }
input::placeholder { color: #6e7b86; }
input:focus, select:focus { border-color: #3cc5d8; box-shadow: 0 0 0 2px #2ebed424; }
.form-error { color: #ec858c; font-size: 12px; line-height: 1.5; white-space: pre-wrap; margin: 12px 0 0; }
.form-error:empty { display: none; }

dialog { width: min(100% - 25px, 490px); max-height: min(92vh, 900px); padding: 0; color: #cdd5dd; background: #1b2026; border: 1px solid #424b55; border-radius: 12px; box-shadow: 0 30px 100px #0009; }
dialog::backdrop { background: #05090dbb; backdrop-filter: blur(3px); }
.wide-dialog { width: min(100% - 25px, 760px); }
.dialog-head, .dialog-foot { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 19px 23px; }
.dialog-head { border-bottom: 1px solid #343c45; }
.dialog-head .eyebrow { margin-bottom: 5px; }
.dialog-head h2 { font-size: 19px; }
.dialog-foot { justify-content: flex-end; border-top: 1px solid #343c45; }
.dialog-content { max-height: calc(92vh - 140px); overflow: auto; padding: 22px 23px; }
.icon-button { padding: 0 4px; color: #a8b4bf; background: none; border: 0; font-size: 26px; line-height: 1; }
.icon-button:hover { color: #4dccdf; }
.form-section { display: flex; align-items: start; gap: 11px; margin: 1px 0 16px; }
.form-section:not(:first-child) { margin-top: 28px; }
.form-section p { color: #8e9aa6; font-size: 12px; margin: 0; }
.section-number { padding: 5px 8px; color: #43c5d9; background: #14333c; border: 1px solid #266775; border-radius: 5px; font-size: 11px; font-weight: 800; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 17px; }
.inbounds-field { display: grid; gap: 7px; color: #bfc8d0; font-size: 12px; font-weight: 650; }
.inbounds-list { display: grid; gap: 6px; max-height: 150px; overflow: auto; padding: 8px; color: #8e9aa6; background: #171c22; border: 1px solid #414b54; border-radius: 7px; font-weight: 400; }
.inbound-option { display: flex; align-items: center; gap: 8px; padding: 6px; border-radius: 5px; background: #222a31; cursor: pointer; }
.inbound-option input { width: auto; min-height: 0; margin: 0; }
.inbound-option span { color: #d0d9e0; font-size: 11px; }
.inbound-option small { display: block; color: #8997a4; font-size: 10px; margin-top: 2px; }
.fingerprint { display: grid; grid-template-columns: 1fr auto; gap: 12px; margin-top: 25px; padding: 15px; border: 1px solid #3b464f; border-radius: 8px; background: #171c22; }
.fingerprint strong { font-size: 13px; }
.fingerprint p { margin: 4px 0 0; color: #8997a4; font-size: 12px; line-height: 1.5; }
.fingerprint-list { grid-column: 1 / -1; display: grid; gap: 7px; }
.key-option { display: flex; align-items: start; gap: 9px; padding: 8px; border: 1px solid #3a444d; border-radius: 6px; cursor: pointer; }
.key-option input { width: auto; min-height: 0; margin: 3px 0; }
.key-option span { font-size: 11px; line-height: 1.5; overflow-wrap: anywhere; }
.check-row { display: flex; align-items: center; gap: 9px; margin-top: 18px; }
.check-row input { width: auto; min-height: 0; }
.fingerprint .check-row { grid-column: 1 / -1; margin-top: 0; }
.note { margin: 17px 0 0; padding: 9px 12px; color: #9fc1c8; background: #123039; border-left: 2px solid #32bfd3; font-size: 11px; line-height: 1.5; }
#action-dialog .dialog-content > .muted { margin-bottom: 20px; }
.toast { position: fixed; right: 23px; bottom: 23px; z-index: 10; max-width: 430px; padding: 12px 15px; color: #c9edf2; background: #15343a; border: 1px solid #287e8b; border-radius: 8px; box-shadow: 0 15px 45px #0007; font-size: 12px; opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: none; }
.toast.error { color: #ffd1d2; background: #45282b; border-color: #9f5158; }

@media (max-width: 1080px) {
  .app-shell { grid-template-columns: 245px minmax(0, 1fr); }
  .sidebar { padding-right: 8px; }
  .sidebar::before { right: 8px; }
  .brand { padding-left: 14px; }
  .brand strong { font-size: 18px; }
  .topbar { padding: 0 24px; }
  #dashboard { padding: 12px 24px 60px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stats .stat:last-child { grid-column: 1 / -1; }
  .node-card { grid-template-columns: 1fr; }
  .node-actions { justify-content: flex-start; }
}
@media (max-width: 700px) {
  .app-shell { display: block; }
  .sidebar { position: static; height: auto; padding: 8px 14px; border-right: 0; border-bottom: 1px solid #2c353d; }
  .sidebar::before { display: none; }
  .brand { height: 48px; margin: 0; padding: 0; }
  .brand strong { font-size: 17px; }
  .brand small { display: none; }
  .sidebar nav, .sidebar-bottom { display: none; }
  .topbar { height: 58px; padding: 0 18px; }
  .version-badge { display: none; }
  .top-icon { min-height: 35px; width: 35px; border-radius: 9px; }
  #dashboard { padding: 20px 18px 50px; }
  .page-heading { align-items: start; flex-direction: column; gap: 15px; margin-bottom: 27px; }
  .page-heading h1 { font-size: 24px; }
  .stats { grid-template-columns: 1fr; }
  .stats .stat:last-child { grid-column: auto; }
  .section-heading { align-items: start; flex-direction: column; }
  .form-grid { grid-template-columns: 1fr; }
  .fingerprint { grid-template-columns: 1fr; }
  .dialog-head, .dialog-foot { padding: 16px; }
  .dialog-content { padding: 17px; }
}
