/* ============================================================
   ROUTERBOX - OLTBOX (MULTI-OLT NMS) EXECUTIVE CYBER-NAVY THEME
   ============================================================ */

.oltbox-root {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  background: #090d16;
  color: #f8fafc;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  box-sizing: border-box;
}

.oltbox-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 14px;
  background: linear-gradient(180deg, #131e33 0%, #0d1627 100%);
  border-bottom: 1px solid rgba(56, 189, 248, 0.2);
  flex-shrink: 0;
}

.oltbox-toolbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.oltbox-toolbar-title {
  font-size: 12px;
  font-weight: 800;
  color: #f8fafc;
  letter-spacing: 0.2px;
}

.oltbox-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  font-weight: 700;
  color: #38bdf8;
  background: rgba(6, 182, 212, 0.16);
  border: 1px solid rgba(56, 189, 248, 0.35);
  padding: 2px 8px;
  border-radius: 9999px;
}

.oltbox-toolbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.oltbox-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 11px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: #182338;
  color: #f8fafc;
  transition: all 0.16s ease;
  font-family: inherit;
  white-space: nowrap;
}

.oltbox-btn:hover {
  background: #1e2d47;
  border-color: rgba(56, 189, 248, 0.45);
}

.oltbox-btn.primary {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  border-color: rgba(96, 165, 250, 0.5);
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.35);
}

.oltbox-btn.primary:hover {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.oltbox-btn.danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  border-color: rgba(248, 113, 113, 0.5);
  color: #ffffff;
}

.oltbox-btn.danger:hover {
  background: linear-gradient(135deg, #f87171 0%, #ef4444 100%);
}

.oltbox-owner-select {
  background: #0b1120;
  border: 1px solid rgba(56, 189, 248, 0.32);
  color: #38bdf8;
  font-size: 11px;
  font-weight: 700;
  padding: 5px 9px;
  border-radius: 6px;
  outline: none;
  cursor: pointer;
}

.oltbox-scroll-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 14px 28px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* 6 KPI Summary Grid (Matches Reference Screenshot) */
.oltbox-kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

@media (max-width: 1180px) {
  .oltbox-kpi-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 560px) {
  .oltbox-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.oltbox-kpi-card {
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 4px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.oltbox-kpi-card.clickable {
  cursor: pointer;
  transition: all 0.18s ease;
  position: relative;
}

.oltbox-kpi-card.clickable:hover {
  border-color: rgba(56, 189, 248, 0.55);
  background: linear-gradient(180deg, #13203b 0%, #0f172a 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(2, 132, 199, 0.28);
}

.oltbox-kpi-card.clickable:active {
  transform: translateY(0);
}

.oltbox-kpi-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 9.5px;
  font-weight: 800;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.oltbox-kpi-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 19px;
  font-weight: 800;
  color: #f8fafc;
  line-height: 1.15;
}

.oltbox-kpi-sub {
  font-size: 10px;
  color: #64748b;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.oltbox-section-label {
  font-size: 11px;
  font-weight: 800;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

/* OLT Status Cards Grid (Matches Reference Screenshot) */
.oltbox-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 10px;
}

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

.oltbox-card {
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  padding: 11px 12px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
  transition: border-color 0.18s ease, transform 0.18s ease;
}

.oltbox-card:hover {
  border-color: rgba(59, 130, 246, 0.5);
}

.oltbox-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.oltbox-card-title {
  font-size: 13px;
  font-weight: 800;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.oltbox-card-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: #94a3b8;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.oltbox-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 9999px;
  flex-shrink: 0;
}

.oltbox-status-pill.online {
  background: rgba(16, 185, 129, 0.18);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.oltbox-status-pill.offline {
  background: rgba(239, 68, 68, 0.18);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.oltbox-mini-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  text-align: center;
  background: rgba(0, 0, 0, 0.26);
  padding: 7px 4px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.oltbox-mini-lbl {
  font-size: 8.5px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  white-space: nowrap;
}

.oltbox-mini-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 800;
  color: #f8fafc;
  margin-top: 2px;
}

.oltbox-health-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 9px;
  white-space: nowrap;
  gap: 4px;
  margin-bottom: 4px;
  overflow: hidden;
}

.oltbox-progress-track {
  width: 100%;
  height: 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.oltbox-progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}

.oltbox-card-foot-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  color: #64748b;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 6px;
  margin-top: auto;
  gap: 6px;
}

.oltbox-card-actions {
  display: grid;
  gap: 5px;
}

.oltbox-statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 12px;
  font-size: 10.5px;
  color: #94a3b8;
  background: #0b1120;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

/* Modal Overlay for ONU Management & OLT CRUD */
.oltbox-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 7, 18, 0.84);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 9999950;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 14px;
  box-sizing: border-box;
}

.oltbox-modal-backdrop.open {
  display: flex;
}

.oltbox-modal-box {
  width: 100%;
  max-width: 980px;
  max-height: 90vh;
  background: #0b1324;
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 12px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.85);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: #f8fafc;
}

.oltbox-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: linear-gradient(135deg, #1e3a8a 0%, #0f172a 100%);
  border-bottom: 1px solid rgba(56, 189, 248, 0.25);
}

.oltbox-modal-body {
  padding: 14px;
  overflow-y: auto;
  flex: 1;
}

.oltbox-pon-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-bottom: 4px;
  margin-bottom: 8px;
}

.oltbox-pon-pill {
  padding: 5px 11px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 700;
  background: #131e33;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  cursor: pointer;
  white-space: nowrap;
}

.oltbox-pon-pill.active {
  background: #2563eb;
  border-color: #60a5fa;
  color: #ffffff;
}

.oltbox-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
}

.oltbox-table th {
  background: #131e33;
  color: #38bdf8;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid rgba(56, 189, 248, 0.22);
}

.oltbox-table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  color: #e2e8f0;
}

.oltbox-table tr:hover td {
  background: rgba(56, 189, 248, 0.06);
}

.oltbox-form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

@media (max-width: 600px) {
  .oltbox-form-grid {
    grid-template-columns: 1fr;
  }
}

.oltbox-input,
.oltbox-select {
  width: 100%;
  background: #070c17;
  border: 1px solid rgba(56, 189, 248, 0.28);
  border-radius: 7px;
  padding: 8px 10px;
  color: #f8fafc;
  font-size: 12px;
  outline: none;
  box-sizing: border-box;
}

/* ============================================================
   MOBILE-FIRST & SMARTPHONE PORTRAIT SUPPORT (#oltboxMobileRoot & .oltbox-is-mobile)
   ============================================================ */
#oltboxMobileRoot .oltbox-kpi-grid,
body.oltbox-is-mobile .oltbox-kpi-grid {
  grid-template-columns: repeat(2, 1fr) !important;
  gap: 8px !important;
}

#oltboxMobileRoot .oltbox-cards-grid,
body.oltbox-is-mobile .oltbox-cards-grid {
  grid-template-columns: 1fr !important;
  gap: 10px !important;
}

#oltboxMobileRoot .oltbox-toolbar,
body.oltbox-is-mobile .oltbox-toolbar {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 10px 12px;
}

#oltboxMobileRoot .oltbox-toolbar-left,
body.oltbox-is-mobile .oltbox-toolbar-left {
  justify-content: space-between;
  width: 100%;
}

#oltboxMobileRoot .oltbox-toolbar-right,
body.oltbox-is-mobile .oltbox-toolbar-right {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  width: 100%;
}

#oltboxMobileRoot .oltbox-toolbar-right .oltbox-btn,
body.oltbox-is-mobile .oltbox-toolbar-right .oltbox-btn {
  padding: 7px 6px;
  font-size: 10.5px;
  width: 100%;
}

/* Mobile Modal Sheet Layout (Fits Smartphone Frame 440px cleanly) */
body.oltbox-is-mobile .oltbox-modal-backdrop {
  padding: 0 !important;
  align-items: stretch !important;
  justify-content: center !important;
}

body.oltbox-is-mobile .oltbox-modal-box {
  width: 100% !important;
  max-width: 440px !important;
  height: 100dvh !important;
  max-height: 100dvh !important;
  border-radius: 0 !important;
  border-top: none !important;
  border-bottom: none !important;
  display: flex !important;
  flex-direction: column !important;
}

body.oltbox-is-mobile .oltbox-modal-header {
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 14px;
}

body.oltbox-is-mobile .oltbox-modal-body {
  padding: 12px;
  overflow-y: auto;
  overflow-x: hidden;
}

body.oltbox-is-mobile .oltbox-form-grid {
  grid-template-columns: 1fr !important;
}

/* Mobile ONU Card List & Mobile CRUD OLT Cards */
.oltbox-mob-card-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.oltbox-mob-item-card {
  background: linear-gradient(180deg, #111c33 0%, #0c1425 100%);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: 10px;
  padding: 11px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.oltbox-mob-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
}

.oltbox-mob-item-mid {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.oltbox-mob-item-name {
  font-size: 13px;
  font-weight: 800;
  color: #f8fafc;
  word-break: break-word;
}

.oltbox-mob-item-mac {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: #94a3b8;
  margin-top: 2px;
}

.oltbox-mob-rx-box {
  text-align: right;
  flex-shrink: 0;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 4px 8px;
  border-radius: 7px;
}

.oltbox-mob-rx-lbl {
  font-size: 8.5px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
}

.oltbox-mob-rx-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
  font-weight: 800;
}

.oltbox-mob-item-actions {
  display: flex;
  gap: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.oltbox-mob-item-actions .oltbox-btn {
  flex: 1;
  padding: 6px 8px;
  font-size: 11px;
}

