/* =========================
   Global theme & typography
   ========================= */

   :root {
    --bg: #f3f4f6;
    --card-bg: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --border: #e5e7eb;
    --primary: #2563eb;
    --primary-100: #dbeafe;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
    --success: #16a34a;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #0ea5e9;
  
    /* Heat-map buckets (days since last cleaning) */
    --heat-fresh: #22c55e;
    --heat-4plus: #a3e635;
    --heat-7plus: #fde047;
    --heat-10plus: #f59e0b;
    --heat-14plus: #ef4444;
    --heat-never: #9ca3af;
  }
  
  * {
    box-sizing: border-box;
  }
  
  html {
    height: 100%;
    overflow-x: hidden;
  }

  body {
    margin: 0;
    min-height: 100%;
    min-height: 100vh;
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
  }
  
  /* =========================
     Header
     ========================= */
  
  header {
    background: #eef2ff;
    padding: 16px 24px;
    border-bottom: 1px solid #e0e7ff;
  }
  
  h1 {
    margin: 0;
    font-size: 22px;
    color: #111827;
  }
  
  .subheader {
    font-size: 13px;
    color: #6b7280;
  }
  
  /* =========================
     Main layout & cards
     ========================= */
  
  main {
    padding: 16px 24px 40px;
    max-width: 1600px;
    margin: 0 auto;
  }
  
  .card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow);
    padding: 16px;
    margin-bottom: 16px;
  }
  
  .streamers-card {
    padding: 24px;
  }
  
  .card-title {
    font-size: 18px;
    margin: 0 0 12px 0;
    display: flex;
    align-items: center;
    gap: 8px;
  }
  
  /* =========================
     Grid utilities
     ========================= */
  
  .grid {
    display: grid;
    gap: 10px;
  }
  
  .grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  
  .grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  
  .grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  
  .grid-5 {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
  
  @media (max-width: 900px) {
    .grid-3,
    .grid-4,
    .grid-5 {
      grid-template-columns: repeat(2, 1fr);
    }
  }
  
  @media (max-width: 600px) {
    .grid-2 {
      grid-template-columns: 1fr;
    }
  }
  
  /* =========================
     Form elements
     ========================= */
  
  label {
    font-size: 14px;
    color: var(--muted);
    display: block;
  }
  
  input,
  select,
  button,
  textarea {
    font-family: inherit;
    font-size: 14px;
  }
  
  input,
  select,
  textarea {
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #f9fafb;
    color: var(--text);
    width: 100%;
    margin-top: 4px;
  }
  
  input:focus,
  select:focus,
  textarea:focus {
    outline: 2px solid var(--primary-100);
    border-color: var(--primary);
  }
  
  /* =========================
     Buttons
     ========================= */
  
  .btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s;
  }
  
  .btn-primary {
    background: var(--primary);
    color: #fff;
  }
  
  .btn-primary:hover {
    background: #1d4ed8;
  }
  
  .btn-secondary {
    background: #e5e7eb;
    color: #111827;
  }
  
  .btn-secondary:hover {
    background: #d1d5db;
  }
  
  .btn-danger {
    background: var(--danger);
    color: #fff;
  }
  
  .btn-danger:hover {
    background: #dc2626;
  }
  
  .btn-outline {
    background: #fff;
    border-color: var(--border);
    color: #111827;
  }
  
  .btn-outline:hover {
    background: #f9fafb;
  }

  .btn-outline-danger {
    border-color: var(--danger);
    color: var(--danger);
  }

  .btn-outline-danger:hover {
    background: #fef2f2;
    color: #b91c1c;
  }
  
  .btn:disabled {
    opacity: 0.6;
    cursor: default;
  }
  
  .actions {
    margin-top: 12px;
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
  }
  
  .status {
    margin-left: 8px;
    font-size: 13px;
  }
  
  /* =========================
     Alerts
     ========================= */
  
  .alert {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f9fafb;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 16px;
  }
  
  .alert-icon {
    font-size: 20px;
  }
  
  .alert-critical .alert-icon {
    color: var(--danger);
  }
  
  .alert-warning .alert-icon {
    color: var(--warning);
  }
  
  .alert-uncleaned .alert-icon {
    color: var(--muted);
  }
  
  .alert-title {
    font-weight: 600;
  }
  
  .alert-sub {
    font-size: 13px;
    color: var(--muted);
  }
  
  /* =========================
     Method selection tiles
     ========================= */
  
  .method-tiles {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
  }
  
  .method-tile {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px;
    text-align: center;
    background: #fff;
    box-shadow: var(--shadow);
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
  }
  
  .method-tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  }
  
  .method-tile.active {
    outline: 2px solid var(--primary);
    border-color: var(--primary);
    background: var(--primary-100);
  }
  
  .method-name {
    margin-top: 8px;
    font-weight: 600;
    font-size: 13px;
  }
  
  /* =========================
     Legend
     ========================= */
  
  .legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
  }
  
  .legend .badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
  }
  
  .legend-swatch {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 1px solid #d1d5db;
  }
  
  /* =========================
     Vertical heat-map (centered, no scroll, integrated modules)
     ========================= */
  
  .hm-grid-vertical {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
    padding: 16px 0;
  }
  
  .hm-col {
    display: grid;
    grid-template-rows: 36px repeat(var(--sections), 32px);
    gap: 4px;
    flex-shrink: 0;
  }
  
  .hm-col-label {
    width: 52px;
    height: 36px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: linear-gradient(135deg, #2563eb, #1e40af);
    border: none;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.3);
  }
  
  .hm-vcell {
    width: 52px;
    height: 32px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #111827;
    border: 1px solid #d1d5db;
    background: #fff;
    user-select: none;
    cursor: pointer;
    transition: all 0.15s ease;
  }
  
  .hm-vcell:hover:not(.hm-module):not(.hm-channel-ref):not(.hm-tail-ref):not(.hm-module-row) {
    transform: scale(1.08);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    z-index: 10;
  }
  
  /* Module cells - integrated into streamer */
  .hm-vcell.hm-module {
    background: #fbbf24 !important;
    border: 2px solid #f59e0b !important;
    color: #78350f;
    font-weight: 700;
    font-size: 10px;
    cursor: default;
    pointer-events: none;
  }
  
  /* Heat buckets */
  .hm-vcell[data-age="fresh"] {
    background: var(--heat-fresh);
    color: #fff;
    border-color: #16a34a;
  }
  
  .hm-vcell[data-age="4plus"] {
    background: var(--heat-4plus);
    border-color: #84cc16;
  }
  
  .hm-vcell[data-age="7plus"] {
    background: var(--heat-7plus);
    border-color: #eab308;
  }
  
  .hm-vcell[data-age="10plus"] {
    background: var(--heat-10plus);
    color: #fff;
    border-color: #ea580c;
  }
  
  .hm-vcell[data-age="14plus"] {
    background: var(--heat-14plus);
    color: #fff;
    border-color: #dc2626;
  }
  
  .hm-vcell[data-age="never"] {
    background: var(--heat-never);
    color: #fff;
    border-color: #6b7280;
  }
  
  /* Drag feedback for selection */
  .hm-vcell.dragging {
    outline: 3px solid var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
    transform: scale(1.05);
    z-index: 50;
  }
  
  .hm-vcell.saved {
    outline: 3px solid var(--success);
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.2);
    animation: pulse 0.6s ease;
  }
  
  @keyframes pulse {
    0%, 100% {
      transform: scale(1);
    }
    50% {
      transform: scale(1.15);
    }
  }
  
  /* =========================
     Modal
     ========================= */
  
  .modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    align-items: center;
    justify-content: center;
  }
  
  .modal.show {
    display: flex;
  }
  
  .modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
  }
  
  .modal-content {
    position: relative;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow: auto;
    animation: modalSlideIn 0.3s ease;
  }
  
  @keyframes modalSlideIn {
    from {
      opacity: 0;
      transform: translateY(-30px) scale(0.95);
    }
    to {
      opacity: 1;
      transform: translateY(0) scale(1);
    }
  }
  
  .modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
  }
  
  .modal-header h3 {
    margin: 0;
    font-size: 20px;
    color: #111827;
  }
  
  .modal-close {
    background: none;
    border: none;
    font-size: 32px;
    color: #6b7280;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
  }
  
  .modal-close:hover {
    background: #f3f4f6;
    color: #111827;
  }
  
  .modal-body {
    padding: 24px;
  }
  
  .modal-summary {
    margin-top: 20px;
    padding: 16px;
    background: #f9fafb;
    border-radius: 10px;
    border: 1px solid var(--border);
  }
  
  .summary-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #e5e7eb;
  }
  
  .summary-item:last-child {
    border-bottom: none;
  }
  
  .summary-label {
    font-size: 14px;
    color: #6b7280;
    font-weight: 500;
  }
  
  .summary-value {
    font-size: 14px;
    color: #111827;
    font-weight: 600;
  }
  
  .modal-footer {
    display: flex;
    gap: 12px;
    padding: 20px 24px;
    border-top: 1px solid var(--border);
    justify-content: flex-end;
  }
  
  .modal-footer .btn {
    min-width: 100px;
  }
  
  /* =========================
     Table (history)
     ========================= */
  
  .table-wrapper {
    overflow-x: auto;
    max-height: 400px;
    overflow-y: auto;
  }
  
  table {
    border-collapse: collapse;
    width: 100%;
  }
  
  th,
  td {
    border-bottom: 1px solid var(--border);
    padding: 10px;
    text-align: left;
    font-size: 13px;
  }
  
  th {
    background: #f8fafc;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 400;
  }
  
  tr:hover {
    background: #f9fafb;
  }
  
  /* =========================
     KPIs & bars
     ========================= */
  
  .kpis {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
  }
  
  .kpi {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow);
    padding: 12px;
  }
  
  .kpi-title {
    font-size: 13px;
    color: var(--muted);
  }
  
  .kpi-value {
    font-size: 20px;
    font-weight: 700;
    margin: 4px 0;
  }
  
  .kpi-sub {
    font-size: 12px;
    color: var(--muted);
  }
  
  .bar {
    height: 16px;
    background: #eef2ff;
    border-radius: 999px;
    overflow: hidden;
    margin-top: 4px;
  }
  
  .bar-fill {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.3s ease;
  }
  
  .bar-label {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    margin: 6px 0 2px;
  }
  
  /* =========================
     CSV textarea
     ========================= */
  
  .csv-output {
    margin-top: 8px;
    width: 100%;
    height: 120px;
    display: none;
    font-family: monospace;
    font-size: 12px;
  }

  .csv-import-progress {
    font-size: 13px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    align-self: center;
  }
  
  /* =========================
     Left Sidebar Navigation
     ========================= */
  
  .sidebar-nav {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    background: #fff;
    border: 1px solid var(--border);
    border-left: none;
    border-radius: 0 12px 12px 0;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
    z-index: 100;
    padding: 8px 0;
  }
  
  .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 3px solid transparent;
  }
  
  .nav-item:hover {
    background: #f9fafb;
  }
  
  .nav-item.active {
    background: #eff6ff;
    border-left-color: var(--primary);
  }
  
  .nav-icon {
    font-size: 24px;
    margin-bottom: 4px;
  }
  
  .nav-label {
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
  }
  
  .nav-item.active .nav-label {
    color: var(--primary);
  }
  
  .main-wrapper {
    margin-left: 90px; /* Adjust based on actual sidebar width */
  }
  
  main {
    padding: 16px 24px 40px;
    max-width: 1600px;
    margin: 0 auto;
  }
  
  /* =========================
     Streamer Cards
     ========================= */
  
     .streamer-cards {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 12px;
    }
    
    .streamer-card {
      background: #fff;
      border: 1px solid var(--border);
      border-radius: 10px;
      padding: 14px;
      transition: all 0.2s;
    }
    
    .streamer-card:hover {
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
      transform: translateY(-2px);
    }
    
    .streamer-card-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 8px;
    }
    
    .streamer-card-title {
      font-weight: 700;
      font-size: 14px;
      color: #111827;
    }
    
    .streamer-card-percent {
      font-weight: 700;
      font-size: 20px;
      color: var(--primary);
    }
    
    .streamer-card-detail {
      font-size: 12px;
      color: #6b7280;
      margin-bottom: 10px;
    }
    
    .progress-bar {
      height: 6px;
      background: #e5e7eb;
      border-radius: 999px;
      overflow: hidden;
    }
    
    .progress-fill {
      height: 100%;
      background: linear-gradient(90deg, var(--primary), #60a5fa);
      transition: width 0.3s ease;
    }
    
    /* Responsive adjustments for streamer cards */
    @media (max-width: 1200px) {
      .streamer-cards {
        grid-template-columns: repeat(3, 1fr);
      }
    }
    
    @media (max-width: 900px) {
      .streamer-cards {
        grid-template-columns: repeat(2, 1fr);
      }
    }
    
    @media (max-width: 600px) {
      .streamer-cards {
        grid-template-columns: 1fr;
      }
    }
  
  /* =========================
     Channel reference column
     ========================= */
  
  .hm-col-channel {
    background: #f9fafb;
    border-right: 2px solid var(--border);
  }
  
  .hm-col-label-channel {
    background: #6b7280 !important;
  }
  
  .hm-channel-ref,
  .hm-tail-ref {
    background: #f3f4f6 !important;
    font-size: 9px;
    color: #6b7280;
    pointer-events: none;
    font-weight: 600;
  }
  
  .hm-module-row {
    background: #fbbf24 !important;
    font-weight: bold;
    pointer-events: none;
    border: 2px solid #f59e0b !important;
  }
  
  .hm-tail-section {
    position: relative;
    border-color: #a78bfa;
    font-weight: 600;
  }
  
  /* Add a diagonal stripe pattern overlay */
  .hm-tail-section::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: inherit;
    background-image: repeating-linear-gradient(
      45deg,
      rgba(255, 255, 255, 0.15) 0,
      rgba(255, 255, 255, 0.15) 4px,
      transparent 4px,
      transparent 8px
    );
  }
  
  .hm-tail-section[data-age="fresh"] {
    border-color: #7c3aed;
  }
  
  /* =========================
     Sortable table headers
     ========================= */
  
  .sortable {
    cursor: pointer;
    user-select: none;
  }
  
  .sortable:hover {
    background: #e5e7eb;
  }
  
  .sortable.sorted {
    background: #dbeafe;
    color: var(--primary);
  }
  
  .sort-icon {
    font-size: 12px;
    margin-left: 4px;
    opacity: 0.5;
  }
  
  .sortable:hover .sort-icon {
    opacity: 1;
  }
  
  /* =========================
     Grid container for heatmap
     ========================= */
  
  .hm-grid-container {
    overflow: visible;
    padding: 8px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
  }
  
  /* =========================
     Filter controls styling (NEW)
     ========================= */
  
  .filter-controls {
    margin-bottom: 16px;
  }
  
  /* =========================
     Streamer overview section within stats (NEW)
     ========================= */
  
  .streamer-overview-section {
    margin-top: 24px;
    margin-bottom: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
  }
  
  .section-subtitle {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 12px;
    margin-top: 0;
  }
  
  /* Adjust KPIs margin when following streamer cards */
  .streamer-overview-section + .kpis {
    margin-top: 16px;
  }
  
  /* =========================
     Method breakdown spacing (NEW)
     ========================= */
  
  .method-breakdown {
    margin-top: 16px;
  }
  
  /* =========================
     Responsive adjustments
     ========================= */
  
  @media (max-width: 900px) {
    .method-tiles {
      grid-template-columns: repeat(3, 1fr);
    }
  
    .kpis {
      grid-template-columns: repeat(2, 1fr);
    }
  }
  
  @media (max-width: 600px) {
    .method-tiles {
      grid-template-columns: repeat(2, 1fr);
    }
  
    .kpis {
      grid-template-columns: 1fr;
    }
  
    .hm-col {
      grid-template-rows: 32px repeat(var(--sections, 107), 28px);
    }
  
    .hm-vcell {
      width: 45px;
      height: 28px;
      font-size: 9px;
    }
  
    .hm-col-label {
      width: 45px;
      height: 32px;
    }
  }
  
  /* =========================
     Hover Tooltip for Sections
     ========================= */
  
  .section-tooltip {
    position: fixed;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    color: #fff;
    padding: 0;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.1);
    z-index: 10000;
    pointer-events: none;
    font-size: 13px;
    min-width: 240px;
    display: none;
    overflow: hidden;
  }
  
  .section-tooltip.show {
    display: block;
  }
  
  .tooltip-header {
    font-weight: 700;
    font-size: 15px;
    padding: 14px 16px;
    background: rgba(59, 130, 246, 0.15);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: #60a5fa;
    letter-spacing: 0.3px;
  }
  
  .tooltip-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 16px;
    font-size: 13px;
    align-items: center;
  }
  
  .tooltip-label {
    color: #94a3b8;
    font-weight: 500;
  }
  
  .tooltip-value {
    font-weight: 600;
    color: #e2e8f0;
  }
  
  .tooltip-method {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(59, 130, 246, 0.2);
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 12px;
    color: #93c5fd;
  }
  
  .tooltip-section {
    margin-top: 0;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }
  
  .tooltip-age {
    color: #6ee7b7;
    font-weight: 700;
    font-size: 13px;
    background: rgba(52, 211, 153, 0.15);
    padding: 4px 10px;
    border-radius: 6px;
  }
  
  .tooltip-age.old {
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.15);
  }

  /* Streamer column header tooltip (Step 8) */
  .hm-col-label.hm-header {
    cursor: pointer; /* match section cells */
  }

  .hm-col-label.hm-header:hover {
    background: rgba(59, 130, 246, 0.12);
  }

  .streamer-header-tooltip {
    position: fixed;
    z-index: 10001;
    pointer-events: none;
    display: none;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    color: #e2e8f0;
    padding: 12px 14px;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.08);
    font-size: 12px;
    min-width: 200px;
    max-width: 280px;
  }

  .streamer-tooltip-title {
    font-weight: 700;
    font-size: 14px;
    color: #60a5fa;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  .streamer-tooltip-row {
    padding: 2px 0;
    color: #cbd5e1;
  }
  
  .kpi-breakdown {
    font-size: 14px;
    margin-top: 6px;
    color: #000000;
    line-height: 2.0;
  }
  

  /* PDF Generation Button */
#generatePdfBtn {
  width: 100%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 12px 24px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s ease;
  font-size: 14px;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

#generatePdfBtn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

#generatePdfBtn:active {
  transform: translateY(0);
}

#pdf-status {
  margin-top: 10px;
  font-size: 14px;
  text-align: center;
  min-height: 20px;
}

/* Delete Modal Specific Styles */
.modal-delete .modal-content {
  max-width: 550px;
}

.modal-header-delete {
  background: #fef2f2;
  border-bottom-color: #fecaca;
}

.modal-header-delete h3 {
  color: #991b1b;
}

.modal-header-warning {
  background: #fffbeb;
  border-bottom-color: #fde68a;
}

.modal-header-warning h3 {
  color: #92400e;
}

.clean-warning {
  display: flex;
  gap: 12px;
  padding: 16px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 10px;
  margin-bottom: 16px;
  align-items: flex-start;
}

.clean-warning-text {
  font-size: 14px;
  color: #78350f;
  line-height: 1.5;
}

.clean-warning-text strong {
  font-weight: 700;
  display: block;
  margin-bottom: 4px;
}

.modal-body-note {
  margin: 0;
  font-size: 14px;
  color: var(--text-muted);
}

.delete-warning {
  display: flex;
  gap: 12px;
  padding: 16px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 10px;
  margin-bottom: 20px;
  align-items: flex-start;
}

.warning-icon {
  font-size: 24px;
  line-height: 1;
  flex-shrink: 0;
}

.warning-text {
  font-size: 14px;
  color: #7f1d1d;
  line-height: 1.5;
}

.warning-text strong {
  font-weight: 700;
  display: block;
  margin-bottom: 4px;
}

.event-details {
  background: #f9fafb;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid #e5e7eb;
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-label {
  font-size: 14px;
  font-weight: 500;
  color: #6b7280;
}

.detail-value {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
  text-align: right;
}

.modal-footer-delete {
  background: #f9fafb;
}

.modal-footer-delete .btn-danger {
  min-width: 140px;
}

/* Set All Coating modal – option buttons */
.coating-modal-options {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.coating-modal-option {
  flex: 1;
  min-width: 100px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #ffffff;
  color: #374151;
  cursor: pointer;
  transition: all 0.2s ease;
}

.coating-modal-option:hover {
  border-color: #3b82f6;
  background: #eff6ff;
  color: #1d4ed8;
}

.coating-modal-option.active {
  border-color: #3b82f6;
  background: #3b82f6;
  color: #ffffff;
}


/* Configuration Collapse Styles */
.config-header {
  display: flex !important;
  justify-content: space-between;
  align-items: center;
  transition: all 0.3s ease;
}

.config-header:hover {
  color: var(--primary);
}

.collapse-icon {
  font-size: 16px;
  transition: transform 0.3s ease;
  color: var(--muted);
}

.collapse-icon.collapsed {
  transform: rotate(-90deg);
}

.config-collapsible {
  max-height: 50000px;
  overflow: visible;
  transition: max-height 0.4s ease, opacity 0.3s ease, padding 0.3s ease;
  opacity: 1;
}

.config-collapsible.collapsed {
  max-height: 0;
  opacity: 0;
  padding: 0;
}

/* =========================
   Login Page Styles
   ========================= */

.login-page {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0f172a 100%);
  overflow: hidden;
  z-index: 9999;
}

/* Animated background waves */
.login-page::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(ellipse at 20% 80%, rgba(59, 130, 246, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(34, 197, 94, 0.1) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(99, 102, 241, 0.08) 0%, transparent 70%);
  animation: pulseGlow 8s ease-in-out infinite;
}

@keyframes pulseGlow {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* Wave animation at bottom */
.login-page::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 200px;
  background: linear-gradient(0deg, rgba(59, 130, 246, 0.2) 0%, transparent 100%);
  animation: waveFloat 6s ease-in-out infinite;
}

@keyframes waveFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-20px); }
}

.login-container {
  position: relative;
  z-index: 10;
  background: rgba(255, 255, 255, 0.98);
  border-radius: 24px;
  box-shadow: 
    0 25px 80px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  margin: 20px;
  backdrop-filter: blur(20px);
  animation: slideUp 0.6s ease-out;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(40px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.login-header {
  text-align: center;
  margin-bottom: 36px;
}

.login-logo {
  font-size: 56px;
  margin-bottom: 16px;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.login-header h1 {
  font-size: 26px;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 10px 0;
  letter-spacing: -0.5px;
}

.login-subtitle {
  color: #64748b;
  font-size: 15px;
  margin: 0;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.login-form .form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.login-form .form-group > label {
  font-weight: 600;
  color: #334155;
  font-size: 14px;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 14px;
  font-size: 18px;
  z-index: 1;
  pointer-events: none;
}

.login-form input[type="text"],
.login-form input[type="password"] {
  width: 100%;
  padding: 14px 14px 14px 48px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  font-size: 15px;
  background: #f8fafc;
  transition: all 0.2s ease;
  margin-top: 0;
}

.login-form input[type="text"]:focus,
.login-form input[type="password"]:focus {
  outline: none;
  border-color: #3b82f6;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}

.password-toggle {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: background 0.2s;
}

.password-toggle:hover {
  background: #e2e8f0;
}

.login-error {
  display: none;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 14px;
  text-align: center;
  font-weight: 500;
  animation: shake 0.4s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.login-btn {
  width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(37, 99, 235, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
}

.login-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(37, 99, 235, 0.45);
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.login-btn:active {
  transform: translateY(0);
}

.login-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.login-footer {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid #e2e8f0;
  text-align: center;
}

.login-footer p {
  font-size: 13px;
  color: #64748b;
  margin: 0 0 12px 0;
}

.access-info {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.access-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.access-badge.superuser {
  background: linear-gradient(135deg, #fae8ff 0%, #f3e8ff 100%);
  color: #6b21a8;
  border: 1px solid #a855f7;
}

.access-badge.admin {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  color: #92400e;
  border: 1px solid #f59e0b;
}

.access-badge.viewer {
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
  color: #1e40af;
  border: 1px solid #3b82f6;
}

/* =========================
   User Header Bar
   ========================= */

.user-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  background: linear-gradient(135deg, #1e3a5f 0%, #0f172a 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  position: sticky;
  top: 0;
  z-index: 500;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  font-size: 28px;
  background: rgba(255, 255, 255, 0.15);
  padding: 6px;
  border-radius: 50%;
}

.user-name {
  font-weight: 600;
  color: #fff;
  font-size: 15px;
}

.user-role-badge {
  padding: 5px 12px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 600;
}

.user-role-badge.superuser {
  background: linear-gradient(135deg, #fae8ff 0%, #f3e8ff 100%);
  color: #6b21a8;
}

.user-role-badge.admin {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  color: #92400e;
}

.user-role-badge.viewer {
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
  color: #1e40af;
}

.user-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.back-to-main-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.back-to-main-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.logout-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.logout-btn:hover {
  background: rgba(239, 68, 68, 0.8);
  border-color: #ef4444;
}

/* =========================
   View Only Badge (for non-admin users in log table)
   ========================= */

.view-only-badge {
  display: inline-block;
  padding: 4px 10px;
  background: #f1f5f9;
  color: #64748b;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
}

/* =========================
   App Container
   ========================= */

.app-container {
  min-height: 100vh;
}

/* =========================
   Toast Notifications
   ========================= */

.toast-container {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 20px;
  border-radius: 14px;
  box-shadow: 
    0 10px 40px rgba(0, 0, 0, 0.2),
    0 0 0 1px rgba(255, 255, 255, 0.1);
  min-width: 320px;
  max-width: 420px;
  pointer-events: auto;
  animation: toastSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(12px);
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateX(100px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

.toast.toast-exit {
  animation: toastSlideOut 0.3s ease-in forwards;
}

@keyframes toastSlideOut {
  from {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateX(100px) scale(0.9);
  }
}

.toast-icon {
  font-size: 24px;
  flex-shrink: 0;
  line-height: 1;
}

.toast-content {
  flex: 1;
}

.toast-title {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 4px;
}

.toast-message {
  font-size: 14px;
  opacity: 0.9;
  line-height: 1.4;
}

.toast-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  opacity: 0.6;
  transition: all 0.2s;
  flex-shrink: 0;
}

.toast-close:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.1);
}

/* Toast Types */
.toast-error {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.toast-error .toast-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.toast-warning {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.toast-success {
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.toast-info {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

/* Progress bar for auto-dismiss */
.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 4px;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 0 0 14px 14px;
  animation: toastProgress 5s linear forwards;
}

@keyframes toastProgress {
  from { width: 100%; }
  to { width: 0%; }
}

/* Responsive */
@media (max-width: 500px) {
  .toast-container {
    left: 12px;
    right: 12px;
    top: auto;
    bottom: 24px;
  }
  
  .toast {
    min-width: auto;
    max-width: none;
  }
}

/* =========================
   Project Configuration Styles
   ========================= */

.project-header {
  display: flex !important;
  justify-content: space-between;
  align-items: center;
  transition: all 0.3s ease;
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  margin: -16px -16px 0 -16px;
  padding: 16px !important;
  border-radius: 10px 10px 0 0;
  border-bottom: 1px solid #bbf7d0;
}

.project-header:hover {
  color: #16a34a;
}

.project-header span:first-child {
  color: #166534;
}

/* Active Project Banner */
.active-project-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  margin-top: 16px;
}

.active-project-banner.has-project {
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
  border-color: #6ee7b7;
}

.active-project-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.active-project-label {
  font-size: 13px;
  font-weight: 500;
  color: #6b7280;
}

.active-project-name {
  font-size: 16px;
  font-weight: 700;
  color: #111827;
}

.active-project-banner.has-project .active-project-name {
  color: #166534;
}

.active-project-vessel {
  font-size: 13px;
  font-weight: 600;
  color: #2563eb;
  background: #dbeafe;
  padding: 4px 10px;
  border-radius: 6px;
}

/* Project List */
.project-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 380px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 6px;
}

.project-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  background: #f9fafb;
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: all 0.2s;
}

.project-item:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.project-item.active {
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
  border-color: #6ee7b7;
}

.project-item-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.project-number {
  font-weight: 700;
  font-size: 14px;
  color: #111827;
}

.project-name {
  font-size: 13px;
  color: #6b7280;
}

.project-vessel {
  font-size: 12px;
  font-weight: 600;
  color: #2563eb;
  background: #dbeafe;
  padding: 3px 8px;
  border-radius: 4px;
}

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

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.badge-active {
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
  color: #fff;
}

/* Small button variant */
.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

/* Project create section styling */
.project-create-section h3,
.project-list-section h3 {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Project event count badge */
.project-event-count {
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  background: #f3f4f6;
  padding: 4px 10px;
  border-radius: 12px;
  margin-left: 8px;
}

.project-item.active .project-event-count {
  background: rgba(22, 163, 74, 0.15);
  color: #166534;
}

/* =========================
   Backup Management Styles
   ========================= */

#backup-list,
.backup-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 400px;
  height: 500px;
  max-height: 70vh;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 10px;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
}

.backup-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: #f9fafb;
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: all 0.2s;
}

.backup-item:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.backup-item-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.backup-filename {
  font-weight: 600;
  font-size: 13px;
  color: #111827;
  font-family: monospace;
}

.backup-meta {
  font-size: 12px;
  color: #6b7280;
  display: flex;
  gap: 12px;
}

.backup-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

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

.btn-restore {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #fff;
  border: none;
}

.btn-restore:hover {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
}

.backup-empty {
  padding: 24px;
  text-align: center;
  color: #6b7280;
  background: #f9fafb;
  border: 1px dashed var(--border);
  border-radius: 10px;
}

/* =========================
   Utility Classes - Refactored
   ========================= */

/* Display utilities */
.hidden { display: none !important; }
.visible { display: block; }
.flex { display: flex; }
.inline { display: inline; }

/* Section structure */
.section-divider {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.section-heading {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
}

/* Text utilities */
.info-text { font-size: 13px; color: var(--muted); }
.info-text-sm { font-size: 12px; color: var(--muted); margin-top: 8px; }
.text-danger-strong { color: #dc2626; font-weight: 700; }
.delete-warning-text { margin-top: 16px; font-size: 13px; color: #7f1d1d; font-weight: 600; }

/* Component specific */
.method-icon { font-size: 32px; }
.clickable { cursor: pointer; user-select: none; }
.actions-align-end { align-self: flex-end; }
.delete-emphasis { background: #fef2f2; padding: 2px 8px; border-radius: 4px; }

/* Status colors */
.status-error { color: var(--danger); }
.status-info { color: var(--primary); }

/* Spacing utilities */
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }

/* Text utilities - additional */
.text-muted { color: #6b7280; }
.font-normal { font-weight: 400; }
.text-sm { font-size: 14px; }

/* Section title without top margin */
.section-title {
  margin-top: 0;
}

/* Info text medium size */
.info-text-md {
  color: #6b7280;
  font-size: 14px;
}

/* Error text medium size */
.error-text-md {
  color: #ef4444;
  font-size: 14px;
}

/* Width utilities */
.w-full { width: 100%; }

/* Legend swatches */
.legend-swatch-fresh { background: var(--heat-fresh); }
.legend-swatch-4plus { background: var(--heat-4plus); }
.legend-swatch-7plus { background: var(--heat-7plus); }
.legend-swatch-10plus { background: var(--heat-10plus); }
.legend-swatch-14plus { background: var(--heat-14plus); }
.legend-swatch-never { background: var(--heat-never); }
.legend-swatch-module { background: #fbbf24; border: 2px solid #f59e0b; }

/* ============================================
   Per-Streamer Deployment Configuration
   ============================================ */

.streamer-deployment-section {
  margin-top: 24px;
}

.streamer-deployment-panel {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.streamer-deployment-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  margin: 16px 0;
}

.streamer-deployment-bulk-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
}

.streamer-deployment-bulk-actions .bulk-actions-label {
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-right: 4px;
}

.streamer-deployment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.streamer-deployment-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 16px;
  transition: all 0.2s ease;
  position: relative;
}

.streamer-deployment-card:hover {
  border-color: #3b82f6;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
  transform: translateY(-2px);
}

.streamer-deployment-card.has-config {
  border-left: 4px solid #10b981;
  background: linear-gradient(to right, #f0fdf4 0%, #ffffff 100%);
}

.streamer-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e5e7eb;
}

.streamer-card-title {
  font-weight: 600;
  font-size: 14px;
  color: #1f2937;
  display: flex;
  align-items: center;
  gap: 6px;
}

.streamer-card-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 12px;
  background: #f3f4f6;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.streamer-card-badge.configured {
  background: #d1fae5;
  color: #065f46;
}

.streamer-deployment-inputs {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.streamer-input-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.streamer-input-group label {
  font-size: 12px;
  font-weight: 500;
  color: #6b7280;
  display: flex;
  align-items: center;
  gap: 4px;
}

.streamer-input-group input,
.streamer-input-group select {
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  transition: all 0.2s ease;
  background: #ffffff;
}

.streamer-input-group input:focus,
.streamer-input-group select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.streamer-input-group input:disabled,
.streamer-input-group select:disabled {
  background: #f9fafb;
  color: #9ca3af;
  cursor: not-allowed;
}

.streamer-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #f3f4f6;
}

.streamer-card-clear {
  flex: 1;
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 500;
  background: transparent;
  color: #ef4444;
  border: 1px solid #fecaca;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.streamer-card-clear:hover {
  background: #fef2f2;
  border-color: #ef4444;
  color: #dc2626;
}

.streamer-card-clear:active {
  transform: scale(0.98);
}

/* Info badges on cards */
.streamer-info-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  font-size: 11px;
}

.streamer-info-badge {
  padding: 2px 6px;
  border-radius: 4px;
  background: #f3f4f6;
  color: #6b7280;
  display: flex;
  align-items: center;
  gap: 4px;
}

.streamer-info-badge.coating-yes {
  background: #dbeafe;
  color: #1e40af;
}

.streamer-info-badge.coating-no {
  background: #fee2e2;
  color: #991b1b;
}

/* Step 4: Modern deployment card - coating toggle (3-state) */
.streamer-deployment-card.modern .streamer-status {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.streamer-deployment-card.modern .status-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 12px;
  background: #f3f4f6;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.streamer-deployment-card.modern .status-badge.configured {
  background: #d1fae5;
  color: #065f46;
}

.coating-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 6px;
  font-weight: 500;
}

.coating-badge.coated {
  background: #dbeafe;
  color: #1e40af;
}

.coating-badge.uncoated {
  background: #fee2e2;
  color: #991b1b;
}

.coating-badge.unknown {
  background: #f3f4f6;
  color: #6b7280;
}

.coating-toggle {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.coating-option {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #f9fafb;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s ease;
}

.coating-option:hover:not(:disabled) {
  border-color: #3b82f6;
  color: #1f2937;
  background: #eff6ff;
}

.coating-option.active {
  background: #3b82f6;
  border-color: #3b82f6;
  color: #fff;
}

.coating-option:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.btn-icon.btn-clear {
  padding: 6px 10px;
  font-size: 14px;
  background: transparent;
  border: 1px solid #fecaca;
  border-radius: 6px;
  color: #ef4444;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-icon.btn-clear:hover {
  background: #fef2f2;
  border-color: #ef4444;
}

/* =========================
   Cleaning Suggestions Table — urgency badges
   ========================= */

.suggestion-days-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.suggestion-days-4plus {
  background: #ecfccb;
  color: #365314;
}

.suggestion-days-7plus {
  background: #fef9c3;
  color: #713f12;
}

.suggestion-days-10plus {
  background: #fef3c7;
  color: #92400e;
}

.suggestion-days-14plus {
  background: #fee2e2;
  color: #991b1b;
}

.suggestion-days-never {
  background: #f3f4f6;
  color: #374151;
  border: 1px solid #d1d5db;
}

/* =========================
   Noise overlay — planning page
   ========================= */

/* Noise column: hidden by default, shown when table has class has-noise-data */
.noise-col {
  display: none;
}

table.has-noise-data .noise-col {
  display: table-cell;
}

/* Header row: title + noise controls side-by-side */
.noise-controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 4px;
}

.noise-controls-row .card-title {
  margin-bottom: 0;
}

.noise-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Toggle switch */
.noise-toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  font-size: 13px;
  color: var(--text);
}

.noise-toggle-label input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.noise-toggle-label input[type="checkbox"]:disabled ~ .noise-toggle-track {
  opacity: 0.4;
  cursor: not-allowed;
}

.noise-toggle-label input[type="checkbox"]:disabled ~ .noise-toggle-text {
  opacity: 0.5;
  cursor: not-allowed;
}

.noise-toggle-track {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 22px;
  background: #d1d5db;
  border-radius: 999px;
  transition: background 0.2s ease;
  flex-shrink: 0;
}

.noise-toggle-label input[type="checkbox"]:checked ~ .noise-toggle-track {
  background: var(--primary);
}

.noise-toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.noise-toggle-label input[type="checkbox"]:checked ~ .noise-toggle-track .noise-toggle-thumb {
  transform: translateX(16px);
}

/* Upload selector */
.noise-upload-selector {
  font-size: 12px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card-bg, #fff);
  color: var(--text);
  max-width: 220px;
}

/* Upload button — styled as a file label */
.noise-upload-btn {
  font-size: 12px;
  padding: 5px 12px;
  cursor: pointer;
  white-space: nowrap;
}

/* Noise gradient legend */
.noise-legend {
  margin-bottom: 8px;
}

.noise-legend-bar {
  position: relative;
  height: 18px;
  border-radius: 6px;
  background: linear-gradient(
    to right,
    #1e3a8a 0%,
    #ffffff 25%,
    #fed7aa 50%,
    #f97316 62%,
    #dc2626 100%
  );
  margin-bottom: 4px;
  max-width: 480px;
}

.noise-legend-tick {
  position: absolute;
  top: 22px;
  transform: translateX(-50%);
  font-size: 11px;
  color: var(--muted, #6b7280);
  white-space: nowrap;
}

.noise-legend-labels {
  display: flex;
  justify-content: space-between;
  max-width: 480px;
  font-size: 11px;
  color: var(--muted, #6b7280);
  margin-top: 28px;
}

/* Noise value badge in the suggestions table */
.noise-rms-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

/* Utility: small margin-top */
.mt-8 {
  margin-top: 8px;
}

/* =========================
   App loading overlay
   ========================= */

.app-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(243, 244, 246, 0.85);
  backdrop-filter: blur(2px);
  /* Block all interaction with content behind the overlay */
  pointer-events: all;
}

.app-loading-overlay.hidden {
  display: none;
}

.app-loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.spinner-ring {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spinner-rotate 0.75s linear infinite;
}

@keyframes spinner-rotate {
  to { transform: rotate(360deg); }
}

.spinner-label {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  font-weight: 500;
}

/* =========================
   Log table pagination
   ========================= */

.log-pagination {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0 4px;
  flex-wrap: wrap;
}

.log-pagination .pagination-info {
  font-size: 13px;
  color: var(--muted);
  flex: 1;
  min-width: 120px;
}

.log-pagination .page-size-label {
  font-size: 13px;
  color: var(--muted);
}

.log-pagination select {
  font-size: 13px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card-bg);
  color: var(--text);
  cursor: pointer;
}

.log-pagination .btn {
  padding: 5px 14px;
  font-size: 13px;
}

.log-pagination .btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
