:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #0b1220;
  --muted: #607089;
  --line: #dbe4f0;
  --accent: #b91c1c;
  --accent2: #1d4ed8;
  --danger: #dc2626;
  --ok: #16a34a;
  --warn: #f59e0b;
  --shadow: 0 12px 30px rgba(2, 6, 23, .08);
  --shadow2: 0 10px 22px rgba(2, 6, 23, .06);
  --radius: 16px;
}

* {
  box-sizing: border-box
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Arial, sans-serif;
  background: var(--bg);
  color: var(--text)
}

/* Auth (login) layout */
.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(420px, 44%) 1fr;
  background: #fff
}

@media(max-width:980px) {
  .auth {
    grid-template-columns: 1fr
  }

  .auth-right {
    display: none
  }
}

.auth-left {
  padding: 44px 56px;
  display: flex;
  flex-direction: column
}

.auth-main {
  max-width: 820px
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 26px
}

.auth-brand-logo {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  background: #eef2f6;
  display: flex;
  align-items: center;
  justify-content: center
}

.auth-brand-logo img {
  width: 34px;
  height: 34px;
  object-fit: contain
}

.auth-brand-name {
  font-weight: 800;
  letter-spacing: .2px
}

.auth-brand-sub {
  font-size: 12px;
  letter-spacing: .22em;
  color: var(--muted)
}

.auth-hello {
  margin-top: 6px;
  color: var(--accent);
  font-weight: 800;
  letter-spacing: .18em;
  font-size: 12px
}

.auth-title {
  margin: 10px 0 18px;
  font-size: 44px;
  line-height: 1.05;
  letter-spacing: -.02em
}

.auth-title span {
  color: rgba(96, 112, 137, .9);
  font-weight: 700
}

.auth-form {
  margin-top: 10px
}

.auth-field label {
  font-size: 12px;
  letter-spacing: .12em;
  font-weight: 800;
  color: var(--text)
}

.auth-input {
  position: relative;
  margin-top: 8px
}

.auth-input input {
  padding: 14px 46px 14px 16px;
  border-radius: 16px;
  border-color: #d7e2f0;
  background: #f7fafc
}

.auth-input input:focus {
  background: #fff
}

.auth-ico {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--danger);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 14px;
  letter-spacing: 2px
}

.auth-links {
  display: flex;
  justify-content: flex-end;
  margin: 14px 0 18px
}

.auth-submit {
  width: 100%;
  border-radius: 14px;
  padding: 14px 16px;
  letter-spacing: .16em;
  font-weight: 900
}

.auth-foot {
  margin-top: auto;
  color: var(--muted);
  font-size: 12px;
  padding-top: 28px
}

.auth-right {
  background: linear-gradient(180deg, #f7fafc 0%, #f3f6fb 100%);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center
}

.auth-right::after {
  content: "NETCOL";
  font-weight: 900;
  letter-spacing: .08em;
  font-size: 96px;
  color: rgba(185, 28, 28, .12);
  transform: translateY(30px)
}

.app {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh
}

@media(max-width:980px) {
  .app {
    grid-template-columns: 1fr
  }

  .sidebar {
    display: none
  }
}

.sidebar {
  background: #2f2f31;
  color: #e5e7eb;
  border-right: 1px solid rgba(255, 255, 255, .06);
  padding: 16px;
  position: sticky;
  top: 0;
  height: 100vh
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  margin-bottom: 14px
}

.sidebar-brand .logo {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .08)
}

.sidebar-brand .logo img {
  display: block;
  width: 36px;
  height: 36px;
  object-fit: contain
}

.sidebar-brand .name {
  font-weight: 800;
  letter-spacing: .3px;
  line-height: 1
}

.sidebar-brand .sub {
  color: rgba(226, 232, 240, .7);
  font-size: 12px;
  margin-top: 4px
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  color: rgba(226, 232, 240, .9);
  text-decoration: none;
  border: 1px solid transparent
}

.nav-item:hover {
  background: rgba(255, 255, 255, .07);
  border-color: rgba(255, 255, 255, .08)
}

.sidebar-foot {
  position: absolute;
  bottom: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap
}

.pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, .12);
  color: rgba(226, 232, 240, .8);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  background: rgba(255, 255, 255, .04)
}

.main {
  display: flex;
  flex-direction: column;
  min-width: 0
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(245, 247, 251, .92);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 5
}

.topbar-left {
  min-width: 0
}

.page-meta .page-title {
  font-weight: 800;
  letter-spacing: .2px
}

.page-meta .page-subtitle {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 8px 12px;
  box-shadow: var(--shadow2);
  min-width: 320px
}

.search-ico {
  color: var(--muted);
  font-size: 14px
}

.search-input {
  border: 0;
  outline: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  width: 100%;
  color: var(--text)
}

@media(max-width:820px) {
  .search {
    min-width: 200px
  }
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #2563eb 0%, #0ea5e9 100%);
  color: #fff;
  font-weight: 800;
  box-shadow: var(--shadow2)
}

.content {
  padding: 18px;
  max-width: 1400px
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 16px;
  align-items: start
}

@media(max-width:1180px) {
  .content-grid {
    grid-template-columns: 1fr
  }
}

.content-main {
  min-width: 0
}

.content-side {
  min-width: 0
}

.side-stack {
  position: sticky;
  top: 86px;
  display: flex;
  flex-direction: column;
  gap: 16px
}

@media(max-width:1180px) {
  .side-stack {
    position: static
  }
}

.side-card {
  box-shadow: var(--shadow2)
}

.side-list {
  display: flex;
  flex-direction: column;
  gap: 10px
}

.side-item {
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px
}

.side-item-title {
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .1px
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin: 16px 0;
  box-shadow: var(--shadow)
}

.card.slim {
  padding: 14px
}

.card.inner {
  background: #f8fafc;
  box-shadow: none
}

.client-data {
  padding: 12px;
  border: 1px solid #dbeafe;
  background: linear-gradient(180deg, #eff6ff 0%, #ffffff 100%);
  border-radius: 14px
}

.conn-row {
  border-radius: 14px;
  padding: 10px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  background: #fff
}

.conn-row.conn-online {
  border-color: rgba(22, 163, 74, .22);
  background: rgba(22, 163, 74, .06)
}

.conn-row.conn-offline {
  border-color: rgba(239, 68, 68, .22);
  background: rgba(239, 68, 68, .06)
}

.conn-row.conn-1 {
  border-left: 6px solid var(--accent)
}

.conn-row.conn-2 {
  border-left: 6px solid var(--accent2)
}

.card h2,
.card h3,
.card h4 {
  letter-spacing: .2px
}

.card h2 {
  font-size: 18px
}

.card h3 {
  font-size: 16px
}

.card h4 {
  font-size: 14px
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px
}

@media(max-width:820px) {
  .row {
    grid-template-columns: 1fr
  }
}

label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin: 10px 0 6px
}

.help {
  color: var(--muted);
  font-size: 12px;
  margin-top: 6px
}

input,
textarea {
  width: 100%;
  padding: 11px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  outline: none
}

textarea {
  min-height: 120px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace
}

input:focus,
textarea:focus {
  border-color: rgba(185, 28, 28, .55);
  box-shadow: 0 0 0 4px rgba(185, 28, 28, .10)
}

input[readonly],
textarea[readonly] {
  opacity: .95
}

.field-row {
  display: flex;
  align-items: center;
  gap: 10px
}

.field-row .grow {
  flex: 1
}

.actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px
}

.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: var(--text);
  font-size: 13px
}

.toggle input {
  width: 16px;
  height: 16px
}

.grid3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px
}

.grid2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px
}

@media(max-width:980px) {
  .grid3 {
    grid-template-columns: 1fr
  }
}

@media(max-width:820px) {
  .grid2 {
    grid-template-columns: 1fr
  }
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 10px
}

.section-title .right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--muted);
  font-size: 12px;
  background: #fff
}

.badge.ok {
  border-color: rgba(22, 163, 74, .25);
  color: rgba(22, 163, 74, .95)
}

.badge.warn {
  border-color: rgba(245, 158, 11, .28);
  color: rgba(245, 158, 11, .95)
}

.badge.err {
  border-color: rgba(220, 38, 38, .28);
  color: rgba(220, 38, 38, .95)
}

.muted {
  color: var(--muted)
}

details {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff
}

summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 600
}

summary::-webkit-details-marker {
  display: none
}

.hr {
  height: 1px;
  background: var(--line);
  margin: 12px 0
}

.btn {
  display: inline-block;
  border: 1px solid rgba(220, 38, 38, .35);
  background: linear-gradient(180deg, #dc2626 0%, #991b1b 100%);
  color: #fff;
  padding: 10px 14px;
  border-radius: 12px;
  text-decoration: none;
  cursor: pointer;
  transition: transform .04s ease, filter .12s ease, border-color .12s ease;
  box-shadow: var(--shadow2);
  margin-top: 20px;
}

.btn:hover {
  filter: brightness(1.06)
}

.btn:active {
  transform: translateY(1px)
}

.btn:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 3px rgba(90, 169, 255, .18)
}

.btn.primary {
  background: linear-gradient(180deg, #dc2626 0%, #991b1b 100%);
  border-color: rgba(220, 38, 38, .35);
  color: #fff
}

.btn.primary:hover {
  filter: brightness(1.03)
}

.btn.primary:focus-visible {
  box-shadow: 0 0 0 4px rgba(220, 38, 38, .16)
}

.btn.ghost {
  background: linear-gradient(180deg, #e23b3b 0%, #a31919 100%);
  border-color: rgba(220, 38, 38, .35);
  color: #fff
}

.btn.danger {
  background: linear-gradient(180deg, #ff6b6b 0%, #cc4141 100%);
  border-color: rgba(255, 107, 107, .35);
  color: #fff
}

.msg {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  margin: 12px 0;
  box-shadow: var(--shadow2)
}

.msg.ok {
  border-color: rgba(94, 240, 163, .35)
}

.msg.err {
  border-color: rgba(255, 107, 107, .35)
}

.kv {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px dashed rgba(35, 49, 81, .6)
}

.kv .k {
  color: var(--muted)
}

.footer {
  border-top: 1px solid var(--line);
  padding: 14px 18px;
  color: var(--muted);
  background: rgba(243, 246, 251, .85)
}

pre.json {
  white-space: pre-wrap;
  word-break: break-word;
  background: #0b1220;
  color: #e5e7eb;
  border: 1px solid #111827;
  border-radius: 12px;
  padding: 12px;
  overflow: auto
}

table.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0
}

table.table th,
table.table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 13px
}

table.table th {
  color: var(--muted);
  font-weight: 700;
  background: #fff;
  position: sticky;
  top: 0
}

.table-actions {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap
}

.table-actions .btn {
  padding: 8px 10px;
  border-radius: 10px;
  box-shadow: none
}

.table-actions .btn.danger {
  box-shadow: none
}

.btn[disabled] {
  opacity: .55;
  cursor: not-allowed;
  filter: grayscale(.25)
}

dialog.dlg {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0;
  max-width: 520px;
  width: calc(100% - 32px);
  box-shadow: var(--shadow)
}

dialog.dlg::backdrop {
  background: rgba(2, 6, 23, .55)
}

.dlg-inner {
  padding: 16px;
  margin: 0
}