/* ===== THEME (slate header + teal primary + cool gray page) ===== */
:root {
    --color-primary: #0d7377;
    --color-primary-hover: #095c5f;
    --color-primary-deep: #064e51;
    --color-primary-soft: #e6f3f3;
    --color-primary-soft-border: #9ecbcc;
    --color-primary-ink: #0a4f52;
    --color-primary-rgb: 13, 115, 119;
    --color-header: #1b263b;
    --color-header-text: #eef2f6;
    --color-header-muted: #a8b4c4;
    --color-tabs: #243447;
    --color-page: #eef2f6;
    --color-secondary-bg: rgba(13, 115, 119, 0.12);
    --color-secondary-border: #0d7377;
    --color-secondary-text: #0a4f52;
    --badge-font-size: 12px;
    --badge-font-weight: 600;
    --badge-line-height: 1.25;
}

/* ===== RESET & BASE STYLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ===== SAFARI FIXES ===== */
/* Fix Safari input rendering issues */
input[type="text"], input[type="email"], input[type="password"] {
    -webkit-appearance: none;
    -webkit-border-radius: 0;
    border-radius: 0;
    -webkit-box-shadow: none;
    box-shadow: none;
    -webkit-transition: none;
    transition: none;
}

/* Prevent Safari from applying default styling (text-like inputs only) */
input:focus:not([type="checkbox"]):not([type="radio"]) {
    -webkit-appearance: none;
    outline: none;
    -webkit-box-shadow: none;
    box-shadow: none;
}

/* Chrome: keep native checkbox/radio visible (global input:focus used to hide them) */
input[type="checkbox"] {
    -webkit-appearance: checkbox !important;
    appearance: checkbox !important;
    width: 16px !important;
    height: 16px !important;
    min-width: 16px !important;
    min-height: 16px !important;
    opacity: 1 !important;
    visibility: visible !important;
    accent-color: var(--color-primary);
}

input[type="radio"] {
    -webkit-appearance: radio !important;
    appearance: radio !important;
    opacity: 1 !important;
    visibility: visible !important;
}

input[type="checkbox"]:focus,
input[type="checkbox"]:active {
    -webkit-appearance: checkbox !important;
    appearance: checkbox !important;
    opacity: 1 !important;
    visibility: visible !important;
}

input[type="radio"]:focus,
input[type="radio"]:active {
    -webkit-appearance: radio !important;
    appearance: radio !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.data-record-checkbox,
input[type="checkbox"][id^="status-checkbox-"] {
    position: relative;
    z-index: 1; /* keep below sticky table headers */
    flex-shrink: 0;
    cursor: pointer;
    pointer-events: auto !important;
}

.data-record-checkbox-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 2px;
    cursor: pointer;
}

/* Simple password masking for text inputs */
.password-masked {
    -webkit-text-security: disc;
    text-security: disc;
}


/* ===== CUSTOM TOOLTIPS ===== */
[title] {
    position: relative;
}

/* Disable browser tooltips to prevent double tooltips */
[title]:hover {
    text-decoration: none;
}

/* Hide browser tooltips completely */
[title] {
    -webkit-tooltip: none;
    tooltip: none;
}

[data-original-title] {
    position: relative;
}

/* CSS ::after tooltips clip inside overflow:hidden ancestors (lists, sticky
   headers, device detail). All title tooltips use #site-tooltip on the body. */
[data-original-title]::before,
[data-original-title]::after {
    content: none !important;
    display: none !important;
}

#site-tooltip {
    position: fixed;
    z-index: 20000;
    background: #333;
    color: #fff;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-family: Arial, sans-serif;
    font-weight: 400;
    line-height: 1.4;
    white-space: normal;
    max-width: min(320px, calc(100vw - 16px));
    text-align: left;
    overflow-wrap: break-word;
    pointer-events: none;
    box-shadow: none;
}

#site-tooltip[hidden] {
    display: none;
}

#site-tooltip .site-tooltip-arrow {
    position: absolute;
    top: -5px;
    width: 0;
    height: 0;
    margin-left: -5px;
    border: 5px solid transparent;
    border-bottom-color: #333;
}

#site-tooltip.is-above .site-tooltip-arrow {
    top: auto;
    bottom: -5px;
    border-bottom-color: transparent;
    border-top-color: #333;
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* ===== CUSTOM ALERT SYSTEM ===== */
.alert-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    max-width: 400px;
    width: 100%;
}

.custom-alert {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    margin-bottom: 10px;
    padding: 16px 20px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    border-left: 4px solid;
    animation: alertSlideIn 0.3s ease-out;
    position: relative;
    overflow: hidden;
}

.custom-alert.alert-success {
    border-left-color: #28a745;
    background: linear-gradient(135deg, #d4edda 0%, #f8f9fa 100%);
}

.custom-alert.alert-error {
    border-left-color: #dc3545;
    background: linear-gradient(135deg, #f8d7da 0%, #f8f9fa 100%);
}

.custom-alert.alert-warning {
    border-left-color: #ffc107;
    background: linear-gradient(135deg, #fff3cd 0%, #f8f9fa 100%);
}

.custom-alert.alert-info {
    border-left-color: #17a2b8;
    background: linear-gradient(135deg, #d1ecf1 0%, #f8f9fa 100%);
}

.alert-icon {
    font-size: 20px;
    flex-shrink: 0;
    margin-top: 2px;
}

.alert-success .alert-icon {
    color: #28a745;
}

.alert-error .alert-icon {
    color: #dc3545;
}

.alert-warning .alert-icon {
    color: #ffc107;
}

.alert-info .alert-icon {
    color: #17a2b8;
}

.alert-content {
    flex: 1;
    min-width: 0;
}

.alert-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
    color: #333;
}

.alert-message {
    font-size: 13px;
    color: #666;
    line-height: 1.4;
    word-wrap: break-word;
}

.alert-close {
    background: none;
    border: none;
    font-size: 18px;
    color: #999;
    cursor: pointer;
    padding: 0;
    margin-left: 8px;
    flex-shrink: 0;
    transition: color 0.2s;
}

.alert-close:hover {
    color: #333;
}

.alert-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: rgba(0, 0, 0, 0.1);
    animation: alertProgress linear;
}

.alert-success .alert-progress {
    background: #28a745;
}

.alert-error .alert-progress {
    background: #dc3545;
}

.alert-warning .alert-progress {
    background: #ffc107;
}

.alert-info .alert-progress {
    background: #17a2b8;
}

@keyframes alertSlideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes alertSlideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

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

.alert-slide-out {
    animation: alertSlideOut 0.3s ease-in forwards;
}

.custom-alert.alert-toast {
    max-width: 360px;
    padding: 12px 16px;
}

.custom-alert.alert-toast .alert-message {
    font-size: 12px;
}

.btn-busy {
    opacity: 0.85;
    cursor: wait !important;
    pointer-events: none;
}

.btn-spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    vertical-align: -2px;
    margin-right: 6px;
    animation: btnSpin 0.7s linear infinite;
}

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

.ux-help-panel {
    background: #e8f5e8;
    margin: 15px 0;
    border-radius: 8px;
    border-left: 4px solid #28a745;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.ux-help-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: transparent;
    border: none;
    padding: 12px 16px;
    color: #155724;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
}

.ux-help-toggle:hover {
    background: rgba(255, 255, 255, 0.35);
}

.ux-help-chevron {
    transition: transform 0.2s ease;
    font-size: 12px;
}

.ux-help-panel:not(.collapsed) .ux-help-chevron {
    transform: rotate(180deg);
}

.ux-help-body {
    padding: 0 16px 16px;
}

.ux-help-panel.collapsed .ux-help-body {
    display: none !important;
}

.device-data-help-grid {
    display: grid;
}

.ux-help-warning {
    margin: 0 16px 12px;
    background: #fff3cd;
    padding: 10px;
    border-radius: 4px;
    border-left: 3px solid #ffc107;
    color: #856404;
    font-size: 13px;
    font-weight: 500;
}

.ux-help-panel.collapsed .ux-help-warning {
    margin-bottom: 12px;
}

.filter-empty-hint {
    padding: 10px 12px;
    color: #6c757d;
    font-size: 13px;
    font-style: italic;
}

.company-tree-hint {
    margin-bottom: 12px;
    padding: 10px 12px;
    background: var(--color-primary-soft);
    border: 1px solid var(--color-primary-soft-border);
    border-radius: 6px;
    color: var(--color-primary-ink);
    font-size: 13px;
}

html {
    max-width: 100%;
}

body {
    font-family: Arial, sans-serif;
    background: var(--color-page);
    padding: 20px;
    color: #243447;
    max-width: 100%;
    overflow-x: hidden;
}

/* ===== LAYOUT COMPONENTS ===== */
.container {
    max-width: min(1400px, 100%);
    width: 100%;
    min-width: 0;
    margin: 0 auto;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow-x: hidden;
}

.main-content {
    display: flex;
    gap: 20px;
    min-height: 500px;
    min-width: 0;
    max-width: 100%;
}

/* ===== TAB SYSTEM ===== */
.tabs {
    display: flex;
    background: var(--color-tabs);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    position: relative;
    z-index: 30;
}

.tabs-split {
    justify-content: space-between;
}

.tabs-group {
    display: flex;
    flex-shrink: 0;
}

.tab {
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
    color: var(--color-header-muted);
    position: relative;
}

.tab.active {
    background: rgba(13, 115, 119, 0.22);
    border-bottom-color: var(--color-primary);
    color: #fff;
    font-weight: 600;
}

.tab:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--color-header-text);
}

.tab-content {
    display: none;
    padding: 20px;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
}

.tab-content.active {
    display: block;
}

/* ===== BOX & ITEM COMPONENTS ===== */
.box {
    flex: 1;
    min-width: 0;
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 15px;
    background: #f9f9f9;
}

.box.drag-over {
    border-color: var(--color-primary);
    background: var(--color-primary-soft);
}

.box-title {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 15px;
    text-align: center;
    color: #333;
    padding: 10px;
    background: white;
    border-radius: 5px;
}

.item-list {
    min-height: 200px;
}

.item {
    background: white;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 10px;
    margin-bottom: 10px;
    cursor: grab;
    transition: all 0.2s;
    position: relative;
}

.item:hover {
    border-color: var(--color-primary);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.item:active {
    cursor: grabbing;
}

.item.dragging {
    opacity: 0.5;
}

.item-name {
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

.item-details {
    font-size: 12px;
    color: #666;
    margin-bottom: 3px;
}

.item-description {
    font-size: 11px;
    color: #999;
    font-style: italic;
}

.item-id {
    font-size: 10px;
    color: #ccc;
    text-align: right;
}

/* ===== STATS & ACTIONS ===== */
.stats {
    display: flex;
    justify-content: space-around;
    padding: 15px 20px;
    background: #f5f5f5;
    border-top: 1px solid #ddd;
}

.stat {
    text-align: center;
}

.stat-number {
    font-size: 20px;
    font-weight: bold;
    color: var(--color-primary);
}

.stat-label {
    font-size: 12px;
    color: #666;
}

.actions {
    padding: 15px 20px;
    text-align: center;
    border-top: 1px solid #ddd;
}

/* ===== BUTTON SYSTEM ===== */
.btn {
    padding: 8px 16px;
    margin: 0 5px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

/* Page action buttons keep classic Bootstrap blue/gray; header chrome stays teal/slate */
.btn-primary {
    background: #007bff;
    color: white;
}

.btn-primary:hover {
    background: #0056b3;
}

.btn-secondary {
    background: #6c757d;
    color: white;
    border: none;
}

.btn-secondary:hover {
    background: #545b62;
    color: white;
}

.btn-warning {
    background: #ffc107;
    color: #212529;
}

.btn-warning:hover {
    background: #e0a800;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #1e7e34;
}

.btn-info {
    background: #17a2b8;
    color: white;
}

.btn-info:hover {
    background: #117a8b;
}

.btn-danger {
    background-color: #dc3545;
    border-color: #dc3545;
    color: white;
}

.btn-danger:hover {
    background-color: #c82333;
    border-color: #bd2130;
}

.btn-small {
    padding: 4px 8px;
    font-size: 11px;
}

/* ===== STATUS INDICATORS ===== */
.status-live { border-left: 4px solid #28a745; }
.status-inactive { border-left: 4px solid #dc3545; }
.status-pending { border-left: 4px solid #ffc107; }
.status-maintenance { border-left: 4px solid #17a2b8; }

/* ===== COMPANY & PROJECT CARDS ===== */
.company-assets {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.company-card {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    width: 100%;
}

.company-header {
    font-weight: bold;
    color: #333;
    margin-bottom: 8px;
    padding-bottom: 3px;
    border-bottom: 1px solid #eee;
}

.project-header {
    font-weight: bold;
    color: #333;
    margin-bottom: 8px;
    font-size: 14px;
}

.project-details {
    font-size: 11px;
    color: #333;
    line-height: 1.2;
    margin-bottom: 8px;
}

.project-details div {
    margin-bottom: 2px;
}

.project-details div:last-child {
    margin-bottom: 0;
}

.company-asset {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 8px;
    margin-bottom: 5px;
    font-size: 12px;
}

/* ===== OVERVIEW COMPONENTS ===== */
.overview-history-item {
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: box-shadow 0.2s ease;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.overview-history-item:hover {
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.overview-histories-container {
    margin-top: 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    min-width: 0;
    max-width: 100%;
    min-height: 0;
    max-height: 800px; /* fallback before JS sync; overwritten to sidebar height */
    overflow-x: hidden;
    overflow-y: auto;
    box-sizing: border-box;
}

.overview-layout {
    display: flex;
    gap: 20px;
    flex-wrap: nowrap;
    align-items: flex-start;
    min-width: 0;
    max-width: 100%;
}

.overview-main-content {
    flex: 1;
    min-width: 0;
    max-width: 100%;
}

/* Overview data lists: scroll horizontally when columns exceed the panel */
.overview-data-table-scroll {
    overflow-x: auto;
    overflow-y: auto;
    max-width: 100%;
    min-width: 0;
    -webkit-overflow-scrolling: touch;
}

.overview-data-table {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
}

.overview-data-table th,
.overview-data-table td {
    white-space: nowrap;
    padding: 3px 8px;
}

.history-data-records,
.history-actions {
    min-width: 0;
}

.overview-history-item [id^="data-records-"] {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

.overview-data-records {
    flex: 1;
    max-width: 400px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    padding: 15px;
    align-self: flex-start;
}

/* ===== USER HEADER ===== */
.user-header {
    background: var(--color-header);
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    border-radius: 10px 10px 0 0;
    position: relative;
    z-index: 40;
    overflow: visible;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    flex: 1 1 auto;
    min-width: 0;
}

.user-info span:first-child {
    font-weight: 600;
    color: var(--color-header-text);
}

.user-info span:last-child {
    color: var(--color-header-muted);
    font-size: 14px;
}

.user-actions {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.user-actions .btn,
.user-actions .instructions-link {
    padding: 8px 16px;
    font-size: 14px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    flex-shrink: 0;
    white-space: nowrap;
    position: relative;
    margin: 0;
}

.user-actions .instructions-link {
    font-weight: 600;
    letter-spacing: 0.02em;
}

.user-actions .btn-secondary,
.user-actions .instructions-link {
    background: rgba(255, 255, 255, 0.06);
    color: var(--color-header-text);
    border: 1px solid rgba(255, 255, 255, 0.28);
}

.user-actions .btn-secondary:hover,
.user-actions .instructions-link:hover {
    background: rgba(13, 115, 119, 0.45);
    border-color: var(--color-primary);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

/* Chrome: sticky table headers must not block clicks on body rows */
.overview-data-table-head,
.data-records-sticky-head,
#data-records-header {
    pointer-events: none;
    position: sticky;
    top: 0;
    z-index: 5;
}

.overview-data-table-head th,
.data-records-sticky-head th,
#data-records-header th {
    pointer-events: auto;
    position: sticky;
    top: 0;
    z-index: 5;
    background: #f8f9fa;
    background-clip: padding-box;
    box-shadow: 0 1px 0 #dee2e6;
}

/* Device detail: keep page width fixed; only Data Records scrolls horizontally */
#device-tab .main-content,
#device-tab #device-list-box,
#device-tab #device-list {
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

#device-tab #device-list {
    width: 100%;
}

#device-tab .device-filter-bar .filter-input {
    width: 100%;
    max-width: none;
    box-sizing: border-box;
}

.device-detail-container {
    max-width: 100%;
    min-width: 0;
    overflow-x: hidden;
    box-sizing: border-box;
    padding-bottom: 88px;
}

.device-detail-container .data-records-section {
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.device-filter-bar .device-filter-hint {
    margin-top: 6px;
    font-size: 12px;
    color: #6c757d;
}

.device-filter-bar kbd {
    display: inline-block;
    padding: 1px 5px;
    border: 1px solid #ced4da;
    border-bottom-width: 2px;
    border-radius: 3px;
    background: #fff;
    font-size: 11px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.device-list-empty {
    text-align: center;
    color: #666;
    padding: 28px 16px;
    font-size: 14px;
}

.device-detail-toolbar {
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.device-detail-toolbar-left {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.device-history-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}

.device-history-selector label {
    font-weight: 600;
    color: #495057;
    margin: 0;
    white-space: nowrap;
}

.device-history-selector select {
    min-width: 200px;
    max-width: min(360px, 70vw);
    padding: 6px 12px;
}

.device-status-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.device-status-badge,
.overview-summary-chip,
.device-chip,
.device-match-chip,
.device-list-meta-bit,
.user-status-badge,
.filter-chip,
.company-tree-pins .pin-chip,
.tree-badge,
.overview-pick-chip,
.issues-company-count {
    font-family: inherit;
    font-size: var(--badge-font-size);
    font-weight: var(--badge-font-weight);
    line-height: var(--badge-line-height);
    letter-spacing: 0;
}

.overview-summary-chip strong,
.overview-summary-chip b {
    font-size: inherit;
    font-weight: 700;
    line-height: inherit;
}

.device-status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid transparent;
}

.device-status-badge.badge-ok {
    background: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
}

.device-status-badge.badge-warn {
    background: #fff3cd;
    color: #856404;
    border-color: #ffeaa7;
}

.device-status-badge.badge-bad {
    background: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

.device-status-badge.badge-info {
    background: #d1ecf1;
    color: #0c5460;
    border-color: #bee5eb;
}

.device-status-badge.badge-muted {
    background: #e9ecef;
    color: #495057;
    border-color: #dee2e6;
}

.device-status-badge.badge-views {
    background: #d6eef0;
    color: #0d7377;
    border-color: #b7dfe2;
}

.device-meta-chips {
    color: #6c757d;
    font-size: var(--badge-font-size);
    margin-top: 10px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.device-chip {
    background: #e9ecef;
    padding: 4px 10px;
    border-radius: 999px;
    color: #495057;
}

.device-subtabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 0 18px;
    padding: 10px;
    background: #e9ecef;
    border: 1px solid #ced4da;
    border-radius: 8px;
}

.device-subtab {
    appearance: none;
    border: 2px solid #adb5bd;
    background: #fff;
    color: #343a40;
    font-size: 14px;
    font-weight: 700;
    padding: 10px 18px;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.device-subtab:hover {
    background: #e7f1ff;
    border-color: #007bff;
    color: #0056b3;
}

.device-subtab.active {
    background: #007bff;
    color: #fff;
    border-color: #007bff;
    box-shadow: 0 2px 6px rgba(0, 123, 255, 0.35);
}

.device-subtab:focus-visible {
    outline: 2px solid #0056b3;
    outline-offset: 2px;
}

.device-subtab-panel {
    display: none;
}

.device-subtab-panel.active:not([hidden]) {
    display: block;
}

.recent-alerts-box {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 15px;
    margin-top: 15px;
}

.recent-alerts-box h5 {
    color: #495057;
    margin: 0 0 10px;
    font-size: 13px;
    font-weight: 600;
}

#recent-alerts-content {
    font-size: 12px;
    color: #6c757d;
    text-align: center;
    padding: 8px 0;
}

.recent-alerts-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
    text-align: left;
    color: #495057;
}

.recent-alerts-table th,
.recent-alerts-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #dee2e6;
}

.recent-alerts-table thead {
    background: #f8f9fa;
}

.recent-alerts-table th {
    font-weight: 600;
}

.recent-alerts-table td:last-child,
.recent-alerts-table th:last-child {
    text-align: right;
}

.recent-alert-level {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    border: 1px solid;
}

.device-recent-alerts {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
}

.device-recent-alerts-label {
    font-size: 11px;
    font-weight: 600;
    color: #6c757d;
    margin-right: 2px;
}

.device-recent-alert-btn {
    border: 1px solid;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    font-family: inherit;
}

.device-recent-alert-btn:hover {
    filter: brightness(0.96);
}

.recent-alert-open-btn {
    margin: 0;
    font-size: 11px;
    padding: 3px 8px;
}

.device-list-row-main,
.device-list-row-side {
    flex: 1;
    min-width: 200px;
}

#device-tab .device-item.device-item {
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    box-sizing: border-box;
    padding: 16px 18px;
    margin: 0 0 12px;
    border: 1px solid #d5dbe3;
    border-radius: 8px;
    background: #fff;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

#device-tab .device-item:hover,
#device-tab .device-item:focus {
    background: #fafbfc;
    border-color: #0d7377;
    outline: none;
}

#device-tab .device-item:focus-visible {
    box-shadow: inset 0 0 0 2px rgba(13, 115, 119, 0.35);
}

.device-list-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px 24px;
    flex-wrap: wrap;
    width: 100%;
}

.device-list-header-main {
    flex: 1 1 320px;
    min-width: 0;
}

.device-list-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px 8px;
    max-width: 100%;
}

.device-list-meta-bit {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    background: #f1f4f7;
    color: #5a6570;
    white-space: nowrap;
}

.device-item .item-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-primary);
    margin: 0 0 8px;
    line-height: 1.25;
}

.device-item .item-details {
    font-size: 15px;
    color: #666;
    margin-bottom: 4px;
}

.device-item .item-description {
    font-size: 14px;
    color: #999;
    margin-bottom: 4px;
}

.device-item .device-list-imei {
    color: #28a745;
    font-weight: bold;
    font-size: 16px;
}

.device-list-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 0;
}

.device-search-fields {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 8px;
    margin: 0;
    width: 100%;
}

.device-search-field {
    margin: 0;
    padding: 8px 10px;
    border: 1px solid #e3e8ee;
    border-radius: 6px;
    background: #f8fafb;
    min-width: 0;
    grid-column: span 2;
}

.device-search-field.span-3 { grid-column: span 3; }
.device-search-field.span-4 { grid-column: span 4; }
.device-search-field.span-6 { grid-column: span 6; }

.device-search-field dt {
    margin: 0 0 3px;
    font-size: 10px;
    font-weight: 700;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.device-search-field dd {
    margin: 0;
    font-size: 13px;
    color: #243447;
    word-break: break-word;
    line-height: 1.35;
}

.device-search-field.is-emphasis dd {
    color: #1f7a3f;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.device-search-field.is-matched {
    border-color: #e0b400;
    background: #fff8e1;
}

.device-match-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--color-primary-soft);
    color: #0b5ed7;
    border: 1px solid var(--color-primary-soft-border);
}

.device-search-mark {
    background: #ffe08a;
    color: inherit;
    padding: 0 2px;
    border-radius: 2px;
}

@media (max-width: 1100px) {
    .device-search-fields {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }

    .device-search-field {
        grid-column: span 2;
    }

    .device-search-field.span-4 {
        grid-column: span 3;
    }

    .device-list-meta {
        justify-content: flex-start;
    }
}

@media (max-width: 700px) {
    .device-search-fields {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .device-search-field,
    .device-search-field.span-3,
    .device-search-field.span-4,
    .device-search-field.span-6 {
        grid-column: span 1;
    }

    .device-search-field.is-wide-mobile {
        grid-column: span 2;
    }
}

.device-list-truncated {
    text-align: center;
    color: #856404;
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 6px;
    padding: 10px 12px;
    margin: 8px 0 16px;
    font-size: 13px;
}

.custom-confirm-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.custom-confirm-dialog {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
}

.custom-confirm-header {
    background: #f8f9fa;
    padding: 16px 20px;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.custom-confirm-header h3 {
    margin: 0;
    color: #495057;
    font-size: 18px;
    font-weight: 600;
}

.custom-confirm-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #6c757d;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    line-height: 1;
}

.custom-confirm-close:hover,
.custom-confirm-close:focus {
    background: #e9ecef;
    color: #212529;
}

.custom-confirm-body {
    padding: 20px;
    color: #495057;
    line-height: 1.5;
    max-height: 400px;
    overflow-y: auto;
}

.custom-confirm-body p {
    margin: 0;
    white-space: pre-line;
    font-size: 14px;
}

.custom-confirm-footer {
    background: #f8f9fa;
    padding: 12px 20px;
    border-top: 1px solid #dee2e6;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.device-user-count {
    font-weight: 500;
    color: #6c757d;
    font-size: 12px;
}

.device-user-warning {
    margin-top: 6px;
    font-size: 12px;
    color: #856404;
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 4px;
    padding: 6px 8px;
}

.device-sticky-save {
    position: sticky;
    bottom: 0;
    z-index: 20;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 12px;
    padding: 12px 14px;
    background: rgba(248, 249, 250, 0.96);
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(4px);
}

.device-sticky-save.is-dirty {
    border-color: #ffc107;
    box-shadow: 0 -4px 16px rgba(255, 193, 7, 0.2);
}

.device-sticky-save-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 140px;
}

.device-dirty-indicator {
    font-size: 12px;
    font-weight: 700;
    color: #856404;
}

.device-save-status {
    font-size: 12px;
    font-weight: 500;
    min-height: 16px;
}

.device-sticky-save-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.device-sticky-save-actions .btn {
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 4px;
}

.device-chart-wrap {
    min-height: 280px;
}

.variance-form-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr)) auto;
    gap: 10px;
    align-items: start;
}

.variance-form-actions {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.variance-actions-label {
    display: block;
    height: 16px;
    margin-bottom: 4px;
    line-height: 16px;
    font-size: 12px;
}

.variance-action-btns {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 32px;
}

.variance-action-btns .btn {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 4px;
    white-space: nowrap;
    height: 32px;
    box-sizing: border-box;
}

@media (max-width: 768px) {
    .device-basic-grid,
    .device-detail-grid,
    .device-data-help-grid {
        grid-template-columns: 1fr !important;
    }

    .variance-form-grid {
        grid-template-columns: 1fr 1fr !important;
    }

    .variance-form-actions {
        grid-column: 1 / -1;
    }

    .variance-action-btns {
        height: auto;
        flex-wrap: wrap;
    }

    .device-sticky-save {
        position: sticky;
        bottom: 0;
        flex-direction: column;
        align-items: stretch;
    }

    .device-sticky-save-actions {
        width: 100%;
    }

    .device-sticky-save-actions .btn {
        flex: 1 1 auto;
        min-width: 0;
        font-size: 12px;
        padding: 10px 8px;
    }

    .device-history-selector {
        width: 100%;
    }

    .device-history-selector select {
        flex: 1;
        min-width: 0;
        max-width: none;
    }

    .device-subtab {
        padding: 10px 14px;
        font-size: 13px;
        flex: 1 1 auto;
        text-align: center;
    }

    .device-chart-wrap {
        height: 280px !important;
    }

    #device-tab .filter-input {
        font-size: 16px; /* avoid iOS zoom */
    }
}

#data-records-container.data-records-scroll,
#data-records-container {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

#data-records-table {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
}

#data-records-table th,
#data-records-table td {
    white-space: nowrap;
}

/* ===== PROJECT OVERVIEW STYLING ===== */
.project-description {
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid var(--color-primary);
    color: #495057;
    line-height: 1.5;
    font-size: 14px;
}

.project-description:hover {
    background: #e9ecef;
    transition: background-color 0.2s ease;
}

.overview-sidebar {
    width: 200px;
    flex-shrink: 0;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    padding: 10px;
    align-self: flex-start;
    height: fit-content;
    box-sizing: border-box;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .overview-layout {
        flex-direction: column;
        flex-wrap: wrap;
        align-items: stretch;
    }
    
    .overview-sidebar {
        width: 100%;
        order: -1;
        align-self: auto;
    }
    
    .overview-histories-container {
        min-width: auto;
        max-width: 100%;
        max-height: min(70vh, 800px);
    }
    
    .history-name-tooltip .tooltip-content {
        width: 90vw;
        max-width: 90vw;
        left: 0;
        transform: none;
    }
}

/* ===== SCROLLBAR STYLING ===== */
.overview-histories-container::-webkit-scrollbar {
    width: 8px;
}

.overview-histories-container::-webkit-scrollbar-track {
    background: #e9ecef;
    border-radius: 4px;
}

.overview-histories-container::-webkit-scrollbar-thumb {
    background: #adb5bd;
    border-radius: 4px;
}

.overview-histories-container::-webkit-scrollbar-thumb:hover {
    background: #6c757d;
}

/* ===== CONFIGURATION COMPONENTS ===== */
.zero-button {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s;
    width: 100%;
}

.zero-button:hover {
    background-color: #2980b9;
}

.config-input, .config-select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    margin-bottom: 8px;
    box-sizing: border-box;
    background-color: white;
}

.config-input:focus, .config-select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.25);
}

.config-label {
    font-size: 11px;
    color: #666;
    margin-bottom: 4px;
    font-weight: 600;
}

.set-config-button {
    background-color: #27ae60;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s;
    width: 100%;
    margin-top: 8px;
}

.set-config-button:hover {
    background-color: #229954;
}

.create-alert-button {
    background-color: #f39c12;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s;
    width: 100%;
    margin-top: 8px;
}

.create-alert-button:hover {
    background-color: #e67e22;
}

/* ===== ASSIGNMENT CONTROLS ===== */
.assignment-controls {
    background: white;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
}

.company-select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    margin-bottom: 10px;
}

.company-select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(var(--color-primary-rgb),0.25);
}

.selected-company-info {
    background: var(--color-primary-soft);
    border: 1px solid var(--color-primary);
    border-radius: 5px;
    padding: 10px;
    margin-top: 10px;
}

.company-details {
    font-size: 12px;
    color: #333;
    line-height: 1.4;
}

/* ===== FILTERS & INPUTS ===== */
.project-filter, .client-filter {
    background: white;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
}

.project-filter-input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.project-filter-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(var(--color-primary-rgb),0.25);
}

/* ===== CLIENT & PROJECT SECTIONS ===== */
.client-details-header h3 {
    margin: 0 0 15px 0;
    color: #333;
    border-bottom: 2px solid var(--color-primary);
    padding-bottom: 10px;
}

.client-info {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.client-info div {
    margin-bottom: 8px;
}

.client-projects h4 {
    margin: 15px 0 10px 0;
    color: #495057;
}

.project-item {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 10px;
    margin-bottom: 8px;
}

.project-name {
    font-weight: 600;
    color: #495057;
    margin-bottom: 5px;
}

.project-status {
    font-size: 12px;
    color: #6c757d;
    margin-bottom: 3px;
}

.project-dates {
    font-size: 11px;
    color: #adb5bd;
}

/* ===== COMPANY TREE COMPONENTS ===== */
.company-tree-shell {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.company-tree-body {
    display: flex;
    gap: 0;
    min-height: 0;
    border: 1px solid #e9ecef;
    border-top: none;
    border-radius: 0 0 12px 12px;
    overflow: hidden;
    background: #fff;
}

.company-tree-detail {
    width: 280px;
    flex-shrink: 0;
    border-left: 1px solid #e9ecef;
    background: #fafbfc;
    padding: 14px;
    overflow-y: auto;
    max-height: min(70vh, 720px);
}

.tree-detail-empty {
    color: #6c757d;
    font-size: 13px;
    padding: 20px 8px;
    text-align: center;
}

.tree-detail-card h3 {
    margin: 0 0 6px;
    font-size: 16px;
    color: #212529;
}

.tree-detail-meta {
    margin: 0 0 12px;
    font-size: 12px;
    color: #6c757d;
}

.tree-detail-stats {
    margin: 0 0 12px;
    padding-left: 18px;
    font-size: 13px;
    color: #495057;
}

.tree-detail-note {
    font-size: 12px;
    color: #856404;
    margin: 0 0 10px;
}

.tree-detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tree-detail-actions .btn {
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    letter-spacing: normal;
    text-transform: none;
    line-height: 1.25;
}

.company-tree-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.filter-chip {
    border: 1px solid #ced4da;
    background: #fff;
    border-radius: 999px;
    padding: 4px 10px;
    cursor: pointer;
    color: #495057;
}

.filter-chip.active,
.filter-chip[aria-pressed="true"] {
    background: var(--color-primary-soft);
    border-color: #80bdff;
    color: var(--color-primary-ink);
}

.tree-multi-hint {
    font-size: 11px;
    color: #0c5460;
    margin-left: 4px;
}

.tree-check-wrap {
    display: inline-flex;
    align-items: center;
    margin: 0;
    cursor: pointer;
}

.tree-multi-check {
    margin: 0;
    cursor: pointer;
}

.company-tree-header.tree-multi-on {
    background: #e8f4ff;
}

.expand-icon.is-loading {
    animation: btnSpin 0.8s linear infinite;
    color: #6c757d;
}

.tree-loading-block,
.tree-empty-children {
    text-align: center;
    color: #6c757d;
    padding: 16px;
    font-size: 13px;
}

.tree-empty-children {
    padding: 8px 10px;
    text-align: left;
    font-style: italic;
    font-size: 12px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 960px) {
    .company-tree-body {
        flex-direction: column;
    }
    .company-tree-detail {
        width: 100%;
        max-height: 220px;
        border-left: none;
        border-top: 1px solid #e9ecef;
    }
}

.company-tree-toolbar {
    position: sticky;
    top: 0;
    z-index: 5;
    background: #fff;
    border: 1px solid #e9ecef;
    border-bottom: none;
    border-radius: 12px 12px 0 0;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.company-tree-toolbar-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.company-tree-search {
    flex: 1 1 220px;
    min-width: 180px;
    padding: 8px 10px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 13px;
}

.company-tree-toolbar .btn-tree {
    padding: 6px 10px;
    font-size: 12px;
    border-radius: 6px;
    border: 1px solid #ced4da;
    background: #f8f9fa;
    color: #495057;
    cursor: pointer;
}

.company-tree-toolbar .btn-tree:hover {
    background: #e9ecef;
}

.company-tree-toolbar .btn-tree.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}

.company-tree-breadcrumb {
    font-size: 12px;
    color: #495057;
    line-height: 1.4;
    min-height: 18px;
}

.company-tree-breadcrumb button {
    background: none;
    border: none;
    color: var(--color-primary);
    cursor: pointer;
    padding: 0;
    font-size: 12px;
}

.company-tree-breadcrumb button:hover {
    text-decoration: underline;
}

.company-tree-breadcrumb .crumb-sep {
    margin: 0 4px;
    color: #adb5bd;
}

.company-tree-match-count {
    font-size: 12px;
    color: #6c757d;
    min-width: 72px;
    white-space: nowrap;
}

.company-tree-pins {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.company-tree-pins .pin-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.company-tree-pins .pin-label {
    font-size: 11px;
    color: #6c757d;
    font-weight: 600;
    margin-right: 4px;
}

.company-tree-pins .pin-chip {
    border: 1px solid #dee2e6;
    background: #fff;
    border-radius: 999px;
    padding: 4px 10px;
    cursor: pointer;
    color: #495057;
}

.company-tree-pins .pin-chip:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.tree-more-menu {
    position: relative;
}

.tree-more-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 34px;
    min-width: 180px;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
    z-index: 30;
    overflow: hidden;
}

.tree-more-dropdown.open {
    display: block;
}

.tree-more-dropdown button {
    display: block;
    width: 100%;
    text-align: left;
    border: none;
    background: #fff;
    padding: 8px 12px;
    font-size: 12px;
    cursor: pointer;
}

.tree-more-dropdown button:hover {
    background: #f1f3f5;
}

.tree-badges {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}

.tree-badge {
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid #dee2e6;
    background: #fff;
    color: #6c757d;
    white-space: nowrap;
}

.tree-badge.badge-fav {
    color: #b8860b;
    border-color: #ffe08a;
    background: #fff8e1;
}

.tree-badge.badge-project {
    color: #495057;
    background: #e9ecef;
}

.tree-badge.badge-empty {
    color: #856404;
    background: #fff3cd;
    border-color: #ffeeba;
}

.tree-badge.badge-locs {
    color: #0c5460;
    background: #d1ecf1;
    border-color: #bee5eb;
}

.company-tree-item.is-project > .company-tree-header {
    border-left: 3px solid #6c757d;
}

.company-tree-header.tree-dragging {
    opacity: 0.55;
}

.company-tree-header.tree-drop-target {
    outline: 2px solid #28a745;
    background: #e8f5e9;
}

.company-tree-item.tree-flat-row {
    margin-bottom: 4px;
}

.company-tree-compact .tree-badges .badge-locs,
.company-tree-compact .tree-badges .badge-project {
    display: none;
}

.company-tree-item {
    margin-bottom: 8px;
    cursor: pointer;
    position: relative;
}

.company-tree-item.tree-hidden {
    display: none !important;
}

.company-tree-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 1px solid #dee2e6;
    border-radius: 8px;
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.company-tree-header:hover {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-color: var(--color-primary);
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.company-tree-header.tree-selected {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(var(--color-primary-rgb), 0.2);
}

.company-tree-header.tree-match {
    background: #fff8e1;
    border-color: #ffc107;
}

.expand-icon {
    cursor: pointer;
    font-weight: bold;
    color: var(--color-primary);
    min-width: 22px;
    text-align: center;
    user-select: none;
    font-size: 14px;
}

.expand-icon:hover {
    color: var(--color-primary-hover);
}

.expand-icon.leaf {
    color: #adb5bd;
    cursor: default;
}

.company-name {
    font-weight: 600;
    color: #2c3e50;
    flex: 1;
    font-size: 14px;
    min-width: 0;
}

.company-status,
.history-count {
    font-size: 11px;
    color: #6c757d;
    background: #fff;
    padding: 3px 8px;
    border-radius: 12px;
    border: 1px solid #dee2e6;
    font-weight: 500;
    white-space: nowrap;
}

.company-children {
    margin-top: 8px;
    margin-left: 24px;
    border-left: 2px solid #cfe2ff;
    padding-left: 14px;
    position: relative;
    display: none;
}

.company-children.expanded {
    display: block;
}

.tree-actions-menu {
    position: relative;
    margin-left: auto;
    flex-shrink: 0;
}

.tree-actions-toggle {
    border: 1px solid #dee2e6;
    background: #fff;
    border-radius: 6px;
    width: 28px;
    height: 28px;
    line-height: 1;
    cursor: pointer;
    color: #495057;
    font-size: 16px;
    padding: 0;
}

.tree-actions-toggle:hover {
    background: #e9ecef;
}

.tree-actions-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 32px;
    min-width: 150px;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
    z-index: 20;
    overflow: hidden;
}

.tree-actions-menu.open .tree-actions-dropdown {
    display: block;
}

.tree-actions-dropdown button {
    display: block;
    width: 100%;
    text-align: left;
    border: none;
    background: #fff;
    padding: 8px 12px;
    font-size: 12px;
    cursor: pointer;
    color: #333;
}

.tree-actions-dropdown button:hover {
    background: #f1f3f5;
}

.company-tree-compact .company-tree-header {
    padding: 6px 8px;
    gap: 6px;
}

.company-tree-compact .company-name {
    font-size: 13px;
}

.company-tree-compact .company-status,
.company-tree-compact .history-count,
.company-tree-compact .tree-level-indicator {
    display: none;
}

.company-tree-compact .company-tree-item {
    margin-bottom: 4px;
}

.company-tree-compact .company-children {
    margin-top: 4px;
    margin-left: 16px;
    padding-left: 10px;
}

.company-tree-details-header h3 {
    margin: 0 0 15px 0;
    color: #333;
    border-bottom: 2px solid var(--color-primary);
    padding-bottom: 10px;
}

/* ===== DRAG & DROP STYLES ===== */
.dragging {
    opacity: 0.5;
    transform: rotate(5deg);
    transition: all 0.2s ease;
}

.drop-zone {
    background-color: #f0f8ff !important;
    border-color: var(--color-primary) !important;
    transition: all 0.2s ease;
}

.item {
    cursor: pointer;
    transition: all 0.2s ease;
}

.item:hover {
    background-color: #f8f9fa;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.item.draggable {
    cursor: grab;
}

.item.draggable:active {
    cursor: grabbing;
}

.drag-instructions, .drop-zone-instructions {
    font-size: 13px;
    line-height: 1.4;
    position: relative;
    padding-right: 28px;
}

.drag-instructions strong, .drop-zone-instructions strong {
    color: #333;
}

.ux-dismissible[hidden] {
    display: none !important;
}

.ux-dismiss-btn {
    position: absolute;
    top: 4px;
    right: 6px;
    border: none;
    background: transparent;
    color: #6c757d;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 2px 6px;
}

.ux-dismiss-btn:hover {
    color: #212529;
}

.item-actions {
    margin-top: 8px;
    text-align: right;
}

/* ===== LOCATIONS TAB ===== */
.locations-filter-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.locations-filter-bar .filter-input {
    flex: 1;
    min-width: 200px;
}

.locations-search-count {
    font-size: 12px;
    color: #6c757d;
    font-weight: 600;
    white-space: nowrap;
}

.locations-assign-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 0 10px;
    flex-wrap: wrap;
}

.locations-selected-label {
    font-size: 12px;
    color: #495057;
}

.locations-empty-hint {
    text-align: center;
    color: #666;
    padding: 20px;
    font-size: 13px;
}

.locations-available-list {
    max-height: 70vh;
    overflow-y: auto;
}

.item-corner-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 5;
}

.item-corner-actions .btn {
    margin: 0;
    white-space: nowrap;
}

/*
 * Custom tooltips default to above the control. Corner actions sit at the
 * top-right of cards in overflow lists, so upward tooltips clip and
 * downward ones hide behind the next buttons in the stack.
 * Place them to the left of the action column instead.
 */
.item-corner-actions [data-original-title] {
    position: relative;
    overflow: visible;
    z-index: 1;
}

.item-corner-actions [data-original-title]:hover {
    z-index: 30;
}

.item-corner-actions [data-original-title]::after {
    bottom: auto;
    top: 50%;
    left: auto;
    right: calc(100% + 8px);
    transform: translateY(-50%);
    margin: 0;
    z-index: 10050;
    max-width: min(240px, 55vw);
    white-space: normal;
    text-align: left;
    line-height: 1.35;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.item-corner-actions [data-original-title]::before {
    bottom: auto;
    top: 50%;
    left: auto;
    right: calc(100% - 2px);
    transform: translateY(-50%);
    border: 5px solid transparent;
    border-top-color: transparent;
    border-bottom-color: transparent;
    border-left-color: #333;
    margin: 0;
    z-index: 10050;
}

.location-available-item,
.device-available-item,
.company-available-item {
    padding-right: 120px;
    overflow: visible;
}

.locations-available-list .location-available-item:hover,
.devices-available-list .device-available-item:hover,
.companies-available-list .company-available-item:hover {
    z-index: 6;
}

.location-available-item .location-card-company,
.device-available-item .location-card-company,
.company-available-item .location-card-company {
    color: #0d6efd;
    font-weight: 600;
}

.location-available-item.is-selected {
    border-color: #0d6efd;
    box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.25);
    background: #f0f7ff;
}

.location-drop-box.location-drop-ready,
.location-drop-zone.location-drop-ready {
    border-color: #28a745;
    background: #f4fff6;
}

.location-drop-box.location-drop-needs-company,
.location-drop-zone.location-drop-needs-company {
    border-style: dashed;
}

#history-assignment-box.drag-over-valid,
#location-company-list.drag-over-valid {
    border: 2px solid #28a745 !important;
    background: #d4edda !important;
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.25);
}

#history-assignment-box.drag-over-invalid,
#location-company-list.drag-over-invalid {
    border: 2px solid #dc3545 !important;
    background: #f8d7da !important;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.2);
}

.locations-list-sentinel {
    height: 1px;
    width: 100%;
}

/* ===== DEVICES TAB (mirrors Locations UX; assign still creates history) ===== */
.devices-filter-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.devices-filter-bar .filter-input {
    flex: 1;
    min-width: 200px;
}

.devices-available-list {
    max-height: 70vh;
    overflow-y: auto;
}

.device-available-item.is-selected {
    border-color: #28a745;
    box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.25);
    background: #f4fff6;
}

.device-card-imei {
    color: #28a745;
    font-weight: 600;
}

.device-card-history {
    color: #0d7377;
    font-weight: 600;
}

.device-open-link {
    display: inline;
    margin: 0;
    padding: 0;
    border: none;
    background: none;
    color: #0d7377;
    font: inherit;
    font-weight: 700;
    text-decoration: underline;
    cursor: pointer;
    text-align: left;
}

.device-open-link:hover,
.device-open-link:focus {
    color: #095457;
}

.device-open-link:focus-visible {
    outline: 2px solid rgba(13, 115, 119, 0.45);
    outline-offset: 2px;
    border-radius: 2px;
}

.location-available-item .item-name .device-open-link {
    font-size: inherit;
}

#asset-assignment-box.drag-over-valid,
#asset-company-assignments-list.drag-over-valid {
    border: 2px solid #28a745 !important;
    background: #d4edda !important;
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.25);
}

#asset-assignment-box.drag-over-invalid,
#asset-company-assignments-list.drag-over-invalid {
    border: 2px solid #dc3545 !important;
    background: #f8d7da !important;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.2);
}

/* ===== COMPANIES TAB (mirrors Devices / Locations UX) ===== */
.companies-filter-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.companies-filter-bar .filter-input {
    flex: 1;
    min-width: 200px;
}

.companies-available-list {
    max-height: 70vh;
    overflow-y: auto;
}

.company-available-item.is-selected {
    border-color: #6f42c1;
    box-shadow: 0 0 0 2px rgba(111, 66, 193, 0.25);
    background: #f8f4ff;
}

#client-details-box.drag-over-valid,
#client-company-list.drag-over-valid {
    border: 2px solid #28a745 !important;
    background: #d4edda !important;
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.25);
}

#client-details-box.drag-over-invalid,
#client-company-list.drag-over-invalid {
    border: 2px solid #dc3545 !important;
    background: #f8d7da !important;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.2);
}

/* ===== COMPANY TREE INFO & PROJECTS ===== */
.company-tree-info {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.company-tree-info div {
    margin-bottom: 8px;
}

.company-tree-projects h4 {
    margin: 15px 0 10px 0;
    color: #495057;
}

.project-tree-item {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 10px;
    margin-bottom: 8px;
}

.project-tree-name {
    font-weight: 600;
}

.company-tree-container {
    flex: 1;
    min-width: 0;
    max-height: min(70vh, 720px);
    overflow-y: auto;
    padding: 14px 16px 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border: none;
    border-radius: 0;
    outline: none;
}

.company-tree-container:focus {
    box-shadow: inset 0 0 0 2px rgba(var(--color-primary-rgb), 0.2);
}

.company-tree-header:focus {
    outline: 2px solid #80bdff;
    outline-offset: 1px;
}

.tree-level-indicator {
    display: inline-block;
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-hover) 100%);
    color: white;
    border-radius: 50%;
    text-align: center;
    line-height: 24px;
    font-size: 11px;
    font-weight: bold;
    margin-right: 12px;
    box-shadow: 0 2px 4px rgba(var(--color-primary-rgb),0.3);
}

/* ===== COMPANY TREE SCROLLBAR ===== */
.company-tree-container::-webkit-scrollbar {
    width: 10px;
}

.company-tree-container::-webkit-scrollbar-track {
    background: #f1f3f4;
    border-radius: 5px;
}

.company-tree-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 5px;
}

.company-tree-container::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Company Tree list matches the Floor plan company list */
.company-tree-toolbar {
    padding: 8px 12px;
    gap: 6px;
    box-shadow: none;
    background: transparent;
    border: none;
    border-radius: 0;
}

.company-tree-toolbar-row {
    gap: 6px;
}

.company-tree-search {
    padding: 8px 10px;
    border: 1px solid rgba(13, 115, 119, 0.22);
    border-radius: 8px;
    background: #fff;
    color: #243033;
    font-size: 12px;
}

.company-tree-search:focus {
    outline: none;
    border-color: #0d7377;
    box-shadow: 0 0 0 3px rgba(13, 115, 119, 0.15);
}

.company-tree-toolbar .company-tree-hint {
    margin: 0;
    padding: 0;
    background: none;
    border: none;
    color: #868e96;
    font-size: 11px;
    font-style: normal;
}

.company-tree-pins:empty {
    display: none;
}

.company-tree-pins {
    gap: 4px;
}

.company-tree-pins .pin-row {
    gap: 4px;
}

.company-tree-pins .pin-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.company-tree-pins .pin-chip {
    padding: 2px 8px;
    background: #f8f9fa;
}

.company-tree-filters {
    gap: 4px;
}

.filter-chip {
    padding: 3px 9px;
    font-size: 12px;
}

.company-tree-body {
    border: none;
    border-radius: 0;
    background: transparent;
    gap: 12px;
}

.company-tree-container {
    padding: 8px 10px;
    background: rgba(13, 115, 119, 0.1);
    border: 1px solid rgba(13, 115, 119, 0.22);
    border-radius: 10px;
}

.company-tree-item {
    margin-bottom: 4px;
}

.company-tree-item.tree-flat-row {
    margin-bottom: 4px;
}

.company-tree-header {
    gap: 6px;
    padding: 6px 8px;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    cursor: pointer;
}

.company-tree-header:hover {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-color: #0d7377;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.company-tree-header.tree-selected {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-color: #0d7377;
    box-shadow: 0 0 0 2px rgba(13, 115, 119, 0.2);
}

.company-tree-header.tree-multi-on {
    background: #eef6f6;
}

.company-tree-header.tree-match {
    background: #fff8e1;
    border-color: #ffc107;
}

.company-tree-header.tree-match .company-name {
    background: transparent;
    border-radius: 0;
    padding: 0;
}

.company-tree-header.tree-selected.tree-match {
    background: #fff8e1;
    border-color: #0d7377;
    box-shadow: 0 0 0 2px rgba(13, 115, 119, 0.2);
}

.company-tree-item.is-project > .company-tree-header {
    border-left: 1px solid #dee2e6;
}

.company-name {
    font-size: 13px;
    font-weight: 600;
}

.tree-level-indicator,
.history-count {
    display: none;
}

.company-tree-compact .company-tree-header .company-status,
.company-tree-header .company-status {
    display: inline-block;
    font-size: 11px;
    font-weight: 500;
    color: #6c757d;
    background: #fff;
    padding: 2px 6px;
    border-radius: 12px;
    border: 1px solid #dee2e6;
    white-space: nowrap;
}

.tree-check-wrap {
    opacity: 0;
    width: 14px;
    justify-content: center;
}

.company-tree-header:hover .tree-check-wrap,
.company-tree-header:focus-within .tree-check-wrap,
.company-tree-header.tree-multi-on .tree-check-wrap,
.company-tree-container.tree-has-multi .tree-check-wrap {
    opacity: 1;
}

.expand-icon {
    width: 18px;
    min-width: 18px;
    padding: 0;
    font-size: 12px;
    font-weight: 700;
    color: #0d7377;
    text-align: center;
    line-height: 1;
}

.expand-icon:hover {
    color: var(--color-primary);
}

.tree-badge {
    padding: 1px 7px;
}

.tree-badge.badge-empty {
    display: none;
}

.company-children {
    margin-top: 4px;
    margin-left: 14px;
    padding-left: 0;
    border-left: 0;
}

.tree-actions-toggle {
    width: 24px;
    height: 24px;
    border-color: transparent;
    background: transparent;
    color: #adb5bd;
}

.company-tree-header:hover .tree-actions-toggle,
.tree-actions-menu.open .tree-actions-toggle {
    border-color: #dee2e6;
    background: #fff;
    color: #495057;
}

.company-tree-compact .company-tree-header {
    padding: 6px 8px;
    gap: 6px;
}

.company-tree-compact .company-children {
    margin-top: 4px;
    margin-left: 14px;
    padding-left: 0;
    border-left: 0;
}

.company-tree-detail {
    background: #f8f9fa;
    padding: 12px;
}

.tree-detail-stats {
    list-style: none;
    padding-left: 0;
    margin: 0 0 14px;
}

.tree-detail-stats li {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 5px 0;
    border-bottom: 1px solid #e9ecef;
    font-size: 12px;
}

.tree-detail-stats li strong {
    font-weight: 600;
    color: #212529;
}

/* ===== MODAL & FORM STYLES ===== */
.create-company-modal {
    max-width: min(1200px, calc(100vw - 24px));
    width: 95%;
}

.form-section {
    margin-bottom: 30px;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    border: 1px solid #e9ecef;
}

.section-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--color-primary);
}

.section-header i {
    color: var(--color-primary);
    font-size: 18px;
    margin-right: 10px;
}

.section-header h4 {
    margin: 0;
    color: #2c3e50;
    font-size: 16px;
    font-weight: 600;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.3s ease;
    background: white;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb),0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

.form-help {
    color: #6c757d;
    font-size: 12px;
    margin-top: 5px;
    display: block;
}

.file-upload-wrapper {
    position: relative;
    border: 2px dashed #dee2e6;
    border-radius: 6px;
    padding: 30px;
    text-align: center;
    background: white;
    transition: all 0.3s ease;
    cursor: pointer;
}

.file-upload-wrapper:hover {
    border-color: var(--color-primary);
    background: #f8f9fa;
}

.file-input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.file-upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.file-upload-label i {
    font-size: 24px;
    color: var(--color-primary);
}

.file-upload-label span {
    color: #6c757d;
    font-size: 14px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0056b3 0%, #004085 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
}

.btn-secondary {
    background: #6c757d;
    color: white;
    border: none;
}

.btn-secondary:hover {
    background: #5a6268;
    color: white;
    transform: translateY(-1px);
}

/* ===== TAB BUTTONS & CONTENT ===== */
.tab-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.tab-btn {
    padding: 8px 16px;
    border: 2px solid #dee2e6;
    background: white;
    color: #6c757d;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    border-color: #007bff;
    color: #007bff;
}

.tab-btn.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.asset-tab-content, .location-tab-content, .overview-tab-content {
    display: none;
}

.asset-tab-content.active, .location-tab-content.active, .overview-tab-content.active {
    display: block;
}

.overview-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.overview-tab-btn {
    padding: 10px 20px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.overview-tab-btn:hover {
    background: #f8f9fa;
    border-color: #007bff;
}

.overview-tab-btn.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

/* ===== COMPANY OVERVIEW COMPONENTS ===== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.overview-company-filter-bar { margin-bottom: 12px; }
.overview-filter-hint { margin-top: 6px; font-size: 12px; color: #6c757d; }
.overview-quick-picks { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.overview-pick-group { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.overview-pick-label { font-size: 11px; font-weight: 700; color: #6c757d; text-transform: uppercase; margin-right: 4px; }
.overview-pick-chip {
    appearance: none; border: 1px solid #ced4da; background: #fff; color: #495057;
    border-radius: 999px; padding: 4px 10px; cursor: pointer;
}
.overview-pick-chip:hover, .overview-pick-chip:focus { border-color: #0d6efd; color: #0d6efd; outline: none; }
.overview-pick-chip.is-fav { background: #fff3cd; border-color: #ffeaa7; color: #856404; }
.overview-fav-group {
    max-height: 140px;
    overflow-y: auto;
    align-content: flex-start;
}
.overview-pick-count {
    font-weight: 600;
    text-transform: none;
    color: #adb5bd;
}
.overview-pick-chip-wrap {
    display: inline-flex;
    align-items: stretch;
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid #ffeaa7;
    background: #fff3cd;
    flex: 0 0 auto;
}
.overview-pick-chip-wrap .overview-pick-chip {
    border: none;
    border-radius: 0;
    background: transparent;
    padding-right: 6px;
}
.overview-pick-chip-wrap .overview-pick-chip:hover,
.overview-pick-chip-wrap .overview-pick-chip:focus {
    background: rgba(255, 255, 255, 0.35);
}
.overview-pick-remove {
    appearance: none;
    border: none;
    border-left: 1px solid #ffeaa7;
    background: #fff8e1;
    color: #856404;
    font-size: 16px;
    line-height: 1;
    padding: 0 9px;
    cursor: pointer;
    font-weight: 700;
    min-width: 28px;
}
.overview-pick-remove:hover,
.overview-pick-remove:focus {
    background: #f8d7da;
    color: #721c24;
    outline: none;
}
.overview-pick-empty, .overview-empty-hint { text-align: center; color: #666; padding: 28px 16px; font-size: 14px; }

.company-overview-header,
.overview-sticky-header {
    position: sticky;
    top: 0;
    z-index: 15;
    background: rgba(248, 249, 250, 0.97);
    backdrop-filter: blur(4px);
    padding: 14px 16px;
    border-radius: 8px;
    margin-bottom: 12px;
    border: 1px solid #dee2e6;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.company-overview-header h3 {
    margin: 0;
    color: #495057;
    font-size: 22px;
}

.overview-header-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.overview-meta-row { display: flex; flex-wrap: wrap; gap: 12px 18px; margin-top: 8px; font-size: 13px; color: #6c757d; }
.overview-summary-strip { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.overview-summary-chip {
    display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px;
    background: #e9ecef; color: #495057; border: 1px solid #dee2e6;
    cursor: help;
}
.overview-summary-chip.badge-ok { background: #d4edda; color: #155724; border-color: #c3e6cb; }
.overview-summary-chip.badge-warn { background: #fff3cd; color: #856404; border-color: #ffeaa7; }
.overview-summary-chip.badge-bad { background: #f8d7da; color: #721c24; border-color: #f5c6cb; }
.overview-summary-chip.badge-info { background: #d1ecf1; color: #0c5460; border-color: #bee5eb; }
.overview-summary-chip.badge-muted { background: #e9ecef; color: #495057; }
.overview-summary-chip.badge-views { background: #d6eef0; color: #0d7377; border-color: #b7dfe2; }
button.overview-summary-chip.overview-filter-chip {
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    font-family: inherit;
    font-size: var(--badge-font-size);
    font-weight: var(--badge-font-weight);
    line-height: var(--badge-line-height);
}
button.overview-summary-chip.overview-filter-chip:hover { filter: brightness(0.97); }
button.overview-summary-chip.overview-filter-chip.is-active {
    outline: 2px solid #0d7377;
    outline-offset: 1px;
    box-shadow: 0 0 0 1px rgba(13, 115, 119, 0.25);
}

.overview-location-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.overview-location-search { flex: 1 1 220px; min-width: 180px; }
.overview-location-toolbar .form-control { padding: 6px 10px; font-size: 13px; max-width: 220px; }
.overview-location-count { font-size: 12px; color: #6c757d; font-weight: 600; }

.overview-filter-help { position: relative; flex: 0 0 auto; }
.overview-filter-help-btn {
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid #ced4da;
    border-radius: 50%;
    background: #f8f9fa;
    color: #495057;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
}
.overview-filter-help-btn:hover,
.overview-filter-help-btn[aria-expanded="true"] {
    background: #e9ecef;
    border-color: #adb5bd;
    color: #212529;
}
.overview-filter-help-panel {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 40;
    width: min(360px, calc(100vw - 32px));
    padding: 12px 14px;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    font-size: 12px;
    color: #495057;
}
.overview-filter-help-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
    color: #212529;
}
.overview-filter-help-close {
    border: none;
    background: transparent;
    font-size: 18px;
    line-height: 1;
    color: #6c757d;
    cursor: pointer;
    padding: 0 4px;
}
.overview-filter-help-list { margin: 0; }
.overview-filter-help-list dt {
    font-weight: 600;
    color: #343a40;
    margin-top: 8px;
}
.overview-filter-help-list dt:first-child { margin-top: 0; }
.overview-filter-help-list dd {
    margin: 2px 0 0;
    line-height: 1.35;
}

.overview-history-item {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 16px;
    padding: 16px 18px;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}
.overview-history-item[hidden] { display: none !important; }
.overview-history-item.has-site-issue {
    border-color: #f1aeb5;
    box-shadow: 0 2px 4px rgba(220, 53, 69, 0.08);
}
.overview-card-top {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 0 1 280px;
    min-width: 0;
}
.overview-history-item .history-name {
    font-size: 18px;
    font-weight: 700;
    color: #0d6efd;
    margin: 0;
    cursor: pointer;
    text-decoration: underline;
    line-height: 1.3;
}
.overview-card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.overview-card-info {
    margin: 0;
    display: grid;
    gap: 4px;
}
.overview-info-row {
    display: grid;
    grid-template-columns: 96px 1fr;
    gap: 8px;
    align-items: baseline;
    font-size: 13px;
    line-height: 1.35;
}
.overview-info-row dt {
    margin: 0;
    color: #6c757d;
    font-weight: 600;
}
.overview-info-row dd {
    margin: 0;
    color: #212529;
    word-break: break-word;
}
.overview-info-row.overview-moved-line dt {
    color: #856404;
}
.overview-info-row.overview-moved-line dd {
    color: #856404;
    font-weight: 600;
}
.overview-moved-co {
    font-weight: 500;
    color: #6c757d;
}
.overview-data-col { flex: 1 1 280px; min-width: 0; max-width: 700px; }
.overview-date-filter-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}
.overview-date-label {
    display: inline-block;
    font-size: 12px;
    font-weight: bold;
    color: #495057;
    margin: 0;
    white-space: nowrap;
}
.overview-date-filter-row .date-filter-input {
    flex: 1;
    min-width: 0;
    max-width: 200px;
}
.overview-data-records-box {
    padding: 12px; background: white; border-radius: 4px; border: 1px solid #dee2e6;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08); min-width: 0; max-width: 100%; overflow: hidden; box-sizing: border-box;
}
.overview-data-empty { padding: 10px; text-align: center; color: #6c757d; font-style: italic; }
.dropdown-option.is-active { background: var(--color-primary) !important; color: #fff !important; }

.company-overview-stats { display: flex; gap: 30px; }
.stat-item { font-size: 16px; color: #6c757d; }

/* Issues tab — reuse Overview cards/chips with a tighter list layout */
.issues-content {
    min-height: 200px;
    min-width: 0;
    max-width: 100%;
}
.issues-list { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.issues-header { min-width: 0; max-width: 100%; overflow: visible; }
.issues-header .overview-header-top { min-width: 0; width: 100%; }
.issues-header h3 { min-width: 0; flex: 1 1 auto; }
.issues-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    flex: 0 0 auto;
    min-width: 0;
    max-width: 100%;
}
.issues-header-actions .btn,
.issues-row-actions .btn {
    margin: 0;
}
.issues-row { cursor: pointer; overflow: visible; }
.issues-row .overview-history-main { width: 100%; min-width: 0; }
.issues-row .overview-info-row {
    display: flex; gap: 8px; margin-top: 4px; font-size: 12px; color: #6c757d;
}
.issues-row .overview-info-row dt {
    font-weight: 600; color: #495057; min-width: 52px;
}
.issues-row .overview-info-row dd { margin: 0; }
.issues-filter-chip {
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    font-family: inherit;
    font-size: var(--badge-font-size);
    font-weight: var(--badge-font-weight);
    line-height: var(--badge-line-height);
}
.issues-filter-chip:hover { filter: brightness(0.97); }
.issues-filter-chip.is-active {
    outline: 2px solid #0d7377;
    outline-offset: 1px;
    box-shadow: 0 0 0 1px rgba(13, 115, 119, 0.25);
}
.issues-company-group {
    border: 1px solid #dee2e6;
    border-radius: 6px;
    background: #fff;
    overflow: visible;
    min-width: 0;
    max-width: 100%;
}
.issues-company-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    border: none;
    background: #f8f9fa;
    cursor: pointer;
    text-align: left;
    font-size: 14px;
    font-weight: 600;
    color: #495057;
}
.issues-company-toggle:hover { background: #eef2f3; }
.issues-company-title { flex: 1; min-width: 0; }
.issues-company-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    padding: 4px 10px;
    border-radius: 999px;
    background: #e9ecef;
    color: #495057;
}
.issues-company-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
}
.issues-company-group.is-collapsed .issues-company-body { display: none; }
.issues-spike-link {
    color: #0d7377;
    font-weight: 600;
    text-decoration: underline;
}
.issues-spike-link:hover { color: #095a5d; }
button.overview-spike-link.device-status-badge {
    cursor: pointer;
    border: none;
    font-family: inherit;
    font-size: var(--badge-font-size);
    font-weight: var(--badge-font-weight);
    line-height: var(--badge-line-height);
    text-decoration: underline;
}
button.overview-spike-link.device-status-badge:hover {
    filter: brightness(0.95);
}
.issues-ignored-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #495057;
    cursor: pointer;
    user-select: none;
}
.issues-row-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    min-width: 0;
    width: 100%;
}
.issues-row-top .history-name {
    min-width: 0;
    flex: 1 1 auto;
    overflow-wrap: anywhere;
}
.issues-row-actions {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    margin-right: 0;
}
.issues-row.is-ignored {
    opacity: 0.72;
    border-style: dashed;
}
.issues-ignore-btn,
.issues-unignore-btn,
.issues-retire-btn {
    font-size: 11px !important;
    padding: 3px 8px !important;
}

@media (max-width: 768px) {
    .overview-history-item { flex-direction: column; }
    .overview-card-top,
    .overview-data-col { flex: 1 1 auto; max-width: 100%; width: 100%; }
    .overview-location-toolbar .form-control { max-width: none; flex: 1 1 100%; }
}

.company-projects-section,
.company-histories-section,
.company-assets-section {
    margin-bottom: 25px;
}

.company-projects-section h4,
.company-histories-section h4,
.company-assets-section h4 {
    color: #495057;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--color-primary);
}

.company-project-item {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.project-name {
    font-weight: 600;
    color: #495057;
    margin-bottom: 8px;
    font-size: 16px;
}

.project-status {
    color: #6c757d;
    margin-bottom: 5px;
    font-size: 14px;
}

.project-description {
    color: #6c757d;
    font-size: 14px;
    line-height: 1.4;
}

.company-overview .overview-layout {
    display: flex;
    gap: 20px;
    margin-top: 20px;
    align-items: flex-start;
    flex-wrap: nowrap;
}

.company-overview .overview-main-content {
    flex: 1;
    min-width: 0;
}

.company-overview .overview-sidebar {
    width: 300px;
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    align-self: flex-start;
    height: fit-content;
    box-sizing: border-box;
}

/* Match Create Alert button typography across Overview */
.company-overview .btn,
.company-overview .btn.btn-small,
.company-overview button.btn {
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    letter-spacing: normal;
    text-transform: none;
    line-height: 1.25;
}

/* ===== PROJECT STATUS & HEADERS ===== */
.project-tree-status {
    font-size: 12px;
    color: #6c757d;
    margin-bottom: 3px;
}

.project-tree-dates {
    font-size: 11px;
    color: #adb5bd;
}

.project-status-active { border-left: 4px solid #28a745; }
.project-status-pending { border-left: 4px solid #ffc107; }
.project-status-completed { border-left: 4px solid #17a2b8; }
.project-status-cancelled { border-left: 4px solid #dc3545; }

.project-header {
    font-weight: bold;
    color: var(--color-primary);
    margin: 10px 0;
    padding: 5px 0;
    border-bottom: 1px solid #eee;
}

/* ===== TOOLTIP SYSTEM ===== */
.history-name-tooltip {
    position: relative;
    cursor: pointer;
}

.history-name-tooltip .tooltip-content {
    visibility: hidden;
    width: 800px;
    max-width: 90vw;
    background-color: #2c3e50;
    color: #ecf0f1;
    text-align: left;
    border-radius: 6px;
    padding: 10px;
    position: fixed;
    z-index: 99999;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 11px;
    line-height: 1.3;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    border: 1px solid #34495e;
    pointer-events: none;
}

.tooltip-two-column {
    display: flex;
    gap: 15px;
}

.tooltip-left-column {
    flex: 1;
    border-left: 1px solid #34495e;
    padding-left: 10px;
}

.tooltip-right-column {
    flex: 1;
    border-left: 1px solid #34495e;
    padding-left: 10px;
}

.history-name-tooltip:hover .tooltip-content {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

.history-name-tooltip .tooltip-content::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #2c3e50 transparent transparent transparent;
}

.tooltip-section {
    margin-bottom: 8px;
    padding-bottom: 6px;
}

.tooltip-section:not(:last-child) {
    border-bottom: 1px solid #34495e;
    padding-bottom: 8px;
}

.tooltip-section-title {
    font-weight: bold;
    color: #3498db;
    margin-bottom: 6px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.tooltip-field {
    margin-bottom: 3px;
    display: flex;
    align-items: flex-start;
}

.tooltip-field-label {
    font-weight: 600;
    color: #bdc3c7;
    min-width: 120px;
    margin-right: 6px;
}

.tooltip-field-value {
    color: #ecf0f1;
    flex: 1;
}

/* ===== OVERVIEW DETAIL DISPLAY ===== */
.detail-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: 3px;
}

.detail-label {
    font-weight: 600;
    color: #6c757d;
    min-width: 100px;
    margin-right: 8px;
    font-size: 12px;
}

.detail-value {
    color: #495057;
    flex: 1;
    font-size: 12px;
}

.variance-field {
    background: #e9ecef;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    color: #495057;
    white-space: nowrap;
}

.tooltip-data-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-top: 6px;
}

.tooltip-data-field {
    display: flex;
    flex-direction: column;
}

.tooltip-data-label {
    font-weight: 600;
    color: #bdc3c7;
    font-size: 10px;
    margin-bottom: 1px;
}

.tooltip-data-value {
    color: #ecf0f1;
    font-size: 11px;
}

.tooltip-config {
    font-family: 'Courier New', monospace;
    font-size: 10px;
    background: #1a252f;
    padding: 6px;
    border-radius: 3px;
    margin-top: 4px;
    white-space: pre-wrap;
    max-height: 100px;
    overflow-y: auto;
    border: 1px solid #34495e;
}

.tooltip-variance-item {
    margin-bottom: 6px;
    padding: 4px 6px;
    background: #1a252f;
    border-radius: 3px;
    border: 1px solid #34495e;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    font-size: 10px;
}

.tooltip-variance-field {
    display: flex;
    align-items: center;
    gap: 3px;
}

.tooltip-variance-label {
    color: #bdc3c7;
    font-weight: 600;
    font-size: 9px;
}

.tooltip-variance-value {
    color: #ecf0f1;
}

/* ===== USER LIST COMPONENTS ===== */
.user-card {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    margin-bottom: 16px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.user-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
    border-color: var(--color-primary);
}

.user-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.user-name {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
    margin: 0;
    line-height: 1.3;
}

.user-id {
    background: #f8f9fa;
    color: #6c757d;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
}

.user-details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.user-detail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.user-detail-label {
    font-size: 12px;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.user-detail-value {
    font-size: 14px;
    color: #495057;
    font-weight: 500;
}

.user-status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
}

.user-status-live {
    background: #d4edda;
    color: #155724;
}

.user-status-inactive {
    background: #fff3cd;
    color: #856404;
}

.user-status-suspended {
    background: #f8d7da;
    color: #721c24;
}

.user-filter-hint {
    font-size: 12px;
    color: #6c757d;
    margin-top: 6px;
}

.user-analytics {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 12px;
}

.user-analytics-label {
    font-size: 11px;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 8px;
}

.user-analytics-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
}

.user-analytics-stat {
    min-width: 0;
}

.user-analytics-stat strong {
    display: block;
    font-size: 15px;
    color: #0d7377;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-analytics-stat span {
    font-size: 11px;
    color: #6c757d;
}

@media (max-width: 720px) {
    .user-analytics-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}


/* ===== HISTORY COMPONENTS ===== */
.history-name {
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

.history-details {
    color: #666;
    font-size: 0.9em;
    margin-bottom: 5px;
}

.history-status {
    color: var(--color-primary);
    font-size: 0.9em;
    font-weight: bold;
}

/* ===== MODAL SYSTEM ===== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: white;
    margin: 2% auto;
    padding: 0;
    border-radius: 8px;
    width: 90%;
    max-width: min(600px, calc(100vw - 24px));
    max-height: 90vh;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    min-width: 0;
    box-sizing: border-box;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.modal-header h3 {
    margin: 0;
    color: #333;
}

.close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.analytics-modal {
    width: min(1100px, calc(100vw - 24px));
    max-width: calc(100vw - 24px);
    height: 92vh;
    max-height: 92vh;
    min-width: 0;
}

.analytics-modal .modal-body {
    display: flex;
    flex-direction: column;
    min-height: 0;
    max-width: 100%;
    overflow: hidden;
}

.analytics-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 10px;
    margin-bottom: 12px;
    flex-shrink: 0;
}

.analytics-date-label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    color: #495057;
}

.analytics-date-label .form-control {
    min-width: 140px;
}

.analytics-range-label {
    font-size: 12px;
    color: #6c757d;
    margin-left: auto;
}

.analytics-status {
    font-size: 13px;
    color: #6c757d;
    min-height: 1.2em;
    margin-bottom: 8px;
    flex-shrink: 0;
}

#analytics-body {
    flex: 1;
    min-height: 0;
    max-width: 100%;
    overflow: auto;
}

.analytics-nav {
    position: sticky;
    top: 0;
    z-index: 6;
    background: #fff;
    padding-bottom: 4px;
    max-width: 100%;
    min-width: 0;
}

.analytics-nav .info-tabs {
    margin-bottom: 10px;
}

.analytics-filter-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.analytics-filter-bar .filter-input {
    flex: 1;
    min-width: 200px;
}

.analytics-panel {
    display: none;
}

.analytics-panel.active {
    display: block;
    max-width: 100%;
    min-width: 0;
}

.analytics-panel > .analytics-table-wrap {
    margin-bottom: 16px;
}

.analytics-top-users {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 16px;
}

.analytics-top-users-empty {
    grid-column: 1 / -1;
    padding: 16px;
    text-align: center;
    color: #6c757d;
    font-size: 13px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
}

.analytics-top-user {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 10px 12px;
    min-width: 0;
}

.analytics-top-user-rank {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: #6c757d;
    margin-bottom: 4px;
}

.analytics-top-user strong {
    display: block;
    font-size: 14px;
    color: #0d7377;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.analytics-top-user-views {
    display: block;
    margin: 6px 0 2px;
    font-size: 12px;
    color: #495057;
}

.analytics-top-user-views strong {
    display: inline;
    font-size: 16px;
}

.analytics-top-user-meta {
    display: block;
    font-size: 11px;
    color: #6c757d;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 900px) {
    .analytics-top-users {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.analytics-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 8px;
    margin-bottom: 16px;
}

.analytics-stat {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 10px 12px;
}

.analytics-stat[data-analytics-tab] {
    cursor: pointer;
}

.analytics-stat[data-analytics-tab]:hover {
    border-color: var(--color-primary);
    background: var(--color-primary-soft);
}

.analytics-stat strong {
    display: block;
    font-size: 20px;
    color: #0d7377;
}

.analytics-stat span {
    font-size: 12px;
    color: #6c757d;
}

.analytics-chart-wrap {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 16px;
}

.analytics-chart-wrap h4,
.analytics-columns h4,
.analytics-panel > h4 {
    margin: 0 0 8px;
    font-size: 14px;
    color: #495057;
}

.analytics-columns {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px;
    margin-bottom: 16px;
    max-width: 100%;
}

.analytics-table-wrap {
    overflow: auto;
    max-width: 100%;
    min-width: 0;
    max-height: min(420px, 50vh);
    border: 1px solid #e9ecef;
    border-radius: 6px;
}

.analytics-events-wrap {
    max-height: min(520px, 58vh);
}

.analytics-table {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.analytics-table th,
.analytics-table td {
    padding: 6px 8px;
    text-align: left;
    border-bottom: 1px solid #f1f3f5;
    white-space: nowrap;
}

.analytics-table th {
    background: #f8f9fa;
    position: sticky;
    top: 0;
    cursor: pointer;
    user-select: none;
}

.analytics-table th[data-sort="asc"]::after {
    content: " ▲";
    font-size: 10px;
    color: #6c757d;
}

.analytics-table th[data-sort="desc"]::after {
    content: " ▼";
    font-size: 10px;
    color: #6c757d;
}

.analytics-table tbody tr:hover {
    background: #f8f9fa;
}

.analytics-empty {
    padding: 16px;
    color: #6c757d;
    font-style: italic;
    font-size: 13px;
}

@media (max-width: 768px) {
    .analytics-columns {
        grid-template-columns: 1fr;
    }
}

.close:hover {
    color: #000;
}

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

.error-message {
    background-color: #f8d7da;
    color: #721c24;
    padding: 12px 16px;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.error-message i {
    color: #dc3545;
}

/* ===== FORM COMPONENTS ===== */
.form-group {
    margin-bottom: 15px;
}

.form-row {
    display: flex;
    gap: 15px;
}

.form-row .form-group {
    flex: 1;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #333;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(var(--color-primary-rgb),0.25);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

/* ===== FILTER COMPONENTS ===== */
.filter {
    background: white;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
}

.filter-input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.filter-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(var(--color-primary-rgb),0.25);
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    .user-header {
        flex-wrap: wrap;
        gap: 10px;
    }

    .user-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .main-content {
        flex-direction: column;
    }
    
    .stats {
        flex-direction: column;
        gap: 10px;
    }

    .tabs {
        flex-direction: column;
        overflow: visible;
    }

    .tabs-group {
        flex-wrap: wrap;
        flex-shrink: 1;
        width: 100%;
    }

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

    .form-row {
        flex-direction: column;
    }

    .overview-layout {
        flex-direction: column;
    }

    .company-overview .overview-sidebar {
        width: 100%;
    }
}

/* ===== SENSOR MANAGEMENT TAB STYLES ===== */
.sensor-content {
    padding: 20px;
}

.sensor-form-section {
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.sensor-form-section h3 {
    color: #495057;
    margin-bottom: 10px;
    font-size: 1.2em;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sensor-form-section p {
    color: #6c757d;
    margin-bottom: 20px;
    line-height: 1.5;
}

.sensor-form {
    background: white;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.sensor-form .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.sensor-form .form-group {
    display: flex;
    flex-direction: column;
}

.sensor-form .form-group label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 5px;
    font-size: 0.9em;
}

.sensor-form .form-group .form-control {
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.9em;
    height: 40px;
    box-sizing: border-box;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.sensor-form .form-group .form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(var(--color-primary-rgb),0.25);
}

.sensor-form .form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}


/* Responsive design for sensor form */
@media (max-width: 768px) {
    .sensor-form .form-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .sensor-form .form-actions {
        flex-direction: column;
    }
    
    .sensor-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .sensor-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

/* ===== INFO TAB STYLES ===== */
.info-content {
    padding: 20px;
}

.info-filter-section {
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.info-filter-section h3 {
    color: #495057;
    margin-bottom: 10px;
    font-size: 1.2em;
    display: flex;
    align-items: center;
    gap: 10px;
}

.info-filter-section p {
    color: #6c757d;
    margin-bottom: 20px;
    line-height: 1.5;
}

.imei-search-form {
    background: white;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.imei-search-form .form-group {
    display: flex;
    flex-direction: column;
    max-width: 500px;
}

.imei-search-form .form-group label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 5px;
    font-size: 0.9em;
}

.imei-search-input { position: relative; }
.imei-search-form .form-group .form-control {
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.9em;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    margin-bottom: 10px;
}
.imei-search-input .nd-suggest { top: calc(100% - 10px); z-index: 20; }

.imei-search-form .form-group .form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(var(--color-primary-rgb),0.25);
}

.imei-search-form .btn {
    align-self: flex-start;
}

.info-results-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.info-results-section h3 {
    color: #495057;
    margin-bottom: 15px;
    font-size: 1.2em;
    display: flex;
    align-items: center;
    gap: 10px;
}

.info-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.info-tab-btn {
    padding: 8px 16px;
    border: 1px solid #dee2e6;
    background: white;
    color: #495057;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9em;
}

.info-tab-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.info-tab-btn.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.info-tab-content {
    display: none;
    background: white;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.info-tab-content.active {
    display: block;
}

/* PDF Import Tab Styles */
.pdf-import-content {
    padding: 20px;
}

.pdf-drop-zone {
    border: 2px dashed #ced4da;
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    background: #f8f9fa;
    margin: 20px 0;
    transition: all 0.3s ease;
    cursor: pointer;
}

.pdf-drop-zone:hover {
    border-color: var(--color-primary);
    background: var(--color-primary-soft);
}

.pdf-drop-zone.dragover {
    border-color: #28a745;
    background: #d4edda;
    transform: scale(1.02);
}

.pdf-drop-zone .drop-zone-content {
    pointer-events: none;
}

.pdf-drop-zone .drop-zone-content i {
    font-size: 48px;
    color: #6c757d;
    margin-bottom: 20px;
    transition: color 0.3s ease;
}

.pdf-drop-zone:hover .drop-zone-content i {
    color: var(--color-primary);
}

.pdf-drop-zone.dragover .drop-zone-content i {
    color: #28a745;
}

.pdf-drop-zone h4 {
    color: #495057;
    margin-bottom: 10px;
    font-size: 1.2em;
}

.pdf-drop-zone p {
    color: #6c757d;
    margin-bottom: 20px;
    font-size: 14px;
}

.pdf-file-list {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    margin: 20px 0;
}

.pdf-file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    margin-bottom: 10px;
    background: #f8f9fa;
}

.pdf-file-item:last-child {
    margin-bottom: 0;
}

.pdf-file-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pdf-file-info i {
    color: #dc3545;
    font-size: 18px;
}

.pdf-file-details {
    display: flex;
    flex-direction: column;
}

.pdf-file-name {
    font-weight: 500;
    color: #495057;
    font-size: 14px;
}

.pdf-file-size {
    color: #6c757d;
    font-size: 12px;
}

.pdf-file-status {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
}

.pdf-file-status.processing {
    color: #856404;
}

.pdf-file-status.success {
    color: #155724;
}

.pdf-file-status.error {
    color: #721c24;
}

.pdf-extracted-data {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
}

.pdf-data-content {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 15px;
    max-height: 400px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.4;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.import-progress {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
}

.progress {
    height: 20px;
    background: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-bar {
    height: 100%;
    background: #28a745;
    width: 0%;
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: 500;
}

.import-status-text {
    color: #6c757d;
    font-size: 14px;
}

.info-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.info-table th,
.info-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
}

.info-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #495057;
    font-size: 0.9em;
}

.info-table td {
    color: #6c757d;
    font-size: 0.85em;
}

.info-table tr:hover {
    background: #f8f9fa;
}

.no-data {
    text-align: center;
    color: #6c757d;
    padding: 40px 20px;
    font-style: italic;
}

/* Responsive design for info tab */
@media (max-width: 768px) {
    .info-tabs {
        flex-direction: column;
    }
    
    .info-tab-btn {
        text-align: center;
    }
    
    .info-table {
        font-size: 0.8em;
    }
    
    .info-table th,
    .info-table td {
        padding: 6px 8px;
    }
}

/* Histories card layout */
.histories-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    padding: 10px 0;
}

.history-card {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
}

.history-header h4 {
    margin: 0;
    font-size: 14px;
    color: #333;
}

.history-status {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
}

.history-status.live {
    background: #d4edda;
    color: #155724;
}

.history-status.inactive {
    background: #f8d7da;
    color: #721c24;
}

.history-status.unknown {
    background: #e2e3e5;
    color: #6c757d;
}

.history-content {
    padding: 15px;
}

.history-row {
    display: flex;
    gap: 15px;
    margin-bottom: 10px;
}

.history-row:last-child {
    margin-bottom: 0;
}

.history-field {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.history-field.full-width {
    flex: 100%;
}

.history-field label {
    font-size: 11px;
    font-weight: bold;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.history-field span {
    font-size: 13px;
    color: #333;
    word-break: break-word;
}

/* Sensor data sections */
.sensor-data-section {
    margin-bottom: 30px;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    overflow: hidden;
}

.sensor-data-section h4 {
    margin: 0;
    padding: 10px 15px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    color: #333;
    font-size: 14px;
    font-weight: bold;
}

.sensor-data-section .info-table {
    margin-top: 0;
}

.sensor-data-section .info-table th {
    background: #e9ecef;
}

/* Responsive design for histories */
@media (max-width: 768px) {
    .histories-container {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .history-row {
        flex-direction: column;
        gap: 8px;
    }
    
    .history-field {
        flex: none;
    }
}

/* ===== SEARCHABLE DROPDOWN STYLES ===== */
.searchable-dropdown {
    position: relative;
    width: 100%;
}

.searchable-dropdown .dropdown-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ced4da;
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.searchable-dropdown .dropdown-option {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid #e9ecef;
    transition: background-color 0.2s;
}

.searchable-dropdown .dropdown-option:hover {
    background-color: #f8f9fa;
}

.searchable-dropdown .dropdown-option:last-child {
    border-bottom: none;
}

.searchable-dropdown .dropdown-option.highlighted {
    background-color: var(--color-primary);
    color: white;
}

/* ===== DRAGGABLE OVERLAY MARKERS ===== */
.draggable-marker {
    position: absolute;
    cursor: move;
    z-index: 1000;
    transition: transform 0.1s;
    user-select: none;
}

.draggable-marker:hover {
    transform: scale(1.05);
}

.draggable-marker .marker-container {
    background-color: rgba(255, 255, 255, 0.9);
    border: 1px solid #333;
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 11px;
    font-family: monospace;
    color: #0000ff;
    line-height: 15px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.draggable-marker .marker-container > div {
    white-space: nowrap;
}

/* Draggable history items */
.draggable-history-item {
    transition: background-color 0.2s, transform 0.1s;
    user-select: none;
}

.draggable-history-item:hover {
    transform: translateX(2px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.draggable-history-item.dragging {
    opacity: 0.5;
    transform: scale(0.95);
}

/* Drop zone styling */
#overlay-image-preview.drag-over {
    background-color: var(--color-primary-soft) !important;
    border-color: #2196f3 !important;
    border-width: 3px !important;
}

/* Swap / Move tabs: two columns with vertically aligned rows */
.swap-controls,
.move-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
    align-items: stretch;
}

.swap-column {
    display: grid;
    grid-template-rows: auto auto auto;
    gap: 8px;
    margin-bottom: 0;
    min-width: 0;
}

.move-column {
    display: grid;
    grid-template-rows: auto auto auto auto;
    gap: 8px;
    margin-bottom: 0;
    min-width: 0;
}

.swap-column .swap-col-label,
.move-column .move-col-label {
    margin: 0;
    min-height: 2.75em;
    line-height: 1.35;
    display: flex;
    align-items: flex-end;
}

.swap-field-hint,
.move-field-hint {
    margin: 0;
    min-height: 2.6em;
    font-size: 12px;
    color: #6c757d;
    line-height: 1.35;
}

.swap-input-row,
.move-input-row {
    margin: 0;
}

.swap-input-row,
.move-input-row {
    position: relative;
}

.swap-input-row .filter-dropdown,
.move-input-row .filter-dropdown {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    z-index: 20;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    max-height: 180px;
    overflow: auto;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.swap-input-row .filter-item,
.move-input-row .filter-item {
    padding: 8px 10px;
    cursor: pointer;
    font-size: 13px;
}

.swap-input-row .filter-item:hover,
.move-input-row .filter-item:hover {
    background: #e6f3f3;
}

.move-lookup-row {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

.move-lookup-row .move-input-row {
    flex: 1;
    min-width: 0;
}

.move-lookup-row .btn {
    flex-shrink: 0;
    margin-top: 10px;
}

.move-history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.move-history-card {
    border: 1px inset #ccc;
    background: #eee;
    color: #000;
    padding: 8px 10px;
    font-size: 13px;
}

.move-history-card.is-empty {
    background: #fff;
    color: #aaa;
}

.move-history-path {
    font-weight: 600;
    margin-bottom: 6px;
    line-height: 1.35;
}

.move-history-card table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.move-history-card th,
.move-history-card td {
    text-align: left;
    padding: 2px 6px 2px 0;
    font-weight: 600;
}

.move-history-card td {
    font-weight: 400;
}

.move-column .move-history-pick {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    font-weight: 600;
}

.move-column .move-history-pick input {
    width: auto;
    padding: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.move-history-range {
    margin-top: 4px;
    font-size: 12px;
}

.swap-input-row .filter-input,
.move-input-row .filter-input {
    width: 100%;
    box-sizing: border-box;
}

.swap-info-slot,
.move-info-slot {
    min-height: 0;
}

.swap-history-info,
.move-history-info {
    margin-top: 0;
    padding: 12px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 5px;
}

.swap-info-title,
.move-info-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.swap-info-line,
.move-info-line {
    font-size: 13px;
    color: #666;
    margin-bottom: 4px;
}

.swap-info-line:last-child,
.move-info-line:last-child {
    margin-bottom: 0;
}

.swap-info-line i,
.move-info-line i {
    color: #6c757d;
    margin-right: 5px;
    width: 14px;
    text-align: center;
}

.swap-option-check {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 0;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    color: #495057;
}

.swap-option-check input[type="checkbox"] {
    margin-top: 2px;
    flex-shrink: 0;
}

.swap-option-help {
    display: block;
    color: #6c757d;
    font-size: 12px;
    margin-top: 2px;
}

@media (max-width: 900px) {
    .swap-controls,
    .move-controls {
        grid-template-columns: 1fr;
    }
}

#new-device-box {
    background: transparent;
    border: none;
    padding: 0;
}
#nd-device-forms[hidden] { display: none; }
.nd-lastseen { margin: 0 0 10px; }
.nd-find-lookup {
    display: grid;
    grid-template-columns: minmax(240px, 1.4fr) minmax(180px, 1fr);
    gap: 12px;
    margin-bottom: 12px;
}
.nd-find-lookup .nd-field { margin-bottom: 0; position: relative; }
.nd-find-grid {
    display: grid;
    grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
    grid-template-rows: auto minmax(0, auto);
    column-gap: 16px;
    row-gap: 4px;
    align-items: stretch;
}
.nd-find-grid .nd-company-field,
.nd-find-side {
    display: grid;
    grid-template-rows: subgrid;
    grid-row: 1 / span 2;
    min-width: 0;
    min-height: 0;
    margin-bottom: 0;
}
.nd-find-side > label,
.nd-company-field > label { margin-bottom: 0; }
.nd-find-side > label { display: block; font-weight: 600; font-size: 12px; color: #475467; }
.nd-company-field .review-company-cart {
    display: flex;
    flex-direction: column;
    margin: 0;
    min-height: 0;
}
.nd-company-field .nd-inline { align-items: center; margin-bottom: 8px; flex: 0 0 auto; }
.nd-company-field .review-company-search { flex: 1; width: auto; min-width: 0; height: 34px; margin-bottom: 0; box-sizing: border-box; }
.nd-company-field .nd-inline .btn { height: 34px; }
.nd-company-picked { margin: 0 0 6px; font-size: 12px; font-weight: 600; color: #667085; flex: 0 0 auto; }
.nd-company-picked.is-set { font-weight: 700; color: #0d7377; }
#nd-company-count { flex: 0 0 auto; }
.nd-find-grid .review-company-tree {
    flex: 0 0 auto;
    height: 110px;
    min-height: 110px;
    max-height: 110px;
}
.nd-find-side .nd-imei-list {
    height: 0;
    min-height: 100%;
    max-height: 100%;
    margin-bottom: 0;
    overflow: auto;
}
.nd-find-side .nd-imei-list .nd-empty { padding: 28px 12px; }
.nd-side .nd-grid-2 { grid-template-columns: 1fr; }
.nd-find { margin-bottom: 12px; }
#device-quick-picks { margin-bottom: 10px; }
#device-quick-picks .overview-pick-empty { padding: 0; text-align: left; font-size: 12px; }
.nd-config-wide { width: 100%; }
.nd-config-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    align-items: center;
    margin-bottom: 8px;
}
.nd-config-bar .nd-actions { margin: 0; }
.nd-config-bar .nd-inline { flex: 1; min-width: 220px; }
.nd-config-bar .nd-preset-pick { flex: 2 1 520px; min-width: 320px; flex-wrap: nowrap; }
.nd-preset-pick #nd-preset-filter { flex: 0 1 150px; }
.nd-preset-pick #nd-preset { flex: 1 1 220px; min-width: 160px; }
.nd-config-wide .nd-config { width: 100%; }
.nd-page-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    margin-bottom: 14px;
}
.nd-page-head h2 {
    margin: 0;
    font-size: 22px;
    color: #1f2a2e;
}
.nd-page-head p {
    margin: 4px 0 0;
    color: #667085;
    font-size: 13px;
}
.nd-lastseen {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    color: #667085;
    font-size: 12px;
}
.nd-imei-pill {
    background: #e7f4f4;
    color: #0d7377;
    border: 1px solid #b7dfe2;
    border-radius: 999px;
    padding: 4px 10px;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.nd-layout {
    display: grid;
    grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}
.nd-side, .nd-main { min-width: 0; }
.nd-card {
    background: #fff;
    border: 1px solid #e4e7ec;
    border-radius: 10px;
    padding: 14px 16px 16px;
    margin-bottom: 12px;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}
.nd-card h3, .nd-card-head h3 {
    margin: 0 0 12px;
    font-size: 14px;
    font-weight: 700;
    color: #1f2a2e;
}
.nd-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}
.nd-card-head h3 { margin: 0; }
.nd-history-card { margin-bottom: 0; padding: 12px 14px 14px; }
.nd-history-card .nd-card-head { margin-bottom: 8px; }
.nd-history-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
#nd-histories.nd-opts-off col.nd-opt { width: 0; visibility: collapse; }
#nd-histories.nd-opts-off .nd-opt { display: none !important; }
.nd-history-card .nd-table { min-width: 0; }
.nd-history-card .nd-table th,
.nd-history-card .nd-table td { padding: 6px; vertical-align: top; }
.nd-name { width: auto; min-width: 160px; }
#new-device-box .nd-table .form-control {
    padding: 2px 6px;
    min-height: 0;
    height: auto;
    font-size: 12px;
}
#new-device-box .nd-table select.form-control {
    height: 26px;
    padding: 1px 4px;
}
#new-device-box .nd-name .form-control {
    font-size: 13px;
    line-height: 1.2;
    padding: 3px 8px;
    min-height: 0;
}
.nd-field { margin-bottom: 10px; }
.nd-find-grid .nd-field { position: relative; }
.nd-suggest {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% - 6px);
    z-index: 30;
    background: #fff;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    box-shadow: 0 8px 20px rgba(16, 24, 40, 0.12);
    max-height: 220px;
    overflow: auto;
}
.nd-suggest[hidden] { display: none; }
.nd-suggest-item {
    display: block;
    width: 100%;
    text-align: left;
    background: #fff;
    border: 0;
    border-bottom: 1px solid #eee;
    padding: 6px 10px;
    font-size: 13px;
    cursor: pointer;
    color: #1f2a2e;
}
.nd-suggest-item.active,
.nd-suggest-item:hover { background: #e6f3f3; }
.nd-field label {
    display: block;
    font-weight: 600;
    font-size: 12px;
    color: #475467;
    margin-bottom: 4px;
}
.nd-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 10px;
}
.nd-inline, .nd-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}
.nd-actions { margin-top: 4px; }
.nd-action-rows { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.nd-action-row { display: flex; flex-wrap: nowrap; gap: 6px; }
#new-device-box .nd-action-row .btn {
    flex: 1 1 0;
    min-width: 0;
    padding: 7px 8px;
    font-size: 12px;
}
.nd-field .form-control, .nd-grid-2 .form-control { width: 100%; }
.nd-inline { flex-wrap: nowrap; }
.nd-inline .form-control { flex: 1; width: auto; min-width: 0; }
.nd-inline .btn { flex: 0 0 auto; }
#new-device-box .btn,
#device-top-toolbar .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    flex: 0 0 auto;
    margin: 0;
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.25;
    box-shadow: none;
    transform: none;
    white-space: nowrap;
}
#new-device-box .btn.btn-small,
#device-top-toolbar .btn.btn-small {
    padding: 4px 8px;
    font-size: 11px;
}
#new-device-box .btn-primary,
#device-top-toolbar .btn-primary,
#device-detail-panel .btn-primary { background: #007bff; color: #fff; }
#new-device-box .btn-primary:hover,
#device-top-toolbar .btn-primary:hover,
#device-detail-panel .btn-primary:hover { background: #0056b3; color: #fff; transform: none; box-shadow: none; }
#new-device-box .btn-secondary,
#device-top-toolbar .btn-secondary,
#device-detail-panel .btn-secondary { background: #6c757d; color: #fff; }
#new-device-box .btn-secondary:hover,
#device-top-toolbar .btn-secondary:hover,
#device-detail-panel .btn-secondary:hover { background: #545b62; color: #fff; transform: none; box-shadow: none; }
#new-device-box .btn-info,
#device-detail-panel .btn-info { background: #17a2b8; color: #fff; }
#new-device-box .btn-info:hover,
#device-detail-panel .btn-info:hover { background: #117a8b; color: #fff; transform: none; box-shadow: none; }
#new-device-box .btn-success,
#device-detail-panel .btn-success { background: #28a745; color: #fff; }
#new-device-box .btn-success:hover,
#device-detail-panel .btn-success:hover { background: #1e7e34; color: #fff; transform: none; box-shadow: none; }
#new-device-box .btn-warning,
#device-detail-panel .btn-warning { background: #ffc107; color: #212529; }
#new-device-box .btn-warning:hover,
#device-detail-panel .btn-warning:hover { background: #e0a800; color: #212529; transform: none; box-shadow: none; }
#device-detail-panel .btn {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 4px;
    border: none;
    font-weight: 600;
    white-space: nowrap;
}
#new-device-box .form-control {
    box-sizing: border-box;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    padding: 7px 10px;
    font-size: 13px;
    background: #fff;
    color: #1f2a2e;
}
#new-device-box .form-control:focus {
    outline: none;
    border-color: #0d7377;
    box-shadow: 0 0 0 3px rgba(13, 115, 119, 0.15);
}
#new-device-box select.form-control { height: 34px; }
.nd-hint { font-size: 12px; color: #667085; min-height: 16px; }
.nd-empty {
    padding: 36px 16px;
    text-align: center;
    color: #667085;
    background: #f8fafb;
    border: 1px dashed #d0d5dd;
    border-radius: 8px;
}
.nd-empty strong { display: block; color: #1f2a2e; margin-bottom: 4px; }
.nd-empty p { margin: 0; }
.nd-imei-list, .nd-scroll, .nd-notes {
    max-height: 180px;
    overflow: auto;
    border: 1px solid #e4e7ec;
    border-radius: 8px;
    background: #f8fafb;
    padding: 8px;
    margin-bottom: 10px;
    font-size: 12px;
}
.nd-imei-list table { width: 100%; border-collapse: collapse; }
.nd-imei-list th, .nd-imei-list td { text-align: left; padding: 4px 6px; border-bottom: 1px solid #eee; }
.nd-config {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    line-height: 1.45;
    margin-top: 8px;
}
.nd-table-wrap {
    overflow: auto;
    border: 1px solid #e4e7ec;
    border-radius: 8px;
    max-height: 70vh;
    background: #fff;
}
.nd-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12px; min-width: 0; table-layout: fixed; }
.nd-col-type { width: 124px; }
.nd-col-meter { width: 132px; }
.nd-col-flag { width: 42px; }
.nd-col-buttons { width: 68px; }
.nd-col-polarity { width: 74px; }
.nd-col-loc { width: 92px; }
.nd-table th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f4f7f8;
    color: #475467;
    font-size: 11px;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    text-align: left;
    padding: 8px;
    border-bottom: 1px solid #e4e7ec;
    white-space: nowrap;
}
.nd-table th.nd-flag { text-align: center; }
.nd-table td {
    padding: 8px;
    vertical-align: top;
    border-bottom: 1px solid #eef1f4;
    background: #fff;
}
.nd-table th.nd-split,
.nd-table td.nd-split { border-left: 1px solid #e4e7ec; }
.nd-table .form-control {
    font-size: 12px;
    padding: 5px 8px;
    width: 100%;
    min-width: 0;
}
.nd-stack { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.nd-meter { width: 128px; }
.nd-buttons { width: 64px; }
.nd-buttons label { display: flex; align-items: center; gap: 4px; color: #667085; font-size: 11px; }
.nd-buttons .form-control { width: 36px; }
.nd-check { text-align: center; width: 40px; }
.nd-check input { margin: 6px 0 0; }
.nd-polarity { width: 72px; }
.nd-polarity .form-control { width: 64px; }
.nd-loc { width: 88px; }
.nd-type-cell { width: 124px; }
.nd-type-actions { display: flex; flex-direction: column; gap: 4px; }
#new-device-box .nd-type-cell .btn {
    width: 100%;
    justify-content: flex-start;
    overflow: hidden;
    text-overflow: ellipsis;
}
.nd-open { cursor: pointer; }
.nd-open-static { cursor: default; pointer-events: none; }
.nd-id { display: block; margin-top: 6px; color: #98a2b3; font-size: 11px; font-variant-numeric: tabular-nums; }
.nd-primary td { background: #f3fafb; }
.nd-extra td { background: #fff; }
.nd-table tbody tr.nd-extra:nth-child(even) td { background: #fbfcfd; }
.nd-table tbody tr:hover td { background: #f7fbfb; }
.nd-selected td { background: #dff3f4; }
.nd-selected:hover td { background: #d3eef0; }
.nd-selected td:first-child { box-shadow: inset 4px 0 0 #0d7377; }
.nd-history-note {
    margin-top: 8px;
    padding: 7px 10px;
    background: #f8fafb;
    border-radius: 6px;
    color: #667085;
    font-size: 12px;
}
#new-device-box .nd-selected .nd-name .form-control {
    background: #fff;
    border-color: #0d7377;
}
.nd-collapsed { display: none; }
.nd-none { text-align: center; color: #667085; padding: 20px; }
.nd-note, .nd-history-block { border-bottom: 1px solid #eef1f4; padding: 8px 2px; }
.nd-history-block pre { white-space: pre-wrap; margin: 4px 0 0; font-size: 11px; }
.nd-vmeter-form {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
    padding: 10px;
    background: #f8fafb;
    border-radius: 8px;
}
.nd-vmeter-form .form-control { width: auto; min-width: 140px; flex: 1; }
.nd-history-actions { margin-top: 12px; }
#device-top-toolbar:empty { display: none; }
#device-top-toolbar .device-detail-toolbar { margin: 0 0 10px; }
#device-top-toolbar .device-detail-header {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 12px;
}
#device-top-toolbar .device-detail-header h2 {
    margin: 0;
    color: #495057;
    font-size: 20px;
    font-weight: 600;
}
.device-detail-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.nd-lastseen-btn[hidden] { display: none; }
#new-device-box > .device-subtabs { margin-top: 0; margin-bottom: 16px; }
.nd-detail-panel { margin-top: 0; }
.nd-detail-panel[hidden] { display: none; }
#device-detail-panel .device-detail-container {
    margin: 0 0 16px;
}
#device-detail-panel .device-detail-container:has(#device-panel-details.active:not(:has(> :not([hidden])))) {
    display: none;
}
.nd-vmeter-form[hidden], .nd-notes[hidden], .nd-imei-list[hidden] { display: none; }
.nd-anal, .nd-vmeter { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.nd-type-cell .nd-config { margin-top: 0; }
.nd-config[hidden] { display: none !important; }
.history-config-modal { max-width: min(760px, calc(100vw - 24px)); }
.history-config-modal .modal-body { max-height: calc(100vh - 140px); overflow: auto; }
.history-config-modal .billing-card h3 { margin: 0 0 10px; font-size: 14px; }
.history-config-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-bottom: 10px; }
.history-config-row label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: #495057; font-weight: 600; }
.history-config-row .form-input, .history-config-row .form-select { width: 150px; }
.history-config-modal .btn {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 4px;
    border: none;
    font-weight: 600;
    transform: none;
    box-shadow: none;
}
.history-config-modal .btn-primary { background: #007bff; color: #fff; }
.history-config-modal .btn-secondary { background: #6c757d; color: #fff; }
@media (max-width: 1100px) {
    .nd-layout, .nd-grid-2, .nd-find-grid, .nd-find-lookup { grid-template-columns: 1fr; }
    .nd-page-head, .nd-lastseen { align-items: flex-start; flex-direction: column; }
    .nd-find-grid .nd-company-field,
    .nd-find-side {
        display: flex;
        flex-direction: column;
        grid-row: auto;
        grid-template-rows: none;
    }
    .nd-company-field .review-company-cart { height: auto; min-height: 0; }
    #nd-company-tree.review-company-tree,
    .nd-find-side .nd-imei-list {
        flex: none;
        height: 110px;
        max-height: 110px;
    }
}

#billing-tab .billing-detail-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.billing-tree-box { flex: 0 0 300px; max-width: 340px; display: flex; flex-direction: column; min-height: 72vh; }
.billing-detail-box { flex: 1; min-width: 0; }
.billing-tree-box .filter-input {
    width: 100%;
    margin: 0;
    box-sizing: border-box;
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 13px;
    background: #fff;
}
.billing-tree-box .filter-input:focus { outline: none; border-color: #0d7377; box-shadow: 0 0 0 3px rgba(13, 115, 119, 0.15); }
.billing-count { font-size: 12px; color: #667085; margin: 8px 0; }
.billing-tree { overflow: auto; flex: 1; font-size: 13px; margin: 0 -6px; padding-right: 4px; }
.billing-node, .billing-tree > ul { margin: 0; padding: 0; list-style: none; }
.billing-row { display: flex; align-items: center; gap: 2px; border-radius: 6px; }
.billing-row:hover { background: #f7fbfb; }
.billing-toggle, .billing-name {
    border: 0;
    background: transparent;
    cursor: pointer;
    text-align: left;
    font-size: 13px;
    color: #1f2a2e;
}
.billing-toggle { width: 22px; height: 28px; color: #667085; flex: none; }
.billing-name {
    flex: 1;
    display: flex;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
    padding: 5px 6px 5px 2px;
    border-radius: 6px;
}
.billing-name span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.billing-id { color: #98a2b3; font-size: 11px; flex: none; }
.billing-name.selected {
    background: #dff3f4;
    box-shadow: inset 3px 0 0 #0d7377;
    font-weight: 600;
}
.billing-children { margin: 0 0 0 14px; padding: 0; list-style: none; }
.billing-children[hidden], .billing-node[hidden] { display: none; }
.billing-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}
.billing-stat {
    background: #f8fafb;
    border: 1px solid #e4e7ec;
    border-radius: 10px;
    padding: 10px 12px;
}
.billing-stat span { display: block; font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; color: #667085; }
.billing-stat strong { display: block; margin-top: 4px; font-size: 18px; color: #1f2a2e; font-variant-numeric: tabular-nums; }
.billing-stat-vat { background: #e6f3f3; border-color: #9ecbcc; }
.billing-stat-vat strong { color: #0a4f52; }
.billing-card {
    background: #fff;
    border: 1px solid #e4e7ec;
    border-radius: 10px;
    padding: 12px 14px 14px;
    margin-bottom: 12px;
}
.billing-card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }
.billing-card-head h3 { margin: 0; font-size: 14px; color: #1f2a2e; }
.billing-id-pill {
    background: #e6f3f3;
    color: #0a4f52;
    border-radius: 999px;
    padding: 3px 8px;
    font-size: 12px;
    font-weight: 600;
}
.billing-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.billing-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: #495057; font-weight: 600; }
.billing-form input {
    width: 120px;
    box-sizing: border-box;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 13px;
    font-weight: 500;
    background: #fff;
    color: #1f2a2e;
}
.billing-form input:focus { outline: none; border-color: #0d7377; box-shadow: 0 0 0 3px rgba(13, 115, 119, 0.15); }
.billing-form input[readonly] { background: #f8fafb; color: #667085; width: 84px; }
#billing-tab .btn {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 4px;
    border: none;
    font-weight: 600;
    white-space: nowrap;
    transform: none;
    box-shadow: none;
}
#billing-tab .btn-primary { background: #007bff; color: #fff; }
#billing-tab .btn-primary:hover { background: #0056b3; }
#billing-tab .btn-info { background: #17a2b8; color: #fff; }
#billing-tab .btn-info:hover { background: #117a8b; }
.billing-message { min-height: 18px; margin-top: 8px; font-size: 12px; color: #667085; }
.billing-message.is-ok { color: #1e7e34; }
.billing-message.is-error { color: #dc3545; white-space: pre-line; }
.billing-scroll { overflow: auto; border: 1px solid #eef2f6; border-radius: 8px; }
.billing-scroll-tall { max-height: 52vh; }
.billing-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.billing-table th, .billing-table td { text-align: left; padding: 7px 8px; border-bottom: 1px solid #eef2f6; white-space: nowrap; }
.billing-table th {
    position: sticky;
    top: 0;
    background: #f8fafb;
    color: #667085;
    font-size: 11px;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    z-index: 1;
}
.billing-table td.num, .billing-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.billing-table tbody tr:hover td { background: #f7fbfb; }
.billing-table .billing-open td { background: #f3fafb; }
.billing-open-label { color: #0d7377; font-weight: 700; }
.billing-charged td { background: #fff; }
.billing-zero td { color: #98a2b3; }
.billing-table tfoot td {
    position: sticky;
    bottom: 0;
    background: #e6f3f3;
    color: #0a4f52;
    font-weight: 700;
}
#billing-detail > .nd-empty { margin-top: 8px; }
.billing-account-modal { max-width: min(920px, calc(100vw - 24px)); }
.billing-account-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 16px; align-items: start; }
.billing-account-list { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
#billing-account-list {
    max-height: 62vh;
    overflow: auto;
    border: 1px solid #e4e7ec;
    border-radius: 8px;
    background: #f8fafb;
}
.billing-account-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    width: 100%;
    border: 0;
    border-bottom: 1px solid #eef2f6;
    background: transparent;
    text-align: left;
    padding: 8px 10px;
    cursor: pointer;
    color: #1f2a2e;
}
.billing-account-item span { color: #667085; font-size: 12px; }
.billing-account-item.selected, .billing-account-item:hover { background: #e6f3f3; }
.ba-suggest-wrap { position: relative; }
.ba-check { min-height: 0; color: #dc3545; font-size: 12px; font-weight: 500; }
.ba-check:empty { display: none; }
.ba-assign { display: flex; align-items: center; gap: 8px; margin: 4px 0 8px; font-size: 13px; color: #1f2a2e; }
.ba-assign[hidden] { display: none; }
.ba-actions { display: flex; justify-content: flex-end; gap: 8px; }
.billing-account-modal .btn {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 4px;
    border: none;
    font-weight: 600;
    transform: none;
    box-shadow: none;
}
.billing-account-modal .btn-primary { background: #007bff; color: #fff; }
.billing-account-modal .btn-secondary { background: #6c757d; color: #fff; }
.billing-account-modal .form-group { margin-bottom: 8px; }
.review-page { align-items: stretch; gap: 16px; }
.review-pick-box { flex: 0 0 320px; display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.review-company-cart {
    margin: 0 0 4px;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(13, 115, 119, 0.1);
    border: 1px solid rgba(13, 115, 119, 0.22);
}
.review-company-search {
    width: 100%;
    margin-bottom: 8px;
    border: 1px solid rgba(13, 115, 119, 0.22);
    background: #fff;
    color: #243033;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 12px;
}
.review-company-search:focus {
    outline: none;
    border-color: #0d7377;
    box-shadow: 0 0 0 3px rgba(13, 115, 119, 0.15);
}
.review-company-count { margin: 0 0 6px; font-size: 11px; color: #5c6b70; }
.review-company-tree {
    max-height: min(42vh, 420px);
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-right: 2px;
}
.review-tree-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.review-tree-row:hover { border-color: #0d7377; }
.review-tree-row.is-selected {
    border-color: #0d7377;
    box-shadow: 0 0 0 2px rgba(13, 115, 119, 0.2);
}
.review-tree-row.is-match { background: #fff8e1; border-color: #ffc107; }
.review-tree-expand {
    width: 18px;
    min-width: 18px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #0d7377;
    font-weight: 700;
    cursor: pointer;
    line-height: 1;
}
.review-tree-expand.is-leaf { color: #adb5bd; cursor: default; text-align: center; }
.review-tree-row { cursor: pointer; }
.review-tree-name {
    flex: 1;
    min-width: 0;
    font-weight: 600;
    font-size: 13px;
    color: #2c3e50;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.review-tree-id {
    font-size: 11px;
    color: #6c757d;
    background: #fff;
    padding: 2px 6px;
    border-radius: 12px;
    border: 1px solid #dee2e6;
    white-space: nowrap;
}
.review-tree-children { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.review-tree-empty { padding: 8px; color: #5c6b70; font-size: 12px; }
.review-pick-box .btn { width: 100%; }
.review-result-box { flex: 1; min-width: 0; }
.review-working {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 12px;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid #e3e8e8;
    border-radius: 8px;
    color: #243033;
    font-size: 13px;
}
.review-working[hidden] { display: none; }
.review-working img { width: 32px; height: 32px; display: block; }
.review-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.review-summary div { background: #fff; border: 1px solid #e3e8e8; border-left: 3px solid #0d7377; border-radius: 8px; padding: 8px 12px; }
.review-summary div.is-high { border-left-color: #b42318; }
.review-summary div.is-low { border-left-color: #0d7377; }
.review-summary span { display: block; font-size: 11px; letter-spacing: 0.02em; text-transform: uppercase; color: #5c6b70; }
.review-summary strong { font-size: 18px; }
.review-summary p { grid-column: 1 / -1; margin: 0; color: #5c6b70; font-size: 12px; }
.review-options { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 4px 0; }
.review-options label { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: #5c6b70; }
.review-options label:first-child, .review-options label:nth-child(2) { grid-column: 1 / -1; }
.review-options input, .review-options select { width: 100%; height: 30px; border: 1px solid #d5dddd; border-radius: 6px; background: #fff; padding: 0 6px; }
.review-open-days { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: #5c6b70; }
.review-day-pills { display: flex; gap: 4px; }
.review-day-pills button { flex: 1; height: 28px; padding: 0; border: 1px solid #d5dddd; border-radius: 6px; background: #fff; color: #243033; font-size: 11px; cursor: pointer; }
.review-day-pills button.is-on { background: #0d7377; border-color: #0d7377; color: #fff; }
.review-focus[hidden], .review-heatmap[hidden], .review-charts section[hidden] { display: none; }
.review-focus { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 14px 0 8px; }
.review-focus strong { font-size: 16px; }
.review-focus span { color: #5c6b70; font-size: 13px; }
.review-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.review-charts section { background: #fff; border: 1px solid #e3e8e8; border-radius: 8px; padding: 10px 12px 4px; }
.review-charts section.is-wide { grid-column: 1 / -1; }
.review-charts h5, .review-heatmap h5, .review-insights h4, .review-insights h5 { margin: 0 0 6px; font-size: 13px; color: #243033; }
.review-chart-wrap { height: 200px; }
.review-charts section.is-wide .review-chart-wrap { height: 260px; }
.review-heatmap { margin: 12px 0; overflow-x: auto; background: #fff; border: 1px solid #e3e8e8; border-radius: 8px; padding: 10px 12px; }
.review-holiday-note { margin: 0 0 8px; font-size: 12px; color: #4a5c5e; }
.review-heat-grid { display: grid; grid-template-columns: 36px repeat(24, minmax(16px, 1fr)); gap: 3px; min-width: 560px; }
.review-heat-grid span { height: 18px; border-radius: 3px; font-size: 10px; line-height: 18px; color: #667; }
.review-heat-grid .is-hour { text-align: center; }
.review-heat-grid span.is-closed { box-shadow: inset 0 0 0 1px rgba(180, 35, 24, 0.55); }
.review-cal { display: grid; grid-template-columns: 28px repeat(var(--days, 21), minmax(10px, 1fr)); gap: 2px; min-width: calc(28px + var(--days, 21) * 14px); margin: 0 0 16px; }
.review-cal span { height: 12px; border-radius: 2px; font-size: 9px; line-height: 12px; color: #667; }
.review-cal .is-label { background: transparent; text-align: center; }
.review-cal .is-hour { text-align: right; padding-right: 3px; }
.review-cal .is-weekend { color: #b42318; font-weight: 600; }
.review-cal .is-month { box-shadow: -2px 0 0 #0d7377; }
.review-cal .is-empty { background: #f3f6f6; }
.review-cal .is-closed { box-shadow: inset 0 0 0 1px rgba(180, 35, 24, 0.55); }
.review-cal .is-peak { outline: 1px solid #c47b00; outline-offset: -1px; }
.review-stat-group { margin: 10px 0 16px; }
.review-stat-group h6 { margin: 0 0 6px; font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: #4a5c5e; }
.review-stat-group > p { margin: 0; font-size: 12px; color: #5c6b70; }
.review-stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.review-stat { background: #fff; border: 1px solid #e3e8e8; border-left-width: 3px; border-radius: 6px; padding: 8px 10px; }
.review-stat.is-mean { border-left-color: #0d7377; }
.review-stat.is-total { border-left-color: #6f42c1; }
.review-stat.is-peak { border-left-color: #c47b00; }
.review-stat.is-quiet { border-left-color: #3b7ddd; }
.review-stat.is-range { border-left-color: #8aa0a4; }
.review-stat.is-ratio { border-left-color: #4a5c5e; }
.review-stat-label { font-size: 10px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: #7b8b8e; }
.review-stat-value { margin-top: 2px; font-size: 13px; font-weight: 650; color: #243033; line-height: 1.3; }
.review-stat-sub { margin-top: 2px; font-size: 11px; color: #5c6b70; }
@media (max-width: 1100px) { .review-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.review-insights { margin: 12px 0; }
.review-insight-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; margin-bottom: 12px; }
.review-insight-grid .review-savings-box { grid-column: 1 / -1; }
.review-savings-box .is-total { margin-top: 4px; padding-top: 8px; border-top: 1px solid #d5dddd; font-weight: 600; }
.review-savings-box .is-total strong { color: #0d7377; }
.review-savings-box li strong { display: inline-flex; align-items: center; gap: 8px; }
.review-savings-box li span small { display: block; margin-top: 2px; color: #5c6b70; font-size: 11px; font-weight: 400; }
.review-saving-toggle { width: 22px; height: 22px; padding: 0; border: 1px solid #d5dddd; border-radius: 4px; background: #fff; color: #243033; font-size: 16px; line-height: 1; cursor: pointer; }
.review-savings-box .is-out { color: #8a979b; }
.review-savings-box .is-out strong { color: #8a979b; font-weight: 500; }
.review-insights section, .review-opps { background: #fff; border: 1px solid #e3e8e8; border-radius: 8px; padding: 10px 12px; }
.review-insights .review-price { font-size: 18px; margin: 0 0 6px; }
.review-insights p { margin: 0 0 8px; color: #4a5c5e; font-size: 12px; line-height: 1.4; }
.review-insights ul { list-style: none; margin: 0; padding: 0; }
.review-insights li { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; font-size: 13px; border-bottom: 1px solid #f0f3f3; }
.review-insights li:last-child { border-bottom: none; }
.review-opps li { display: block; }
.review-opps em { float: right; font-style: normal; font-weight: 600; color: #0d7377; }
.review-opps p { margin: 4px 0 0; color: #5c6b70; font-size: 12px; clear: both; }
.review-meters { margin-bottom: 4px; background: #fff; border: 1px solid #e3e8e8; border-radius: 8px; max-height: 121px; overflow: auto; }
.review-meters table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.review-meters th, .review-meters td { text-align: left; padding: 7px 10px; border-bottom: 1px solid #eef2f2; }
.review-meters th { position: sticky; top: 0; z-index: 2; background: #f7fafa; font-size: 11px; text-transform: uppercase; letter-spacing: 0.02em; color: #5c6b70; }
.review-meters td.is-num, .review-meters th.is-num { text-align: right; font-variant-numeric: tabular-nums; }
.review-meters tr { cursor: pointer; }
.review-meters tbody tr:hover { background: #f4fafa; }
.review-meters tr.is-selected { background: #e7f4f4; box-shadow: inset 3px 0 0 #0d7377; }
.review-meters tr.is-skipped { color: #8a979b; cursor: default; }
.floor-plan-page .review-company-tree,
.overview-page .review-company-tree,
.users-page .review-company-tree,
.billing-page .review-company-tree,
.info-page .review-company-tree { max-height: min(70vh, 720px); }
.info-page .info-results-section { background: transparent; border: 0; padding: 0; margin: 0; }
.info-page .info-tab-btn.active { background: #0d7377; border-color: #0d7377; color: #fff; }
.info-page .review-company-cart .btn { margin-top: 0; }
.overview-page .overview-quick-picks { margin-top: 8px; }
.overview-page .overview-filter-hint { margin-top: 8px; }
.floor-empty {
    margin-top: 12px;
    padding: 28px 16px;
    text-align: center;
    color: #5c6b70;
    background: #f7fafa;
    border: 1px dashed #d5dddd;
    border-radius: 8px;
}
.floor-empty strong { color: #243033; }
.floor-empty p, .floor-caption, .floor-note { margin: 6px 0 0; font-size: 13px; color: #5c6b70; }
.floor-foot { margin-top: 14px; padding-top: 8px; border-top: 1px solid #e3e8e8; text-align: center; }
.floor-foot .floor-caption, .floor-foot .floor-note { margin: 0; text-align: center; line-height: 1.35; }
.floor-foot .floor-caption:empty { display: none; }
.floor-foot .floor-caption:not(:empty) + .floor-note { margin-top: 2px; }
.floor-stage[hidden], .floor-empty[hidden] { display: none; }
.floor-setup { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; min-width: 0; }
.floor-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid #e3e8e8; border-radius: 8px; background: #fff; flex: 0 1 auto; }
.floor-setup button, .floor-scale-control button { height: 32px; margin: 0; padding: 0 12px; border: 1px solid #d5dddd; border-radius: 6px; background: #fff; color: #243033; font-size: 13px; font-weight: 600; line-height: 30px; cursor: pointer; }
.floor-setup button:disabled, .floor-tools button:disabled { opacity: 0.45; cursor: default; }
.floor-setup .btn-primary, #floor-save { background: #0d7377; border-color: #0d7377; color: #fff; }
#floor-save.is-dirty { background: #c47b00; border-color: #c47b00; }
.floor-show { display: flex; gap: 8px; }
.floor-show button.is-on { background: #0d7377; border-color: #0d7377; color: #fff; }
.floor-scale-control { display: flex; align-items: center; gap: 6px; font-size: 13px; color: #243033; }
.floor-scale-control input[type="number"] { width: 56px; height: 32px; border: 1px solid #d5dddd; border-radius: 6px; padding: 0 6px; font-size: 13px; }
.floor-work { display: flex; gap: 10px; align-items: stretch; margin-top: 10px; }
.floor-side { flex: 0 0 240px; width: 240px; display: flex; flex-direction: column; gap: 8px; max-height: min(70vh, 720px); min-height: 0; }
.floor-meters { flex: 1; min-height: 0; display: flex; flex-direction: column; margin-top: 0; }
.floor-meters h5 { margin: 0 0 6px; font-size: 13px; color: #243033; }
.floor-meter-search { width: 100%; height: 28px; margin: 0 0 6px; border: 1px solid #d5dddd; border-radius: 6px; padding: 0 8px; font-size: 12px; box-sizing: border-box; }
.floor-meter-filters { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.floor-meter-filters button { height: 24px; padding: 0 6px; border: 1px solid #d5dddd; border-radius: 6px; background: #fff; color: #243033; font-size: 11px; cursor: pointer; }
.floor-meter-filters button.is-on { background: #0d7377; border-color: #0d7377; color: #fff; }
.floor-meter-list { list-style: none; margin: 0; padding: 0; flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; border: 1px solid #e3e8e8; border-radius: 8px; background: #fff; }
.floor-meter-list.is-holding { overflow: hidden; }
.floor-meter-list li { display: flex; align-items: center; gap: 6px; padding: 3px 8px; border-bottom: 1px solid #eef2f2; font-size: 12px; cursor: grab; user-select: none; touch-action: none; }
.floor-meter-list .floor-meter-icon,
.floor-meter-list .floor-meter-icon svg { width: 20px; height: 20px; }
.floor-meter-list li:last-child { border-bottom: 0; }
.floor-meter-list li:hover { background: #f4fbfb; }
.floor-meter-list li.is-armed { background: #e7f6f6; }
.floor-meter-list li.is-selected { background: #fff6e8; }
.floor-meter-list li.is-placed .floor-meter-name::after { content: " · on plan"; font-weight: 500; color: #0d7377; }
.floor-meter-icon { width: 28px; height: 28px; flex: none; cursor: grab; touch-action: none; }
.floor-meter-icon svg { width: 28px; height: 28px; display: block; pointer-events: none; }
.floor-meter-list li.is-dragging { opacity: 0.45; }
.floor-meter-list li.is-dragging .floor-meter-icon { cursor: grabbing; }
.floor-svg.is-drop { box-shadow: inset 0 0 0 2px #0d7377; }
.floor-meter-ghost { position: fixed; z-index: 80; display: flex; align-items: center; gap: 6px; padding: 4px 8px 4px 4px; background: #fff; border: 1px solid #0d7377; border-radius: 8px; box-shadow: 0 6px 16px rgba(36,48,51,0.16); pointer-events: none; transform: translate(-14px, -14px); font-size: 13px; font-weight: 600; color: #243033; }
.floor-meter-ghost[hidden] { display: none; }
.floor-meter-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.floor-meter-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; color: #243033; }
.floor-meter-meta { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #5c6b70; font-size: 11px; }
.floor-props .floor-meter-card { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #243033; line-height: 1.3; }
.floor-props .floor-meter-card .floor-meter-icon,
.floor-props .floor-meter-card .floor-meter-icon svg { width: 28px; height: 28px; }
.floor-meter-empty { color: #5c6b70; }
.floor-tools { display: flex; flex-direction: column; align-items: stretch; gap: 4px; margin-top: 0; }
.floor-tool-row { display: flex; gap: 4px; }
.floor-tool-row button { flex: 1; min-width: 0; text-align: center; }
.floor-tools button { height: 30px; padding: 0 10px; border: 1px solid #d5dddd; border-radius: 6px; background: #fff; color: #243033; cursor: pointer; text-align: left; }
.floor-edit { display: flex; gap: 4px; width: 100%; }
.floor-edit button { flex: 1; padding: 0 2px; text-align: center; font-size: 12px; }
.floor-preset { display: flex; align-items: center; gap: 6px; font-size: 13px; color: #243033; }
.floor-preset select { height: 32px; border: 1px solid #d5dddd; border-radius: 6px; background: #fff; padding: 0 8px; font-size: 13px; }
.floor-scale { width: 88px; height: 16px; margin: 0; accent-color: #0d7377; }
.floor-slider { position: relative; display: flex; align-items: flex-end; justify-content: center; width: 88px; height: 32px; min-width: 88px; cursor: pointer; }
.floor-slider-title { position: absolute; top: 0; left: 0; right: 0; text-align: center; font-size: 11px; font-weight: 700; color: #243033; line-height: 1; pointer-events: none; }
.floor-preset #floor-scale-label { min-width: 40px; color: #5c6b70; }
.floor-levels { display: flex; gap: 4px; }
.floor-levels[hidden] { display: none; }
.floor-tools button.is-on { background: #0d7377; border-color: #0d7377; color: #fff; }
#floor-advanced { width: 100%; text-align: center; }
.floor-advanced { display: flex; flex-direction: column; align-items: stretch; gap: 4px; }
.floor-advanced[hidden] { display: none; }
.floor-tool-row select { flex: 1; min-width: 0; height: 30px; border: 1px solid #d5dddd; border-radius: 6px; background: #fff; font-size: 12px; }
.floor-layers, .floor-sheet { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; font-size: 11px; color: #243033; }
.floor-layers label { display: flex; align-items: center; gap: 4px; }
.floor-sheet input[type="text"], .floor-sheet input[type="number"] { height: 28px; border: 1px solid #d5dddd; border-radius: 6px; padding: 0 6px; font-size: 12px; }
.floor-sheet input[type="text"] { flex: 1 1 90px; min-width: 0; }
.floor-sheet input[type="number"] { width: 58px; }
.floor-sheet button, .floor-edit button { font-size: 11px; }
.floor-print-note { display: none; align-items: center; gap: 8px; margin-top: 10px; font-size: 13px; font-weight: 700; color: #243033; }
.floor-stage.is-print .floor-print-note { display: flex; }
.floor-stage.is-print .floor-setup,
.floor-stage.is-print .floor-side,
.floor-stage.is-print .floor-foot { display: none; }
.floor-sheet select { height: 28px; border: 1px solid #d5dddd; border-radius: 6px; background: #fff; font-size: 12px; }
.floor-schedule { max-height: 120px; overflow: auto; border: 1px solid #e3e8e8; border-radius: 6px; background: #fff; padding: 6px 8px; font-size: 11px; color: #243033; }
.floor-schedule p { margin: 0 0 4px; }
.floor-props .floor-align-row { display: flex; flex-wrap: wrap; gap: 4px; }
.floor-props .floor-align-row button { height: 26px; padding: 0 6px; border: 1px solid #d5dddd; border-radius: 6px; background: #fff; font-size: 11px; cursor: pointer; }
.floor-props { display: flex; flex-wrap: nowrap; align-items: flex-end; gap: 10px; min-width: 0; margin-top: 8px; height: 52px; min-height: 52px; max-height: 52px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.floor-props::-webkit-scrollbar { display: none; height: 0; }
.floor-status-row { display: flex; align-items: center; justify-content: center; height: 22px; min-height: 22px; max-height: 22px; overflow: hidden; }
.floor-status { flex: 0 1 auto; align-self: center; min-width: 0; max-width: 100%; margin: 0; padding: 0 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; font-size: 12px; line-height: 1; color: #5c6b70; }
.floor-props button { flex: 0 0 auto; height: 30px; padding: 0 10px; border: 1px solid #d5dddd; border-radius: 6px; background: #fff; color: #243033; cursor: pointer; font-size: 13px; }
#floor-upstream.is-on { background: #6d28d9; border-color: #6d28d9; color: #fff; }
#floor-downstream.is-on { background: #067647; border-color: #067647; color: #fff; }
.floor-props label { flex: 0 0 auto; display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: #5c6b70; white-space: nowrap; }
.floor-props input { height: 30px; width: 120px; border: 1px solid #d5dddd; border-radius: 6px; padding: 0 8px; }
.floor-props select { height: 30px; max-width: 180px; border: 1px solid #d5dddd; border-radius: 6px; padding: 0 6px; background: #fff; font-size: 13px; }
.floor-scroll { flex: 1; min-width: 0; margin-top: 0; overflow: auto; max-height: min(70vh, 720px); border: 1px solid #e3e8e8; border-radius: 8px; background: #f4f7f7; }
.floor-svg { display: block; touch-action: none; background:
    linear-gradient(to right, rgba(13,115,119,0.08) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(13,115,119,0.08) 1px, transparent 1px);
    background-size: 40px 40px; }
@media (max-width: 1100px) {
    .billing-page, .review-page { flex-direction: column; }
    .review-pick-box { flex: none; }
    .review-summary { grid-template-columns: 1fr 1fr; }
    .review-charts { grid-template-columns: 1fr; }
    .billing-tree-box { flex: none; max-width: none; min-height: 280px; }
    .billing-stats { grid-template-columns: 1fr 1fr; }
    .billing-account-layout { grid-template-columns: 1fr; }
    #billing-account-list { max-height: 180px; }
}
.floor-company-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.floor-company-heading button { height: 28px; padding: 0 10px; border: 1px solid #d5dddd; border-radius: 6px; background: #fff; color: #243033; cursor: pointer; font-size: 12px; font-weight: 600; }
.floor-plan-page.is-companies-closed .review-pick-box,
.overview-page.is-companies-closed .review-pick-box,
.users-page.is-companies-closed .review-pick-box,
.review-energy-page.is-companies-closed .review-pick-box,
.billing-page.is-companies-closed .review-pick-box,
.info-page.is-companies-closed .review-pick-box { flex: 0 0 44px; width: 44px; min-width: 44px; padding: 8px 4px; overflow: hidden; }
.floor-plan-page.is-companies-closed .review-company-cart,
.overview-page.is-companies-closed .review-company-cart,
.users-page.is-companies-closed .review-company-cart,
.review-energy-page.is-companies-closed .review-company-cart,
.billing-page.is-companies-closed .review-company-cart,
.info-page.is-companies-closed .review-company-cart,
.review-energy-page.is-companies-closed .review-options,
.review-energy-page.is-companies-closed .review-pick-box > .btn,
.review-energy-page.is-companies-closed #review-status,
.overview-page.is-companies-closed .overview-quick-picks,
.overview-page.is-companies-closed .overview-filter-hint { display: none; }
.floor-plan-page.is-companies-closed .floor-company-heading,
.overview-page.is-companies-closed .floor-company-heading,
.users-page.is-companies-closed .floor-company-heading,
.review-energy-page.is-companies-closed .floor-company-heading,
.billing-page.is-companies-closed .floor-company-heading,
.info-page.is-companies-closed .floor-company-heading { flex-direction: column; justify-content: flex-start; height: min(70vh, 720px); margin: 0; padding: 8px 0; }
.floor-plan-page.is-companies-closed .floor-company-heading span,
.overview-page.is-companies-closed .floor-company-heading span,
.users-page.is-companies-closed .floor-company-heading span,
.review-energy-page.is-companies-closed .floor-company-heading span,
.billing-page.is-companies-closed .floor-company-heading span,
.info-page.is-companies-closed .floor-company-heading span { writing-mode: vertical-rl; transform: rotate(180deg); font-size: 13px; letter-spacing: 0.04em; }
@media (max-width: 1100px) {
    .floor-plan-page.is-companies-closed .review-pick-box,
    .overview-page.is-companies-closed .review-pick-box,
    .users-page.is-companies-closed .review-pick-box,
    .review-energy-page.is-companies-closed .review-pick-box,
    .billing-page.is-companies-closed .review-pick-box,
    .info-page.is-companies-closed .review-pick-box { width: 100%; height: 44px; max-height: 44px; min-width: 0; }
    .floor-plan-page.is-companies-closed .floor-company-heading,
    .overview-page.is-companies-closed .floor-company-heading,
    .users-page.is-companies-closed .floor-company-heading,
    .review-energy-page.is-companies-closed .floor-company-heading,
    .billing-page.is-companies-closed .floor-company-heading,
    .info-page.is-companies-closed .floor-company-heading { flex-direction: row; height: auto; padding: 0; }
    .floor-plan-page.is-companies-closed .floor-company-heading span,
    .overview-page.is-companies-closed .floor-company-heading span,
    .users-page.is-companies-closed .floor-company-heading span,
    .review-energy-page.is-companies-closed .floor-company-heading span,
    .billing-page.is-companies-closed .floor-company-heading span,
    .info-page.is-companies-closed .floor-company-heading span { writing-mode: horizontal-tb; transform: none; }
    .floor-status-row { justify-content: center; }
    .floor-work { flex-direction: column; }
    .floor-side { flex: none; width: 100%; max-height: none; }
    .floor-tools { flex-direction: row; flex-wrap: wrap; }
    .floor-advanced { flex: 1 1 100%; }
    .floor-tools button { width: auto; }
    .floor-meter-list { max-height: 220px; flex: none; }
}