:root {
  --bg: #0b0c0f;
  --bg-elevated: #15171c;
  --border: #262933;
  --accent: #0a84ff;
  --accent-soft: rgba(10,132,255,0.18);
  --text: #f5f5f7;
  --text-muted: #8e8e93;
  --danger: #ff453a;
  --warn: #ffd60a;
  --ok: #30d158;
  --radius-lg: 18px;
  --shadow-soft: 0 18px 40px rgba(0,0,0,0.4);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;

  /* Aliases used by infra module templates */
  --bg-primary: var(--bg);
  --bg-secondary: var(--bg-elevated);
  --card-bg: var(--bg-elevated);
  --text-primary: var(--text);
  --text-secondary: var(--text-muted);
  --border-color: var(--border);

  /* Infra entity accent colors */
  --color-olt: #0a84ff;
  --color-otb: #f7dc6f;
  --color-odc: #f5b041;
  --color-odp: #82e0aa;
  --color-tiang: #3498db;
  --color-homepass: #e74c3c;
}

* {
  box-sizing: border-box;
}

html {
  overflow-x: clip; /* Clip nav drawer without blocking nested scroll */
}

body {
  margin: 0;
  font-family: var(--font);
  background: radial-gradient(circle at top, #1b1c22, #050509);
  color: var(--text);
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: clip; /* Additional clip for older browsers */
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 22px;
  backdrop-filter: blur(24px);
  background: linear-gradient(to bottom, rgba(15,16,20,0.92), rgba(7,8,11,0.92));
  border-bottom: 1px solid rgba(255,255,255,0.04);
  position: sticky;
  top: 0;
  z-index: 10;
}

.logo {
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-size: 14px;
  flex-shrink: 0;
}
.logo span {
  color: var(--accent);
}

/* Hamburger Menu Button */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  z-index: 1001;
}
.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text);
  margin: 5px 0;
  transition: all 0.3s ease;
  border-radius: 2px;
}
.nav-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}
.nav-toggle.active span:nth-child(2) {
  opacity: 0;
}
.nav-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* Navigation */
.nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.nav a {
  color: var(--text-muted);
  text-decoration: none;
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 6px;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.nav a:hover {
  color: var(--text);
  background: rgba(255,255,255,0.08);
}
.nav a.active {
  color: var(--accent);
  background: var(--accent-soft);
}

/* Tablet - Smaller nav items */
@media (max-width: 1024px) {
  .app-header {
    padding: 10px 16px;
  }
  .nav a {
    padding: 5px 8px;
    font-size: 12px;
  }
}

/* Mobile - Hamburger menu */
@media (max-width: 768px) {
  .nav-toggle {
    display: block;
  }
  .nav {
    position: fixed;
    top: 0;
    right: 0;
    width: 280px;
    max-width: 85vw;
    height: 100vh;
    background: linear-gradient(to bottom, rgba(20,22,28,0.98), rgba(10,12,16,0.98));
    backdrop-filter: blur(20px);
    flex-direction: column;
    align-items: stretch;
    padding: 70px 16px 24px;
    gap: 4px;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
    border-left: 1px solid var(--border);
    box-shadow: -10px 0 30px rgba(0,0,0,0.5);
    visibility: hidden;
  }
  .nav.active {
    transform: translateX(0);
    visibility: visible;
  }
  .nav a {
    padding: 12px 16px;
    font-size: 15px;
    border-radius: 8px;
    border: 1px solid transparent;
  }
  .nav a:hover {
    border-color: var(--border);
    background: rgba(255,255,255,0.06);
  }
  .nav-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 999;
  }
  .nav-overlay.active {
    display: block;
  }
  .app-main {
    padding: 16px;
  }
}

/* Small phone */
@media (max-width: 480px) {
  .app-header {
    padding: 10px 12px;
  }
  .logo {
    font-size: 13px;
  }
  .nav {
    width: 100%;
    max-width: 100%;
  }
  .app-main {
    padding: 10px;
  }
  .page-title {
    font-size: 18px;
  }
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .grid {
    grid-template-columns: 1fr;
  }
  .grid-pon {
    grid-template-columns: 1fr;
  }
  .card {
    padding: 12px;
  }
  .metrics-row {
    gap: 8px;
  }
  .metric {
    min-width: auto;
    padding: 6px 10px;
    font-size: 12px;
  }
  .btn-primary, .btn-secondary {
    padding: 8px 12px;
    font-size: 13px;
  }
  .table {
    font-size: 11px;
  }
  .table th, .table td {
    padding: 6px 4px;
  }
  .modal-content {
    min-width: auto !important;
    width: 95vw !important;
    max-width: 95vw !important;
    padding: 16px;
  }
}

.app-main {
  padding: 24px;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

.page-title {
  font-size: 24px;
  font-weight: 600;
  margin: 0 0 16px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.link-back {
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
}
.link-back:hover {
  color: var(--accent);
}

.card {
  background: radial-gradient(circle at top left, #1d2027, #101219);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: var(--shadow-soft);
  padding: 16px 18px;
}

.card-login {
  max-width: 360px;
  margin: 80px auto;
}

.card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
}

.card-title {
  font-weight: 500;
  font-size: 16px;
}

.card-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

.card-body {
  font-size: 14px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
  gap: 16px;
}

.grid-pon {
  grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr));
}

.card-olt, .card-pon {
  text-decoration: none;
  color: inherit;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}
.card-olt:hover, .card-pon:hover {
  transform: translateY(-2px);
  box-shadow: 0 22px 44px rgba(0,0,0,0.6);
  border-color: rgba(10,132,255,0.6);
}

.olt-name {
  font-weight: 600;
  font-size: 16px;
}
.olt-host {
  font-size: 12px;
  color: var(--text-muted);
}

.pon-title {
  font-weight: 500;
}

.metrics-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.metric {
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(15,15,20,0.9);
  border: 1px solid rgba(255,255,255,0.06);
  min-width: 90px;
}
.metric-label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
}
.metric-value {
  font-size: 15px;
  font-weight: 500;
}

.metric-bad {
  border-color: rgba(255,69,58,0.7);
  background: rgba(255,69,58,0.16);
}
.metric-warn {
  border-color: rgba(255,214,10,0.7);
  background: rgba(255,214,10,0.12);
}
.metric-ok {
  border-color: rgba(48,209,88,0.7);
  background: rgba(48,209,88,0.12);
}

.form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}
.form label {
  display: flex;
  flex-direction: column;
  font-size: 13px;
  gap: 4px;
}
.form input {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(7,7,10,0.9);
  color: var(--text);
  font-size: 14px;
}
.form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-soft);
}

.btn-primary,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}
.btn-primary {
  background: linear-gradient(135deg,#0a84ff,#5ac8fa);
  color: #000;
}
.btn-primary:hover {
  filter: brightness(1.05);
}
.btn-secondary {
  background: rgba(255,255,255,0.06);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.12);
}
.btn-secondary:hover {
  border-color: var(--accent);
}

.pon-actions {
  display: flex;
  gap: 8px;
}

.muted {
  color: var(--text-muted);
  font-size: 13px;
}

.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: max-content;
}
.table thead {
  background: rgba(255,255,255,0.03);
}
.table th,
.table td {
  padding: 6px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  text-align: left;
}
.table-compact th,
.table-compact td {
  white-space: nowrap;
}

/* Sticky columns for ONU and Name - keeps them visible during horizontal scroll */
.table .col-sticky-1,
.table .col-sticky-2 {
  position: sticky;
  background: #0b0c0f; /* Opaque background - must not use rgba or var that might be transparent */
  z-index: 2;
}
.table thead .col-sticky-1,
.table thead .col-sticky-2 {
  background: #15171c; /* --bg-elevated, opaque for headers */
  z-index: 4; /* Higher than body sticky cells */
}
.table .col-sticky-1 {
  left: 0;
  min-width: 50px;
}
.table .col-sticky-2 {
  left: 50px;
  min-width: 150px;
  border-right: 2px solid var(--border);
  box-shadow: 3px 0 8px rgba(0,0,0,0.3);
}
/* Row danger - OPAQUE red background for sticky columns (no bleed-through) */
.table tr.row-danger .col-sticky-1,
.table tr.row-danger .col-sticky-2 {
  background: #2a1215; /* Opaque dark red - approximates rgba(255,59,48,0.15) on #0b0c0f */
}
/* Row warning - OPAQUE yellow background for sticky columns */
.table tr.row-warning .col-sticky-1,
.table tr.row-warning .col-sticky-2 {
  background: #252008; /* Opaque dark yellow - approximates rgba(255,193,7,0.15) on #0b0c0f */
}
/* Row threshold - OPAQUE burnt orange background for sticky columns */
.table tr.row-threshold .col-sticky-1,
.table tr.row-threshold .col-sticky-2 {
  background: #2e190c; /* Opaque - approximates rgba(204,85,0,0.18) on #0b0c0f */
}

.flash-container {
  margin-bottom: 12px;
}
.flash {
  padding: 8px 10px;
  border-radius: 999px;
  font-size: 13px;
}
.flash-danger {
  background: rgba(255,69,58,0.14);
  border: 1px solid rgba(255,69,58,0.6);
}

@media (max-width: 640px) {
  .app-main {
    padding: 16px;
  }
  .card-login {
    margin-top: 40px;
  }
}

.metric-link {
  text-decoration: none;
  color: inherit;
}
.metric-link:hover {
  box-shadow: 0 0 0 1px var(--accent-soft);
}

.metric-link {
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}
.metric-link:hover {
  box-shadow: 0 0 0 1px var(--accent-soft);
}
.metric-active {
  box-shadow: 0 0 0 1px var(--accent-soft);
}

.state-table {
  display: none;
}
.state-table.active {
  display: block;
}

th.sort {
  cursor: pointer;
  user-select: none;
}
th.sort:hover {
  text-decoration: underline;
}


th.sortable {
  cursor: pointer;
  position: relative;
  user-select: none;
}
th.sortable::after {
  content: '↕';
  font-size: 10px;
  opacity: 0.35;
  margin-left: 6px;
}
th.sortable[data-dir="asc"]::after {
  content: '↑';
  opacity: 0.8;
}
th.sortable[data-dir="desc"]::after {
  content: '↓';
  opacity: 0.8;
}

.btn-small {
  padding: 4px 10px;
  font-size: 12px;
}

.search-bar {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.search-input {
  flex: 1;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(0,0,0,0.3);
  padding: 0.6rem 1rem;
  color: #fff;
  outline: none;
}
.search-input:focus {
  border-color: rgba(255,255,255,0.25);
}

.grid-olts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
}

.card-olt .pon-list-label {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.55);
  margin-bottom: 0.4rem;
}

.pon-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.pon-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.1rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.08);
  background: radial-gradient(circle at top left, rgba(255,255,255,0.12), rgba(0,0,0,0.5));
  font-size: 0.8rem;
  text-decoration: none;
  color: #fff;
}
.pon-badge:hover {
  border-color: rgba(255,255,255,0.35);
}

/* Danger button styling (for delete actions) */
.btn-danger-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  background: rgba(255, 69, 58, 0.15);
  border: 1px solid rgba(255, 69, 58, 0.5);
  color: var(--danger);
  cursor: pointer;
}
.btn-danger-sm:hover {
  background: rgba(255, 69, 58, 0.3);
}

/* Warning button styling (for edit actions) */
.btn-warning-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  background: rgba(255, 159, 10, 0.15);
  border: 1px solid rgba(255, 159, 10, 0.5);
  color: #ff9f0a;
  cursor: pointer;
  margin-right: 4px;
}
.btn-warning-sm:hover {
  background: rgba(255, 159, 10, 0.3);
}

/* Info button styling (for reboot actions) */
.btn-info-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  background: rgba(50, 173, 230, 0.15);
  border: 1px solid rgba(50, 173, 230, 0.5);
  color: #32ade6;
  cursor: pointer;
  margin-right: 4px;
}
.btn-info-sm:hover {
  background: rgba(50, 173, 230, 0.3);
}

/* Secondary button styling (for edit name actions) */
.btn-secondary-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  background: rgba(142, 142, 147, 0.15);
  border: 1px solid rgba(142, 142, 147, 0.5);
  color: #8e8e93;
  cursor: pointer;
  margin-right: 4px;
}
.btn-secondary-sm:hover {
  background: rgba(142, 142, 147, 0.3);
}

/* Success button styling (for enable actions) */
.btn-success-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  background: rgba(52, 199, 89, 0.15);
  border: 1px solid rgba(52, 199, 89, 0.5);
  color: #34c759;
  cursor: pointer;
  margin-right: 4px;
}
.btn-success-sm:hover {
  background: rgba(52, 199, 89, 0.3);
}

/* Dark button styling (for shutdown actions) */
.btn-dark-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  background: rgba(72, 72, 74, 0.15);
  border: 1px solid rgba(72, 72, 74, 0.5);
  color: #636366;
  cursor: pointer;
  margin-right: 4px;
}
.btn-dark-sm:hover {
  background: rgba(72, 72, 74, 0.3);
}

.link-small {
  font-size: 0.8rem;
  text-decoration: none;
  color: rgba(255,255,255,0.7);
}
.link-small:hover {
  color: #fff;
}

/* Row highlighting for ONU status */
.table tr.row-danger {
  background: rgba(255, 69, 58, 0.15);
}
.table tr.row-danger:hover {
  background: rgba(255, 69, 58, 0.25);
}
.table tr.row-danger td {
  color: #ff6b6b;
}
.table tr.row-warning {
  background: rgba(255, 193, 7, 0.15);
}
.table tr.row-warning:hover {
  background: rgba(255, 193, 7, 0.25);
}
.table tr.row-warning td {
  color: #e6a800;
}
/* Row threshold - weak signal (current dBm < -27), burnt orange #CC5500 */
.table tr.row-threshold {
  background: rgba(204, 85, 0, 0.18);
}
.table tr.row-threshold:hover {
  background: rgba(204, 85, 0, 0.28);
}
.table tr.row-threshold td {
  color: #cc5500;
}

/* Modal styles */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(6px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.modal-overlay.active {
  display: flex;
}
.modal-container {
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 24px;
  min-width: min(400px, 90vw);
  max-width: 90vw;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-soft);
}
.modal-title {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text);
}
.modal-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.modal-section {
  margin-bottom: 20px;
}
.modal-section-title {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.modal-body {
  margin-bottom: 20px;
}
.modal-footer {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}
.modal-btn {
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
}
.modal-btn-primary {
  background: var(--accent);
  color: white;
}
.modal-btn-primary:hover:not(:disabled) {
  background: #2d8bff;
}
.modal-btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.modal-btn-secondary {
  background: var(--border);
  color: var(--text);
}
.modal-btn-secondary:hover {
  background: #3a3d48;
}

/* Serial Number option list */
.sn-option-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
}
.sn-option {
  display: flex;
  align-items: center;
  padding: 12px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.sn-option:hover {
  background: rgba(255,255,255,0.1);
}
.sn-option.selected {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.sn-option-radio {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-radius: 50%;
  margin-right: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sn-option.selected .sn-option-radio {
  border-color: var(--accent);
}
.sn-option.selected .sn-option-radio::after {
  content: '';
  width: 10px;
  height: 10px;
  background: var(--accent);
  border-radius: 50%;
}
.sn-option-serial {
  font-family: 'SF Mono', monospace;
  font-weight: 600;
  color: var(--text);
  margin-right: 8px;
}
.sn-option-info {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Form elements in modal */
.modal-input,
.modal-textarea {
  width: 100%;
  padding: 12px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
}
.modal-input:focus,
.modal-textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(255,255,255,0.08);
}
.modal-textarea {
  min-height: 80px;
  resize: vertical;
}
.modal-loading {
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
}
.modal-empty {
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  background: rgba(255,215,10,0.1);
  border-radius: 8px;
}

/* ========================================
   Dark Theme Form Controls
   ======================================== */

/* Select dropdowns - dark theme */
select,
.filter-row select {
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(15, 16, 20, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238e8e93' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
  min-width: 100px;
}

select:hover,
.filter-row select:hover {
  border-color: rgba(255, 255, 255, 0.25);
  background-color: rgba(20, 21, 26, 0.95);
}

select:focus,
.filter-row select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(10, 132, 255, 0.25);
}

select option {
  background: #1a1b20;
  color: var(--text);
  padding: 8px;
}

/* Input fields - dark theme */
input[type="text"],
input[type="search"],
.filter-row input {
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(15, 16, 20, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text);
  font-size: 13px;
}

input[type="text"]:hover,
input[type="search"]:hover,
.filter-row input:hover {
  border-color: rgba(255, 255, 255, 0.25);
}

input[type="text"]:focus,
input[type="search"]:focus,
.filter-row input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(10, 132, 255, 0.25);
}

input::placeholder {
  color: var(--text-muted);
}

/* ========================================
   Multi-Select Dropdown Component
   ======================================== */

.multi-select {
  position: relative;
  display: inline-block;
  min-width: 120px;
}

.multi-select-btn {
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(15, 16, 20, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 120px;
  transition: all 0.15s ease;
}

.multi-select-btn:hover {
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(20, 21, 26, 0.95);
}

.multi-select-btn.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(10, 132, 255, 0.25);
}

.multi-select-btn .btn-text {
  flex: 1;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.multi-select-btn .btn-arrow {
  font-size: 10px;
  opacity: 0.6;
  transition: transform 0.2s;
}

.multi-select-btn.active .btn-arrow {
  transform: rotate(180deg);
}

.multi-select-btn .badge-count {
  background: var(--accent);
  color: white;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: 600;
}

.multi-select-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 200px;
  max-height: 280px;
  overflow-y: auto;
  background: rgba(22, 23, 28, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  z-index: 100;
  margin-top: 4px;
  padding: 6px;
}

.multi-select-dropdown.show {
  display: block;
}

.multi-select-search {
  width: calc(100% - 12px);
  margin: 4px 6px 8px;
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: 12px;
}

.multi-select-search:focus {
  outline: none;
  border-color: var(--accent);
}

.multi-select-actions {
  display: flex;
  gap: 6px;
  padding: 4px 6px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 6px;
}

.multi-select-action-btn {
  padding: 4px 8px;
  font-size: 11px;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  border-radius: 4px;
  cursor: pointer;
}

.multi-select-action-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: var(--text);
}

.multi-select-option {
  display: flex;
  align-items: center;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}

.multi-select-option:hover {
  background: rgba(255, 255, 255, 0.08);
}

.multi-select-option.selected {
  background: rgba(10, 132, 255, 0.2);
}

.multi-select-option input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-radius: 4px;
  margin-right: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  flex-shrink: 0;
}

.multi-select-option input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.multi-select-option input[type="checkbox"]:checked::after {
  content: '✓';
  color: white;
  font-size: 12px;
  font-weight: bold;
}

.multi-select-option .option-label {
  flex: 1;
  font-size: 13px;
}

.multi-select-option .option-count {
  font-size: 11px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: 8px;
}

/* ========================================
   PON Alert Banner in Card
   ======================================== */

.pon-alerts-mini {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.pon-alert-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(255, 69, 58, 0.12);
  border: 1px solid rgba(255, 69, 58, 0.4);
  border-radius: 8px;
  margin-bottom: 6px;
  font-size: 13px;
}

.pon-alert-item:last-child {
  margin-bottom: 0;
}

.pon-alert-icon {
  font-size: 16px;
}

.pon-alert-text {
  flex: 1;
  color: #ff6b6b;
}

.pon-alert-text a {
  color: #ff9494;
  text-decoration: none;
  font-weight: 500;
}

.pon-alert-text a:hover {
  text-decoration: underline;
}

.pon-alert-count {
  font-weight: 600;
  color: #ff453a;
}

.pon-alerts-mini-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #ff6b6b;
  margin-bottom: 8px;
  font-weight: 500;
}

.no-alerts {
  font-size: 12px;
  color: var(--text-muted);
  padding: 8px;
  text-align: center;
}

/* ========================================
   Missing Utility Classes
   ======================================== */

/* Form control (used in infra forms/modals) */
.form-control {
  display: block;
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(7,7,10,0.9);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(10,132,255,0.25);
}
.form-control::placeholder {
  color: var(--text-muted);
}

.form-group {
  margin-bottom: 1rem;
}
.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

/* Small buttons */
.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
  border-radius: 6px;
}

/* Color variant buttons */
.btn-info {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid rgba(50,173,230,0.5);
  background: rgba(50,173,230,0.15);
  color: #32ade6;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
}
.btn-info:hover { background: rgba(50,173,230,0.25); }

.btn-warning {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid rgba(255,159,10,0.5);
  background: rgba(255,159,10,0.15);
  color: #ff9f0a;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
}
.btn-warning:hover { background: rgba(255,159,10,0.25); }

.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid rgba(255,69,58,0.5);
  background: rgba(255,69,58,0.15);
  color: var(--danger);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
}
.btn-danger:hover { background: rgba(255,69,58,0.25); }

.btn-success {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid rgba(52,199,89,0.5);
  background: rgba(52,199,89,0.15);
  color: #34c759;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
}
.btn-success:hover { background: rgba(52,199,89,0.25); }

/* Page subtitle */
.subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0;
}

/* ========================================
   Infra: Shared Component Styles
   ======================================== */

/* -- Breadcrumb -- */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.breadcrumb a {
  color: var(--accent);
  text-decoration: none;
}
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .sep { opacity: 0.4; }

/* -- Section title -- */
.section-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 1.5rem 0 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* -- Empty state -- */
.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }
.empty-state p { margin: 0; }

/* -- Detail page header -- */
.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.detail-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
}
.detail-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}
.detail-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  flex-shrink: 0;
}

/* -- Detail info grid (key-value pairs) -- */
.detail-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}
.detail-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}
.detail-info-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.detail-info-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 500;
}
.detail-info-value {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
  word-break: break-word;
}

/* -- Stats row (used in detail pages) -- */
.stats-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.stat-item {
  flex: 1;
  min-width: 120px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  text-align: center;
}
.stat-item .stat-value {
  font-size: 1.5rem;
  font-weight: 700;
}
.stat-item .stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* -- Port usage bar -- */
.port-bar {
  height: 8px;
  background: rgba(255,255,255,0.08);
  border-radius: 4px;
  overflow: hidden;
  width: 100%;
}
.port-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
}
.port-usage {
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 0.3rem;
}

/* -- Status badges -- */
.status-online { color: var(--ok); }
.status-offline { color: var(--danger); }
.status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}
.status-badge.online {
  background: rgba(48,209,88,0.15);
  color: var(--ok);
}
.status-badge.offline {
  background: rgba(255,69,58,0.15);
  color: var(--danger);
}

/* -- Accordion groups (infra lists) -- */
.infra-group { border-bottom: 1px solid var(--border); }
.infra-group:last-child { border-bottom: none; }
.infra-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  cursor: pointer;
  background: var(--bg-elevated);
  transition: background 0.2s;
  user-select: none;
  gap: 8px;
}
.infra-group-header:hover { background: rgba(255,255,255,0.06); }
.infra-group-header.expanded {
  border-left: 4px solid var(--accent);
  background: rgba(10,132,255,0.08);
}
.infra-group-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.infra-group-stats {
  display: flex;
  gap: 12px;
  color: var(--text-muted);
  font-size: 0.82rem;
  flex-shrink: 0;
}
.infra-group-stats span {
  display: flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
}
.infra-group-chevron {
  font-size: 1rem;
  transition: transform 0.2s;
  flex-shrink: 0;
}
.infra-group-header.expanded .infra-group-chevron {
  transform: rotate(180deg);
}
.infra-group-body {
  display: none;
  background: var(--bg);
}
.infra-group-body.show { display: block; }

/* -- Infra list item row -- */
.infra-item {
  display: grid;
  gap: 10px;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  cursor: pointer;
  transition: background 0.15s;
  font-size: 0.88rem;
}
.infra-item:hover { background: rgba(255,255,255,0.04); }
.infra-item:last-child { border-bottom: none; }
.infra-item.header-row {
  cursor: default;
  background: rgba(255,255,255,0.02);
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--text-muted);
  padding-top: 8px;
  padding-bottom: 8px;
}

/* -- Infra toolbar -- */
.infra-toolbar {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}
.infra-toolbar .search-input {
  min-width: 160px;
  flex: 1;
  max-width: 260px;
}

/* -- Infra card header -- */
.infra-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  flex-wrap: wrap;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border);
}
.infra-card-header h2 { margin: 0; font-size: 1.15rem; }

/* -- Infra data table (shared) -- */
.infra-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.infra-table th {
  text-align: left;
  padding: 0.6rem 0.75rem;
  border-bottom: 2px solid var(--border);
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.infra-table td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.infra-table tr:hover { background: rgba(255,255,255,0.03); }
.infra-table a { color: var(--accent); text-decoration: none; }
.infra-table a:hover { text-decoration: underline; }

/* -- Infra modal (shared) -- */
.infra-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
}
.infra-modal-overlay.active { display: flex; }
.infra-modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.5rem;
  width: min(500px, 92vw);
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}
.infra-modal h3 {
  margin: 0 0 1rem;
  font-size: 1.15rem;
}
.infra-modal-footer {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1.25rem;
}

/* ========================================
   Infra: Responsive Overrides
   ======================================== */

/* Tablet: collapse grids */
@media (max-width: 991px) {
  .detail-info-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .stats-row .stat-item {
    min-width: 100px;
  }
}

/* Mobile */
@media (max-width: 767px) {
  .detail-header {
    flex-direction: column;
    align-items: stretch;
  }
  .detail-actions {
    justify-content: flex-start;
  }
  .detail-info-grid {
    grid-template-columns: 1fr;
  }
  .stats-row {
    flex-direction: column;
  }
  .stats-row .stat-item {
    min-width: auto;
  }
  .infra-toolbar {
    width: 100%;
  }
  .infra-toolbar .search-input {
    max-width: none;
    flex: 1 1 100%;
  }
  .infra-card-header {
    padding: 0.75rem 1rem;
  }
  .infra-card-header h2 {
    font-size: 1rem;
  }
  .breadcrumb {
    font-size: 0.78rem;
  }
  .infra-group-header {
    padding: 12px 14px;
  }
  .infra-group-stats {
    gap: 8px;
    font-size: 0.75rem;
  }
  .infra-table {
    font-size: 0.78rem;
  }
  .infra-table th,
  .infra-table td {
    padding: 0.4rem 0.5rem;
  }
}

