:root {
  --v2-bg: #f4f7fb;
  --v2-surface: #ffffff;
  --v2-surface-2: #f8fafc;
  --v2-line: #e3e8ef;
  --v2-text: #162033;
  --v2-muted: #667085;
  --v2-primary: #2563eb;
  --v2-primary-dark: #1e40af;
  --v2-success: #16815f;
  --v2-warning: #b7791f;
  --v2-danger: #c24141;
  --v2-sidebar: #101827;
  --v2-sidebar-soft: #1b2537;
  --v2-shadow: 0 18px 40px rgba(21, 32, 51, 0.08);
}

html,
body.panel-v2 {
  min-height: 100%;
}

body.panel-v2 {
  margin: 0;
  background: var(--v2-bg);
  color: var(--v2-text);
  font-family: Arial, Helvetica, sans-serif;
  letter-spacing: 0;
}

.v2-icon {
  width: 18px;
  height: 18px;
  display: block;
  flex: 0 0 auto;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
}

.app-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 24px 18px;
  background: var(--v2-sidebar);
  color: #e6edf7;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  color: #fff;
  text-decoration: none;
}

.brand-lockup:hover {
  color: #fff;
  text-decoration: none;
}

.brand-logo {
  width: 46px;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}

.brand-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-copy strong,
.brand-copy small {
  display: block;
  line-height: 1.1;
}

.brand-copy strong {
  font-size: 17px;
}

.brand-copy small {
  margin-top: 4px;
  color: #98a6ba;
  font-size: 12px;
}

.side-nav {
  display: grid;
  gap: 6px;
}

.side-link {
  min-height: 44px;
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  color: #bac7db;
  text-decoration: none;
}

.side-link:hover,
.side-link.is-active {
  color: #fff;
  background: var(--v2-sidebar-soft);
  text-decoration: none;
}

.nav-symbol {
  width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: #eaf2ff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

.nav-symbol .v2-icon {
  width: 15px;
  height: 15px;
}

.side-link:hover .nav-symbol,
.side-link.is-active .nav-symbol {
  background: rgba(37, 99, 235, 0.34);
  color: #fff;
}

.side-link b {
  min-width: 28px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 12px;
}

.sidebar-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: #b7c4d8;
  font-size: 13px;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #35d07f;
  box-shadow: 0 0 0 4px rgba(53, 208, 127, 0.16);
}

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

.app-topbar {
  min-height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 28px;
  background: rgba(255, 255, 255, 0.88);
  border-bottom: 1px solid var(--v2-line);
  backdrop-filter: blur(12px);
}

.app-topbar h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  color: var(--v2-text);
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--v2-muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

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

.ip-chip {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--v2-line);
  border-radius: 999px;
  background: #fff;
  color: var(--v2-muted);
  font-size: 13px;
}

.ip-chip strong {
  color: var(--v2-text);
  font-size: 11px;
  font-weight: 800;
}

.icon-action {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--v2-line);
  border-radius: 8px;
  background: #fff;
  color: var(--v2-text);
  text-decoration: none;
}

.icon-action[data-symbol]::before {
  content: attr(data-symbol);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.icon-action .v2-icon,
.icon-btn .v2-icon,
.btn.btn-icon .v2-icon {
  width: 16px;
  height: 16px;
}

.icon-action:hover {
  color: var(--v2-primary);
  text-decoration: none;
}

.icon-action.danger:hover {
  color: var(--v2-danger);
}

.content-stage {
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: 28px;
}

.app-footer {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 28px;
  color: var(--v2-muted);
  font-size: 13px;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.page-head h2 {
  margin: 0;
  color: var(--v2-text);
  font-size: 26px;
  font-weight: 800;
}

.page-head p {
  margin: 6px 0 0;
  max-width: 720px;
  color: var(--v2-muted);
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.inline-action-form {
  display: inline-flex;
  margin: 0;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric-card {
  min-height: 112px;
  padding: 18px;
  border: 1px solid var(--v2-line);
  border-radius: 8px;
  background: var(--v2-surface);
  box-shadow: var(--v2-shadow);
}

.metric-card span {
  display: block;
  color: var(--v2-muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.metric-card strong {
  display: block;
  margin-top: 8px;
  color: var(--v2-text);
  font-size: 30px;
  line-height: 1;
}

.metric-card small {
  display: block;
  margin-top: 10px;
  color: var(--v2-muted);
}

.panel-card {
  border: 1px solid var(--v2-line);
  border-radius: 8px;
  background: var(--v2-surface);
  box-shadow: var(--v2-shadow);
}

.container-fluid {
  padding-left: 0;
  padding-right: 0;
}

.card {
  border: 1px solid var(--v2-line);
  border-radius: 8px;
  box-shadow: var(--v2-shadow);
}

.card-header {
  border-bottom: 1px solid var(--v2-line);
  background: var(--v2-surface);
}

.card-header h6,
.text-primary {
  color: var(--v2-primary) !important;
}

.h3,
h1.h3 {
  color: var(--v2-text) !important;
  font-weight: 800;
}

.panel-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--v2-line);
}

.panel-card-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  color: var(--v2-text);
}

.panel-card-body {
  padding: 18px;
}

.toolbar-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.search-control {
  position: relative;
}

.search-symbol {
  position: absolute;
  top: 50%;
  left: 12px;
  transform: translateY(-50%);
  color: var(--v2-muted);
  pointer-events: none;
}

.search-symbol .v2-icon {
  width: 16px;
  height: 16px;
}

.search-control i {
  display: none !important;
}

.search-control input {
  padding-left: 38px;
}

.table-modern {
  margin: 0;
  color: var(--v2-text);
}

.table-modern thead th {
  border-top: 0;
  border-bottom: 1px solid var(--v2-line);
  color: var(--v2-muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.table-modern tbody td {
  vertical-align: middle;
  border-top: 1px solid #edf1f6;
  font-size: 14px;
}

.table-modern tbody tr:hover {
  background: #f8fbff;
}

.mono-value {
  font-family: Consolas, Monaco, monospace;
  font-size: 13px;
}

.truncate-url {
  max-width: 360px;
  display: inline-block;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
  white-space: nowrap;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.status-pill.ok {
  color: #0b684a;
  background: #e6f7ef;
}

.status-pill.warn {
  color: #875900;
  background: #fff3d0;
}

.status-pill.bad {
  color: #9f1f1f;
  background: #ffe4e4;
}

.btn {
  border-radius: 8px;
  font-weight: 700;
}

.button-symbol {
  min-width: 20px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  margin-right: 6px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.18);
  color: inherit;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  vertical-align: middle;
}

.button-symbol .v2-icon {
  width: 14px;
  height: 14px;
}

.btn-light .button-symbol,
.btn-warning .button-symbol,
.btn-danger .button-symbol {
  background: rgba(22, 32, 51, 0.08);
}

.btn-v2-primary,
.btn.btn-v2-primary {
  border-color: var(--v2-primary);
  background: var(--v2-primary);
  color: #fff;
}

.btn-v2-primary:hover,
.btn.btn-v2-primary:hover {
  border-color: var(--v2-primary-dark);
  background: var(--v2-primary-dark);
  color: #fff;
}

.icon-btn {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--v2-line);
  border-radius: 8px;
  background: #fff;
  color: var(--v2-text);
  cursor: pointer;
  vertical-align: middle;
}

.btn.btn-icon {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--v2-line);
  border-radius: 8px;
  background: #fff;
  color: var(--v2-text);
}

.icon-btn[data-symbol]::before,
.btn.btn-icon[data-symbol]::before {
  content: attr(data-symbol);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.icon-btn:hover {
  color: var(--v2-primary);
  text-decoration: none;
}

.btn.btn-icon:hover {
  color: var(--v2-primary);
  text-decoration: none;
}

.btn.btn-icon[data-symbol="D"]:hover,
.btn.btn-icon.danger:hover {
  color: var(--v2-danger);
}

.icon-btn.danger:hover {
  color: var(--v2-danger);
}

.form-modern {
  max-width: 860px;
}

.form-modern label {
  color: var(--v2-text);
  font-weight: 800;
}

.form-control {
  border-color: #d7dee8;
  border-radius: 8px;
}

.form-control:focus {
  border-color: var(--v2-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background: #eef4fb;
}

.auth-card {
  width: 100%;
  max-width: 430px;
  padding: 28px;
  border: 1px solid var(--v2-line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--v2-shadow);
}

.auth-logo {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  margin-bottom: 18px;
  border-radius: 14px;
  background: #edf3ff;
  overflow: hidden;
}

.auth-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.auth-card h1 {
  margin: 0;
  color: var(--v2-text);
  font-size: 26px;
  font-weight: 800;
}

.auth-card p {
  margin: 6px 0 20px;
  color: var(--v2-muted);
}

.alert {
  border-radius: 8px;
}

.modal-content {
  border: 0;
  border-radius: 8px;
  box-shadow: var(--v2-shadow);
}

.scroll-to-top {
  border-radius: 8px;
}

.panel-v2 .btn i,
.panel-v2 .card-header i,
.panel-v2 .alert i,
.panel-v2 .icon-action i,
.panel-v2 .icon-btn i,
.panel-v2 .btn.btn-icon i,
.panel-v2 .scroll-to-top i {
  display: none !important;
}

.panel-v2 .btn-icon-split .icon {
  display: none !important;
}

@media (max-width: 1060px) {
  .app-shell {
    grid-template-columns: 88px minmax(0, 1fr);
  }

  .app-sidebar {
    padding: 18px 12px;
  }

  .brand-copy,
  .side-link > span:not(.nav-symbol),
  .sidebar-footer span,
  .side-link b {
    display: none;
  }

  .side-link {
    grid-template-columns: 1fr;
    justify-items: center;
  }
}

@media (max-width: 780px) {
  .app-shell {
    display: block;
  }

  .app-sidebar {
    position: static;
    height: auto;
    padding: 12px;
  }

  .brand-lockup {
    display: none;
  }

  .side-nav {
    display: flex;
    overflow-x: auto;
  }

  .side-link {
    min-width: 58px;
  }

  .app-topbar,
  .page-head,
  .toolbar-grid,
  .app-footer {
    display: grid;
  }

  .content-stage {
    padding: 18px;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ip-chip {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

@media (max-width: 520px) {
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .topbar-actions,
  .action-row {
    width: 100%;
  }

  .topbar-actions {
    flex-wrap: wrap;
  }
}
