/* BKT R&D Cluster application styles - extracted for browser caching. */

/* Utility: permanently hidden data table section */
.data-table-hidden { display: none !important; }

:root {
    --primary-gradient: linear-gradient(135deg, #3b82f6 0%, #2563eb 50%, #1d4ed8 100%);
    --success-gradient: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    --glass-bg: rgba(255, 255, 255, 0.98);
    --glass-border: 1px solid rgba(255, 255, 255, 0.8);
    --card-shadow: 0 8px 28px rgba(0, 0, 0, 0.08);
    --text-main: #0f172a;
    --text-muted: #475569;
    --excel-header-bg: #f8fafc;
    --excel-border: #e2e8f0;

    --gridCellPadY: 8px;
    --gridCellLineHeight: 1.25;
    --gridCellWhiteSpace: nowrap;
    --gridCellWordBreak: normal;
    --gridCellPadX: 12px;
    --gridColMinWidth: 140px;
  }

  body {
    font-family: 'Kanit', sans-serif;
    background: linear-gradient(135deg, #f0f4f8 0%, #e8f0f7 50%, #f3f4f6 100%);
    background-attachment: fixed;
    min-height: 100vh;
    height: auto;
    overflow-x: hidden;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    color: var(--text-main);
  }

  /* Admin Helpers
       Use `revert` so Bootstrap utility classes (e.g. `.d-flex`) keep working and
       admin-only blocks don't get forced into the wrong layout. */
  .admin-only {
    display: none !important;
  }

  body.is-admin .admin-only {
    display: revert !important;
  }

  .swal2-container {
    z-index: 20000 !important;
  }

  /* Navbar */
  .navbar {
    min-height: 88px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 250, 252, 0.9) 100%);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
    border-bottom: 1px solid rgba(37, 99, 235, 0.12);
    border-radius: 24px;
    padding: 12px 24px;
    flex-shrink: 0;
    z-index: 1000;
    margin: 12px 18px 0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    gap: 20px;
    justify-content: space-between;
    flex-wrap: nowrap;
    border: 1px solid rgba(255, 255, 255, 0.7);
  }

  .brand-block {
    align-items: center;
    display: flex;
    gap: 12px;
    flex-shrink: 0;
  }

  .brand-logo {
    height: 68px;
    width: auto;
    max-width: 320px;
    object-fit: contain;
    background: transparent;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
    border: none;
    transition: transform 0.2s ease, opacity 0.2s ease;
  }

  .navbar:hover .brand-logo {
    box-shadow: none;
    transform: none;
  }

  .brand-copy {
    display: flex;
    flex-direction: column;
    gap: 4px;
    line-height: 1.05;
  }

  .brand-text {
    font-weight: 900;
    color: #0f172a;
    letter-spacing: -0.7px;
    background: -webkit-linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.1;
    font-size: 1.1rem;
  }

  .brand-subtext {
    color: #475569;
    letter-spacing: 0.1px;
    margin-top: -2px;
  }

  .nav-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-left: auto;
    flex-shrink: 0;
  }

  .nav-tabs-custom {
    margin-right: 6px;
  }

  /* Main Layout */
  .main-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 1.25rem;
    gap: 1.25rem;
    max-width: 100%;
  }

  /* Control Bar */
  .control-bar {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 250, 252, 0.92) 100%);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    padding: 1.25rem 1.5rem;
    border-radius: 22px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.8);
    border: 1.5px solid rgba(226, 232, 240, 0.7);
    flex-shrink: 0;
    position: relative;
    z-index: 2000;
    overflow: visible;
  }

  body.ui-collapsed .control-bar {
    display: none;
  }

  .form-label-mini {
    font-size: 0.75rem;
    font-weight: 800;
    color: #475569;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    background: linear-gradient(135deg, #64748b, #475569);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
  }

  /* Room Editor image preview */
  .room-img-preview-wrap {
    position: relative;
  }

  .room-img-preview {
    width: 100%;
    height: 180px;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .room-img-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #fff;
    cursor: zoom-in;
  }

  .room-img-empty {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-weight: 600;
  }


  /* KPI Cards */
  .kpi-card {
    background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
    border: 1.5px solid rgba(226, 232, 240, 0.8);
    border-radius: 18px;
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-width: 220px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
  }

  .kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 100% 0%, rgba(37, 99, 235, 0.08) 0%, transparent 60%);
    pointer-events: none;
  }

  .kpi-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary-gradient);
    transition: width 0.3s ease;
  }

  .kpi-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 32px -4px rgba(37, 99, 235, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.8);
    border-color: #bfdbfe;
  }

  .kpi-card:hover::after {
    width: 6px;
  }

  .kpi-value {
    font-size: 1.75rem;
    font-weight: 900;
    color: #0f172a;
    line-height: 1.1;
    letter-spacing: -0.8px;
    position: relative;
    z-index: 2;
  }

  .kpi-label {
    font-size: 0.75rem;
    color: #64748b;
    font-weight: 700;
    letter-spacing: 0.6px;
    position: relative;
    z-index: 2;
  }

  .kpi-card.expense-card::after {
    background: linear-gradient(135deg, #16a34a, #22c55e);
  }

  .kpi-card.expense-card .kpi-value {
    color: #14532d;
  }

  /* --- EXCEL TABLE STYLES --- */
  .content-area {
    flex: 1;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 22px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.07);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1.5px solid rgba(226, 232, 240, 0.6);
    position: relative;
    z-index: 1;
  }

  .table-container {
    flex: 1;
    overflow: auto;
    position: relative;
  }

  /* Smooth fade transition for realtime data updates */
  #tableBody {
    transition: opacity 0.15s ease-in-out;
  }

  #tableBody.refreshing {
    opacity: 0.5;
  }

  #buildingPivotBody {
    transition: opacity 0.15s ease-in-out;
  }

  table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
  }

  thead {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #fff;
  }

  /* Excel Headers */
  .excel-col-header {
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    color: #475569;
    font-weight: 800;
    text-align: center;
    border-bottom: 2px solid #e2e8f0;
    border-right: 1px solid #e8ecf1;
    padding: 8px 12px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.4px;
  }

  .excel-col-header:hover {
    background: linear-gradient(180deg, #e2e8f0 0%, #cbd5e1 100%);
    color: #0f172a;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
  }

  .excel-col-header.selected-column-header {
    background: linear-gradient(180deg, #dbeafe 0%, #bfdbfe 100%);
    color: #1e40af;
    border-bottom: 3px solid #2563eb;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
  }

  .excel-row-header {
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    color: #475569;
    font-weight: 700;
    font-size: 0.75rem;
    text-align: center;
    border-right: 1.5px solid #e2e8f0;
    border-bottom: 1px solid #f0f4f8;
    width: 50px;
    min-width: 50px;
    -webkit-user-select: none;
    user-select: none;
    cursor: pointer;
    transition: all 0.2s ease;
  }

  .excel-row-header:hover {
    background: linear-gradient(180deg, #e2e8f0 0%, #cbd5e1 100%);
    color: #0f172a;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
  }

  .data-header {
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    color: #475569;
    font-weight: 700;
    font-size: 0.85rem;
    padding: 12px 16px;
    border-bottom: 1.5px solid #e2e8f0;
    white-space: nowrap;
    border-right: 1px solid #f0f4f8;
  }

  /* Cells */
  tbody td {
    padding: var(--gridCellPadY) var(--gridCellPadX) !important;
    border-bottom: 1px solid #f0f4f8;
    border-right: 1px solid #f8fafc;
    font-size: 0.9rem;
    line-height: var(--gridCellLineHeight) !important;
    white-space: var(--gridCellWhiteSpace) !important;
    word-break: var(--gridCellWordBreak) !important;
    overflow-wrap: anywhere;
    height: auto !important;
    vertical-align: top;
    color: #334155;
    transition: background-color 0.12s ease, box-shadow 0.12s ease;
    background: #fafbfc;
  }

  tbody tr:hover td {
    background-color: rgba(37, 99, 235, 0.06) !important;
  }



  /* Column sizing (viewer adjustable) */
  .data-header {
    min-width: var(--gridColMinWidth) !important;
  }

  tbody td {
    min-width: var(--gridColMinWidth) !important;
  }

  /* Viewer grid controls */
  .gridAdjust {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(248, 250, 252, 0.9));
    border: 1.5px solid rgba(226, 232, 240, 0.8);
    border-radius: 16px;
    padding: 8px 16px;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
  }

  .gridAdjust .form-range {
    width: 140px;
    margin: 0;
  }

  .gridAdjust .small {
    line-height: 1;
  }

  .selected-cell {
    background-color: transparent !important;
    outline: 2.5px solid #2563eb;
    outline-offset: -2.5px;
    z-index: 5;
    box-shadow: inset 0 0 0 2.5px #dbeafe;
  }

  .range-selected {
    background-color: rgba(37, 99, 235, 0.12) !important;
  }

  /* --- EXCEL: FILL HANDLE (Drag to copy) --- */
  .fill-handle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    border: 2px solid #ffffff;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
    border-radius: 3px;
    z-index: 9999;
    display: none;
    cursor: crosshair;
    -webkit-user-select: none;
    user-select: none;
    touch-action: none;
  }

  .fill-range {
    background-color: rgba(37, 99, 235, 0.15) !important;
    outline: 1.5px dashed rgba(37, 99, 235, 0.7);
    outline-offset: -1.5px;
  }

  /* --- EXCEL: Formula reference highlights (when editing formula) --- */
  .formula-ref-cell {
    position: relative;
    outline: 2px dashed rgba(37, 99, 235, 0.9);
    outline-offset: -2px;
    background-color: rgba(37, 99, 235, 0.1) !important;
    z-index: 4;
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.2);
  }

  .formula-ref-1 {
    outline-color: rgba(220, 38, 38, 0.9);
    background-color: rgba(220, 38, 38, 0.1) !important;
    box-shadow: inset 0 0 0 1px rgba(220, 38, 38, 0.2);
  }

  .formula-ref-2 {
    outline-color: rgba(22, 163, 74, 0.9);
    background-color: rgba(22, 163, 74, 0.1) !important;
    box-shadow: inset 0 0 0 1px rgba(22, 163, 74, 0.2);
  }

  .formula-ref-3 {
    outline-color: rgba(147, 51, 234, 0.9);
    background-color: rgba(147, 51, 234, 0.1) !important;
    box-shadow: inset 0 0 0 1px rgba(147, 51, 234, 0.2);
  }


  /* === Buttons in control bar === */
  .btn-success,
  .btn-primary,
  .btn-secondary {
    border-radius: 12px !important;
    font-weight: 700 !important;
    padding: 7px 16px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    letter-spacing: 0.3px;
  }

  .btn-primary:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.25) !important;
  }

  .btn-success:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 20px rgba(22, 163, 74, 0.25) !important;
  }

  .btn-secondary:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 20px rgba(107, 114, 128, 0.2) !important;
  }

  .btn-light {
    background: rgba(255, 255, 255, 0.95) !important;
    border: 1.5px solid #e2e8f0 !important;
    color: #0f172a !important;
    font-weight: 600 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
  }

  .btn-light:hover {
    background: #f1f5f9 !important;
    border-color: #cbd5e1 !important;
    transform: translateY(-2px) !important;
  }

  /* Form Controls */
  .form-select {
    border-radius: 14px !important;
    border: 1.5px solid rgba(226, 232, 240, 0.6) !important;
    background-color: rgba(255, 255, 255, 0.97) !important;
    padding: 8px 12px !important;
    font-size: 0.9rem !important;
    font-weight: 600 !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
  }

  .form-select:hover {
    border-color: #cbd5e1 !important;
    background-color: #f8fafc !important;
  }

  .form-select:focus {
    border-color: #2563eb !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1), 0 2px 8px rgba(0, 0, 0, 0.04) !important;
  }

  /* --- Row resizer (drag bottom edge like Excel) --- */
  td.excel-row-header {
    position: relative;
  }

  .row-resizer {
    position: absolute;
    left: 0;
    right: 0;
    bottom: -3px;
    height: 10px;
    cursor: row-resize;
    -webkit-user-select: none;
    user-select: none;
    touch-action: none;
    z-index: 60;
  }

  .row-resizer::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 4px;
    height: 2px;
    background: rgba(37, 99, 235, 0.7);
    opacity: 0;
    border-radius: 2px;
    transition: opacity .2s ease;
    pointer-events: none;
  }

  td.excel-row-header:hover .row-resizer::after {
    opacity: 1;
  }

  .col-resizer {
    position: absolute;
    top: 0;
    right: -4px;
    width: 12px;
    height: 100%;
    cursor: col-resize;
    -webkit-user-select: none;
    user-select: none;
    touch-action: none;
    z-index: 50;
  }

  .col-resizer::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 2px;
    transform: translateX(-1px);
    background: rgba(37, 99, 235, 0.7);
    opacity: 0;
    border-radius: 2px;
    transition: opacity .2s ease;
    pointer-events: none;
  }

  th.resizable:hover .col-resizer::after {
    opacity: 1;
  }

  .col-resizer:hover {
    background: rgba(37, 99, 235, 0.12);
  }

  .name-box {
    width: 100px;
    font-size: 0.85rem;
    font-weight: 700;
    background: rgba(248, 250, 252, 0.9);
    border: 1.5px solid rgba(226, 232, 240, 0.6);
    border-radius: 10px;
    padding: 8px 12px;
    color: #0f172a;
    transition: all 0.2s ease;
  }

  .name-box:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
  }

  .excel-toolbar-btn {
    border: 1.5px solid rgba(226, 232, 240, 0.6);
    background: rgba(255, 255, 255, 0.97);
    border-radius: 12px;
    padding: 8px 12px;
    line-height: 1;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
    transition: all 0.2s ease;
    font-weight: 600;
    color: #0f172a;
  }

  .excel-toolbar-btn:hover:not(:disabled) {
    background: #eff6ff;
    border-color: #bfdbfe;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
  }

  .excel-toolbar-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
  }

  /* --- EXCEL: Quick Tools Bar (Copy/Cut/Paste + Insert/Delete Row/Col) --- */
  .excel-quick-tools {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px;
    border: 1.5px solid rgba(226, 232, 240, 0.6);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.97), rgba(248, 250, 252, 0.95));
    border-radius: 16px;
    box-shadow: 0 8px 20px rgba(2, 6, 23, 0.08);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
  }

  .excel-quick-tools.hidden {
    display: none !important;
  }

  .qt-btn {
    border: none;
    background: transparent;
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 0.9rem;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 8px;
    line-height: 1;
    white-space: nowrap;
    -webkit-user-select: none;
    user-select: none;
    transition: all 0.2s ease;
    font-weight: 600;
  }

  .qt-btn:hover {
    background: #eff6ff;
    transform: translateY(-1px);
  }

  .qt-btn.danger:hover {
    background: #fef2f2;
  }

  .qt-sep {
    width: 1px;
    height: 24px;
    background: #e5e7eb;
    margin: 0 4px;
    flex: 0 0 auto;
  }

  @media (max-width: 768px) {
    .qt-btn span {
      display: none;
    }

    .qt-btn {
      padding: 8px 9px;
    }

    .qt-sep {
      margin: 0 2px;
    }
  }

  .context-menu {
    position: fixed;
    min-width: 190px;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid #e2e8f0;
    box-shadow: 0 18px 35px rgba(2, 6, 23, 0.15);
    border-radius: 12px;
    padding: 6px;
    z-index: 15000;
    display: none;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
  }

  .context-menu .cm-item {
    width: 100%;
    text-align: left;
    border: none;
    background: transparent;
    padding: 9px 10px;
    border-radius: 10px;
    font-size: 0.9rem;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .context-menu .cm-item:hover {
    background: #eff6ff;
  }

  .context-menu .cm-sep {
    height: 1px;
    background: #e5e7eb;
    margin: 6px 4px;
  }

  .context-menu .cm-item.danger:hover {
    background: #fef2f2;
  }

  .highlight-column-cell {
    background-color: #eff6ff !important;
  }

  tbody tr:hover td {
    background-color: #f1f5f9;
  }

  .cell-formula-result {
    color: #2563eb;
    font-weight: 600;
  }

  /* Style for calculated cells */

  /* Formula Bar */
  .formula-bar-container {
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, #ffffff, #f8fafc);
    border-bottom: 1.5px solid rgba(226, 232, 240, 0.7);
    padding: 10px 14px;
    gap: 12px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
  }

  .fx-label {
    font-family: 'Times New Roman', serif;
    font-style: italic;
    font-weight: bold;
    color: #64748b;
    font-size: 1.1rem;
    -webkit-user-select: none;
    user-select: none;
  }

  #formulaInput {
    border: 1.5px solid rgba(226, 232, 240, 0.6);
    background: rgba(255, 255, 255, 0.98);
    border-radius: 10px;
    width: 100%;
    font-size: 0.9rem;
    color: #0f172a;
    padding: 8px 12px;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.02);
    transition: all 0.2s ease;
    font-weight: 600;
  }

  #formulaInput:focus {
    outline: none;
    border-color: #2563eb;
    background: #fff;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.02), 0 0 0 3px rgba(37, 99, 235, 0.1);
  }

  .excel-corner {
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    border-right: 1.5px solid #e2e8f0;
    border-bottom: 1.5px solid #e2e8f0;
    z-index: 20;
  }


  /* ===== Excel-like Ribbon (Font/Alignment/Number) ===== */
  .excel-ribbon {
    display: flex;
    gap: 12px;
    align-items: stretch;
    padding: 12px 16px;
    border-bottom: 1.5px solid rgba(226, 232, 240, 0.7);
    background: linear-gradient(135deg, #ffffff, #f8fafc);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    overflow-x: auto;
  }

  .excel-ribbon::-webkit-scrollbar {
    height: 8px;
  }

  .ribbon-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 14px;
    border: 1.5px solid rgba(226, 232, 240, 0.6);
    background: linear-gradient(135deg, rgba(248, 250, 252, 0.9), rgba(241, 245, 249, 0.9));
    border-radius: 16px;
    min-width: 240px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  }

  .ribbon-title {
    font-size: 0.75rem;
    font-weight: 900;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    -webkit-user-select: none;
    user-select: none;
  }

  .ribbon-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
  }

  .ribbon-select {
    min-width: 140px;
    border-radius: 12px !important;
    border: 1.5px solid rgba(226, 232, 240, 0.6) !important;
    background: rgba(255, 255, 255, 0.97) !important;
    font-weight: 700;
    font-size: 0.85rem;
    padding: 8px 12px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
    transition: all 0.2s ease;
  }

  .ribbon-select:hover {
    border-color: #cbd5e1 !important;
    background: #f8fafc !important;
  }

  .ribbon-select:focus {
    border-color: #2563eb !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
  }

  .ribbon-select.ribbon-size {
    min-width: 90px;
    width: 90px;
  }

  .ribbon-btn {
    border: 1.5px solid rgba(226, 232, 240, 0.6);
    background: rgba(255, 255, 255, 0.97);
    border-radius: 12px;
    padding: 8px 12px;
    line-height: 1;
    font-weight: 800;
    color: #0f172a;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    -webkit-user-select: none;
    user-select: none;
    white-space: nowrap;
  }

  .ribbon-btn:hover {
    background: #eff6ff;
    border-color: #bfdbfe;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(37, 99, 235, 0.15);
  }

  .ribbon-btn:active {
    transform: translateY(0);
  }

  /* ===== /Excel-like Ribbon ===== */
  .excel-status-bar {
    background: linear-gradient(135deg, #ffffff, #f8fafc);
    border-top: 1.5px solid rgba(226, 232, 240, 0.7);
    padding: 6px 18px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 24px;
    font-size: 0.75rem;
    color: #475569;
    font-weight: 600;
    height: 36px;
  }

  .stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .stat-val {
    font-weight: 800;
    color: #2563eb;
  }

  .pagination-footer {
    background: linear-gradient(135deg, #ffffff, #f8fafc);
    border-top: 1.5px solid rgba(226, 232, 240, 0.7);
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
  }

  #loadingOverlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.8);
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }

  /* --- MAP IMAGE SIZE (responsive) --- */
  #mapWrapper.map-wrapper {
    position: relative;
    margin: 0 auto;
    padding: 16px;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-start;
  }

  #mapStage.map-stage {
    position: relative;
    display: inline-block;
    line-height: 0;
    /* remove inline-block gap */
    max-width: 100%;
    --pin-scale: 1;
    contain: layout paint;
    transform-origin: 0 0;
  }

  img.map-image {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 60vh;
    object-fit: contain;
    border-radius: 20px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.15);
  }

  /* --- MAP PINS (anchor at tip) --- */
  .map-pin-wrap {
    position: absolute;
    transform: translate(-50%, -100%);
    z-index: 30;
    -webkit-user-select: none;
    cursor: pointer;
    user-select: none;
    filter: none;
    pointer-events: auto;
    transition: z-index 0s;
  }

  /* Dragging state for pins */
  .map-pin-wrap.dragging {
    cursor: grabbing !important;
    z-index: 999 !important;
    filter: none;
    transition: none;
  }

  .map-pin-wrap.dragging .map-pin-icon {
    animation: none !important;
    transform: scale(1.15) !important;
  }

  .map-pin-scale {
    display: inline-flex;
    transform: scale(var(--pin-scale, 1));
    transform-origin: 50% 100%;
  }

  .map-pin-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    font-size: 18px !important;
    border-radius: 16px;
    color: #fff;
    background: var(--pin-fill, linear-gradient(145deg, #2563eb, #1d4ed8));
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.35);
    transform-origin: 50% 95%;
    animation: none;
    transition: transform 180ms cubic-bezier(0.4, 0, 0.2, 1), filter 180ms ease;
    will-change: auto;
    position: relative;
    overflow: visible;
  }

  .map-pin-icon::before {
    content: "";
    position: absolute;
    inset: -4px;
    border-radius: 16px;
    background: radial-gradient(circle at 50% 30%, rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0));
    opacity: 0.8;
    filter: blur(4px);
    z-index: -1;
  }

  .map-pin-icon::after {
    content: "";
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.18);
    top: 10px;
    left: 12px;
  }

  @keyframes pin-float {

    0%,
    100% {
      transform: translateY(0px);
    }

    50% {
      transform: translateY(-10px);
    }
  }

  .map-pin-wrap:hover .map-pin-icon {
    transform: translateY(-16px) scale(1.1);
    filter: drop-shadow(0 18px 32px rgba(37, 99, 235, 0.35));
  }

  .map-pin-icon.pin-pop {
    animation: pin-pop 420ms cubic-bezier(.2, 1.25, .2, 1);
  }

  @keyframes pin-pop {
    0% {
      transform: translateY(0px) scale(0.92);
    }

    60% {
      transform: translateY(-12px) scale(1.18);
    }

    100% {
      transform: translateY(0px) scale(1.0);
    }
  }

  .map-pin-icon.is-active {
    animation: none;
    transform: translateY(-10px) scale(1.08);
    box-shadow: 0 16px 28px rgba(37, 99, 235, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.32);
  }

  @keyframes pin-pulse {

    0%,
    100% {
      box-shadow: 0 12px 22px rgba(8, 15, 40, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.32);
    }

    50% {
      box-shadow: 0 16px 28px rgba(37, 99, 235, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.32);
    }
  }

  .map-pin-icon.is-active::before {
    animation: none;
    box-shadow: 0 0 0 8px rgba(255, 255, 255, 0.2);
  }

  @keyframes pinHalo {
    0% {
      transform: scale(1);
      opacity: 0.9;
    }

    60% {
      transform: scale(1.14);
      opacity: 0.35;
    }

    100% {
      transform: scale(1.2);
      opacity: 0;
    }
  }

  @media (prefers-reduced-motion: reduce) {
    .map-pin-icon {
      animation: none !important;
    }

    .map-pin-icon.is-active {
      animation: none !important;
    }
  }

  .pin-orange {
    --pin-fill: linear-gradient(145deg, #f97316, #ea580c);
    background: var(--pin-fill);
  }

  .pin-blue {
    --pin-fill: linear-gradient(145deg, #2563eb, #1d4ed8);
    background: var(--pin-fill);
  }

  .pin-yellow {
    --pin-fill: linear-gradient(145deg, #fbbf24, #f59e0b);
    background: var(--pin-fill);
  }

  .pin-green {
    --pin-fill: linear-gradient(145deg, #22c55e, #16a34a);
    background: var(--pin-fill);
  }

  /* --- MAP: Add-Pin Click Layer (capture clicks reliably) --- */
  #mapClickLayer {
    position: absolute;
    inset: 0;
    z-index: 25;
    /* under pins (30) but above the image */
    display: none;
    cursor: crosshair;
    background: rgba(0, 0, 0, 0);
    pointer-events: auto;
    touch-action: none;
  }

  #mapStage.add-pin-mode #mapClickLayer {
    display: block;
  }

  #mapStage.add-pin-mode img.map-image {
    pointer-events: none;
  }

  #mapStage.add-pin-mode {
    cursor: crosshair;
  }

  /* --- Chart Modal (Area Summary) --- */
  #chartModal .modal-dialog {
    max-width: 980px;
  }

  .chart-modal {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.97) 0%, rgba(248, 250, 252, 0.99) 60%);
    border: 1.5px solid rgba(226, 232, 240, 0.8);
    overflow: hidden;
    position: relative;
    border-radius: 24px;
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.12);
  }

  .chart-modal-decor {
    position: absolute;
    inset: -20% -10% auto auto;
    width: 420px;
    height: 420px;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.25), rgba(99, 102, 241, 0.12), rgba(255, 255, 255, 0));
    filter: blur(0px);
    pointer-events: none;
  }

  .chart-modal::after {
    content: "";
    position: absolute;
    left: -15%;
    bottom: -25%;
    width: 420px;
    height: 420px;
    background: radial-gradient(circle, rgba(250, 204, 21, 0.28), rgba(249, 115, 22, 0.15), rgba(255, 255, 255, 0));
    pointer-events: none;
  }

  .chart-modal-header {
    background: linear-gradient(135deg, #2563eb 0%, #7c3aed 50%, #dc2626 100%);
    border: 0;
    color: #fff;
    position: relative;
    z-index: 2;
    border-radius: 24px 24px 0 0;
    padding: 1.5rem;
    box-shadow: 0 8px 16px rgba(37, 99, 235, 0.2);
  }

  .chart-modal-title {
    display: flex;
    align-items: center;
    gap: 16px;
  }

  .chart-modal-icon {
    width: 52px;
    height: 52px;
    border-radius: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.25);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 4px 12px rgba(0, 0, 0, 0.15);
    font-size: 1.2rem;
  }

  .chart-modal-text {
    font-weight: 900;
    font-size: 1.15rem;
    letter-spacing: 0.2px;
  }

  .chart-modal-sub {
    font-size: 0.8rem;
    opacity: 0.9;
  }

  .chart-modal-body {
    padding: 28px;
    position: relative;
    z-index: 2;
  }

  .chart-stage {
    background: rgba(255, 255, 255, 0.85);
    border-radius: 22px;
    padding: 20px;
    border: 1.5px solid rgba(226, 232, 240, 0.8);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.08);
  }

  .chart-surface {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 20px;
    padding: 16px;
    min-height: 420px;
  }

  .chart-surface canvas {
    width: 100% !important;
    height: 400px !important;
  }

  .chart-footnote {
    margin-top: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
  }

  .chart-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.12);
    font-size: 0.85rem;
    font-weight: 600;
    color: #2563eb;
  }

  .chart-pill.secondary {
    color: #0f172a;
    font-size: 0.78rem;
    font-weight: 700;
    border: 1px solid rgba(14, 165, 233, 0.25);
  }

  /* --- REPORT POPUP (SweetAlert2) : Modern Popup --- */
  .swal2-popup.report-modal {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 250, 252, 0.96) 100%) !important;
    border: 1.5px solid rgba(226, 232, 240, 0.8) !important;
    border-radius: 28px !important;
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.12) !important;
    padding: 2rem !important;
    width: min(1580px, 98vw) !important;
    height: min(96vh, 1000px) !important;
    padding: 0 !important;
    border-radius: 22px !important;
    overflow: hidden !important;
    box-shadow: 0 24px 60px rgba(2, 6, 23, 0.35) !important;
    border: 1px solid rgba(255, 255, 255, 0.55);
    background: #fff !important;
  }

  .swal2-popup.report-modal .swal2-html-container {
    margin: 0 !important;
    padding: 0 !important;
    height: 100% !important;
    overflow: hidden !important;
  }

  /* =========================================================
     MODERN ROOM DETAILS MODAL REDESIGN
     ========================================================= */
  /* =========================================================
     MODERN ROOM DETAILS MODAL REDESIGN (EXPANDED LARGE)
     ========================================================= */
  .swal2-popup.bkt-room-detail-popup,
  .swal2-popup.room-modal {
    width: min(1180px, 96vw) !important;
    max-width: 1180px !important;
    height: auto !important;
    max-height: 95vh !important;
    padding: 0 !important;
    border-radius: 22px !important;
    overflow: hidden !important;
    box-shadow: 0 30px 75px -15px rgba(15, 23, 42, 0.4) !important;
    border: 1px solid rgba(226, 232, 240, 0.95) !important;
    background: #ffffff !important;
  }

  .swal2-popup.bkt-room-detail-popup .swal2-html-container,
  .swal2-popup.room-modal .swal2-html-container {
    margin: 0 !important;
    padding: 0 !important;
    height: auto !important;
    overflow: visible !important;
    text-align: left !important;
  }

  .bkt-room-shell {
    display: flex;
    flex-direction: column;
    background: #f8fafc;
    color: #1e293b;
    font-family: 'Kanit', sans-serif;
  }

  /* Header */
  .bkt-room-header {
    background: #ffffff;
    padding: 1.35rem 1.75rem;
    border-bottom: 1px solid #e2e8f0;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .bkt-room-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, #2563eb, #3b82f6, #60a5fa);
  }

  .bkt-room-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
    min-width: 0;
  }

  .bkt-room-header-icon {
    width: 54px;
    height: 54px;
    border-radius: 14px;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    color: #2563eb;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
    border: 1px solid #bfdbfe;
  }

  .bkt-room-header-info {
    flex: 1;
    min-width: 0;
  }

  .bkt-room-header-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
  }

  .bkt-room-title {
    margin: 0;
    font-size: 1.55rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.25;
    letter-spacing: -0.3px;
  }

  .bkt-room-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.82rem;
    font-weight: 700;
    padding: 4px 11px;
    border-radius: 9999px;
  }

  .bkt-room-status-badge.has-image {
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
  }

  .bkt-room-status-badge.no-image {
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #e2e8f0;
  }

  .bkt-room-header-tags {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 8px;
  }

  .bkt-room-tag {
    display: inline-flex;
    align-items: center;
    font-size: 0.88rem;
    font-weight: 500;
    color: #475569;
    background: #f8fafc;
    padding: 4px 12px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
  }

  /* Body Grid */
  .bkt-room-body {
    padding: 1.5rem 1.75rem;
    display: grid;
    grid-template-columns: 1.1fr 1.25fr;
    gap: 1.5rem;
    max-height: calc(94vh - 160px);
    overflow-y: auto;
  }

  @media (max-width: 900px) {
    .bkt-room-body {
      grid-template-columns: 1fr;
      max-height: calc(90vh - 140px);
      padding: 1.15rem;
      gap: 1.15rem;
    }
  }

  /* Cards */
  .bkt-room-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.05);
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .bkt-room-card-header {
    padding: 12px 18px;
    background: #ffffff;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .bkt-card-title {
    font-size: 0.98rem;
    font-weight: 700;
    color: #1e293b;
    display: flex;
    align-items: center;
  }

  .bkt-card-hint {
    font-size: 0.78rem;
    color: #94a3b8;
  }

  /* Photo Section */
  .bkt-room-photo-card {
    height: 100%;
    min-height: 400px;
  }

  .bkt-room-card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
  }

  .bkt-room-photo-frame {
    position: relative;
    width: 100%;
    min-height: 380px;
    max-height: 520px;
    height: 100%;
    background: #0f172a;
    overflow: hidden;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .bkt-room-photo-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
  }

  .bkt-room-photo-frame:hover img {
    transform: scale(1.03);
  }

  .bkt-photo-hover-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
  }

  .bkt-room-photo-frame:hover .bkt-photo-hover-overlay {
    opacity: 1;
  }

  .bkt-photo-overlay-btn {
    background: rgba(255, 255, 255, 0.95);
    color: #0f172a;
    font-size: 0.88rem;
    font-weight: 700;
    padding: 8px 18px;
    border-radius: 9999px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
  }

  /* Empty Photo State */
  .bkt-room-photo-empty {
    min-height: 380px;
    padding: 40px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    flex: 1;
  }

  .bkt-empty-icon-bubble {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: #94a3b8;
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.07);
    margin-bottom: 16px;
  }

  .bkt-empty-title {
    font-weight: 700;
    font-size: 1.08rem;
    color: #334155;
    margin-bottom: 6px;
  }

  .bkt-empty-desc {
    font-size: 0.88rem;
    color: #64748b;
    max-width: 280px;
    line-height: 1.5;
  }

  .bkt-btn-add-img-quick {
    margin-top: 18px;
    font-size: 0.86rem;
    font-weight: 600;
    padding: 6px 18px;
    border-radius: 9999px;
  }

  /* Specs Grid */
  .bkt-room-specs-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .bkt-spec-tile {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 11px 15px;
    display: flex;
    flex-direction: column;
  }

  .bkt-spec-tile-wide {
    grid-column: span 2;
  }

  .spec-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
  }

  .spec-value {
    font-size: 0.98rem;
    font-weight: 700;
    color: #0f172a;
    word-break: break-word;
    line-height: 1.4;
  }

  /* History Content */
  .bkt-room-history-content {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-left: 4px solid #3b82f6;
    border-radius: 10px;
    padding: 14px 18px;
    font-size: 0.94rem;
    color: #334155;
    line-height: 1.65;
    max-height: 180px;
    overflow-y: auto;
    white-space: pre-wrap;
  }

  .bkt-room-history-empty {
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 10px;
    padding: 16px 18px;
    font-size: 0.88rem;
    color: #94a3b8;
    font-style: italic;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Footer */
  .bkt-room-footer {
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    padding: 1rem 1.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
  }

  .bkt-footer-btn {
    border-radius: 12px !important;
    font-size: 0.92rem !important;
    font-weight: 600 !important;
    padding: 9px 20px !important;
    display: inline-flex !important;
    align-items: center !important;
  }

  .bkt-footer-btn-primary {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%) !important;
    border-color: #2563eb !important;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25) !important;
    color: #ffffff !important;
  }

  .bkt-footer-btn-primary {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%) !important;
    border-color: #2563eb !important;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25) !important;
    color: #ffffff !important;
  }

  .pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
  }

  .pill-soft {
    background: rgba(37, 99, 235, 0.08);
    color: #2563eb;
    border: 1px solid rgba(37, 99, 235, 0.15);
  }

  .pill-success {
    background: rgba(34, 197, 94, 0.12);
    color: #16a34a;
    border: 1px solid rgba(34, 197, 94, 0.2);
  }

  .pill-muted {
    background: rgba(100, 116, 139, 0.1);
    color: #64748b;
    border: 1px solid rgba(100, 116, 139, 0.15);
  }

  /* Shell */
  .report-shell {
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #f8fafc;
  }

  /* Topbar */
  .report-topbar {
    background: var(--primary-gradient);
    color: #fff;
    padding: 1.05rem 1.25rem;
    position: relative;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
  }

  .report-title {
    min-width: 260px;
  }

  .report-title h2 {
    margin: 0;
    font-weight: 800;
    letter-spacing: -0.4px;
    font-size: 1.35rem;
    line-height: 1.1;
  }

  .report-title .sub {
    margin-top: 6px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    opacity: 0.95;
  }

  .chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.14);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    white-space: nowrap;
  }

  .chip.ghost {
    background: rgba(255, 255, 255, 0.10);
  }

  .stat-chips {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
  }

  .stat-chip {
    border-radius: 16px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.35);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    min-width: 160px;
  }

  .stat-chip .label {
    font-size: 0.72rem;
    opacity: 0.85;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
  }

  .stat-chip .value {
    font-size: 1.15rem;
    font-weight: 900;
    letter-spacing: -0.4px;
    margin-top: 2px;
  }

  /* Content area scroll */
  .report-content {
    flex: 1;
    overflow: auto;
    padding: 1rem 1.25rem 1rem;
  }

  /* Grid */
  .report-grid {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 14px;
    align-items: start;
  }

  @media (max-width: 992px) {
    .report-grid {
      grid-template-columns: 1fr;
    }

    .stat-chip {
      min-width: 140px;
    }
  }

  /* Cards */
  .r-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    box-shadow: 0 10px 16px -10px rgba(2, 6, 23, 0.18);
    overflow: hidden;
  }

  .r-card .r-head {
    padding: 12px 14px;
    border-bottom: 1px solid #eef2f7;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  }

  .r-card .r-head .ttl {
    font-weight: 900;
    color: #334155;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    flex: 1 1 auto;
    min-width: 260px;
    white-space: normal;
  }

  .usage-head-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-left: auto;
  }

  .usage-owner-search,
  .usage-owner-select,
  .usage-lab-select {
    min-width: 220px;
  }

  .usage-owner-search .form-control,
  .usage-owner-select .form-control,
  .usage-lab-select .form-control {
    min-width: 160px;
  }

  @media (max-width: 576px) {

    .usage-owner-search,
    .usage-owner-select,
    .usage-lab-select {
      width: 100%;
    }

    .usage-owner-search .form-control,
    .usage-owner-select .form-control,
    .usage-lab-select .form-control {
      min-width: 0;
    }
  }

  .r-card .r-body {
    padding: 14px;
  }

  /* Chart */
  .chart-wrap {
    position: relative;
    height: 300px;
  }

  @media (max-width: 576px) {
    .chart-wrap {
      height: 260px;
    }
  }

  /* Image frame */
  #reportImageContainer {
    position: relative;
    height: 280px;
    border-radius: 16px;
    overflow: hidden;
    background: linear-gradient(180deg, rgba(248, 250, 252, 1) 0%, rgba(241, 245, 249, 1) 100%);
    border: 1px solid #e2e8f0;
  }

  @media (max-width: 576px) {
    #reportImageContainer {
      height: 220px;
    }
  }

  #reportImage {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    background: #ffffff;
    cursor: zoom-in;
  }

  #noImagePlaceholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #94a3b8;
    text-align: center;
    padding: 14px;
  }

  /* Image edit overlay */
  .btn-add-image {
    position: absolute;
    top: auto;
    right: 12px;
    bottom: 12px;
    z-index: 6;
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    -webkit-backdrop-filter: blur(12px);
    justify-content: center;
    backdrop-filter: blur(12px);
    background: linear-gradient(135deg, #2563eb, #1d4ed8) !important;
    color: #fff !important;
    border: 0 !important;
    border-radius: 14px !important;
    box-shadow: 0 12px 28px rgba(2, 6, 23, 0.25);
    transition: transform .15s var(--bkt-ease), box-shadow .15s var(--bkt-ease);
  }

  .btn-add-image:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 32px rgba(2, 6, 23, 0.3);
  }

  #imgEditBox {
    position: absolute;
    inset: 0;
    padding: 14px;
    display: none;
    /* toggled to flex */
    align-items: flex-end;
    justify-content: center;
    background: rgba(2, 6, 23, 0.55);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    z-index: 7;
  }

  #imgEditBox .input-group {
    max-width: 620px;
    width: 100%;
    background: #fff;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 16px 38px rgba(2, 6, 23, 0.35);
  }

  .floorplan-block {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed #e2e8f0;
  }

  .floorplan-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }

  .floorplan-title {
    font-weight: 800;
    color: #334155;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }

  .floorplan-edit {
    margin-top: 8px;
    display: none;
  }

  .floorplan-edit textarea {
    width: 100%;
    min-height: 90px;
    resize: vertical;
  }

  .floorplan-grid {
    margin-top: 10px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
  }

  .floorplan-thumb {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    padding: 0;
    background: #ffffff;
    cursor: pointer;
    position: relative;
    min-height: 90px;
    box-shadow: 0 8px 18px rgba(2, 6, 23, 0.08);
  }

  .floorplan-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    aspect-ratio: 4 / 3;
  }

  .floorplan-thumb.is-broken::after {
    content: "Image unavailable";
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 0.75rem;
    background: #f8fafc;
    text-align: center;
    padding: 8px;
  }

  /* Upload indicator for floorplan thumbnails */
  .floorplan-thumb.floorplan-uploading {
    pointer-events: none;
  }

  .floorplan-thumb .upload-indicator {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.8);
    color: #3b82f6;
    font-size: 1.2rem;
  }

  .floorplan-empty {
    margin-top: 8px;
    color: #94a3b8;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 6px;
  }

  /* Floor Plan Upload Area */
  .floorplan-upload-section {
    margin-top: 12px;
  }

  .floorplan-upload-area {
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100px;
  }

  .floorplan-upload-area:hover {
    border-color: #3b82f6;
    background: #eff6ff;
  }

  .floorplan-upload-area.dragover {
    border-color: #3b82f6;
    background: #dbeafe;
    transform: scale(1.01);
  }

  .floorplan-upload-progress {
    padding: 12px;
    background: #f1f5f9;
    border-radius: 8px;
  }

  .floorplan-upload-progress .progress {
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
  }

  .floorplan-upload-progress .progress-bar {
    background: linear-gradient(90deg, #3b82f6, #2563eb);
    transition: width 0.3s ease;
  }

  /* =========================================================================
     BUILDING REPORT / DETAIL POPUP (Modern Aurora Glass UI)
     ========================================================================= */
  .bkt-building-modal {
    border-radius: 24px !important;
    overflow: hidden !important;
    box-shadow: 0 25px 60px -15px rgba(15, 23, 42, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.12) !important;
    max-height: 94vh !important;
    display: flex !important;
    flex-direction: column !important;
    background: #ffffff !important;
    border: none !important;
  }

  .bkt-building-modal .swal2-close {
    background: rgba(255, 255, 255, 0.22) !important;
    border-radius: 50% !important;
    color: #ffffff !important;
    width: 36px !important;
    height: 36px !important;
    top: 16px !important;
    right: 18px !important;
    font-size: 1.25rem !important;
    border: 1px solid rgba(255, 255, 255, 0.35) !important;
    transition: all 0.2s ease !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
  }

  .bkt-building-modal .swal2-close:hover {
    background: rgba(255, 255, 255, 0.4) !important;
    transform: rotate(90deg) scale(1.08) !important;
    color: #ffffff !important;
  }

  .report-shell {
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #f8fafc;
  }

  /* Topbar */
  .report-topbar {
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 55%, #3b82f6 100%);
    color: #fff;
    padding: 16px 24px;
    position: relative;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 4px 20px rgba(30, 58, 138, 0.25);
  }

  .bkt-building-hero-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    color: #ffffff;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
  }

  .report-title h2 {
    margin: 0;
    font-weight: 800;
    letter-spacing: -0.3px;
    font-size: 1.4rem;
    line-height: 1.2;
    color: #ffffff;
  }

  .report-title .sub {
    margin-top: 6px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
  }

  .stat-chips {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
  }

  .stat-chip {
    border-radius: 14px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.35);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    min-width: 150px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
  }

  .stat-chip .label {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 700;
    letter-spacing: 0.4px;
  }

  .stat-chip .value {
    font-size: 1.25rem;
    font-weight: 900;
    color: #ffffff;
    margin-top: 2px;
  }

  .stat-chip .unit {
    font-size: 0.78rem;
    font-weight: 600;
    opacity: 0.9;
    margin-left: 2px;
  }

  /* Content area scroll */
  .report-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px 20px;
  }

  .report-grid {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 16px;
    align-items: start;
  }

  @media (max-width: 992px) {
    .report-grid {
      grid-template-columns: 1fr;
    }
  }

  /* Cards */
  .r-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    box-shadow: 0 6px 18px -4px rgba(15, 23, 42, 0.06);
    overflow: hidden;
    transition: box-shadow 0.2s ease;
  }

  .r-card .r-head {
    padding: 12px 18px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    background: #ffffff;
  }

  .r-card .r-head .ttl {
    font-weight: 800;
    color: #1e293b;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    flex: 1 1 auto;
    min-width: 260px;
    white-space: normal;
  }

  .r-card .r-body {
    padding: 16px 18px;
  }

  /* Usage Area Card */
  .usage-area-card {
    position: relative;
    border: 1px solid #e2e8f0;
    background: #ffffff;
  }

  .usage-ttl-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    color: #fff;
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.3);
    font-size: 0.85rem;
  }

  .usage-chart-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 330px;
    gap: 16px;
    align-items: start;
  }

  @media (max-width: 992px) {
    .usage-chart-layout {
      grid-template-columns: 1fr;
    }
  }

  .usage-chart-wrap {
    height: 280px;
    border-radius: 16px;
    border: 1px solid #f1f5f9;
    background: radial-gradient(circle at 50% 50%, #ffffff 0%, #f8fafc 100%);
    position: relative;
  }

  .donut-center-info {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
  }

  .usage-chart-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
  }

  .usage-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    color: #334155;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
  }

  .usage-legend {
    border-radius: 14px;
    background: #f8fafc;
    border: 1px solid #eef2f6;
    padding: 10px;
    max-height: 330px;
    overflow-y: auto;
  }

  .usage-legend-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: #64748b;
    margin: 2px 4px 8px;
  }

  .usage-legend-list {
    display: flex;
    flex-direction: column;
    gap: 7px;
  }

  .usage-legend-item {
    padding: 8px 11px;
    border-radius: 11px;
    background: #ffffff;
    border: 1px solid #eef2f6;
    box-shadow: 0 2px 5px rgba(15, 23, 42, 0.03);
    transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
  }

  .usage-legend-item:hover {
    border-color: #3b82f6;
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(37, 99, 235, 0.12);
    background: #f8fbff;
  }

  .usage-legend-item.is-active-legend {
    border-color: #2563eb !important;
    background: #eff6ff !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2), 0 6px 14px rgba(37, 99, 235, 0.15) !important;
  }

  .usage-legend-item.is-active-legend .legend-name {
    color: #1d4ed8;
    font-weight: 800;
  }

  .legend-info-btn {
    opacity: 0.7;
    transition: all 0.15s ease;
  }

  .usage-legend-item:hover .legend-info-btn {
    opacity: 1;
    background: #e0f2fe !important;
    color: #0284c7 !important;
    transform: scale(1.1);
  }

  .legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9);
  }

  .legend-name {
    font-size: 0.82rem;
    font-weight: 700;
    color: #1e293b;
    word-break: break-word;
  }

  .legend-val {
    font-size: 0.82rem;
    font-weight: 800;
    color: #2563eb;
    white-space: nowrap;
  }

  .legend-unit {
    font-size: 0.72rem;
    color: #64748b;
    font-weight: normal;
  }

  .legend-pct-badge {
    font-size: 0.72rem;
    font-weight: 700;
    background: #e0f2fe;
    color: #0284c7;
    padding: 2px 6px;
    border-radius: 6px;
    margin-left: 3px;
    white-space: nowrap;
  }

  .usage-progress-track {
    height: 4px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
    margin-top: 4px;
  }

  .usage-progress-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 0.35s ease;
  }

  /* History card */
  .building-history-card .history-quote-box {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-left: 4px solid #3b82f6;
    border-radius: 0 14px 14px 0;
    padding: 16px 22px;
    border-top: 1px solid #e2e8f0;
    border-right: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
  }

  .history-content-text {
    font-size: 0.94rem;
    color: #334155;
    line-height: 1.75;
  }

  /* Media Card */
  #reportImageContainer {
    position: relative;
    height: 240px;
    border-radius: 14px;
    overflow: hidden;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
  }

  #reportImage {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    cursor: zoom-in;
    transition: transform 0.25s ease;
  }

  #reportImage:hover {
    transform: scale(1.02);
  }

  .no-image-box {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: #64748b;
    text-align: center;
    padding: 16px;
  }

  .no-img-icon-wrap {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .floorplan-block {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px dashed #e2e8f0;
  }

  .floorplan-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }

  .floorplan-title {
    font-weight: 800;
    color: #1e293b;
    font-size: 0.88rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }

  .floorplan-grid {
    margin-top: 10px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 8px;
  }

  .floorplan-thumb {
    aspect-ratio: 4 / 3;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    padding: 0;
    background: #ffffff;
    cursor: pointer;
    position: relative;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
    transition: all 0.2s ease;
  }

  .floorplan-thumb:hover {
    transform: translateY(-2px);
    border-color: #3b82f6;
    box-shadow: 0 6px 14px rgba(37, 99, 235, 0.15);
  }

  .floorplan-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }

  .floorplan-empty-box {
    margin-top: 10px;
    padding: 16px;
    border-radius: 12px;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    color: #64748b;
    font-size: 0.84rem;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Rooms table */
  .rooms-table-wrap {
    max-height: 320px;
    overflow-y: auto;
    border-top: 1px solid #eef2f7;
  }

  .modern-table thead th {
    position: sticky;
    top: 0;
    z-index: 3;
    background: #f8fafc !important;
    border-bottom: 1px solid #e2e8f0 !important;
    font-weight: 700;
    color: #475569;
    font-size: 0.82rem;
  }

  /* Footer */
  .report-footer {
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
  }


  /* Fullscreen preview */
  .swal2-popup.image-preview-popup {
    width: min(1200px, 98vw) !important;
    padding: 10px !important;
    border-radius: 18px !important;
  }

  .swal2-popup.image-preview-popup .swal2-html-container {
    margin: 0 !important;
  }

  .preview-img {
    width: 100%;
    max-height: 80vh;
    object-fit: contain;
    display: block;
    border-radius: 14px;
    background: #fff;
  }


  /* Ensure action buttons are always clickable even inside scrollable tables */
  .action-icons,
  .action-icons * {
    pointer-events: auto;
  }

  .btn-view-room {
    cursor: pointer;
  }

  /* SweetAlert close: keep clear from custom buttons */
  .swal2-close {
    position: absolute !important;
    top: -12px !important;
    right: -12px !important;
    width: 42px !important;
    height: 42px !important;
    border-radius: 12px !important;
    background: rgba(255, 255, 255, 0.95) !important;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    z-index: 20000 !important;
  }

  .swal2-close:focus {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
  }

  /* Room modal layout */
  .room-modal-grid {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 16px;
  }

  @media(max-width: 768px) {
    .room-modal-grid {
      grid-template-columns: 1fr;
    }
  }

  .room-card {
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 12px 28px rgba(2, 6, 23, 0.12);
    display: flex;
    flex-direction: column;
  }

  .room-card-head {
    padding: 12px 14px;
    border-bottom: 1px solid #e8edf5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: linear-gradient(180deg, #fdfefe 0%, #f3f6fb 100%);
  }

  .room-card-body {
    padding: 14px;
    flex: 1;
  }

  .room-image-frame {
    position: relative;
    height: 320px;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid #e8edf5;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.06), rgba(99, 102, 241, 0.04));
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
  }

  .room-image-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }

  .room-image-empty {
    color: #94a3b8;
  }

  .room-card-info .history-box {
    border: 1px dashed #d7deeb;
    border-radius: 12px;
    padding: 12px;
    background: #f8fafc;
    min-height: 160px;
  }

  .room-meta {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .meta-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    border: 1px solid #e5eaf2;
    border-radius: 12px;
    padding: 8px 10px;
    background: #fff;
  }

  .meta-label {
    font-weight: 700;
    color: #475569;
  }

  .meta-val {
    font-weight: 800;
    color: #0f172a;
  }

  .pill {
    border-radius: 999px;
    padding: 6px 10px;
    font-weight: 700;
    font-size: 0.82rem;
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: rgba(255, 255, 255, 0.7);
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }

  .pill-soft {
    background: rgba(37, 99, 235, 0.08);
    border-color: rgba(37, 99, 235, 0.16);
    color: #1d4ed8;
  }

  .pill-success {
    background: rgba(34, 197, 94, 0.12);
    border-color: rgba(34, 197, 94, 0.28);
    color: #15803d;
  }

  .pill-muted {
    background: rgba(148, 163, 184, 0.12);
    border-color: rgba(148, 163, 184, 0.3);
    color: #475569;
  }

  /* MAP ZOOM CONTROLS */
  #mapStage.map-stage {
    transform-origin: 0 0;
  }

  /* Pan (drag to move) */
  #mapContainer {
    overflow: auto;
    cursor: grab;
  }

  #mapContainer.is-panning {
    cursor: grabbing;
  }

  #bktMapImage {
    -webkit-user-select: none;
    user-select: none;
  }

  .map-zoom-controls .map-zoom-btn {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 14px;
  }

  .map-zoom-controls .map-zoom-btn i {
    font-size: 1.05rem;
  }

  #mapZoomPct {
    font-variant-numeric: tabular-nums;
  }

  /* =========================================================
       BKT CLEAN UI v11 (Major UI Refresh)
       - Clean cards, soft shadows, subtle motion, unified popups
       ========================================================= */
  :root {
    --bkt-bg: #f6f7fb;
    --bkt-surface: rgba(255, 255, 255, .92);
    --bkt-surface-solid: #fff;
    --bkt-border: rgba(15, 23, 42, .10);
    --bkt-border-strong: rgba(15, 23, 42, .16);
    --bkt-text: #0f172a;
    --bkt-muted: #64748b;
    --bkt-primary: #3b82f6;
    --bkt-primary-2: #4f46e5;
    --bkt-accent: #22c55e;
    --bkt-warning: #f59e0b;
    --bkt-danger: #ef4444;
    --bkt-radius: 18px;
    --bkt-radius-lg: 22px;
    --bkt-shadow: 0 10px 24px rgba(2, 6, 23, .08);
    --bkt-shadow-lg: 0 18px 50px rgba(2, 6, 23, .14);
    --bkt-glow: 0 0 0 6px rgba(37, 99, 235, .12);
    --bkt-grad: linear-gradient(135deg, var(--bkt-primary) 0%, var(--bkt-primary-2) 100%);
    --bkt-ease: cubic-bezier(.2, .8, .2, 1);
  }

  body {
    background: radial-gradient(circle at 10% 10%, rgba(59, 130, 246, 0.05), transparent 40%),
      radial-gradient(circle at 90% 90%, rgba(99, 102, 241, 0.05), transparent 40%),
      #f8fafc;
    background-attachment: fixed;
    color: var(--bkt-text);
  }

  /* nicer scrollbars */
  *::-webkit-scrollbar {
    height: 10px;
    width: 10px;
  }

  *::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, .55);
    border-radius: 999px;
    border: 3px solid rgba(255, 255, 255, .75);
  }

  *::-webkit-scrollbar-track {
    background: rgba(2, 6, 23, .04);
  }

  /* Page entrance */
  .main-container,
  .navbar {
    animation: bktFadeIn .45s var(--bkt-ease) both;
  }

  @keyframes bktFadeIn {
    from {
      opacity: 0;
      transform: translateY(6px);
    }

    to {
      opacity: 1;
      transform: none;
    }
  }

  /* Topbar refinements */
  .navbar {
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: var(--bkt-radius);
    margin: 12px 14px 0 14px;
    height: 68px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
  }

  .brand-text {
    letter-spacing: -0.6px;
    font-weight: 800;
  }

  .nav-tabs-custom .nav-link {
    border: 0 !important;
    border-radius: 999px !important;
    padding: 10px 14px;
    font-weight: 700;
    color: var(--bkt-muted);
    background: transparent;
    transition: transform .15s var(--bkt-ease), background .15s var(--bkt-ease), color .15s var(--bkt-ease);
  }

  .nav-tabs-custom .nav-link:hover {
    transform: translateY(-1px);
    background: rgba(37, 99, 235, .08);
    color: var(--bkt-primary);
  }

  .nav-tabs-custom .nav-link.active {
    background: rgba(37, 99, 235, .12);
    color: var(--bkt-primary);
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, .22);
  }

  /* Control bar + cards */
  .control-bar {
    border-radius: var(--bkt-radius-lg);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.92);
    /* PERF: removed backdrop-filter — solid bg is visually identical */
  }

  .kpi-card {
    border-radius: 16px;
    box-shadow: 0 10px 22px rgba(2, 6, 23, .07);
    border: 1px solid rgba(148, 163, 184, .22);
    transition: transform .15s var(--bkt-ease), box-shadow .15s var(--bkt-ease);
  }

  .kpi-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--bkt-shadow-lg);
  }

  .kpi-card::before {
    width: 6px;
    border-radius: 18px 0 0 18px;
  }

  /* Buttons: cleaner + bouncy */
  .btn {
    border-radius: 999px !important;
    transition: transform .14s var(--bkt-ease), box-shadow .14s var(--bkt-ease), filter .14s var(--bkt-ease);
  }

  .btn:hover {
    transform: translateY(-1px);
  }

  .btn:active {
    transform: translateY(0px) scale(.98);
  }

  .btn-primary {
    background: var(--bkt-grad) !important;
    border: 0 !important;
    box-shadow: 0 8px 16px rgba(37, 99, 235, .2);
  }

  .btn-primary:hover {
    filter: brightness(1.02);
    box-shadow: 0 14px 24px rgba(37, 99, 235, .26);
  }

  .btn-outline-danger {
    border-width: 2px;
  }

  /* Content shell */
  .content-area {
    border-radius: var(--bkt-radius-lg);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.6);
  }

  /* Table polish — PERF: removed thead backdrop-filter blur (not visible under solid bg) */

  .data-header {
    background: rgba(255, 255, 255, .96);
  }

  tbody tr:hover td {
    background: rgba(2, 6, 23, .02);
  }

  /* Selected cell glow */
  .selected-cell {
    box-shadow: var(--bkt-glow);
    border-radius: 6px;
  }

  /* Loading overlay: cleaner */
  #loadingOverlay {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: rgba(248, 250, 252, .72);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    z-index: 25000;
    transition: opacity .25s var(--bkt-ease), visibility .25s var(--bkt-ease);
  }

  #loadingOverlay .spinner-border {
    width: 3.2rem !important;
    height: 3.2rem !important;
  }

  #loadingText {
    letter-spacing: .2px;
  }

  /* Map controls: card look */
  .map-controls .glass-panel {
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid var(--bkt-border);
    box-shadow: var(--bkt-shadow);
    border-radius: var(--bkt-radius-lg);
    /* PERF: removed backdrop-filter — solid bg is visually identical */
  }

  #mapContainer {
    border-radius: var(--bkt-radius-lg);
    box-shadow: var(--bkt-shadow);
    border: 1px solid var(--bkt-border);
    background: #e2e8f0 !important;
  }

  .map-image {
    box-shadow: var(--bkt-shadow-lg) !important;
    border-radius: var(--bkt-radius-lg) !important;
  }

  /* Bootstrap modal: animate */
  .modal.fade .modal-dialog {
    transform: translateY(14px) scale(.98);
    transition: transform .22s var(--bkt-ease), opacity .22s var(--bkt-ease);
  }

  .modal.show .modal-dialog {
    transform: translateY(0) scale(1);
  }

  .modal-content {
    border-radius: calc(var(--bkt-radius-lg) + 2px) !important;
    box-shadow: var(--bkt-shadow-lg) !important;
  }

  /* SweetAlert2: unified clean popup + bounce */
  @keyframes bktPopIn {
    0% {
      opacity: 0;
      transform: translateY(10px) scale(.96);
    }

    60% {
      opacity: 1;
      transform: translateY(-2px) scale(1.01);
    }

    100% {
      transform: translateY(0) scale(1);
    }
  }

  @keyframes bktPopOut {
    0% {
      opacity: 1;
      transform: translateY(0) scale(1);
    }

    100% {
      opacity: 0;
      transform: translateY(10px) scale(.96);
    }
  }

  .bkt-anim-pop-in {
    animation: bktPopIn .28s var(--bkt-ease) both;
  }

  .bkt-anim-pop-out {
    animation: bktPopOut .18s var(--bkt-ease) both;
  }

  .swal2-popup.bkt-swal {
    border-radius: 22px;
    border: 1px solid var(--bkt-border);
    box-shadow: var(--bkt-shadow-lg);
    padding: 18px 18px 16px;
    background: rgba(255, 255, 255, .97);
    /* PERF: removed backdrop-filter — popup has solid bg */
  }

  .bkt-swal-title {
    font-weight: 800;
    letter-spacing: -0.4px;
  }

  .bkt-swal-html {
    color: var(--bkt-text);
  }

  .swal2-icon {
    transform: scale(.95);
  }

  .swal2-actions {
    gap: 10px !important;
  }

  .bkt-btn {
    border-radius: 999px !important;
    padding: 10px 14px !important;
    font-weight: 800 !important;
    letter-spacing: .2px;
    border: 1px solid var(--bkt-border) !important;
    box-shadow: 0 10px 18px rgba(2, 6, 23, .08);
  }

  .bkt-btn:active {
    transform: scale(.98);
  }

  .bkt-btn-primary {
    background: var(--bkt-grad) !important;
    border: 0 !important;
    color: #fff !important;
    box-shadow: 0 14px 24px rgba(37, 99, 235, .22);
  }

  .bkt-btn-ghost {
    background: rgba(255, 255, 255, .8) !important;
    color: var(--bkt-text) !important;
  }

  .swal2-toast.bkt-swal {
    border-radius: 14px !important;
    box-shadow: var(--bkt-shadow) !important;
    padding: 10px 12px !important;
  }

  /* Report / Building popup (existing ids) */
  .report-modal {
    border-radius: 22px !important;
    overflow: hidden;
    box-shadow: var(--bkt-shadow-lg) !important;
    border: 1px solid var(--bkt-border) !important;
  }

  .report-header {
    background: var(--bkt-grad) !important;
    color: #fff !important;
    padding: 18px 18px 16px !important;
  }

  .report-card {
    border-radius: 18px !important;
    border: 1px solid rgba(148, 163, 184, .25) !important;
    box-shadow: 0 10px 22px rgba(2, 6, 23, .06) !important;
  }

  /* Respect reduced motion */
  @media (prefers-reduced-motion: reduce) {

    .main-container,
    .navbar,
    .modal.fade .modal-dialog {
      animation: none !important;
      transition: none !important;
    }

    .btn {
      transition: none !important;
    }

    .bkt-anim-pop-in,
    .bkt-anim-pop-out {
      animation: none !important;
    }
  }


  /* ===== Auto Pivot (Building Overview - Redesigned) ===== */
  .bkt-overview-section {
    background: #ffffff;
    border-radius: 20px;
    padding: 20px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.04), 0 2px 6px -1px rgba(15, 23, 42, 0.02);
  }

  .bkt-overview-title-badge {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: rgba(37, 99, 235, 0.1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    flex-shrink: 0;
  }

  .bkt-view-switcher .btn {
    border: none !important;
    font-weight: 600;
    font-size: 0.82rem;
    padding: 6px 14px;
    color: #64748b;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .bkt-view-switcher .btn.active {
    background: linear-gradient(135deg, #2563eb, #1d4ed8) !important;
    color: #ffffff !important;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.28) !important;
  }

  /* --- Top KPI Metric Cards --- */
  .bkt-kpi-card {
    border-radius: 16px;
    padding: 16px 18px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.03);
    display: flex;
    align-items: center;
    gap: 14px;
    height: 100%;
    transition: all 0.2s ease;
  }

  .bkt-kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
    border-color: #cbd5e1;
  }

  .bkt-kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
  }

  .bkt-kpi-icon.blue {
    background: rgba(37, 99, 235, 0.1);
    color: #2563eb;
  }

  .bkt-kpi-icon.amber {
    background: rgba(245, 158, 11, 0.12);
    color: #d97706;
  }

  .bkt-kpi-icon.green {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
  }

  .bkt-kpi-icon.rose {
    background: rgba(244, 63, 94, 0.1);
    color: #e11d48;
  }

  .bkt-kpi-value {
    font-size: 1.32rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.15;
    letter-spacing: -0.01em;
  }

  .bkt-kpi-label {
    font-size: 0.74rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 2px;
  }

  .bkt-kpi-sub {
    font-size: 0.74rem;
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
  }

  /* --- Building Cards View --- */
  .bkt-building-card {
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.03);
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
  }

  .bkt-building-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.07);
    transform: translateY(-2px);
  }

  .bkt-building-card.is-top-building {
    border-color: #bfdbfe;
    background: linear-gradient(180deg, #f8faff 0%, #ffffff 100%);
  }

  .bkt-card-header {
    padding: 16px 18px 14px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 10px;
    -webkit-user-select: none;
    user-select: none;
  }

  .bkt-card-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
  }

  .bkt-card-name {
    font-weight: 700;
    font-size: 1.04rem;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 8px;
    line-height: 1.25;
  }

  .bkt-card-name i {
    color: #2563eb;
  }

  .bkt-card-badges {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
  }

  .bkt-badge-area {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
    font-weight: 700;
    font-size: 0.86rem;
    padding: 4px 10px;
    border-radius: 9999px;
  }

  .bkt-badge-pct {
    background: #f8fafc;
    color: #475569;
    border: 1px solid #e2e8f0;
    font-weight: 600;
    font-size: 0.78rem;
    padding: 4px 8px;
    border-radius: 9999px;
  }

  .bkt-card-progress {
    height: 6px;
    border-radius: 999px;
    background: #f1f5f9;
    overflow: hidden;
  }

  .bkt-card-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #2563eb);
    border-radius: 999px;
    transition: width 0.4s ease;
  }

  .bkt-card-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #64748b;
  }

  .bkt-card-meta-tags {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .bkt-meta-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
  }

  .bkt-card-actions {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .bkt-btn-map-pin {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: #2563eb;
    font-size: 0.76rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 9999px;
    cursor: pointer;
    transition: all 0.15s ease;
  }

  .bkt-btn-map-pin:hover {
    background: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
  }

  .bkt-card-chevron {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    color: #64748b;
    transition: transform 0.2s ease, background 0.2s ease;
  }

  .bkt-building-card.is-expanded .bkt-card-chevron {
    transform: rotate(180deg);
    background: #eff6ff;
    color: #2563eb;
    border-color: #bfdbfe;
  }

  .bkt-card-body {
    padding: 0 16px 16px;
    border-top: 1px solid #f1f5f9;
    background: #fafbfc;
    display: none;
  }

  .bkt-building-card.is-expanded .bkt-card-body {
    display: block;
    animation: bktAnimPopIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  }

  .bkt-card-occupant-table {
    font-size: 0.84rem;
    width: 100%;
    margin-bottom: 0;
    background: #ffffff;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
  }

  .bkt-card-occupant-table th {
    font-size: 0.74rem;
    font-weight: 600;
    color: #64748b;
    background: #f8fafc;
    padding: 8px 10px;
    border-bottom: 1px solid #e2e8f0;
  }

  .bkt-card-occupant-table td {
    padding: 8px 10px;
    vertical-align: middle;
    border-bottom: 1px solid #edf2f7;
  }

  .bkt-card-occupant-table tr:last-child td {
    border-bottom: none;
  }

  .bkt-unit-badge-main {
    font-weight: 700;
    color: #0f172a;
  }

  .bkt-unit-badge-sub {
    font-size: 0.8rem;
    color: #475569;
    padding-left: 14px;
    position: relative;
  }

  .bkt-unit-badge-sub::before {
    content: "└";
    position: absolute;
    left: 2px;
    top: 0;
    color: #94a3b8;
    font-family: monospace;
  }

  /* --- Grouped Tree View Styles --- */
  .bkt-tree-table {
    font-size: 0.86rem;
  }

  .bkt-tree-table thead th {
    font-size: 0.78rem;
    font-weight: 700;
    color: #475569;
    padding: 10px 14px;
    border-bottom: 2px solid #e2e8f0;
  }

  .bkt-tree-main-row {
    background: #ffffff;
    cursor: pointer;
    font-weight: 700;
    transition: background 0.15s ease;
  }

  .bkt-tree-main-row:hover {
    background: #f8fafc;
  }

  .bkt-tree-main-row td {
    padding: 10px 14px;
    vertical-align: middle;
    border-bottom: 1px solid #e2e8f0;
  }

  .bkt-tree-sub-row {
    background: #fcfdfe;
    font-size: 0.82rem;
  }

  .bkt-tree-sub-row:hover {
    background: #f1f5f9;
  }

  .bkt-tree-sub-row td {
    padding: 8px 14px;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
  }

  .bkt-tree-toggle-icon {
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: #f1f5f9;
    color: #475569;
    font-size: 0.72rem;
    margin-right: 8px;
    transition: transform 0.15s ease;
  }

  .bkt-tree-main-row.is-expanded .bkt-tree-toggle-icon {
    transform: rotate(90deg);
    background: #eff6ff;
    color: #2563eb;
  }

  /* Matrix Cell Pill Highlight for Non-Zero Cells */
  .pivot-val-pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 6px;
    font-weight: 700;
    color: #0f172a;
    background: rgba(37, 99, 235, 0.08);
    border: 1px solid rgba(37, 99, 235, 0.16);
  }

  #buildingPivotTable th,
  #buildingPivotTable td {
    white-space: nowrap;
  }

  #buildingPivotTable thead th {
    position: sticky;
    top: 0;
    z-index: 3;
  }

  #buildingPivotTable .sticky-col {
    position: sticky;
    left: 0;
    z-index: 4;
  }

  #buildingPivotTable tr.pivot-main-row:hover td {
    background: rgba(37, 99, 235, 0.06);
  }

  #buildingPivotTable tr.pivot-sub-row td {
    font-size: 0.88rem;
  }

  /* Collapsible Building Pivot */
  #buildingPivotSection .pivot-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }

  #buildingPivotSection.building-pivot-collapsed .pivot-actions {
    display: none;
  }

  #buildingPivotSection.building-pivot-collapsed #buildingPivotContent {
    display: none;
  }

  #buildingPivotSection.building-pivot-collapsed {
    padding-bottom: 0 !important;
  }

  #toggleBuildingPivotBtn {
    white-space: nowrap;
  }

  /* ===== Pivot table readability (no text overlap) ===== */
  #buildingPivotContent .table-container {
    overflow: auto;
  }

  #buildingPivotTable {
    border-collapse: separate;
    border-spacing: 0;
    width: max-content;
    min-width: 100%;
    table-layout: auto;
  }

  #buildingPivotContent .table-container {
    max-height: calc(100vh - 260px);
    min-height: 420px;
  }

  #buildingPivotTable th,
  #buildingPivotTable td {
    border-bottom: 1px solid #eef2f7;
    border-right: 1px solid #f1f5f9;
    padding: 8px 10px;
    vertical-align: top;
  }

  #buildingPivotTable thead th {
    position: sticky;
    top: 0;
    z-index: 30;
    background: #FEF3C7 !important;
    /* solid bg to prevent text bleed/overlap while scrolling */
    background-clip: padding-box;
    white-space: normal;
    line-height: 1.15;
    word-break: break-word;
    overflow-wrap: anywhere;
    font-size: 0.82rem;
    box-shadow: 0 2px 0 rgba(148, 163, 184, .28);
  }

  #buildingPivotTable .sticky-col {
    position: sticky;
    left: 0;
    z-index: 20;
    background: #fff;
    background-clip: padding-box;
    box-shadow: 2px 0 0 rgba(148, 163, 184, .20);
  }

  #buildingPivotTable thead th.sticky-col {
    z-index: 35;
    box-shadow: 2px 0 0 rgba(148, 163, 184, .28), 0 2px 0 rgba(148, 163, 184, .28);
  }

  #buildingPivotTable tbody td.sticky-col {
    z-index: 18;
  }

  #buildingPivotTable th.sticky-col {
    min-width: 340px !important;
    max-width: 420px;
  }

  #buildingPivotTable th:not(.sticky-col) {
    min-width: 180px !important;
    max-width: 260px;
  }

  #buildingPivotTable th.pivot-history-col {
    min-width: 260px !important;
    max-width: 420px !important;
  }

  #buildingPivotTable th.pivot-compare-col {
    min-width: 150px !important;
    max-width: 240px !important;
  }

  #buildingPivotTable td {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  #buildingPivotTable td:not(.sticky-col) {
    min-width: 180px;
    max-width: 260px;
  }

  #buildingPivotTable td.pivot-history-cell {
    white-space: normal !important;
    line-height: 1.2;
    max-width: 420px;
    overflow-wrap: anywhere;
    overflow: visible;
    text-overflow: clip;
  }

  #buildingPivotTable td.pivot-compare-cell {
    white-space: nowrap !important;
    font-weight: 650;
    color: #0f172a;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  #buildingPivotTable .pivot-history-wrap {
    display: flex;
    align-items: flex-start;
    gap: 8px;
  }

  #buildingPivotTable .pivot-history-preview {
    flex: 1 1 auto;
  }

  #buildingPivotTable .pivot-history-view {
    flex: 0 0 auto;
    border: 0;
    background: transparent;
    padding: 0;
    color: #0f172a;
    opacity: 0.6;
    cursor: pointer;
  }

  #buildingPivotTable .pivot-history-view:hover {
    opacity: 1;
  }

  #buildingPivotTable tbody tr:hover td {
    background: rgba(37, 99, 235, 0.06);
  }


  /* ===== Pivot: tree bullet list (Main unit > Sub unit) ===== */
  #buildingPivotTable {
    font-size: 13px;
  }

  #buildingPivotTable td,
  #buildingPivotTable th {
    vertical-align: middle;
  }

  #buildingPivotTable td.pivot-label-cell {
    max-width: 560px;
    white-space: normal !important;
    line-height: 1.18;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  #buildingPivotTable .pivot-main-row td {
    background: #ffffff;
  }

  #buildingPivotTable .pivot-main-row td:not(.sticky-col) {
    font-weight: 800;
  }

  #buildingPivotTable .pivot-title {
    display: flex;
    align-items: center;
    gap: 12px;
  }

  #buildingPivotTable .pivot-tree-toggle {
    width: 28px;
    height: 28px;
    border-radius: 9px;
    border: 1px solid #cbd5e1;
    background: linear-gradient(180deg, #ffffff, #f8fafc);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    color: #0f172a;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
    cursor: pointer;
    transition: all 0.12s ease-in-out;
  }

  #buildingPivotTable .pivot-tree-toggle:hover {
    background: #e2e8f0;
    transform: translateY(-1px);
  }

  #buildingPivotTable .pivot-tree-toggle i {
    font-size: 0.72rem;
  }

  #buildingPivotTable .pivot-tree-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #94a3b8;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0.8;
    margin-top: 6px;
  }

  #buildingPivotTable .pivot-caret {
    width: 18px;
    display: inline-flex;
    justify-content: center;
    margin-top: 1px;
    color: #2563eb;
    flex: 0 0 auto;
  }

  #buildingPivotTable .pivot-main-name {
    font-weight: 900;
    color: #0f172a;
  }

  #buildingPivotTable .pivot-map-link {
    background: transparent;
    border: 0;
    padding: 0;
    margin: 0;
    font: inherit;
    color: inherit;
    cursor: pointer;
    text-align: left;
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }

  #buildingPivotTable .pivot-map-link:hover {
    color: #1d4ed8;
    text-decoration: underline;
  }

  #buildingPivotTable .pivot-map-link:focus-visible {
    outline: 2px solid #38bdf8;
    outline-offset: 2px;
    border-radius: 6px;
  }

  #buildingPivotTable .pivot-main-meta {
    margin-top: 2px;
    font-size: 0.74rem;
    font-weight: 600;
    color: #64748b;
  }

  /* Sub rows: show as a clear bullet list under each main unit */
  #buildingPivotTable tr.pivot-sub-row td {
    background: rgba(15, 23, 42, 0.02);
  }

  #buildingPivotTable tr.pivot-sub-row td:not(.sticky-col) {
    color: #334155;
  }

  #buildingPivotTable .pivot-main-row.has-children td.sticky-col {
    padding-left: 10px;
  }

  #buildingPivotTable .pivot-main-row[aria-expanded="false"] td:not(.sticky-col) {
    background: #f8fafc;
    color: #475569;
  }

  #buildingPivotTable tr.pivot-sub-row td.sticky-col {
    position: sticky;
    left: 0;
    white-space: normal !important;
    padding-left: 62px;
    line-height: 1.15;
    word-break: break-word;
    white-space: normal !important;
  }

  /* vertical guide + bullet */
  #buildingPivotTable tr.pivot-sub-row td.sticky-col::before {
    content: none;
  }

  #buildingPivotTable tr.pivot-sub-row td.sticky-col::after {
    content: none;
  }

  #buildingPivotTable .pivot-sub-name {
    display: inline;
    word-break: break-word;
  }

  #buildingPivotTable .pivot-sub-name.pivot-sub-lab {
    color: #0f172a;
    font-weight: 700;
  }

  #buildingPivotTable .pivot-sub-name.pivot-sub-unit {
    color: #0f172a;
    font-weight: 700;
  }

  #buildingPivotTable .pivot-sub-name.pivot-sub-proj {
    color: #0f172a;
    font-weight: 700;
  }

  #buildingPivotTable .pivot-sub-name.pivot-sub-other {
    color: #0f172a;
    font-weight: 650;
  }

:root {
    --ui-radius-1: 14px;
    --ui-radius-2: 18px;
    --ui-shadow-1: 0 14px 40px rgba(2, 6, 23, .08);
    --ui-shadow-2: 0 10px 26px rgba(2, 6, 23, .06);
    --ui-border: rgba(15, 23, 42, .10);
    --ui-surface: rgba(255, 255, 255, .82);
    --ui-surface-2: rgba(255, 255, 255, .92);
  }

  /* Page */
  body {
    background-image: none !important;
    background: #f1f5f9 !important;
  }

  .main-container {
    padding: 18px 18px 22px !important;
    gap: 16px !important;
  }

  /* Top bar */
  .navbar {
    position: sticky;
    top: 10px;
    z-index: 1500;
    margin: 12px 12px 0;
    padding: 12px 14px !important;
    border-radius: var(--ui-radius-2) !important;
    border: 1px solid rgba(255, 255, 255, 0.8) !important;
    background: rgba(255, 255, 255, .9) !important;
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.04) !important;
  }

  .brand-text {
    font-weight: 800 !important;
    letter-spacing: .2px;
    color: var(--text-main) !important;
    display: flex;
    align-items: center;
    gap: 10px;
    line-height: 1.2;
  }

  .brand-text i {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: rgba(37, 99, 235, .10);
    color: var(--primary);
  }

  /* Segmented tabs */
  .nav-tabs-custom {
    border: 1px solid var(--ui-border) !important;
    background: rgba(2, 6, 23, .03) !important;
    border-radius: 999px !important;
    padding: 4px !important;
    gap: 2px;
  }

  .nav-tabs-custom .nav-link {
    border: 0 !important;
    border-radius: 999px !important;
    padding: .50rem .95rem !important;
    font-weight: 700 !important;
    color: var(--text-sub) !important;
    transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
  }

  .nav-tabs-custom .nav-link:hover {
    transform: translateY(-1px);
  }

  .nav-tabs-custom .nav-link.active {
    background: #ffffff !important;
    color: var(--primary) !important;
    box-shadow: 0 1px 0 rgba(255, 255, 255, .85), 0 10px 22px rgba(2, 6, 23, .10) !important;
  }

  /* Buttons */
  .btn {
    border-radius: 12px !important;
    font-weight: 700;
  }

  .btn.btn-sm {
    border-radius: 10px !important;
    padding: .42rem .72rem !important;
  }

  .btn.btn-light {
    background: rgba(255, 255, 255, .86) !important;
    border-color: rgba(15, 23, 42, .10) !important;
  }

  .btn.btn-light:hover {
    background: rgba(255, 255, 255, 1) !important;
  }

  .btn-outline-secondary {
    border-color: rgba(15, 23, 42, .15) !important;
  }

  /* Panels */
  .control-bar {
    border-radius: var(--ui-radius-2) !important;
    border: 1px solid rgba(255, 255, 255, 0.8) !important;
    background: rgba(255, 255, 255, 0.85) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.04) !important;
  }

  .content-area {
    border-radius: var(--ui-radius-2) !important;
    border: 1px solid var(--ui-border) !important;
    background: rgba(255, 255, 255, .80) !important;
    box-shadow: var(--ui-shadow-2) !important;
    overflow: hidden;
  }

  /* Inputs */
  .form-control,
  .form-select {
    border-radius: 12px !important;
    border: 1px solid rgba(15, 23, 42, .12) !important;
    background: var(--ui-surface-2) !important;
  }

  .form-control:focus,
  .form-select:focus {
    box-shadow: 0 0 0 .22rem rgba(37, 99, 235, .18) !important;
    border-color: rgba(37, 99, 235, .35) !important;
  }

  /* KPI cards */
  .stat-card {
    border: 1px solid rgba(15, 23, 42, .10) !important;
    background: rgba(255, 255, 255, .86) !important;
    border-radius: 16px !important;
    box-shadow: 0 10px 22px rgba(2, 6, 23, .06) !important;
  }

  /* Toolbars */
  .excel-quick-tools {
    border-radius: 16px !important;
    border: 1px solid rgba(15, 23, 42, .10) !important;
    background: rgba(255, 255, 255, .76) !important;
    box-shadow: 0 10px 22px rgba(2, 6, 23, .06) !important;
  }

  /* Table */
  .table-container {
    border-radius: 16px !important;
    border: 1px solid rgba(15, 23, 42, .10) !important;
    background: #ffffff !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .85);
  }

  #dataTable {
    background: #ffffff !important;
  }

  #dataTable thead th {
    background: #ffffff !important;
    border-bottom: 1px solid rgba(15, 23, 42, .12) !important;
  }

  #dataTable tbody td {
    border-color: rgba(15, 23, 42, .08) !important;
  }

  .selected-cell {
    outline: 2px solid rgba(37, 99, 235, .75) !important;
    outline-offset: -2px;
  }

  /* Dropdown/menus */
  #columnMenu {
    border-radius: 16px !important;
    border: 1px solid rgba(15, 23, 42, .12) !important;
    box-shadow: var(--ui-shadow-1) !important;
    background: rgba(255, 255, 255, .96) !important;
  }

  /* Map panels */
  .glass-panel {
    border-radius: 16px !important;
    border: 1px solid rgba(15, 23, 42, .10) !important;
    background: rgba(255, 255, 255, .90) !important;
    box-shadow: var(--ui-shadow-2) !important;
    /* PERF: removed backdrop-filter */
  }

  /* Modals */
  .modal-content {
    border-radius: 18px !important;
    border: 1px solid rgba(15, 23, 42, .12) !important;
    box-shadow: var(--ui-shadow-1) !important;
  }

  .modal-header {
    border-bottom: 1px solid rgba(15, 23, 42, .10) !important;
  }

  /* SweetAlert */
  .swal2-popup {
    border-radius: 18px !important;
    border: 1px solid rgba(15, 23, 42, .12) !important;
    box-shadow: var(--ui-shadow-1) !important;
  }

  /* Small tweaks */
  .badge {
    border-radius: 999px !important;
  }

:root {
    --aurora-surface: rgba(255, 255, 255, 0.94);
    --aurora-surface-2: rgba(255, 255, 255, 0.9);
    --aurora-border: rgba(255, 255, 255, 0.55);
    --aurora-shadow: 0 26px 70px rgba(6, 13, 33, 0.12);
    --aurora-shadow-strong: 0 32px 90px rgba(6, 13, 33, 0.18);
    --aurora-grad: linear-gradient(135deg, #0ea5e9 0%, #2563eb 45%, #f59e0b 100%);
    --aurora-grad-soft: linear-gradient(140deg, rgba(14, 165, 233, 0.12), rgba(37, 99, 235, 0.10) 55%, rgba(245, 158, 11, 0.10));
    --aurora-text: #0f172a;
    --aurora-muted: #64748b;
    --aurora-ring: 0 0 0 1px rgba(255, 255, 255, 0.35);
  }

  body {
    background: linear-gradient(180deg, #f4f7fb 0%, #e6ecf7 100%);
    position: relative;
    color: var(--aurora-text);
  }

  /* PERF: Removed body::before/::after blur pseudo-elements.
     Original used filter:blur(80-90px) on 48vw elements = massive GPU cost.
     Using pre-blurred radial-gradients on body background instead (zero GPU cost). */
  body::before,
  body::after {
    content: none;
  }

  .main-container {
    position: relative;
    z-index: 1;
  }

  /* Navigation */
  .navbar {
    background: var(--aurora-surface);
    border: 1px solid var(--aurora-border);
    box-shadow: 0 18px 40px rgba(6, 13, 33, 0.08);
    -webkit-backdrop-filter: blur(22px);
    backdrop-filter: blur(22px);
    padding: 12px 16px !important;
  }

  .brand-text {
    color: var(--aurora-text) !important;
    letter-spacing: 0.1px;
  }

  .nav-tabs-custom {
    border-radius: 999px !important;
    border: 1px solid rgba(15, 23, 42, 0.12) !important;
    background: rgba(255, 255, 255, 0.75) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 10px 26px rgba(6, 13, 33, 0.08);
  }

  .nav-tabs-custom .nav-link {
    color: var(--aurora-muted) !important;
  }

  .nav-tabs-custom .nav-link.active {
    background: #fff !important;
    color: #2563eb !important;
    box-shadow: 0 10px 26px rgba(6, 13, 33, 0.12);
  }

  /* Shell cards */
  .control-bar,
  .glass-panel,
  .content-area,
  .table-container {
    background: var(--aurora-surface);
    border: 1px solid var(--aurora-border);
    box-shadow: var(--aurora-shadow);
    /* PERF: removed backdrop-filter from bulk elements */
  }

  .content-area {
    box-shadow: var(--aurora-shadow-strong);
    background-image: var(--aurora-grad-soft);
  }

  .control-bar {
    background-image: linear-gradient(120deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.9));
  }

  #mapContainer {
    border-radius: 20px;
    border: 1px solid var(--aurora-border);
    box-shadow: var(--aurora-shadow-strong);
    background: linear-gradient(180deg, #e2e8f0, #cbd5e1);
  }

  .glass-panel {
    background: rgba(255, 255, 255, 0.82);
  }

  /* KPI cards */
  .kpi-card {
    border: 1px solid rgba(255, 255, 255, 0.8);
    background: radial-gradient(circle at 16% 20%, rgba(14, 165, 233, 0.12), rgba(14, 165, 233, 0)), radial-gradient(circle at 86% 10%, rgba(245, 158, 11, 0.18), rgba(245, 158, 11, 0)), linear-gradient(140deg, #ffffff, #f8fbff);
    box-shadow: 0 18px 46px rgba(6, 13, 33, 0.14);
    transform: translateY(0);
  }

  .kpi-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 22px 60px rgba(6, 13, 33, 0.16);
  }

  .kpi-card::before {
    width: 6px;
    border-radius: 16px 0 0 16px;
  }

  /* Buttons */
  .btn {
    border-radius: 14px !important;
    border: 1px solid rgba(15, 23, 42, 0.08) !important;
    box-shadow: 0 14px 32px rgba(6, 13, 33, 0.12);
    transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
  }

  .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 36px rgba(6, 13, 33, 0.14);
  }

  .btn:active {
    transform: translateY(0) scale(.99);
  }

  .btn-primary {
    background: var(--aurora-grad) !important;
    color: #fff !important;
    border: none !important;
  }

  .btn-success {
    background: linear-gradient(135deg, #10b981, #0ea5e9) !important;
    border: none !important;
    color: #fff !important;
  }

  .btn-light {
    background: rgba(255, 255, 255, 0.9) !important;
  }

  /* Inputs / selects */
  .form-control,
  .form-select {
    border-radius: 12px !important;
    border: 1px solid rgba(15, 23, 42, 0.12) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 10px 26px rgba(6, 13, 33, 0.05);
    background: var(--aurora-surface-2) !important;
  }

  /* Table + column menu */
  #dataTable thead th {
    background: linear-gradient(180deg, #f9fbff, #eef2ff) !important;
    box-shadow: inset 0 -1px 0 rgba(15, 23, 42, 0.08);
  }

  #dataTable tbody td {
    background: #fff;
  }

  tbody tr:hover td {
    background: rgba(37, 99, 235, 0.04);
  }

  #columnMenu {
    border: 1px solid var(--aurora-border) !important;
    box-shadow: var(--aurora-shadow-strong) !important;
  }

  /* Utility chips */
  .gridAdjust {
    box-shadow: 0 14px 36px rgba(6, 13, 33, 0.12);
    border: 1px solid rgba(226, 232, 240, 0.9);
  }

  /* Map zoom buttons */
  .map-zoom-btn {
    border-radius: 12px !important;
    box-shadow: 0 12px 30px rgba(6, 13, 33, 0.12);
  }

  /* Loading overlay */
  #loadingOverlay {
    background: radial-gradient(circle at 35% 30%, rgba(14, 165, 233, 0.16), rgba(14, 165, 233, 0)), radial-gradient(circle at 75% 60%, rgba(245, 158, 11, 0.14), rgba(245, 158, 11, 0)), rgba(248, 250, 252, 0.85);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
  }

  #loadingOverlay .spinner-border {
    width: 3.4rem !important;
    height: 3.4rem !important;
    box-shadow: 0 0 0 6px rgba(37, 99, 235, 0.12);
  }

  #loadingText {
    color: var(--aurora-muted);
    letter-spacing: 0.2px;
  }

  /* Modals / popups */
  .modal-content {
    border: 1px solid var(--aurora-border) !important;
    box-shadow: var(--aurora-shadow-strong) !important;
    background: var(--aurora-surface);
    background-image: var(--aurora-grad-soft);
  }

  .modal-header {
    background: linear-gradient(120deg, rgba(14, 165, 233, 0.16), rgba(37, 99, 235, 0.18));
    border-bottom: 1px solid rgba(255, 255, 255, 0.65) !important;
  }

  #pivotModal .modal-header,
  #chartModal .modal-header {
    background: var(--aurora-grad);
    color: #fff;
    box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.4);
  }

  .swal2-popup.bkt-swal,
  .swal2-popup.report-modal {
    background: var(--aurora-surface);
    background-image: var(--aurora-grad-soft);
    border: 1px solid var(--aurora-border) !important;
    box-shadow: var(--aurora-shadow-strong) !important;
    /* PERF: removed backdrop-filter from popups */
  }

  .bkt-swal-title {
    color: var(--aurora-text);
  }

  .swal2-actions .bkt-btn-primary {
    background: var(--aurora-grad) !important;
    color: #fff !important;
    border: none !important;
  }

  .report-header {
    background: var(--aurora-grad) !important;
    color: #fff !important;
    box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.5);
  }

  .report-card {
    background: #fff !important;
    box-shadow: 0 18px 40px rgba(6, 13, 33, 0.12) !important;
    border: 1px solid rgba(226, 232, 240, 0.9) !important;
  }

  /* Context menu */
  .context-menu {
    box-shadow: 0 22px 48px rgba(6, 13, 33, 0.16);
    border: 1px solid var(--aurora-border);
    background: rgba(255, 255, 255, 0.96);
  }

  /* Pagination / footer */
  .pagination-footer {
    background: rgba(255, 255, 255, 0.9);
    border-top: 1px solid rgba(226, 232, 240, 0.9);
  }

  /* Building pivot */
  #buildingPivotSection {
    background: var(--aurora-surface);
    border-radius: 18px;
    border: 1px solid var(--aurora-border);
    box-shadow: var(--aurora-shadow);
    padding: 14px 14px 8px;
    width: 100%;
    margin-top: 12px;
  }

  #buildingPivotSection .pivot-header-bar {
    background: rgba(255, 255, 255, 0.7);
    border-radius: 14px;
    padding: 10px 12px;
    border: 1px solid rgba(226, 232, 240, 0.9);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
  }

  /* Map toolbar */
  .map-toolbar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
    margin-bottom: 12px;
    align-items: stretch;
  }

  .map-chip {
    background: var(--aurora-surface);
    border: 1px solid var(--aurora-border);
    border-radius: 16px;
    padding: 12px 14px;
    box-shadow: 0 16px 38px rgba(6, 13, 33, 0.12);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    min-height: 76px;
  }

  .map-chip .chip-title {
    font-weight: 800;
    font-size: 0.85rem;
    letter-spacing: 0.2px;
    color: var(--aurora-text);
  }

  .map-chip .chip-sub {
    font-size: 0.78rem;
    color: var(--aurora-muted);
    margin-top: 2px;
  }

  .map-chip .chip-value {
    font-size: 1.4rem;
    font-weight: 900;
    color: #0ea5e9;
    line-height: 1.1;
  }

  .map-chip-zoom .map-zoom-btn,
  .map-chip-pin .map-zoom-btn {
    width: 42px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .map-chip-zoom .zoom-pill,
  .map-chip-pin .zoom-pill {
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.08);
    color: #1d4ed8;
    font-weight: 800;
    border: 1px solid rgba(37, 99, 235, 0.18);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  }

  .map-chip-pin .form-range {
    margin: 0;
    width: 100%;
  }

  .map-chip-admin .form-check-input {
    transform: scale(1.05);
  }

  .map-chip-nav select {
    margin-top: 6px;
  }

  .map-chip-base .map-base-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
  }

  .map-base-btn {
    border-radius: 12px;
    font-size: 0.78rem;
    font-weight: 800;
    padding: 6px 10px;
    border: 1px solid rgba(148, 163, 184, 0.4);
    background: rgba(255, 255, 255, 0.9);
    color: #0f172a;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  }

  .map-base-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 14px rgba(15, 23, 42, 0.12);
  }

  .map-base-btn.is-active {
    color: #fff;
    border-color: transparent;
    box-shadow: 0 14px 22px rgba(15, 23, 42, 0.2);
  }

  .map-base-btn[data-base="bkt"].is-active {
    background: linear-gradient(135deg, #0ea5e9, #2563eb);
  }

  .map-base-btn[data-base="kmutt"].is-active {
    background: linear-gradient(135deg, #f97316, #ef4444);
  }

  .map-chip-base .chip-sub {
    font-weight: 700;
  }

  /* Survey page */
  .survey-shell {
    height: 100%;
    display: flex;
    flex-direction: column;
  }

  .survey-hero {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 20px;
    padding: 24px;
    background: linear-gradient(135deg, #0ea5e9 0%, #2563eb 45%, #0ea5e9 90%);
    border-radius: 20px;
    box-shadow: var(--aurora-shadow-strong);
    color: #0b152c;
    min-height: 420px;
    position: relative;
    overflow: hidden;
  }

  .survey-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.18), transparent 40%), radial-gradient(circle at 80% 0%, rgba(255, 255, 255, 0.12), transparent 38%);
    pointer-events: none;
  }

  .survey-hero-left {
    position: relative;
    z-index: 1;
    color: #e9f5ff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 10px;
  }

  .survey-title {
    font-size: 1.9rem;
    font-weight: 800;
    letter-spacing: 0.2px;
    margin: 0;
    color: #fff;
  }

  .survey-subtitle {
    color: rgba(255, 255, 255, 0.9);
    max-width: 640px;
    margin: 0;
    font-size: 1rem;
  }

  .survey-points {
    list-style: none;
    padding: 0;
    margin: 10px 0 0;
    color: #f8fbff;
    display: grid;
    gap: 6px;
  }

  .survey-points li {
    font-weight: 700;
    letter-spacing: 0.1px;
  }

  .survey-badge {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    color: #fff;
    padding: 6px 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
  }

  .survey-hero-right {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: flex-end;
  }

  .survey-card {
    width: 100%;
    max-width: 520px;
    border-radius: 18px;
    background: var(--aurora-surface);
    border: 1px solid var(--aurora-border);
    overflow: hidden;
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
  }

  .survey-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    background: linear-gradient(135deg, #0ea5e9, #2563eb);
    color: #fff;
  }

  .survey-year-pill {
    padding: 6px 10px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.14);
    font-weight: 800;
    letter-spacing: 0.2px;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
  }

  .survey-form-body {
    padding: 16px 16px 18px;
    background: var(--aurora-surface);
  }

  .survey-form-body .form-control {
    background: #fff !important;
  }

  .survey-footnote {
    line-height: 1.3;
  }

  @media(max-width: 992px) {
    .survey-hero {
      grid-template-columns: 1fr;
    }

    .survey-hero-right {
      justify-content: flex-start;
    }
  }

  /* Map stage */
  .map-wrapper {
    box-shadow: 0 20px 60px rgba(6, 13, 33, 0.16);
  }

.control-grid {
    display: grid;
    grid-template-columns: 1.6fr 1.2fr auto;
    gap: 16px;
    align-items: end;
  }

  @media (max-width: 992px) {
    .control-grid {
      grid-template-columns: 1fr;
    }

    .control-actions {
      align-items: stretch;
    }

    .control-actions .tools-row,
    .control-actions .action-btn-group {
      justify-content: flex-start;
    }

    .filter-row {
      grid-template-columns: repeat(2, minmax(180px, 1fr));
    }
  }

  .filter-row {
    display: grid;
    grid-template-columns: minmax(240px, 1.4fr) repeat(4, minmax(140px, 1fr));
    gap: 10px;
    align-items: end;
  }

  @media (max-width: 576px) {
    .filter-row {
      grid-template-columns: 1fr;
    }
  }

  .control-kpis {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    align-items: stretch;
  }

  @media (max-width: 576px) {
    .control-kpis {
      grid-template-columns: 1fr;
    }
  }

  .control-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-end;
  }

  .control-actions .action-btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
    width: 100%;
  }

  .control-actions .tools-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
    width: 100%;
    z-index: 3000;
  }

  .utility-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
  }

  .utility-left {
    flex: 1 1 360px;
    min-width: 280px;
  }

  .utility-right {
    flex: 1 1 520px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
    min-width: 260px;
  }

  #globalSearch {
    width: 280px;
    max-width: 100%;
  }

  /* Make grid controls compact and wrap nicely */
  .gridAdjust {
    padding: 6px 10px;
  }

  .gridAdjust .form-range {
    width: 120px;
  }

  @media (max-width: 768px) {
    .gridAdjust {
      width: 100%;
      justify-content: space-between;
      gap: 10px !important;
    }

    .gridAdjust .form-range {
      width: 140px;
    }
  }

  /* Collapsible admin tools (ribbon/formula + quick tools) */
  body:not(.tools-open) #adminToolsPanel {
    display: none !important;
  }

  body:not(.tools-open) #excelQuickToolsBar {
    display: none !important;
  }

  /* Reduce ribbon bulk a bit */
  .excel-ribbon {
    padding: 8px 10px;
    gap: 10px;
  }

  .ribbon-group {
    min-width: 200px;
  }

  .formula-bar-container {
    gap: 8px;
  }

  /* Keep control bar content from overlapping menus */
  .control-bar {
    overflow: visible;
  }

:root {
    --clean-bg: #f5f7fb;
    --clean-surface: rgba(255, 255, 255, 0.9);
    --clean-surface-strong: #ffffff;
    --clean-border: rgba(15, 23, 42, 0.08);
    --clean-border-strong: rgba(15, 23, 42, 0.16);
    --clean-shadow-sm: 0 6px 18px rgba(15, 23, 42, 0.08);
    --clean-shadow-md: 0 16px 36px rgba(15, 23, 42, 0.12);
    --clean-shadow-lg: 0 28px 60px rgba(15, 23, 42, 0.16);
    --clean-primary: #0ea5e9;
    --clean-primary-2: #2563eb;
    --clean-accent: #10b981;
    --clean-radius: 18px;
    --clean-radius-sm: 12px;
    --clean-ease: cubic-bezier(.2, .8, .2, 1);
  }

  body {
    background-color: var(--clean-bg) !important;
    background-image: radial-gradient(circle at 8% 8%, rgba(14, 165, 233, 0.12), transparent 45%),
      radial-gradient(circle at 92% 18%, rgba(16, 185, 129, 0.10), transparent 45%),
      radial-gradient(circle at 50% 92%, rgba(37, 99, 235, 0.10), transparent 45%) !important;
    background-attachment: fixed;
  }

  /* PERF: Removed GPU-heavy blur pseudo-elements.
     Using pre-blurred radial-gradients on body background instead. */
  body::before,
  body::after {
    content: none;
  }

  .navbar,
  .main-container {
    position: relative;
    z-index: 1;
  }

  .navbar {
    height: auto !important;
    min-height: 88px;
    border-radius: calc(var(--clean-radius) + 2px) !important;
    background: var(--clean-surface) !important;
    border: 1px solid var(--clean-border) !important;
    box-shadow: var(--clean-shadow-sm) !important;
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
  }

  .brand-logo {
    height: 68px;
    width: auto;
    max-width: 320px;
    object-fit: contain;
    border-radius: 0;
    background: transparent;
    padding: 0;
    box-shadow: none;
    border: none;
    filter: none;
  }

  .brand-text {
    color: #0f172a !important;
    letter-spacing: -0.2px;
    background: none !important;
    -webkit-text-fill-color: currentColor;
  }

  .brand-subtext {
    color: #475569;
  }

  .nav-actions {
    gap: 10px;
  }

  .nav-tabs-custom {
    border: 1px solid var(--clean-border) !important;
    background: rgba(15, 23, 42, 0.04) !important;
    padding: 4px !important;
    border-radius: 999px !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
  }

  .nav-tabs-custom .nav-link {
    border-radius: 999px !important;
    padding: .55rem 1rem !important;
    font-weight: 700 !important;
    color: #475569 !important;
  }

  .nav-tabs-custom .nav-link.active {
    color: var(--clean-primary) !important;
    background: #fff !important;
    box-shadow: var(--clean-shadow-sm) !important;
  }

  .main-container {
    padding: 18px 18px 24px !important;
    gap: 16px !important;
  }

  .control-bar {
    border-radius: calc(var(--clean-radius) + 4px) !important;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.97), rgba(248, 250, 252, 0.92)) !important;
    border: 1px solid var(--clean-border) !important;
    box-shadow: var(--clean-shadow-md) !important;
    /* PERF: removed backdrop-filter */
  }

  .control-grid {
    grid-template-columns: minmax(280px, 1.6fr) minmax(240px, 1.1fr) auto;
    gap: 18px;
    align-items: stretch;
  }

  .control-filters {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .filter-row {
    gap: 12px;
  }

  .filter-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
  }

  .control-kpis {
    gap: 14px;
  }

  .control-actions {
    gap: 12px;
  }

  .kpi-card {
    border-radius: 18px;
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.96), rgba(248, 250, 252, 0.9));
    border: 1px solid var(--clean-border);
    box-shadow: var(--clean-shadow-sm);
    overflow: hidden;
    position: relative;
    transition: transform .2s var(--clean-ease), box-shadow .2s var(--clean-ease);
  }

  .kpi-card::before {
    width: 6px;
    background: linear-gradient(180deg, var(--clean-primary), var(--clean-primary-2));
    border-radius: 18px 0 0 18px;
  }

  .kpi-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--clean-shadow-lg);
  }

  .utility-bar {
    padding: 10px 12px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid var(--clean-border);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
  }

  .gridAdjust {
    border-radius: 999px;
    border: 1px solid var(--clean-border);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.10);
  }

  .form-control,
  .form-select {
    border-radius: var(--clean-radius-sm) !important;
    border: 1px solid var(--clean-border) !important;
    background: rgba(255, 255, 255, 0.96) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  }

  .form-control:focus,
  .form-select:focus {
    border-color: rgba(14, 165, 233, 0.5) !important;
    box-shadow: 0 0 0 .22rem rgba(14, 165, 233, 0.18) !important;
  }

  .btn {
    border-radius: 12px !important;
    font-weight: 700;
    transition: transform .16s var(--clean-ease), box-shadow .16s var(--clean-ease), filter .16s var(--clean-ease);
  }

  .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.12);
  }

  .btn:active {
    transform: translateY(0) scale(.98);
  }

  .btn-primary {
    background: linear-gradient(135deg, var(--clean-primary), var(--clean-primary-2)) !important;
    border: none !important;
    box-shadow: 0 12px 24px rgba(14, 165, 233, 0.25);
  }

  .btn-success {
    background: linear-gradient(135deg, #10b981, #22c55e) !important;
    border: none !important;
    box-shadow: 0 12px 24px rgba(16, 185, 129, 0.25);
  }

  .btn-warning {
    background: linear-gradient(135deg, #f59e0b, #f97316) !important;
    border: none !important;
    box-shadow: 0 12px 24px rgba(245, 158, 11, 0.25);
  }

  .btn-light {
    background: rgba(255, 255, 255, 0.95) !important;
    border: 1px solid var(--clean-border) !important;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.10);
  }

  .btn-outline-primary {
    border-color: rgba(14, 165, 233, 0.6) !important;
    color: var(--clean-primary) !important;
  }

  .btn-outline-secondary {
    border-color: var(--clean-border-strong) !important;
  }

  .btn-outline-danger {
    border-width: 2px;
  }

  .content-area {
    border-radius: calc(var(--clean-radius) + 4px) !important;
    background: #fff !important;
    border: 1px solid var(--clean-border) !important;
    box-shadow: var(--clean-shadow-lg) !important;
  }

  .table-container {
    border-radius: 16px !important;
    border: 1px solid var(--clean-border) !important;
    background: #fff !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  }

  #dataTable thead th {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.96)) !important;
  }

  #dataTable tbody tr:nth-child(even) td {
    background: rgba(15, 23, 42, 0.015);
  }

  tbody tr:hover td {
    background: rgba(14, 165, 233, 0.06);
  }

  .selected-cell {
    outline: 2px solid rgba(14, 165, 233, 0.7) !important;
    box-shadow: 0 0 0 6px rgba(14, 165, 233, 0.15);
  }

  #columnMenu,
  .context-menu {
    border-radius: 16px !important;
    border: 1px solid var(--clean-border) !important;
    box-shadow: var(--clean-shadow-md) !important;
    background: rgba(255, 255, 255, 0.98) !important;
  }

  #loadingOverlay {
    background: radial-gradient(circle at 30% 30%, rgba(14, 165, 233, 0.14), transparent 55%), rgba(248, 250, 252, 0.82) !important;
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
  }

  /* Building pivot: cleaner layout + easier scrolling */
  #buildingPivotSection {
    padding: 14px;
    border-radius: calc(var(--clean-radius) + 4px);
    background: rgba(255, 255, 255, 0.86);
    border: 1px solid var(--clean-border);
    box-shadow: var(--clean-shadow-md);
  }

  #buildingPivotSection .pivot-header-bar {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 10px 12px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--clean-border);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
  }

  #buildingPivotSection .pivot-header-left h6 {
    color: #0f172a;
    letter-spacing: 0.1px;
  }

  #buildingPivotSection .pivot-header-right {
    display: grid;
    gap: 8px;
    justify-items: end;
  }

  #buildingPivotSection .pivot-control-row {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
  }

  #buildingPivotCompareSelect {
    width: min(260px, 100%) !important;
    max-width: 280px;
    min-width: 180px;
    max-height: 120px;
  }

  #buildingPivotSection .pivot-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  #buildingPivotContent .table-container {
    max-height: min(68vh, 640px) !important;
    border-radius: 16px;
    border: 1px solid var(--clean-border);
    background: #fff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
    overscroll-behavior: contain;
    overflow-y: scroll;
    /* Fallback for scrollbar-gutter support */
  }

  #buildingPivotContent .table-container::-webkit-scrollbar {
    height: 10px;
    width: 10px;
  }

  #buildingPivotContent .table-container::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.75);
    border-radius: 999px;
    border: 2px solid rgba(255, 255, 255, 0.9);
  }

  #buildingPivotContent .table-container::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.05);
    border-radius: 999px;
  }

  #buildingPivotTable {
    font-size: 0.84rem;
  }

  #buildingPivotTable th,
  #buildingPivotTable td {
    padding: 10px 12px;
    line-height: 1.25;
  }

  #buildingPivotTable thead th {
    text-align: center;
    background: linear-gradient(180deg, rgba(14, 165, 233, 0.16), rgba(14, 165, 233, 0.06)) !important;
    color: #0f172a;
  }

  #buildingPivotTable thead th.sticky-col {
    text-align: left;
    background: linear-gradient(180deg, rgba(14, 165, 233, 0.18), rgba(14, 165, 233, 0.08)) !important;
  }

  #buildingPivotTable thead th.pivot-history-col {
    text-align: left;
  }

  #buildingPivotTable tbody tr:nth-child(even) td {
    background: rgba(15, 23, 42, 0.018);
  }

  #buildingPivotTable tbody tr.pivot-main-row td {
    background: rgba(255, 255, 255, 0.98);
  }

  #buildingPivotTable tbody tr.pivot-main-row td.sticky-col {
    box-shadow: inset 3px 0 0 rgba(14, 165, 233, 0.35);
  }

  #buildingPivotTable tbody tr.pivot-sub-row td {
    background: rgba(248, 250, 252, 0.9);
  }

  #buildingPivotTable tbody tr:hover td {
    background: rgba(14, 165, 233, 0.08);
  }

  #buildingPivotTable tr.pivot-total-row td {
    background: #fff6cf !important;
    border-top: 2px solid rgba(15, 23, 42, 0.12);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  }

  #buildingPivotTable tr.pivot-total-row td.sticky-col {
    background: #ffefad !important;
    z-index: 24;
  }

  #buildingPivotTable td:not(.sticky-col) {
    text-align: right;
  }

  #buildingPivotTable td.pivot-history-cell {
    text-align: left;
  }

  @keyframes cleanRise {
    from {
      opacity: 0;
      transform: translateY(8px);
    }

    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  @keyframes slideInLeft {
    from {
      opacity: 0;
      transform: translateX(-16px);
    }

    to {
      opacity: 1;
      transform: translateX(0);
    }
  }

  @keyframes fadeIn {
    from {
      opacity: 0;
    }

    to {
      opacity: 1;
    }
  }

  .control-bar,
  .content-area {
    animation: cleanRise .45s var(--clean-ease) both;
  }

  .kpi-card {
    animation: cleanRise .45s var(--clean-ease) both;
  }

  .control-kpis .kpi-card:nth-child(1) {
    animation-delay: .05s;
  }

  .control-kpis .kpi-card:nth-child(2) {
    animation-delay: .1s;
  }

  @media (max-width: 1200px) {
    .navbar {
      flex-wrap: wrap;
    }

    .nav-actions {
      width: 100%;
      justify-content: flex-start;
    }

    .brand-logo {
      height: 56px;
      width: auto;
      max-width: 260px;
      padding: 0;
    }

    #buildingPivotSection .pivot-header-bar {
      grid-template-columns: 1fr;
    }

    #buildingPivotSection .pivot-header-right {
      justify-items: start;
    }

    #buildingPivotSection .pivot-control-row {
      justify-content: flex-start;
    }

    #buildingPivotSection .pivot-actions {
      justify-content: flex-start;
    }
  }

  @media (max-width: 992px) {
    .control-grid {
      grid-template-columns: 1fr;
    }

    .control-actions {
      align-items: stretch;
    }

    #buildingPivotTable th.sticky-col {
      min-width: 260px !important;
    }

    #buildingPivotTable th:not(.sticky-col) {
      min-width: 140px !important;
      max-width: 220px !important;
    }
  }

  /* Utility classes for inline styles */
  .spinner-lg {
    width: 3rem;
    height: 3rem;
  }

  .modal-lg-wide {
    max-width: 95vw;
  }

  .modal-tall {
    height: 90vh;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.97) 0%, rgba(248, 250, 252, 0.99) 100%);
  }

  .modal-header-gradient {
    background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%) !important;
    border-radius: 24px 24px 0 0;
  }

  .pivot-content {
    height: 60vh;
    min-height: 350px;
  }

  .pivot-form {
    min-height: 0;
  }

  .pivot-footer {
    z-index: 10;
  }

  .table-max-height {
    max-height: 520px;
  }

  .map-container-full {
    width: 100%;
    height: 100%;
    overflow: auto;
    position: relative;
    cursor: grab;
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
    display: flex;
  }

  .select-rows-control {
    width: 70px;
  }

  .select-pivot-wide {
    width: 210px;
  }

  .pivot-card-section {
    min-height: 200px;
  }

  .column-menu {
    display: none;
    position: absolute;
    top: 120%;
    right: 0;
    min-width: 280px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 5000;
  }

  /* --- UI MODERNIZATION: Smooth Transitions (Next.js feel) --- */
  .view-container {
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 1;
    transform: translateY(0) scale(1);
    /* PERF: removed will-change to avoid permanent GPU layer allocation */
  }

  .view-exit {
    opacity: 0 !important;
    transform: translateY(-8px) scale(0.99) !important;
    pointer-events: none;
    position: absolute;
    width: 100%;
    top: 0;
    left: 0;
  }

  .view-enter {
    opacity: 0;
    transform: translateY(8px) scale(0.99);
  }

  .view-enter-active {
    opacity: 1 !important;
    transform: translateY(0) scale(1) !important;
  }

  .d-none-animated {
    display: none !important;
  }

  /* Skeleton Loading (Shimmer) */
  .skeleton {
    background: #f1f5f9;
    background-image: linear-gradient(90deg,
        rgba(255, 255, 255, 0) 0,
        rgba(255, 255, 255, 0.5) 20%,
        rgba(255, 255, 255, 0.8) 60%,
        rgba(255, 255, 255, 0));
    background-repeat: no-repeat;
    background-size: 200px 100%;
    display: inline-block;
    position: relative;
    animation: shimmer 1.5s infinite linear;
    border-radius: 6px;
    color: transparent !important;
    cursor: default;
    -webkit-user-select: none;
    user-select: none;
  }

  @keyframes shimmer {
    0% {
      background-position: -200px 0;
    }

    100% {
      background-position: calc(200px + 100%) 0;
    }
  }

  /* Specific Skeletons */
  .skeleton-text {
    height: 1em;
    width: 80%;
    margin-bottom: 0.5em;
  }

  .skeleton-title {
    height: 1.5em;
    width: 50%;
  }

  .skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
  }

  .skeleton-row td {
    position: relative;
  }

  .skeleton-row td::after {
    content: "";
    display: block;
    width: 90%;
    height: 12px;
    background: #e2e8f0;
    border-radius: 4px;
    animation: pulse 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
  }

  @keyframes pulse {

    0%,
    100% {
      opacity: 1;
    }

    50% {
      opacity: .5;
    }
  }

  /* --- NEW ANNUAL SURVEY DESIGN (CENTERED & MODERN) --- */
  .survey-container-modern {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100%;
    padding: 40px 20px;
    background: radial-gradient(circle at 50% 30%, rgba(37, 99, 235, 0.15) 0%, transparent 70%);
  }

  .survey-glass-card {
    width: 100%;
    max-width: 700px;
    background: rgba(255, 255, 255, 0.95);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 32px;
    box-shadow:
      0 20px 50px -12px rgba(15, 23, 42, 0.15),
      0 0 0 1px rgba(255, 255, 255, 0.6) inset;
    padding: 0;
    overflow: hidden;
    position: relative;
    animation: surveyPopIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  @keyframes surveyPopIn {
    0% {
      opacity: 0;
      transform: scale(0.95) translateY(20px);
    }

    100% {
      opacity: 1;
      transform: scale(1) translateY(0);
    }
  }

  .survey-header-modern {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    padding: 40px 40px 30px;
    position: relative;
    overflow: hidden;
  }

  .survey-header-modern::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.2) 0%, transparent 70%);
    border-radius: 50%;
  }

  .survey-header-logo {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.15);
    padding: 8px 16px;
    border-radius: 100px;
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
  }

  .survey-title-large {
    color: white;
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 10px;
    line-height: 1.1;
  }

  .survey-desc {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.05rem;
    line-height: 1.6;
    max-width: 90%;
  }

  .survey-body-modern {
    padding: 40px;
  }

  .form-group-modern {
    margin-bottom: 28px;
    position: relative;
  }

  .form-label-modern {
    display: block;
    font-weight: 700;
    color: #334155;
    margin-bottom: 10px;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .form-label-modern i {
    color: #2563eb;
    background: #dbeafe;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 0.85rem;
  }

  .form-control-modern {
    width: 100%;
    padding: 16px 20px;
    font-size: 1.05rem;
    border: 2px solid #e2e8f0;
    border-radius: 16px;
    background: #f8fafc;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    color: #1e293b;
    font-weight: 500;
  }

  .form-control-modern:focus {
    background: white;
    border-color: #2563eb;
    outline: none;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
    transform: translateY(-1px);
  }

  .form-control-modern::placeholder {
    color: #94a3b8;
    font-weight: 400;
  }

  .survey-notes-field {
    resize: none;
  }

  .btn-submit-modern {
    width: 100%;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: white;
    border: none;
    padding: 18px;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 10px 20px -5px rgba(37, 99, 235, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
  }

  .btn-submit-modern:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 30px -5px rgba(37, 99, 235, 0.5);
  }

  .btn-submit-modern:active {
    transform: translateY(-1px);
  }

  /* Hardening + anti-pattern cleanup */
  .brand-copy {
    min-width: 0;
    max-width: min(64vw, 760px);
  }

  .brand-text {
    background: none;
    -webkit-background-clip: border-box;
    -webkit-text-fill-color: currentColor;
    background-clip: border-box;
    color: #173766;
    overflow-wrap: anywhere;
  }

  .brand-subtext {
    overflow-wrap: anywhere;
  }

  .form-label-mini {
    background: none;
    -webkit-background-clip: border-box;
    -webkit-text-fill-color: currentColor;
    background-clip: border-box;
    color: #475569;
  }

  @media (max-width: 1200px) {
    .brand-logo {
      height: 58px;
      width: auto;
      max-width: 280px;
    }
  }

  @media (max-width: 992px) {
    .navbar {
      flex-wrap: wrap;
    }

    .brand-block {
      align-items: flex-start;
    }

    .brand-copy {
      max-width: 100%;
    }

    .nav-actions {
      width: 100%;
      justify-content: flex-end;
    }
  }

  @media (max-width: 576px) {
    .brand-logo {
      height: 44px;
      width: auto;
      max-width: 200px;
      padding: 0;
    }

    .brand-text {
      font-size: 0.92rem;
      line-height: 1.25;
    }

    .brand-subtext {
      font-size: 0.72rem;
      line-height: 1.35;
    }
  }

  /* Flagship polish layer (frontend-design + polish + typeset + arrange + colorize) */
  :root {
    --refine-ink: #0f223e;
    --refine-muted: #3f546f;
    --refine-soft: #eef4fb;
    --refine-border: rgba(23, 55, 102, 0.16);
    --refine-focus: rgba(14, 165, 233, 0.36);
    --refine-shadow: 0 12px 34px rgba(15, 23, 42, 0.12);
  }

  body {
    color: var(--refine-ink);
  }

  .navbar {
    padding: 10px 18px;
  }

  .brand-copy {
    gap: 6px;
  }

  .brand-text {
    font-weight: 800;
    font-size: clamp(1rem, 0.76vw + 0.88rem, 1.34rem);
    line-height: 1.18;
    letter-spacing: -0.01em;
    color: var(--refine-ink) !important;
  }

  .brand-subtext {
    color: var(--refine-muted);
    line-height: 1.36;
    max-width: 74ch;
  }

  .nav-tabs-custom .nav-link {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
  }

  #statusBadge {
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 0.76rem;
  }

  .control-bar {
    padding: 1rem 1.15rem;
  }

  .form-label-mini {
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  .filter-item .form-select,
  .filter-item .form-control,
  #sheetSelect {
    min-height: 38px;
    font-size: 0.92rem;
  }

  .kpi-card {
    min-height: 108px;
    padding: 1rem 1.05rem;
    border: 1px solid var(--refine-border);
    box-shadow: var(--refine-shadow);
  }

  .kpi-label {
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    color: #4c6484;
    line-height: 1.35;
    text-transform: uppercase;
  }

  .kpi-value {
    font-size: clamp(1.18rem, 1.15vw + 0.95rem, 1.72rem);
    line-height: 1.15;
    color: #102746;
    font-variant-numeric: tabular-nums;
  }

  .utility-bar {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(244, 249, 255, 0.86));
    border: 1px solid var(--refine-border);
  }

  .utility-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
  }

  #globalSearch {
    min-width: 220px;
  }

  .gridAdjust {
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.86);
  }

  .control-actions .action-btn-group .btn,
  .control-actions .tools-row .btn {
    min-height: 36px;
  }

  .content-area {
    padding: 10px;
  }

  .table-container {
    border-color: var(--refine-border) !important;
  }

  #dataTable {
    font-size: 0.93rem;
  }

  #dataTable thead th {
    position: sticky;
    top: 0;
    z-index: 4;
    color: #1d365a;
    font-weight: 700;
  }

  #dataTable tbody td {
    color: #213958;
    line-height: 1.32;
  }

  #dataTable tbody tr:nth-child(even) td {
    background: rgba(15, 43, 82, 0.028);
  }

  #dataTable tbody tr:hover td {
    background: rgba(14, 165, 233, 0.1);
  }

  .pagination-footer {
    border-top: 1px solid var(--refine-border);
    padding-top: 10px;
    margin-top: 10px;
  }

  #columnMenu,
  .context-menu {
    border-color: var(--refine-border) !important;
  }

  .map-toolbar {
    border: 1px solid var(--refine-border);
    border-radius: 14px;
    box-shadow: var(--refine-shadow);
  }

  .btn:focus-visible,
  .nav-tabs-custom .nav-link:focus-visible,
  .form-control:focus-visible,
  .form-select:focus-visible,
  .form-check-input:focus-visible {
    outline: 0;
    box-shadow: 0 0 0 3px var(--refine-focus) !important;
  }

  /* AI Assistant modal */
  .swal2-container.bkt-ai-container {
    padding: max(10px, 1.2vw) !important;
  }

  .swal2-popup.bkt-ai-popup {
    width: min(92vw, 1540px) !important;
    max-width: min(92vw, 1540px) !important;
    border-radius: 16px !important;
    border: 1px solid #cdd8e5 !important;
    background: #f5f7fb !important;
    box-shadow: 0 20px 52px rgba(15, 23, 42, 0.24) !important;
    padding: 0 !important;
    overflow: hidden !important;
  }

  .swal2-popup.bkt-ai-popup .swal2-title {
    display: flex !important;
    align-items: center;
    gap: 10px;
    font-size: 2rem !important;
    font-weight: 700 !important;
    color: #0f2945 !important;
    margin: 0 !important;
    padding: 18px 22px !important;
    border-bottom: 1px solid #cdd8e5;
    text-align: left !important;
  }

  .swal2-popup.bkt-ai-popup .swal2-close.bkt-ai-close {
    width: 34px;
    height: 34px;
    margin: 12px 16px 0 0;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    color: #64748b;
    font-size: 1.6rem;
    line-height: 1;
    transition: transform 0.15s ease, background-color 0.15s ease;
  }

  .swal2-popup.bkt-ai-popup .swal2-close.bkt-ai-close:hover {
    background: #eef2f7;
    transform: scale(1.03);
  }

  .swal2-popup.bkt-ai-popup .swal2-html-container.bkt-ai-html {
    margin: 0 !important;
    padding: 16px 20px 18px !important;
    overflow: hidden !important;
  }

  .ai-assistant-title {
    display: inline-flex;
    align-items: center;
    gap: 10px;
  }

  .ai-assistant-title-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #cffafe, #a5f3fc);
    color: #0e7490;
    font-size: 1rem;
  }

  .ai-assistant-shell {
    display: flex;
    flex-direction: column;
    gap: 10px;
    height: min(76vh, 760px);
    min-height: 520px;
  }

  .ai-assistant-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
  }

  .ai-btn-summary {
    border-radius: 10px !important;
    border: 0 !important;
    background: linear-gradient(135deg, #0f9cb7, #0e7fa0) !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    box-shadow: 0 6px 16px rgba(14, 127, 160, 0.24) !important;
    min-height: 34px;
  }

  .ai-assistant-check {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.86rem;
    font-weight: 500;
    color: #334155;
    -webkit-user-select: none;
    user-select: none;
    white-space: nowrap;
  }

  .ai-assistant-check input[type="checkbox"] {
    accent-color: #0e8cab;
    width: 14px;
    height: 14px;
  }

  .ai-sheet-note {
    font-size: 0.78rem;
    color: #64748b;
    margin-top: -2px;
  }

  .ai-chat-panel {
    border: 1px solid #c7d5e7;
    border-radius: 12px;
    background: #e5ecf4;
    min-height: 260px;
    height: auto;
    max-height: none;
    overflow: hidden;
    display: flex;
    flex: 1 1 auto;
  }

  .ai-chat-log {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overscroll-behavior: contain;
  }

  .ai-chat-msg {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 86%;
  }

  .ai-chat-msg-assistant {
    align-self: flex-start;
  }

  .ai-chat-msg-user {
    align-self: flex-end;
  }

  .ai-chat-msg-label {
    font-size: 0.76rem;
    font-weight: 700;
    color: #475569;
    padding: 0 4px;
  }

  .ai-chat-msg-bubble {
    background: #ffffff;
    border: 1px solid #d1dbe8;
    border-radius: 11px;
    padding: 9px 11px;
    font-size: 0.88rem;
    line-height: 1.5;
    color: #1e293b;
    box-shadow: 0 2px 7px rgba(15, 23, 42, 0.08);
    word-break: break-word;
  }

  .ai-chat-msg-user .ai-chat-msg-bubble {
    background: linear-gradient(135deg, #0ea5c6, #0b88a5);
    border-color: #0b88a5;
    color: #ffffff;
  }

  .ai-chat-msg-bubble.is-error {
    background: #fef2f2;
    border-color: #fecaca;
    color: #b91c1c;
  }

  .ai-input-panel {
    border: 1px solid #1aa0bf;
    border-radius: 10px;
    background: #ffffff;
  }

  .ai-question-input {
    width: 100%;
    min-height: 70px;
    resize: none;
    border: 0;
    background: transparent;
    font-size: 0.9rem;
    line-height: 1.45;
    color: #0f172a;
    padding: 10px 12px;
  }

  .ai-question-input:focus {
    outline: none;
  }

  .ai-footer-bar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
  }

  .ai-chat-status {
    flex: 1 1 260px;
    min-height: 18px;
    font-size: 0.76rem;
    color: #64748b;
  }

  .ai-chat-status.is-error {
    color: #b91c1c;
  }

  .ai-footer-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
  }

  .ai-btn-clear,
  .ai-btn-send {
    border-radius: 11px !important;
    border: 0 !important;
    min-height: 34px;
    font-weight: 700 !important;
    box-shadow: none !important;
    padding: 0 15px !important;
  }

  .ai-btn-clear {
    background: #64748b !important;
    color: #ffffff !important;
  }

  .ai-btn-send {
    background: #0891b2 !important;
    color: #ffffff !important;
  }

  .ai-btn-summary:disabled,
  .ai-btn-clear:disabled,
  .ai-btn-send:disabled {
    opacity: 0.66 !important;
    cursor: not-allowed;
  }

  @media (max-width: 768px) {
    .swal2-popup.bkt-ai-popup .swal2-title {
      font-size: 1.45rem !important;
      padding: 14px 16px !important;
    }

    .swal2-popup.bkt-ai-popup .swal2-html-container.bkt-ai-html {
      padding: 12px 12px 14px !important;
    }

    .ai-assistant-toolbar {
      gap: 8px;
    }

    .ai-assistant-shell {
      height: min(82vh, 720px);
      min-height: 460px;
    }

    .ai-chat-panel {
      min-height: 210px;
    }

    .ai-chat-msg {
      max-width: 96%;
    }

    .ai-footer-actions {
      width: 100%;
      justify-content: flex-end;
    }

    .ai-btn-summary {
      width: 100%;
    }
  }

  @media (max-width: 1200px) {
    .brand-subtext {
      max-width: 54ch;
    }

    .control-grid {
      grid-template-columns: minmax(260px, 1.5fr) minmax(220px, 1fr) auto;
    }
  }

  @media (max-width: 992px) {
    .navbar {
      padding: 10px 12px;
      gap: 10px;
    }

    .nav-actions {
      gap: 8px;
    }

    .control-bar {
      padding: 0.9rem 0.9rem;
    }

    .content-area {
      padding: 8px;
    }

    #globalSearch {
      min-width: 170px;
      flex: 1 1 220px;
    }
  }

  @media (max-width: 576px) {
    .main-container {
      padding: 12px 10px 16px !important;
      gap: 10px !important;
    }

    .brand-text {
      font-size: 0.95rem;
    }

    .brand-subtext {
      font-size: 0.7rem;
      max-width: 100%;
    }

    .kpi-card {
      min-height: 96px;
      padding: 0.85rem 0.9rem;
    }

    .kpi-value {
      font-size: 1.24rem;
    }

    .utility-right {
      width: 100%;
    }

    .gridAdjust {
      width: 100%;
      justify-content: space-between;
    }
  }

html,
  body {
    max-width: 100%;
    overflow-x: hidden;
  }

  .navbar,
  .main-container,
  #viewTable,
  #viewMap,
  #viewSurvey,
  .control-grid,
  .filter-row,
  .utility-right,
  .content-area,
  #mapContainer,
  #mapWrapper,
  #mapStage {
    min-width: 0;
  }

  .navbar>.d-flex.align-items-center.gap-3,
  .brand-block,
  .brand-copy,
  .nav-actions {
    min-width: 0;
  }

  .brand-logo {
    height: clamp(48px, 5vw, 70px);
    width: auto;
    max-width: 320px;
  }

  .brand-text {
    font-size: clamp(0.9rem, 0.75rem + 0.55vw, 1.12rem);
    line-height: 1.18;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .brand-subtext {
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.25;
  }

  .control-grid {
    grid-template-columns: minmax(360px, 1.7fr) minmax(260px, 1.15fr) minmax(260px, 1fr);
    align-items: stretch;
  }

  .filter-row {
    grid-template-columns: minmax(230px, 1.35fr) repeat(4, minmax(140px, 1fr));
  }

  .control-actions .action-btn-group,
  .control-actions .tools-row,
  .utility-right {
    justify-content: flex-start;
  }

  #globalSearch {
    flex: 1 1 260px;
    width: auto;
    min-width: 180px;
  }

  .gridAdjust {
    flex-wrap: wrap;
    row-gap: 6px;
    min-width: 260px;
  }

  #viewMap {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
  }

  #viewMap #mapContainer.map-container-full {
    flex: 1 1 auto;
    height: auto;
    min-height: 320px;
  }

  .map-base-btn {
    white-space: normal;
    line-height: 1.25;
  }

  @media (max-width: 1300px) {
    .control-grid {
      grid-template-columns: 1fr;
    }
  }

  @media (max-width: 1200px) {
    .navbar {
      flex-wrap: wrap;
      align-items: flex-start;
    }

    .nav-actions {
      width: 100%;
      justify-content: flex-start;
      align-items: center;
    }

    .nav-tabs-custom {
      order: -1;
      width: 100%;
      justify-content: flex-start;
    }

    .filter-row {
      grid-template-columns: repeat(2, minmax(170px, 1fr));
    }
  }

  @media (max-width: 768px) {
    .filter-row,
    .map-toolbar {
      grid-template-columns: 1fr;
    }

    .utility-right,
    .gridAdjust {
      width: 100%;
    }

    #globalSearch {
      flex: 1 1 100%;
      min-width: 0;
    }
  }

/* Final layout override: let dense controls wrap before they collide. */
  .navbar {
    gap: 14px !important;
  }

  .navbar > .d-flex.align-items-center.gap-3 {
    flex: 1 1 520px;
    max-width: 100%;
  }

  .brand-block {
    width: 100%;
  }

  .brand-copy {
    flex: 1 1 auto;
    max-width: none !important;
  }

  .nav-actions {
    flex: 1 1 560px;
    justify-content: flex-end;
    row-gap: 8px;
    min-width: 0;
  }

  .nav-tabs-custom {
    display: flex;
    flex-wrap: wrap;
    max-width: 100%;
  }

  .nav-tabs-custom .nav-link {
    white-space: nowrap;
  }

  @media (max-width: 1500px) {
    .navbar {
      flex-wrap: wrap !important;
      align-items: flex-start !important;
    }

    .nav-actions {
      width: 100%;
      justify-content: flex-start !important;
    }
  }

  .control-grid {
    grid-template-columns: minmax(0, 1fr) minmax(300px, auto) !important;
    grid-template-areas:
      "filters filters"
      "kpis actions";
    align-items: stretch;
    gap: 16px 18px !important;
  }

  .control-filters {
    grid-area: filters;
    min-width: 0;
  }

  .control-kpis {
    grid-area: kpis;
    min-width: 0;
    grid-template-columns: repeat(2, minmax(220px, 1fr)) !important;
  }

  .control-actions {
    grid-area: actions;
    align-items: stretch !important;
    min-width: 0;
  }

  .filter-row {
    grid-template-columns: minmax(220px, 1.25fr) repeat(4, minmax(150px, 1fr)) !important;
    gap: 12px !important;
    min-width: 0;
  }

  .filter-item,
  .filter-item .d-flex {
    min-width: 0;
  }

  .filter-item .form-select,
  .filter-item .form-control {
    width: 100%;
  }

  .control-actions .tools-row,
  .control-actions .action-btn-group {
    justify-content: flex-end !important;
    gap: 8px 10px !important;
  }

  .control-actions .tools-row .btn,
  .control-actions .action-btn-group .btn {
    white-space: nowrap;
  }

  .utility-bar {
    gap: 12px !important;
  }

  .utility-right {
    flex: 1 1 100%;
    display: grid !important;
    grid-template-columns: minmax(260px, 1fr) auto minmax(360px, auto);
    align-items: center;
    gap: 10px;
  }

  #globalSearch {
    width: 100% !important;
    min-width: 0 !important;
  }

  .gridAdjust {
    min-width: 0 !important;
    justify-content: flex-end;
  }

  #buildingPivotSection .pivot-header-bar {
    display: grid !important;
    grid-template-columns: minmax(300px, 1fr) minmax(360px, auto);
    align-items: center;
    gap: 14px !important;
  }

  #buildingPivotSection .pivot-header-left,
  #buildingPivotSection .pivot-header-right {
    min-width: 0;
  }

  #buildingPivotSection .pivot-header-right {
    display: flex !important;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 10px 12px !important;
  }

  #buildingPivotSection .pivot-control-row {
    flex-wrap: wrap;
    justify-content: flex-end !important;
    min-width: 0;
  }

  #buildingPivotSection .pivot-control-row label {
    white-space: nowrap;
  }

  #buildingPivotCompareSelect {
    width: 220px !important;
    min-width: 190px !important;
  }

  #buildingPivotSection .pivot-actions {
    justify-content: flex-end !important;
    gap: 8px !important;
  }

  @media (max-width: 1200px) {
    .control-grid {
      grid-template-columns: 1fr !important;
      grid-template-areas:
        "filters"
        "kpis"
        "actions";
    }

    #buildingPivotSection .pivot-header-bar {
      grid-template-columns: 1fr !important;
    }

    .control-actions .tools-row,
    .control-actions .action-btn-group,
    #buildingPivotSection .pivot-header-right,
    #buildingPivotSection .pivot-control-row,
    #buildingPivotSection .pivot-actions {
      justify-content: flex-start !important;
    }

    .filter-row {
      grid-template-columns: repeat(2, minmax(180px, 1fr)) !important;
    }

    .utility-right {
      grid-template-columns: minmax(220px, 1fr) auto;
    }

    .gridAdjust {
      grid-column: 1 / -1;
      justify-content: flex-start;
      width: 100%;
    }
  }

  @media (max-width: 768px) {
    .navbar,
    .control-bar,
    .content-area {
      border-radius: 14px !important;
    }

    .brand-block {
      align-items: flex-start;
    }

    .nav-actions,
    .nav-tabs-custom {
      width: 100%;
    }

    .nav-actions .btn {
      flex: 1 1 auto;
    }

    .filter-row,
    .control-kpis,
    .utility-right {
      grid-template-columns: 1fr !important;
    }

    .control-actions .tools-row .btn {
      flex: 1 1 calc(50% - 8px);
    }

    #buildingPivotCompareSelect {
      width: 100% !important;
    }
  }

/* CSS Containment: prevent layout thrashing from spreading across sections */
  .table-container,
  #buildingPivotContent .table-container,
  .content-area,
  .control-bar {
    contain: layout style;
  }

  /* Simplify box-shadows: reduce multi-layer shadows to single layer on non-critical elements */
  .usage-legend-item,
  .usage-meta-item,
  .usage-chart-wrap,
  .map-chip {
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08) !important;
  }

  /* Reduce transition properties: only animate transform (GPU-accelerated) */
  .btn {
    transition: transform .14s ease, opacity .14s ease !important;
  }

  .kpi-card {
    transition: transform .2s ease !important;
  }

  /* Remove all remaining backdrop-filter on non-essential elements */
  .control-bar,
  .glass-panel,
  .content-area,
  .swal2-popup,
  .map-chip,
  .survey-glass-card,
  .survey-card,
  #loadingOverlay,
  .chip,
  .stat-chip,
  .btn-add-image,
  #imgEditBox,
  .survey-header-logo {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }

  /* Keep backdrop-filter ONLY on navbar (sticky glass effect truly benefits from it) */
  .navbar {
    -webkit-backdrop-filter: blur(18px) !important;
    backdrop-filter: blur(18px) !important;
  }

  /* GPU hint only during active transitions */
  .btn:hover,
  .kpi-card:hover {
    will-change: transform;
  }

  /* Debounce paint on table rows */
  #dataTable tbody tr {
    contain: layout style;
  }

  #buildingPivotTable tbody tr {
    contain: layout style;
  }

#bktUserManual .manual-hero{
                background: linear-gradient(135deg, #f3f8ff 0%, #fff7ef 100%);
                border: 1px solid #e6ebf5;
              }
              #bktUserManual .manual-nav .nav-link{
                border-radius: 999px;
                padding: .35rem .9rem;
                font-weight: 600;
                color: #495057;
              }
              #bktUserManual .manual-nav .nav-link.active{
                background: #0d6efd;
                color: #fff;
              }
              #bktUserManual .manual-card{
                border: 1px solid #e9ecef;
                background: #fff;
              }
              #bktUserManual .manual-step{
                display: flex;
                gap: 12px;
                padding: 12px 14px;
                border: 1px solid #e9ecef;
                border-radius: 12px;
                background: #fff;
              }
              #bktUserManual .step-badge{
                width: 36px;
                height: 36px;
                border-radius: 50%;
                display: inline-flex;
                align-items: center;
                justify-content: center;
                background: #e7f1ff;
                color: #0d6efd;
                font-weight: 700;
                flex: 0 0 36px;
              }
              #bktUserManual .manual-kbd{
                font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
                background: #f1f3f5;
                padding: 0 .35rem;
                border-radius: 6px;
                font-size: .85em;
              }
              #bktUserManual .manual-callout{
                border: 1px dashed #cfe2ff;
                background: #f8fbff;
                border-radius: 12px;
                padding: 12px 14px;
              }
              #bktUserManual .manual-list{
                padding-left: 1.1rem;
              }

/* =========================================================
   BKT MODERN GOOGLE AUTH & PREMIUM POPUP SUITE
   ========================================================= */

/* --- Google SVG & Buttons --- */
.google-icon-svg,
.bkt-google-hero-svg {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

/* Header Google Sign-In Button */
.btn-google-nav {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #ffffff !important;
  color: #374151 !important;
  border: 1px solid #d1d5db !important;
  border-radius: 9999px !important;
  padding: 6px 14px !important;
  font-family: 'Kanit', sans-serif !important;
  font-size: 0.85rem !important;
  font-weight: 600 !important;
  letter-spacing: 0.01em;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04) !important;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1) !important;
  cursor: pointer;
}

.btn-google-nav:hover {
  background: #f9fafb !important;
  border-color: #93c5fd !important;
  color: #1d4ed8 !important;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.18) !important;
  transform: translateY(-1px);
}

.btn-google-nav:active {
  background: #f3f4f6 !important;
  transform: scale(0.98) translateY(0) !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) !important;
}

/* Redesigned Logout Button */
.btn-danger-soft {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fef2f2 !important;
  color: #dc2626 !important;
  border: 1px solid #fecaca !important;
  font-weight: 600 !important;
  font-size: 0.84rem !important;
  padding: 6px 12px !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.btn-danger-soft:hover {
  background: #dc2626 !important;
  color: #ffffff !important;
  border-color: #dc2626 !important;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.25) !important;
  transform: translateY(-1px);
}

.btn-danger-soft:active {
  transform: scale(0.98) translateY(0) !important;
}

.btn-google-nav.d-none,
.btn-danger-soft.d-none,
#headerLoginBtn.d-none,
#adminLogoutBtn.d-none {
  display: none !important;
}

/* User Status Badges */
.bkt-badge-admin {
  background: rgba(239, 68, 68, 0.08) !important;
  color: #b91c1c !important;
  border: 1px solid rgba(239, 68, 68, 0.25) !important;
  border-radius: 9999px !important;
  padding: 5px 10px !important;
  font-size: 0.76rem !important;
  font-weight: 600 !important;
  letter-spacing: 0.02em;
}

.bkt-badge-viewer {
  background: rgba(37, 99, 235, 0.08) !important;
  color: #1d4ed8 !important;
  border: 1px solid rgba(37, 99, 235, 0.25) !important;
  border-radius: 9999px !important;
  padding: 5px 10px !important;
  font-size: 0.76rem !important;
  font-weight: 500 !important;
}

.bkt-badge-guest {
  background: rgba(100, 116, 139, 0.08) !important;
  color: #475569 !important;
  border: 1px solid rgba(148, 163, 184, 0.3) !important;
  border-radius: 9999px !important;
  padding: 5px 10px !important;
  font-size: 0.76rem !important;
  font-weight: 500 !important;
  cursor: pointer;
  transition: all 0.2s ease !important;
}

.bkt-badge-guest:hover {
  background: rgba(37, 99, 235, 0.12) !important;
  color: #1d4ed8 !important;
  border-color: #93c5fd !important;
}

/* --- Global SweetAlert2 Theme Redesign --- */
.swal2-container {
  z-index: 10050 !important;
}

.swal2-backdrop-show {
  background: rgba(15, 23, 42, 0.5) !important;
  -webkit-backdrop-filter: blur(6px) !important;
  backdrop-filter: blur(6px) !important;
}

.swal2-popup.bkt-swal,
.swal2-popup {
  border-radius: 24px !important;
  padding: 28px 24px 24px !important;
  background: #ffffff !important;
  border: 1px solid rgba(226, 232, 240, 0.9) !important;
  box-shadow: 0 25px 60px -15px rgba(15, 23, 42, 0.25), 0 0 0 1px rgba(241, 245, 249, 0.8) !important;
  font-family: 'Kanit', sans-serif !important;
  color: #1e293b !important;
}

.swal2-popup .swal2-title {
  font-family: 'Kanit', sans-serif !important;
  font-weight: 700 !important;
  font-size: 1.32rem !important;
  color: #0f172a !important;
  padding: 0 !important;
  margin-bottom: 8px !important;
}

.swal2-popup .swal2-html-container {
  font-family: 'Kanit', sans-serif !important;
  font-size: 0.94rem !important;
  color: #475569 !important;
  line-height: 1.6 !important;
  margin: 0 !important;
  padding: 4px 0 12px !important;
}

.swal2-popup .swal2-actions {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 10px !important;
  margin-top: 18px !important;
  width: 100% !important;
}

.swal2-popup .swal2-close {
  width: 32px !important;
  height: 32px !important;
  border-radius: 50% !important;
  border: 1px solid #e2e8f0 !important;
  color: #94a3b8 !important;
  font-size: 1.4rem !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  top: 14px !important;
  right: 14px !important;
  background: #f8fafc !important;
  transition: all 0.18s ease !important;
}

.swal2-popup .swal2-close:hover {
  background: #f1f5f9 !important;
  color: #0f172a !important;
  transform: rotate(90deg) scale(1.05);
}

/* Custom SweetAlert Button Classes */
.bkt-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'Kanit', sans-serif !important;
  font-weight: 600 !important;
  font-size: 0.94rem !important;
  border-radius: 9999px !important;
  padding: 10px 22px !important;
  min-height: 42px !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
  cursor: pointer !important;
  text-decoration: none !important;
  border: none !important;
  -webkit-user-select: none !important;
  user-select: none !important;
}

.swal2-actions .swal2-styled[style*="display: none"],
.swal2-actions button.bkt-btn[style*="display: none"],
.swal2-popup .swal2-deny[style*="display: none"],
.swal2-popup .swal2-cancel[style*="display: none"] {
  display: none !important;
}

/* Official Google Action Button */
.bkt-btn-google {
  background: #ffffff !important;
  color: #374151 !important;
  border: 1px solid #dadce0 !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04) !important;
  font-size: 1rem !important;
  font-weight: 600 !important;
  padding: 11px 24px !important;
  min-height: 46px !important;
  position: relative !important;
  overflow: hidden !important;
}

.bkt-btn-google:hover {
  background: #f8fafc !important;
  border-color: #93c5fd !important;
  color: #1d4ed8 !important;
  box-shadow: 0 6px 20px rgba(66, 133, 244, 0.22) !important;
  transform: translateY(-2px) !important;
}

.bkt-btn-google:active {
  background: #f1f5f9 !important;
  transform: scale(0.98) translateY(0) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
}

/* Primary Gradient Button */
.bkt-btn-primary {
  background: linear-gradient(135deg, #2563eb, #1d4ed8) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3) !important;
}

.bkt-btn-primary:hover {
  background: linear-gradient(135deg, #1d4ed8, #1e40af) !important;
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.42) !important;
  transform: translateY(-2px) !important;
}

.bkt-btn-primary:active {
  transform: scale(0.98) translateY(0) !important;
}

/* Danger / Logout Button */
.bkt-btn-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.3) !important;
}

.bkt-btn-danger:hover {
  background: linear-gradient(135deg, #dc2626, #b91c1c) !important;
  box-shadow: 0 6px 20px rgba(220, 38, 38, 0.42) !important;
  transform: translateY(-2px) !important;
}

.bkt-btn-danger:active {
  transform: scale(0.98) translateY(0) !important;
}

/* Ghost / Cancel Button */
.bkt-btn-ghost {
  background: #f1f5f9 !important;
  color: #64748b !important;
  border: 1px solid #e2e8f0 !important;
}

.bkt-btn-ghost:hover {
  background: #e2e8f0 !important;
  color: #0f172a !important;
  transform: translateY(-1px) !important;
}

.bkt-btn-ghost:active {
  transform: scale(0.98) translateY(0) !important;
}

/* --- Auth Card Modal Interior Design --- */
.bkt-auth-swal-popup,
.bkt-logout-swal-popup {
  max-width: 440px !important;
  width: 92vw !important;
}

.bkt-auth-modal-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.bkt-auth-hero-icon-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  margin: 4px auto 14px;
}

.bkt-auth-hero-pulse {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(66, 133, 244, 0.22) 0%, rgba(66, 133, 244, 0) 70%);
  animation: bktHeroPulse 2.4s ease-in-out infinite;
}

.bkt-auth-hero-pulse.is-logout {
  background: radial-gradient(circle, rgba(239, 68, 68, 0.25) 0%, rgba(239, 68, 68, 0) 70%);
}

.bkt-auth-hero-circle {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ffffff 0%, #f0f4f9 100%);
  border: 2px solid #ffffff;
  box-shadow: 0 10px 25px -5px rgba(66, 133, 244, 0.25), 0 0 0 1px rgba(226, 232, 240, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
}

.bkt-auth-hero-circle.is-logout {
  background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
  color: #dc2626;
  font-size: 1.8rem;
  box-shadow: 0 10px 25px -5px rgba(220, 38, 38, 0.25), 0 0 0 1px rgba(254, 202, 202, 0.8);
}

@keyframes bktHeroPulse {
  0%, 100% {
    transform: scale(0.95);
    opacity: 0.6;
  }
  50% {
    transform: scale(1.15);
    opacity: 1;
  }
}

.bkt-auth-modal-title {
  font-family: 'Kanit', sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 6px 0;
  line-height: 1.25;
}

.bkt-auth-modal-subtitle {
  font-family: 'Kanit', sans-serif;
  font-size: 0.88rem;
  color: #64748b;
  line-height: 1.45;
  margin: 0 0 14px 0;
}

.bkt-auth-modal-features {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-bottom: 6px;
}

.bkt-feature-tag {
  display: inline-flex;
  align-items: center;
  font-size: 0.76rem;
  font-weight: 500;
  color: #334155;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  padding: 4px 10px;
  border-radius: 9999px;
}

/* Spinner for Google login loading state */
.bkt-google-spinner-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 76px;
  height: 76px;
}

.bkt-google-spin-glow {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 3px solid transparent;
  border-top-color: #4285F4;
  border-right-color: #34A853;
  border-bottom-color: #FBBC05;
  border-left-color: #EA4335;
  animation: bktSpin 1.2s linear infinite;
}

.bkt-google-spin-badge {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

@keyframes bktSpin {
  100% {
    transform: rotate(360deg);
  }
}

/* Animation pop in & out */
.bkt-anim-pop-in {
  animation: bktAnimPopIn 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
}

.bkt-anim-pop-out {
  animation: bktAnimPopOut 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
}

@keyframes bktAnimPopIn {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes bktAnimPopOut {
  from {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
  to {
    opacity: 0;
    transform: scale(0.94) translateY(4px);
  }
}

/* =========================================================
   BUILDING SPACE OVERVIEW - MASTER-DETAIL DESIGN SYSTEM
   ========================================================= */
.bkt-master-detail-wrapper {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.05);
  margin-top: 12px;
}

.bkt-master-sidebar {
  background: #f8fafc;
  border-right: 1px solid #e2e8f0;
  border-top-left-radius: 16px;
  border-bottom-left-radius: 16px;
  display: flex;
  flex-direction: column;
  height: 640px;
  max-height: calc(100vh - 130px);
  min-height: 500px;
  position: sticky;
  top: 15px;
}

.bkt-master-sidebar-header {
  flex-shrink: 0;
  padding: 12px 14px;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  border-top-left-radius: 16px;
}

.bkt-master-sort-select {
  font-size: 0.82rem;
  height: 32px;
  padding: 3px 26px 3px 8px;
  border-color: #e2e8f0;
  background-color: #f8fafc;
  border-radius: 6px;
}

.bkt-tree-search-group {
  max-width: 320px;
}

.bkt-master-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overscroll-behavior: contain;
}

.bkt-master-list::-webkit-scrollbar {
  width: 6px;
}
.bkt-master-list::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 6px;
}
.bkt-master-list::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 6px;
}
.bkt-master-list::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.bkt-master-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.16s ease;
  -webkit-user-select: none;
  user-select: none;
}

.bkt-master-item:hover {
  border-color: #93c5fd;
  background: #f0f7ff;
  transform: translateX(2px);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.08);
}

.bkt-master-item.is-active {
  background: #eff6ff !important;
  border-color: #2563eb !important;
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.14) !important;
  position: relative;
}

.bkt-master-item.is-active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 15%;
  height: 70%;
  width: 3.5px;
  background: #2563eb;
  border-radius: 0 3px 3px 0;
}

.bkt-master-item-rank {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: #f1f5f9;
  color: #475569;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.bkt-master-item.is-active .bkt-master-item-rank {
  background: #2563eb;
  color: #ffffff;
}

.bkt-master-item-info {
  flex: 1;
  min-width: 0;
}

.bkt-master-item-name {
  font-weight: 600;
  font-size: 0.86rem;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}

.bkt-master-item.is-active .bkt-master-item-name {
  color: #1d4ed8;
  font-weight: 700;
}

.bkt-master-item-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  color: #64748b;
  margin-top: 2px;
}

.bkt-master-item-badges {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex-shrink: 0;
}

.bkt-master-badge-area {
  font-size: 0.8rem;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
}

.bkt-master-badge-pct {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 9999px;
  background: #e0f2fe;
  color: #0369a1;
}

/* Detail Panel (Right Column) */
.bkt-detail-panel {
  background: #ffffff;
  border-top-right-radius: 16px;
  border-bottom-right-radius: 16px;
  display: flex;
  flex-direction: column;
  min-height: 520px;
  height: auto;
  padding: 20px 24px;
}

.bkt-detail-header-card {
  background: linear-gradient(135deg, #f8fafc 0%, #eff6ff 100%);
  border: 1px solid #dbeafe;
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 16px;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.04);
}

.bkt-detail-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.bkt-detail-building-title {
  font-size: 1.22rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.25;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.bkt-detail-stats-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.bkt-detail-stat-box {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px 12px;
}

.bkt-detail-stat-box .label {
  font-size: 0.72rem;
  color: #64748b;
  margin-bottom: 1px;
}

.bkt-detail-stat-box .val {
  font-size: 1.05rem;
  font-weight: 800;
  color: #0f172a;
}

.bkt-detail-table-card {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.bkt-detail-table-card .table-responsive {
  max-height: 380px;
  overflow-x: auto;
  overflow-y: auto;
}

.bkt-detail-table-card .table-responsive::-webkit-scrollbar {
  width: 6px;
}
.bkt-detail-table-card .table-responsive::-webkit-scrollbar-track {
  background: #f8fafc;
}
.bkt-detail-table-card .table-responsive::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 6px;
}
.bkt-detail-table-card .table-responsive::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.bkt-detail-table-card .table {
  margin-bottom: 0;
}

.bkt-detail-table-card thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #f8fafc;
  color: #475569;
  font-weight: 700;
  font-size: 0.84rem;
  padding: 10px 14px;
  border-bottom: 1px solid #e2e8f0;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.bkt-detail-table-card tbody td {
  padding: 10px 14px;
  vertical-align: middle;
  border-bottom: 1px solid #f1f5f9;
}

.bkt-detail-table-card tbody tr.main-unit-row {
  background: #fcfdfe;
  font-weight: 700;
  color: #1e293b;
}

.bkt-detail-table-card tbody tr.sub-lab-row {
  background: #ffffff;
  font-size: 0.88rem;
  color: #334155;
}

.bkt-detail-table-card tbody tr.sub-lab-row:hover {
  background: #f8fafc;
}

@media (max-width: 991px) {
  .bkt-master-sidebar {
    height: 380px;
    position: static;
    border-right: none;
    border-bottom: 1px solid #e2e8f0;
    border-bottom-left-radius: 0;
    border-top-right-radius: 16px;
  }
  .bkt-detail-panel {
    border-top-right-radius: 0;
    border-bottom-left-radius: 16px;
    padding: 16px;
  }
  .bkt-detail-stats-strip {
    grid-template-columns: repeat(2, 1fr);
  }
}

