/**
 * BOL Dashboard - Tab Module Styles
 * Phase 2: Styles for modular tab system
 */

/* Loading states */
.loading {
  text-align: center;
  padding: 2rem;
  color: #6b7280;
}

.loading-indicator {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
}

/* Tab content containers */
.bol-list-tab {
  padding: 1rem;
}

.tab-placeholder {
  text-align: center;
  padding: 3rem;
  color: #6b7280;
  background: #f9fafb;
  border-radius: 0.5rem;
  border: 2px dashed #d1d5db;
}

.error {
  text-align: center;
  padding: 2rem;
  color: #dc2626;
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: 0.5rem;
}

/* BOL table enhancements for modular version */
.bol-list-tab .bol-table {
  width: 100%;
  border-collapse: collapse;
}

.bol-list-tab .bol-table th {
  background: #374151;
  color: white;
  padding: 0.75rem;
  text-align: left;
  font-weight: 600;
}

.bol-list-tab .bol-table td {
  padding: 0.75rem;
  border-bottom: 1px solid #e5e7eb;
}

.bol-list-tab .bol-row:hover {
  background: #f9fafb;
}

.bol-list-tab .bol-row.selected {
  background: #eff6ff;
}

/* V3 overview table interactions */
#bol-rows tr {
  cursor: pointer;
  transition: background-color 0.15s ease;
}

#bol-rows tr:hover {
  background-color: rgba(59, 130, 246, 0.12);
}

#bol-rows tr.is-selected {
  background-color: rgba(59, 130, 246, 0.18);
}

.overview-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 12px;
}

.overview-controls__search {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.overview-controls__sort {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.overview-controls__label {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.7;
}

.sort-toggle {
  display: inline-flex;
  gap: 6px;
}

.sort-toggle__btn {
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.7);
  color: #d7e0ff;
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.sort-toggle__btn:hover {
  border-color: #60a5fa;
  background: rgba(59, 130, 246, 0.18);
  color: #ffffff;
}

.sort-toggle__btn.is-active {
  border-color: #3b82f6;
  background: rgba(37, 99, 235, 0.28);
  color: #f8fafc;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border: 1px solid transparent;
  background: rgba(148, 163, 184, 0.12);
  color: #cbd5e1;
}

.status-chip--draft {
  background: rgba(148, 163, 184, 0.18);
  border-color: rgba(148, 163, 184, 0.32);
  color: #e2e8f0;
}

.status-chip--pending {
  background: rgba(250, 204, 21, 0.18);
  border-color: rgba(250, 204, 21, 0.38);
  color: #facc15;
}

.status-chip--transit {
  background: rgba(59, 130, 246, 0.18);
  border-color: rgba(59, 130, 246, 0.38);
  color: #93c5fd;
}

.status-chip--signed {
  background: rgba(129, 140, 248, 0.18);
  border-color: rgba(129, 140, 248, 0.4);
  color: #c7d2fe;
}

.status-chip--completed {
  background: rgba(34, 197, 94, 0.18);
  border-color: rgba(34, 197, 94, 0.38);
  color: #bbf7d0;
}

.status-chip--cancelled {
  background: rgba(248, 113, 113, 0.18);
  border-color: rgba(248, 113, 113, 0.38);
  color: #fecaca;
}

.status-chip--default {
  background: rgba(148, 163, 184, 0.12);
  border-color: rgba(148, 163, 184, 0.3);
  color: #cbd5f5;
}

.drawer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.action-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid transparent;
  background: rgba(148, 163, 184, 0.16);
  color: #dbeafe;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
  text-decoration: none;
}

.action-chip:hover {
  background: rgba(94, 129, 244, 0.2);
  border-color: rgba(94, 129, 244, 0.4);
  color: #ffffff;
}

.action-chip--primary {
  background: rgba(37, 99, 235, 0.24);
  border-color: rgba(37, 99, 235, 0.5);
  color: #bfdbfe;
}

.action-chip--muted {
  background: rgba(148, 163, 184, 0.16);
  border-color: rgba(148, 163, 184, 0.36);
  color: #e2e8f0;
}

.action-chip--warn {
  background: rgba(234, 179, 8, 0.2);
  border-color: rgba(234, 179, 8, 0.45);
  color: #fde68a;
}

.action-chip--danger {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.45);
  color: #fecaca;
}

.action-chip--alert {
  background: rgba(248, 113, 113, 0.2);
  border-color: rgba(248, 113, 113, 0.5);
  color: #fee2e2;
}

.action-chip--info {
  background: rgba(129, 140, 248, 0.2);
  border-color: rgba(129, 140, 248, 0.5);
  color: #e0e7ff;
}

.financial-card {
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 12px;
  background: rgba(8, 13, 23, 0.85);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.financial-card__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.financial-alert-badge {
  border: 1px solid rgba(248, 113, 113, 0.5);
  background: rgba(248, 113, 113, 0.18);
  color: #fecaca;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 4px 12px;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.financial-alert-badge:hover {
  border-color: rgba(248, 113, 113, 0.8);
  background: rgba(248, 113, 113, 0.3);
  color: #fff5f5;
}

.financial-card--empty {
  align-items: stretch;
}

.financial-card__summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.financial-card__summary-item {
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 10px;
  padding: 10px;
  background: rgba(15, 23, 42, 0.6);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.financial-card__summary-label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.7;
}

.financial-card__summary-value {
  font-size: 16px;
  font-weight: 600;
  color: #e2e8f0;
}

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

.financial-card__empty {
  padding: 16px;
  border: 1px dashed rgba(148, 163, 184, 0.35);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.4);
}

.financial-party {
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 10px;
  padding: 10px;
  background: rgba(8, 13, 23, 0.6);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.financial-party__header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.financial-party__name {
  font-size: 15px;
  font-weight: 600;
  color: #f8fafc;
}

.financial-party__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.financial-party__meta {
  font-size: 12px;
  color: #cbd5f5;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.financial-party__meta span {
  opacity: 0.8;
}

.financial-party__remit {
  font-size: 13px;
  color: #cbd5f5;
}

.financial-party__remit p {
  margin: 4px 0 0 0;
  line-height: 1.4;
}

.financial-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid transparent;
  background: rgba(148, 163, 184, 0.18);
  color: #e2e8f0;
}

.financial-chip--label {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.35);
  color: #bfdbfe;
  margin-bottom: 4px;
}

.financial-chip--quickpay {
  background: rgba(34, 197, 94, 0.16);
  border-color: rgba(34, 197, 94, 0.4);
  color: #bbf7d0;
}

.financial-chip--muted {
  background: rgba(148, 163, 184, 0.12);
  border-color: rgba(148, 163, 184, 0.3);
  color: #cbd5f5;
}

.financial-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid transparent;
}

.financial-pill--ok {
  background: rgba(34, 197, 94, 0.18);
  border-color: rgba(34, 197, 94, 0.45);
  color: #bbf7d0;
}

.financial-pill--warn {
  background: rgba(250, 204, 21, 0.18);
  border-color: rgba(250, 204, 21, 0.45);
  color: #fde68a;
}

.financial-pill--late {
  background: rgba(251, 146, 60, 0.2);
  border-color: rgba(251, 146, 60, 0.5);
  color: #fed7aa;
}

.financial-pill--danger {
  background: rgba(248, 113, 113, 0.2);
  border-color: rgba(248, 113, 113, 0.55);
  color: #fecaca;
}

.financial-pill--info {
  background: rgba(129, 140, 248, 0.2);
  border-color: rgba(129, 140, 248, 0.55);
  color: #e0e7ff;
}

.financial-pill--muted {
  background: rgba(148, 163, 184, 0.18);
  border-color: rgba(148, 163, 184, 0.4);
  color: #e2e8f0;
}

/* Status badges */
.status-badge {
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.status-created { background: #dbeafe; color: #1e40af; }
.status-in-transit { background: #fef3c7; color: #92400e; }
.status-delivered { background: #d1fae5; color: #065f46; }
.status-pending { background: #fce7f3; color: #be185d; }
.status-unknown { background: #f3f4f6; color: #374151; }

/* Progress bars */
.progress-bar {
  width: 60px;
  height: 8px;
  background: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: #10b981;
  transition: width 0.3s ease;
}

/* Action buttons */
.action-buttons {
  display: flex;
  gap: 0.25rem;
}

.action-buttons .btn {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  border-radius: 0.25rem;
}

/* Pagination */
.pagination-container {
  background: #f9fafb;
}

.pagination-controls .btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Card container for tab content */
.bol-list-tab .card {
  background: white;
  border-radius: 0.5rem;
  border: 1px solid #e5e7eb;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

/* ===== NEW TAB MODULES - PHASE 3 ===== */

/* Create BOL Tab */
.create-bol-container .progress-steps {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 2rem;
}

.create-bol-container .step {
  display: flex;
  flex-direction: column;
  align-items: center;
  opacity: 0.5;
  transition: opacity 0.3s;
}

.create-bol-container .step.active {
  opacity: 1;
}

.create-bol-container .step-number {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgb(51 65 85);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  margin-bottom: 0.5rem;
  color: white;
}

.create-bol-container .step.active .step-number {
  background: rgb(59 130 246);
}

.create-bol-container .mode-btn {
  padding: 0.5rem 1rem;
  border: 1px solid rgb(51 65 85);
  background: transparent;
  color: rgb(203 213 225);
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.3s;
}

.create-bol-container .mode-btn.active {
  background: rgb(59 130 246);
  border-color: rgb(59 130 246);
}

/* Users Tab */
.users-container .stats-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.users-container .stat .stat-value {
  font-size: 1.5rem;
  font-weight: bold;
  color: rgb(59 130 246);
}

.users-container .user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgb(59 130 246);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: white;
  margin-right: 0.75rem;
}

/* QR Operations Tab */
.qr-operations-container .scanner-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.qr-operations-container .stat-item .stat-value {
  font-size: 1.25rem;
  font-weight: bold;
  color: rgb(59 130 246);
}

/* Scheduling Tab */
.scheduling-container {
  width: 100%;
  max-width: 80rem;
  margin: 0 auto;
}

.view-toggle {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.view-btn {
  padding: 0.5rem 1rem;
  background: rgb(51 65 85);
  color: rgb(148 163 184);
  border-radius: 0.5rem;
  border: 1px solid rgb(71 85 105);
  cursor: pointer;
  transition: all 0.2s;
}

.view-btn:hover {
  background: rgb(71 85 105);
}

.view-btn.active {
  background: rgb(59 130 246);
  color: white;
  border-color: rgb(29 78 216);
}

/* Timeline styles */
.timeline {
  position: relative;
  padding-left: 1.5rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 0.75rem;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgb(71 85 105);
}

.timeline-item {
  position: relative;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
}

.timeline-marker {
  position: absolute;
  left: -0.5rem;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  border: 2px solid rgb(71 85 105);
  background: rgb(30 41 59);
}

.timeline-item.completed .timeline-marker {
  background: rgb(34 197 94);
  border-color: rgb(22 163 74);
}

.timeline-item.current .timeline-marker {
  background: rgb(59 130 246);
  border-color: rgb(29 78 216);
  animation: pulse 2s infinite;
}

.timeline-item.pending .timeline-marker {
  background: rgb(71 85 105);
  border-color: rgb(51 65 85);
}

.timeline-content {
  margin-left: 1.5rem;
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}

.timeline-title {
  font-weight: 500;
  color: white;
}

.timeline-status .status-badge {
  padding: 0.25rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.status-badge.status-completed {
  background: rgb(20 83 45);
  color: rgb(187 247 208);
}

.status-badge.status-current {
  background: rgb(30 58 138);
  color: rgb(191 219 254);
}

.status-badge.status-pending {
  background: rgb(51 65 85);
  color: rgb(203 213 225);
}

.timeline-details {
  font-size: 0.875rem;
  color: rgb(148 163 184);
}

.timeline-notes {
  margin-top: 0.25rem;
  color: rgb(203 213 225);
}

.timeline-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

/* Verification styles */
.verification-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: rgb(30 41 59);
  border-radius: 0.5rem;
  padding: 1rem;
  text-align: center;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: bold;
  margin-bottom: 0.25rem;
}

.stat-label {
  color: rgb(148 163 184);
  font-size: 0.875rem;
}

.fraud-alerts {
  margin-bottom: 1.5rem;
}

.alert-item {
  padding: 0.75rem;
  border-radius: 0.5rem;
  margin-bottom: 0.5rem;
}

.alert-severity {
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-weight: 500;
}

.alert-severity.severity-high {
  background: rgb(127 29 29);
  color: rgb(252 165 165);
}

.alert-severity.severity-medium {
  background: rgb(146 64 14);
  color: rgb(253 230 138);
}

.alert-severity.severity-low {
  background: rgb(30 58 138);
  color: rgb(191 219 254);
}

.verification-badge {
  padding: 0.25rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.verification-badge.verification-verified {
  background: rgb(20 83 45);
  color: rgb(187 247 208);
}

.verification-badge.verification-pending {
  background: rgb(146 64 14);
  color: rgb(253 230 138);
}

.verification-badge.verification-flagged {
  background: rgb(127 29 29);
  color: rgb(252 165 165);
}

.permits-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.permit-card {
  padding: 0.75rem;
  border-radius: 0.5rem;
  background: rgb(30 41 59);
}

.permit-state {
  font-weight: 500;
  color: white;
  margin-bottom: 0.25rem;
}

/* Action buttons */
.action-btn {
  padding: 0.5rem 0.75rem;
  background: rgb(51 65 85);
  color: rgb(148 163 184);
  border-radius: 0.25rem;
  border: 1px solid rgb(71 85 105);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.875rem;
}

.action-btn:hover {
  background: rgb(71 85 105);
}

.bol-quick-btn {
  padding: 0.5rem 0.75rem;
  background: rgb(51 65 85);
  color: rgb(148 163 184);
  border-radius: 0.25rem;
  border: 1px solid rgb(71 85 105);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.875rem;
  text-align: left;
  width: 100%;
}

.bol-quick-btn:hover {
  background: rgb(71 85 105);
}

/* Event items */
.event-item {
  border-bottom: 1px solid rgb(51 65 85);
  padding-bottom: 0.5rem;
  margin-bottom: 0.5rem;
}

.event-item:last-child {
  border-bottom: none;
}

.event-time {
  font-size: 0.75rem;
  color: rgb(148 163 184);
}

.event-description {
  font-size: 0.875rem;
  color: rgb(203 213 225);
}

/* Responsive */
@media (max-width: 768px) {
  .scheduling-container {
    padding: 0 0.5rem;
  }

  .view-toggle {
    flex-wrap: wrap;
  }

  .view-btn {
    font-size: 0.875rem;
    padding: 0.375rem 0.75rem;
  }

  .verification-stats {
    grid-template-columns: 1fr;
  }

  .permits-grid {
    grid-template-columns: 1fr;
  }
}

/* ======================================================================
 * V3 Dashboard Shell Styling (scoped to body[data-ui="v3"])
 * ----------------------------------------------------------------------
 * Reuses this shared stylesheet so we do not proliferate more CSS files
 * while still giving the modern shell its own look.
 * ====================================================================== */

body[data-ui="v3"] {
    --bg: #0b1323;
    --bg-elevated: #111c2e;
    --bg-soft: #152136;
    --border: #1f2b41;
    --border-strong: #2b3b58;
    --accent: #3b82f6;
    --accent-soft: rgba(59, 130, 246, 0.12);
    --text: #e2e8f0;
    --text-soft: #94a3b8;
    --danger: #ef4444;
    --warn: #f59e0b;
    margin: 0;
    min-height: 100vh;
    font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    background: radial-gradient(circle at top, rgba(30, 64, 175, 0.34), transparent 55%), var(--bg);
    color: var(--text);
    display: flex;
    flex-direction: column;
}

body[data-ui="v3"] * {
    box-sizing: border-box;
}

body[data-ui="v3"] #ui-stamp {
    font-family: "JetBrains Mono", "Fira Code", Consolas, "Liberation Mono", monospace;
}

body[data-ui="v3"] .topbar {
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding: 16px 28px;
    background: rgba(10, 16, 27, 0.88);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 4px 14px rgba(3, 12, 26, 0.45);
    overflow: visible;
}

body[data-ui="v3"] .brand {
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text);
    font-size: 15px;
    display: flex;
    align-items: center;
    flex: 0 0 auto;
  min-width: max-content;
}

body[data-ui="v3"] .boltrackerLogoImg {
  display: block;
  height: 48px;
  width: auto;
  padding: 0 14px;
  flex: 0 0 auto;
}

/* Header logo must render in native colors (no filter tricks). */
body[data-ui="v3"] .boltrackerLogoImg {
  filter: none !important;
  opacity: 1 !important;
  mix-blend-mode: normal !important;
  -webkit-mask-image: none !important;
  mask-image: none !important;
}

@media (max-width: 768px) {
  body[data-ui="v3"] .boltrackerLogoImg {
      height: 36px;
  }
}

body[data-ui="v3"] .tabs {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    /* Wide shells with many authorized tabs wrap instead of clipping or pushing nav off screen. */
    min-width: 0;
    flex-wrap: wrap;
}

body[data-ui="v3"] .tabs-more {
  position: relative;
  margin-left: auto;
}

body[data-ui="v3"] .tab-more {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding-right: 12px;
  padding-left: 12px;
}

body[data-ui="v3"] .tabs-more-menu {
  /* The menu is mounted on document.body and positioned from the More button:
     the topbar's backdrop-filter makes it the containing block for fixed
     descendants, and the nav's overflow clips absolute ones, so a menu inside
     the tab strip can never actually be seen. */
  position: fixed;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 160px;
  max-width: calc(100vw - 20px);
  padding: 8px;
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  /* Short viewports: the menu never extends past the screen; entries scroll instead. */
  max-height: calc(100vh - 72px);
  overflow-y: auto;
  z-index: 10300;
}

body[data-ui="v3"] .tabs-more-menu[hidden] {
  display: none;
}

body[data-ui="v3"] .tabs-more-menu .tab {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
  border-radius: 8px;
  padding: 8px 12px;
}

@media (max-width: 480px) {
  html,
  body[data-ui="v3"] {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }

  body[data-ui="v3"] main,
  body[data-ui="v3"] .app,
  body[data-ui="v3"] [data-tab-host] {
    max-width: 100%;
    overflow-x: hidden;
  }

  body[data-ui="v3"] .topbar {
    flex-wrap: nowrap;
    gap: 10px;
    max-width: 100vw;
    overflow-x: hidden;
  }

  body[data-ui="v3"] .brand {
    font-size: 14px;
    white-space: nowrap;
  }

  body[data-ui="v3"] .tabs {
    gap: 8px;
    justify-content: flex-start;
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
  }

  body[data-ui="v3"] .tabs::-webkit-scrollbar {
    display: none;
  }

  body[data-ui="v3"] .tabs-more {
    flex: 0 0 auto;
    margin-left: 0;
  }

  body[data-ui="v3"] .tabs-more-menu {
    position: fixed;
    top: 58px;
    right: 10px;
    max-width: calc(100vw - 20px);
  }

  body[data-ui="v3"] .tab,
  body[data-ui="v3"] .tab.tab-menu,
  body[data-ui="v3"] .tab.tab-more {
    min-height: 44px;
    padding: 10px 16px;
    border-radius: 999px;
  }

  body[data-ui="v3"] .tab {
    background: rgba(148, 163, 184, 0.12);
    color: var(--text-soft);
    border-color: rgba(148, 163, 184, 0.35);
  }

  body[data-ui="v3"] .tab.active {
    background: rgba(59, 130, 246, 0.26);
    border-color: rgba(59, 130, 246, 0.55);
    color: var(--text);
    box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.55);
    font-weight: 700;
  }

  body[data-ui="v3"] .tab:hover {
    background: rgba(148, 163, 184, 0.2);
  }

  body[data-ui="v3"] #menu,
  body[data-ui="v3"] [data-auth-controls] {
    display: none !important;
  }

    [data-bol-detail-panel="1"] {
      inset: 0;
      width: 100vw;
      height: 100vh;
      padding: 0;
      margin: 0;
      align-items: flex-start;
      justify-content: flex-start;
      overflow-y: auto;
      overflow-x: hidden;
    }

    [data-bol-detail-panel="1"] .bol-detail-dialog {
      width: 100vw;
      max-width: none;
      min-height: 100vh;
      border-radius: 0;
      padding: 16px 16px 28px;
      font-size: 15px;
      line-height: 1.55;
      box-sizing: border-box;
    }

    [data-bol-detail-panel="1"] .bol-detail-header,
    [data-bol-detail-panel="1"] .bol-detail-title-row,
    [data-bol-detail-panel="1"] .bol-detail-chip-row,
    [data-bol-detail-panel="1"] .bol-detail-actions,
    [data-bol-detail-panel="1"] .actions {
      flex-wrap: wrap;
      gap: 10px;
    }

    [data-bol-detail-panel="1"] .bol-detail-actions button,
    [data-bol-detail-panel="1"] .actions .btn,
    [data-bol-detail-panel="1"] .bol-detail-chip,
    [data-bol-detail-panel="1"] .bol-detail-chip--ghost,
    [data-bol-detail-panel="1"] .bol-chip {
      width: auto;
      min-width: 140px;
      justify-content: center;
      text-align: center;
    }

    [data-bol-detail-panel="1"] h3,
    [data-bol-detail-panel="1"] h4 {
      line-height: 1.4;
    }
}

body[data-ui="v3"] .tabs-more-divider {
  height: 1px;
  margin: 6px 0;
  background: rgba(148, 163, 184, 0.35);
}

body[data-ui="v3"] .tab {
    -webkit-tap-highlight-color: transparent;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-soft);
    font: inherit;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

body[data-ui="v3"] .tab:hover {
    color: var(--text);
    border-color: var(--border);
    background: rgba(15, 23, 42, 0.6);
}

body[data-ui="v3"] .tab.active {
    color: var(--text);
    background: var(--accent-soft);
    border-color: rgba(59, 130, 246, 0.4);
    box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.35);
}

body[data-ui="v3"] .tab:focus-visible,
body[data-ui="v3"] .btn:focus-visible,
body[data-ui="v3"] .input:focus-visible {
    outline: 2px solid rgba(59, 130, 246, 0.75);
    outline-offset: 2px;
}

body[data-ui="v3"] .btn {
    -webkit-tap-highlight-color: transparent;
    appearance: none;
    border: 1px solid rgba(59, 130, 246, 0.6);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.45), rgba(56, 189, 248, 0.45));
    color: var(--text);
    padding: 8px 18px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

body[data-ui="v3"] .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(59, 130, 246, 0.18);
}

body[data-ui="v3"] .btn:active {
    transform: translateY(0);
}

body[data-ui="v3"] .btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--text);
    padding: 6px 12px;
    font-size: 13px;
}

body[data-ui="v3"] .btn-ghost:hover {
    background: rgba(148, 163, 184, 0.12);
}

body[data-ui="v3"] .cockpit-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  flex-wrap: wrap;
}

body[data-ui="v3"] .cockpit-header__copy {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 260px;
  min-height: 0;
  flex: 1 1 320px;
}

body[data-ui="v3"] .cockpit-header__eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #93c5fd;
}

body[data-ui="v3"] .cockpit-header__headline {
  margin: 0;
  font-size: clamp(22px, 3vw, 28px);
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: #f8fafc;
}

body[data-ui="v3"] .cockpit-header__subtitle {
  margin: 0;
  max-width: 68ch;
  font-size: 14px;
  line-height: 1.5;
  color: rgba(226, 232, 240, 0.82);
}

body[data-ui="v3"] .cockpit-header__meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
  min-width: min(100%, 260px);
  flex: 1 1 280px;
}

body[data-ui="v3"] .cockpit-chip-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

body[data-ui="v3"] .cockpit-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(30, 41, 59, 0.55);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #cbd5e1;
}

body[data-ui="v3"] .cockpit-chip--info {
  border-color: rgba(125, 211, 252, 0.3);
  background: rgba(8, 47, 73, 0.42);
  color: #bae6fd;
}

body[data-ui="v3"] .cockpit-chip--ok {
  border-color: rgba(110, 231, 183, 0.25);
  background: rgba(6, 78, 59, 0.35);
  color: #d1fae5;
}

body[data-ui="v3"] .cockpit-chip--accent {
  border-color: rgba(96, 165, 250, 0.28);
  background: rgba(37, 99, 235, 0.16);
  color: #dbeafe;
}

body[data-ui="v3"] .cockpit-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
}

body[data-ui="v3"] .cockpit-action,
body[data-ui="v3"] .btn.cockpit-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.72);
  font-size: 13px;
  color: #e2e8f0;
  text-decoration: none;
  box-shadow: none;
  transform: none;
}

body[data-ui="v3"] .cockpit-action:hover,
body[data-ui="v3"] .btn.cockpit-action:hover {
  border-color: rgba(96, 165, 250, 0.42);
  background: rgba(37, 99, 235, 0.18);
  box-shadow: none;
  transform: none;
}

body[data-ui="v3"] .cockpit-action--accent,
body[data-ui="v3"] .btn.cockpit-action--accent {
  border-color: rgba(125, 211, 252, 0.32);
  background: rgba(14, 116, 144, 0.16);
}

body[data-ui="v3"] .cockpit-action--ok,
body[data-ui="v3"] .btn.cockpit-action--ok {
  border-color: rgba(110, 231, 183, 0.4);
  background: rgba(6, 95, 70, 0.22);
  color: #d1fae5;
}

body[data-ui="v3"] .cockpit-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(96, 165, 250, 0.18);
  background: linear-gradient(180deg, rgba(10, 19, 38, 0.9), rgba(15, 23, 42, 0.78));
  box-shadow: 0 10px 22px rgba(2, 6, 23, 0.14);
}

body[data-ui="v3"] .cockpit-panel__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

body[data-ui="v3"] .cockpit-panel__eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #93c5fd;
}

body[data-ui="v3"] .cockpit-panel__title {
  margin: 2px 0 0;
  font-size: 14px;
  line-height: 1.25;
  color: #f8fafc;
}

body[data-ui="v3"] .cockpit-panel__summary {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: #cbd5e1;
}

body[data-ui="v3"] .input {
    width: 100%;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-soft);
    color: var(--text);
    font: inherit;
    transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

body[data-ui="v3"] .input:hover {
    border-color: var(--border-strong);
}

body[data-ui="v3"] .input::placeholder {
    color: #64748b;
}

body[data-ui="v3"] main.content {
    flex: 1;
    width: min(1120px, 100%);
    margin: 32px auto 48px;
    padding: 0 28px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

body[data-ui="v3"] .card {
    background: rgba(17, 28, 46, 0.92);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 20px 22px;
    box-shadow: 0 22px 50px rgba(2, 13, 27, 0.36);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

body[data-ui="v3"] .cockpit-shell,
body[data-ui="v3"] .card.cockpit-shell {
  position: relative;
  overflow: visible;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  border-radius: 20px;
  border: 1px solid rgba(94, 234, 212, 0.16);
  background: radial-gradient(circle at top left, rgba(14, 116, 144, 0.18), transparent 40%), linear-gradient(145deg, rgba(8, 15, 28, 0.98), rgba(17, 24, 39, 0.94));
  box-shadow: 0 24px 56px rgba(2, 6, 23, 0.24);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

body[data-ui="v3"] .cockpit-shell--compact,
body[data-ui="v3"] .card.cockpit-shell--compact {
  gap: 12px;
  padding: 14px 16px 10px;
}

body[data-ui="v3"] .cockpit-shell--framed,
body[data-ui="v3"] .card.cockpit-shell--framed {
  border-color: rgba(96, 165, 250, 0.2);
}

body[data-ui="v3"] .cockpit-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

body[data-ui="v3"] .row {
    display: flex;
    align-items: center;
    gap: 12px;
}

body[data-ui="v3"] .stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

body[data-ui="v3"] .stat-card {
    padding: 14px 16px;
    border-radius: 14px;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 96px;
}

body[data-ui="v3"] .stat-card__label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-soft);
}

body[data-ui="v3"] .stat-card__value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text);
}

body[data-ui="v3"] .stat-card--warn {
    border-color: rgba(245, 158, 11, 0.35);
    background: rgba(245, 158, 11, 0.12);
}

body[data-ui="v3"] .stat-card--error {
    border-color: rgba(239, 68, 68, 0.35);
    background: rgba(239, 68, 68, 0.12);
}

body[data-ui="v3"] .status-card {
    border: 1px solid var(--border);
    background: var(--bg-soft);
    color: var(--text);
    transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

body[data-ui="v3"] .status-card:hover {
    transform: translateY(-1px);
    border-color: var(--accent);
    background: rgba(59, 130, 246, 0.16);
}

body[data-ui="v3"] .status-card.active {
    border-color: var(--accent);
    background: var(--accent-soft);
}

body[data-ui="v3"] .table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    min-width: 640px;
}

body[data-ui="v3"] .table th,
body[data-ui="v3"] .table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

body[data-ui="v3"] .table thead th {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-soft);
    background: rgba(15, 23, 42, 0.72);
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 1;
}

body[data-ui="v3"] .table tbody tr:hover {
    background: rgba(59, 130, 246, 0.08);
}

body[data-ui="v3"] .table tbody tr.active {
    background: rgba(59, 130, 246, 0.16);
}

body[data-ui="v3"] .stub-pill {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: rgba(52, 211, 153, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: #5eead4;
}

body[data-ui="v3"] .drawer-backdrop {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(10, 14, 22, 0.64);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    z-index: 80;
}

body[data-ui="v3"] .drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: min(360px, 90vw);
    height: 100vh;
    background: rgba(12, 19, 32, 0.96);
    border-left: 1px solid var(--border);
    box-shadow: -24px 0 40px rgba(3, 12, 26, 0.38);
    display: flex;
    flex-direction: column;
    z-index: 90;
}

body[data-ui="v3"] .drawer header {
    padding: 20px 22px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
}

body[data-ui="v3"] .drawer-content {
    flex: 1;
    overflow: auto;
    padding: 20px 22px 32px;
}

body[data-ui="v3"] .drawer-close {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-soft);
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 8px;
    transition: background 0.18s ease, color 0.18s ease;
}

body[data-ui="v3"] .drawer-close:hover {
    color: var(--text);
    background: rgba(148, 163, 184, 0.16);
}

body[data-ui="v3"] .embed-frame {
    position: relative;
    min-height: 480px;
    margin-top: 16px;
}

body[data-ui="v3"] .embed-frame iframe {
    width: 100%;
    min-height: 480px;
    border: 0;
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.85);
    box-shadow: 0 18px 36px rgba(2, 12, 26, 0.32);
}

body[data-ui="v3"] .embed-frame .embed-loading {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    color: var(--text-soft);
    background: rgba(10, 16, 27, 0.65);
    border-radius: 14px;
    z-index: 2;
    transition: opacity 0.2s ease;
}

body[data-ui="v3"] .embed-frame.is-ready .embed-loading,
body[data-ui="v3"] .embed-frame .embed-loading[style*="display: none"] {
    opacity: 0;
    pointer-events: none;
}

body[data-ui="v3"] .alerts .row {
    align-items: flex-start;
}

body[data-ui="v3"].embedded .topbar {
    background: rgba(10, 16, 27, 0.92);
}

@media (max-width: 860px) {
  body[data-ui="v3"] .topbar {
      flex-wrap: wrap;
      gap: 12px;
  }

  body[data-ui="v3"] .tabs {
      order: 3;
      /* The base rule's flex-basis 0 kept the nav on the first topbar line squeezed
         beside the header controls; a full-row basis lets it wrap onto its own line. */
      flex: 1 1 100%;
      width: 100%;
      justify-content: flex-start;
      flex-wrap: nowrap;
      overflow-x: auto;
      padding-bottom: 4px;
  }

  body[data-ui="v3"] main.content {
      padding: 0 18px 40px;
  }

  body[data-ui="v3"] .table {
      min-width: 520px;
  }
}

@media (max-width: 620px) {
  body[data-ui="v3"] .topbar {
      padding: 12px 18px;
  }

  body[data-ui="v3"] main.content {
      margin-top: 24px;
  }

  body[data-ui="v3"] .card {
      padding: 18px;
  }

    body[data-ui="v3"] .cockpit-shell,
    body[data-ui="v3"] .card.cockpit-shell {
      padding: 14px;
    }

    body[data-ui="v3"] .cockpit-header__copy,
    body[data-ui="v3"] .cockpit-header__meta {
      min-width: 0;
      flex-basis: 100%;
    }

    body[data-ui="v3"] .cockpit-actions {
      width: 100%;
      justify-content: flex-start;
    }

    body[data-ui="v3"] .cockpit-action,
    body[data-ui="v3"] .btn.cockpit-action {
      width: 100%;
    }

    body[data-ui="v3"] .cockpit-header__subtitle {
      max-width: none;
      font-size: 13px;
    }
}

@media (max-width: 480px) {
  body[data-ui="v3"] .topbar {
      flex-wrap: nowrap !important;
  }

  body[data-ui="v3"] .tabs {
      order: 0;
      width: auto;
      /* Keep the horizontal scroll from the earlier 480px block: with the topbar's
         overflow hidden, a visible-overflow override here clipped primary tabs instead. */
      flex-wrap: nowrap;
      overflow-x: auto;
      overflow-y: hidden;
      padding-bottom: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  body[data-ui="v3"] *,
  body[data-ui="v3"] *::before,
  body[data-ui="v3"] *::after {
      transition-duration: 0.01ms !important;
      animation-duration: 0.01ms !important;
  }
}

