:root {
  --bg-1: #0f1318;
  --bg-2: #1a2026;
  --accent: #f3d34a;
  --accent-2: #ffb21f;
  --ink: #e8edf2;
  --muted: #9aa7b5;
  --panel: rgba(17, 21, 26, 0.74);
  --border: rgba(255, 255, 255, 0.1);
  --radius-lg: 18px;
}

* { box-sizing: border-box; }

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

html {
  scroll-behavior: smooth;
}

body.app-body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 800px at 75% 20%, rgba(255, 178, 31, 0.12), transparent 55%),
    radial-gradient(900px 700px at 10% 80%, rgba(80, 110, 140, 0.2), transparent 60%),
    linear-gradient(135deg, var(--bg-1), var(--bg-2));
}

.beam {
  position: fixed;
  inset: -80px;
  background: linear-gradient(110deg, transparent 40%, rgba(243, 211, 74, 0.16) 52%, transparent 64%);
  pointer-events: none;
  opacity: 0.68;
  z-index: 0;
}

.app-shell {
  position: relative;
  display: grid;
  grid-template-columns: 286px 1fr;
  min-height: 100vh;
  gap: 18px;
  padding: 18px;
}

.glass-panel,
.glass-card {
  background: var(--panel);
  border: 1px solid var(--border);
  backdrop-filter: blur(8px);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
}

.sidebar {
  padding: 16px;
  position: sticky;
  top: 18px;
  height: calc(100vh - 36px);
  transition: width 180ms ease, padding 180ms ease;
}

.brand-text {
  white-space: nowrap;
}

.brand-shell {
  display: flex;
  align-items: center;
  gap: 0;
  width: 100%;
  padding: 4px 6px 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
  padding: 7px 10px 7px 8px;
  border-radius: 999px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.app-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-weight: 650;
  border-radius: 999px;
  padding: 10px 12px;
  border: 1px solid transparent;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
}

.app-nav-icon {
  font-size: 1rem;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

.app-nav-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-nav-link:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
}

.app-nav-link.active {
  color: #171717;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  box-shadow: 0 10px 24px rgba(243, 211, 74, 0.22);
}

.app-nav-group + .app-nav-group {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.app-nav-group-title {
  color: rgba(154, 167, 181, 0.82);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0 12px 6px;
}

.app-main {
  min-width: 0;
}

.topbar {
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.page-title {
  margin: 0;
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  font-weight: 700;
}

.page-subtitle {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.metric {
  font-size: 2rem;
  line-height: 1.1;
  font-weight: 800;
}

.sidebar-toggle {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  margin-left: 8px;
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.02);
}

.brand-shell .sidebar-toggle:hover,
.brand-shell .sidebar-toggle:focus {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.24);
  color: var(--ink);
}

.scroll-section {
  scroll-margin-top: 84px;
}

.form-control,
.form-select {
  background: rgba(8, 12, 17, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--ink);
  -webkit-text-fill-color: var(--ink);
}

.form-control:focus,
.form-select:focus {
  background: rgba(8, 12, 17, 0.95);
  color: #fff;
  border-color: rgba(243, 211, 74, 0.55);
  box-shadow: 0 0 0 .18rem rgba(243, 211, 74, .2);
}

.form-control::placeholder {
  color: rgba(232, 237, 242, 0.45);
  opacity: 1;
}

.form-select,
.form-select option {
  color: var(--ink);
}

.form-select option {
  background: #0b1118;
}

input.form-control:-webkit-autofill,
input.form-control:-webkit-autofill:hover,
input.form-control:-webkit-autofill:focus,
textarea.form-control:-webkit-autofill,
select.form-select:-webkit-autofill {
  -webkit-text-fill-color: var(--ink) !important;
  -webkit-box-shadow: 0 0 0 1000px rgba(8, 12, 17, 0.95) inset !important;
  box-shadow: 0 0 0 1000px rgba(8, 12, 17, 0.95) inset !important;
  transition: background-color 9999s ease-in-out 0s;
}

.alert {
  border-radius: 12px;
  border-width: 1px;
}

.alert-danger {
  color: #ffd1d1;
  background: rgba(255, 107, 107, 0.15);
  border-color: rgba(255, 107, 107, 0.3);
}

.alert-success {
  color: #c8f7db;
  background: rgba(25, 135, 84, 0.18);
  border-color: rgba(25, 135, 84, 0.32);
}

.table-dark {
  --bs-table-color: var(--ink);
  --bs-table-bg: transparent;
  --bs-table-striped-bg: rgba(255,255,255,0.01);
  --bs-table-hover-bg: rgba(255, 255, 255, 0.045);
  --bs-table-border-color: rgba(255,255,255,0.06);
  border-collapse: separate;
  border-spacing: 0 8px;
  margin: 0 !important;
}

.table-dark thead th {
  color: #f7f9fc;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.04));
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.76rem;
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: 0.02em;
  padding-top: 0.62rem;
  padding-bottom: 0.62rem;
}

.table-dark tbody tr {
  background: rgba(18, 22, 28, 0.7);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35);
}

.table-dark tbody td {
  color: #e7edf4;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.84rem;
  vertical-align: middle;
  padding-top: 0.74rem;
  padding-bottom: 0.74rem;
}

.table-dark tbody tr td:first-child,
.table-dark thead tr th:first-child {
  border-top-left-radius: 12px;
  border-bottom-left-radius: 12px;
}

.table-dark tbody tr td:last-child,
.table-dark thead tr th:last-child {
  border-top-right-radius: 12px;
  border-bottom-right-radius: 12px;
}

.dashboard-table thead th {
  font-size: 0.72rem;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

.dashboard-table tbody td {
  font-size: 0.8rem;
  padding-top: 0.52rem;
  padding-bottom: 0.52rem;
}

.dashboard-table code {
  font-size: 0.78rem;
}

.dashboard-table-left thead th {
  font-size: 0.69rem;
}

.dashboard-table-left tbody td {
  font-size: 0.76rem;
  padding-top: 0.45rem;
  padding-bottom: 0.45rem;
}

.dashboard-column {
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 100%;
}

.dashboard-table-card {
  flex: 1 1 auto;
  min-height: 520px;
}

.dashboard-table-card .table-responsive {
  max-height: 520px;
  overflow: auto;
}

.dashboard-column .small.text-secondary.text-end {
  margin-top: 8px;
}

.btn-accent {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #171717;
  border: 0;
  font-weight: 700;
}

.btn-accent:hover,
.btn-accent:focus {
  background: linear-gradient(135deg, #f7da57, #ffbd35);
  color: #121212;
}

.btn-outline-light {
  background: rgba(255, 255, 255, 0.03);
  color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.btn-outline-light:hover,
.btn-outline-light:focus {
  background: rgba(255, 255, 255, 0.1);
  color: var(--ink);
  border-color: rgba(255, 255, 255, 0.24);
}

.pagination .page-link {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.12);
  color: var(--ink);
}

.pagination .page-link:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.22);
}

.pagination .page-item.active .page-link {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #171717;
  border-color: transparent;
}

.pagination .page-item.disabled .page-link {
  background: rgba(255, 255, 255, 0.02);
  color: rgba(232, 237, 242, 0.45);
}

.tnm-pagination .page-link {
  min-width: 34px;
  text-align: center;
}

.tnm-pagination-wrap {
  row-gap: 10px;
}

.monitor-metric {
  padding: 10px 12px !important;
}

.monitor-metric .metric {
  font-size: 1.85rem;
}

.monitor-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.monitor-strip-title {
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-right: 6px;
}

.monitor-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.03);
  padding: 5px 10px;
  font-size: 0.78rem;
  line-height: 1;
}

.monitor-chip .chip-key {
  color: var(--muted);
  text-transform: lowercase;
}

.monitor-chip .chip-val {
  color: var(--ink);
  font-weight: 800;
}

.monitor-filter-card .form-label {
  margin-bottom: 4px !important;
  font-size: 0.78rem;
  color: var(--muted);
}

.monitor-filter-card .form-control,
.monitor-filter-card .form-select {
  padding-top: 0.4rem;
  padding-bottom: 0.4rem;
}

.monitor-filter-card .btn {
  white-space: nowrap;
}

.badge {
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
}

.bg-secondary {
  background: rgba(255,255,255,0.08) !important;
  border-color: rgba(255,255,255,0.1) !important;
}

.tnm-status {
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
}

.tnm-status-neutral {
  color: #d8e1ea;
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.22);
}

.tnm-status-queued {
  color: #f4e8b2;
  background: rgba(255, 193, 7, 0.22);
  border-color: rgba(255, 193, 7, 0.45);
}

.tnm-status-sending {
  color: #b8e7ff;
  background: rgba(13, 202, 240, 0.22);
  border-color: rgba(13, 202, 240, 0.45);
}

.tnm-status-retry {
  color: #ffe3b8;
  background: rgba(255, 111, 0, 0.22);
  border-color: rgba(255, 111, 0, 0.46);
}

.tnm-status-sent {
  color: #bff0d2;
  background: rgba(25, 135, 84, 0.24);
  border-color: rgba(25, 135, 84, 0.5);
}

.tnm-status-failed {
  color: #ffd1d1;
  background: rgba(220, 53, 69, 0.24);
  border-color: rgba(220, 53, 69, 0.5);
}

.text-muted,
.text-secondary {
  color: var(--muted) !important;
}

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
  z-index: 2;
}

.login-card {
  width: 100%;
  max-width: 480px;
  padding: 26px;
}

.section-title {
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.55rem !important;
}

section.mb-4:last-of-type {
  margin-bottom: 1rem !important;
}

code {
  color: #f2de89;
}

.tnm-modal {
  background: rgba(15, 20, 28, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--ink);
}

#detailsModal {
  z-index: 1080;
}

.modal {
  z-index: 1080;
}

.modal-backdrop.show {
  z-index: 1070;
  opacity: 0.28;
}

.tnm-modal .modal-header {
  border-bottom-color: rgba(255, 255, 255, 0.12);
}

.tnm-modal .modal-title {
  font-weight: 700;
}

.tnm-detail-key {
  width: 190px;
  color: var(--muted);
  font-weight: 700;
  text-transform: capitalize;
}

.tnm-pre {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #e4edf8;
  border-radius: 10px;
  padding: 10px 12px;
  white-space: pre-wrap;
  word-break: break-word;
}

.glass-card.p-0.overflow-hidden {
  padding: 10px 12px 12px !important;
}

.glass-card.p-0.overflow-hidden > .table-responsive {
  margin: 0;
}

html.sidebar-compact .app-shell {
  grid-template-columns: 86px 1fr;
}

html.sidebar-compact .sidebar {
  padding-left: 10px;
  padding-right: 10px;
}

html.sidebar-compact .brand {
  display: none;
}

html.sidebar-compact .brand-text,
html.sidebar-compact .app-nav-label,
html.sidebar-compact .app-nav-group-title {
  display: none;
}

html.sidebar-compact .brand-shell {
  justify-content: center;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

html.sidebar-compact .brand-shell .sidebar-toggle {
  margin-left: 0;
  width: 42px;
  height: 42px;
}

html.sidebar-compact .app-nav-link {
  justify-content: center;
  gap: 0;
  padding-left: 8px;
  padding-right: 8px;
}

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

  .sidebar {
    position: relative;
    height: auto;
  }

  .glass-card.p-0.overflow-hidden {
    padding: 8px 8px 10px !important;
  }
}
