/* ========================================
   TEST EQUIPMENT MATRIX - STYLES
   ======================================== */

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #0a0a12;
    background-image: 
        radial-gradient(ellipse at 10% 20%, rgba(0, 212, 255, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 90% 80%, rgba(139, 92, 246, 0.08) 0%, transparent 50%);
    min-height: 100vh;
    padding: 20px;
    color: #e0e0e0;
}

.container {
    max-width: 100%;
}

/* === HEADER === */
.matrix-header {
    background: linear-gradient(135deg, rgba(15, 52, 96, 0.9) 0%, rgba(26, 26, 64, 0.9) 100%);
    border-radius: 0;
    padding: 24px 30px;
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-top: none;
    border-bottom: none;
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.matrix-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #00d4ff, #8b5cf6, #00d4ff);
    background-size: 200% 100%;
    animation: shimmer 3s linear infinite;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 15px;
}

.header-title {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.header-title .field-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.header-title input {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 8px;
    padding: 12px 16px;
    color: #fff;
    font-size: 14px;
    transition: all 0.3s;
}

.header-title input:focus {
    outline: none;
    border-color: #00d4ff;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.4), inset 0 0 10px rgba(0, 212, 255, 0.1);
}

.header-title input::placeholder {
    color: #666;
}

.header-title label {
    color: #00d4ff;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.main-title {
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    text-align: center;
    margin-top: 15px;
    text-shadow: 0 0 30px rgba(0, 212, 255, 0.5);
    letter-spacing: 2px;
}

/* === HEADER ACTIONS === */
.header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.action-btn {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 8px;
    padding: 10px 16px;
    color: #00d4ff;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.action-btn:hover {
    background: rgba(0, 212, 255, 0.15);
    border-color: #00d4ff;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
}

.action-btn svg {
    width: 16px;
    height: 16px;
}

.action-btn.save-btn {
    border-color: rgba(16, 185, 129, 0.5);
    color: #10b981;
    font-weight: 700;
}

.action-btn.save-btn:hover {
    background: rgba(16, 185, 129, 0.15);
    border-color: #10b981;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
}

.action-btn.freeze-btn {
    border-color: rgba(255, 193, 7, 0.5);
    color: #ffc107;
}

.action-btn.freeze-btn:hover {
    background: rgba(255, 193, 7, 0.15);
    border-color: #ffc107;
    box-shadow: 0 0 20px rgba(255, 193, 7, 0.3);
}

.action-btn.freeze-btn.active {
    background: rgba(255, 193, 7, 0.25);
    border-color: #ffc107;
    box-shadow: 0 0 15px rgba(255, 193, 7, 0.4);
}

.action-btn.import-project {
    border-color: rgba(139, 92, 246, 0.5);
    color: #8b5cf6;
}

.action-btn.import-project:hover {
    background: rgba(139, 92, 246, 0.15);
    border-color: #8b5cf6;
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.3);
}

.action-btn.export-project {
    border-color: rgba(16, 185, 129, 0.5);
    color: #10b981;
}

.action-btn.export-project:hover {
    background: rgba(16, 185, 129, 0.15);
    border-color: #10b981;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
}

.refresh-btn:hover svg {
    animation: spin 0.5s ease;
}

.action-btn.reset-btn {
    border-color: rgba(239, 68, 68, 0.4);
    color: #ef4444;
}

.action-btn.reset-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: #ef4444;
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.3);
}

/* === EXPORT FORMAT CHOICES === */
.export-format-choices {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.format-choice-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 20px 16px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.25s;
    color: #ccd;
}

.format-choice-btn:hover {
    background: rgba(0, 212, 255, 0.1);
    border-color: #00d4ff;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.2);
    transform: translateY(-2px);
}

.format-choice-btn.primary-choice {
    border-color: rgba(0, 212, 255, 0.4);
    background: rgba(0, 212, 255, 0.06);
    box-shadow: 0 0 12px rgba(0, 212, 255, 0.1);
}

.format-choice-btn.primary-choice:hover {
    background: rgba(0, 212, 255, 0.15);
    box-shadow: 0 0 24px rgba(0, 212, 255, 0.25);
}

.format-icon {
    font-size: 24px;
    color: #00d4ff;
}

.format-label {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
}

.format-desc {
    font-size: 10px;
    color: #778;
    text-align: center;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* === MATRIX TABLE === */
.matrix-wrapper {
    background: rgba(20, 20, 35, 0.95);
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 0 0 16px 16px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(0, 212, 255, 0.1);
}

.table-scroll {
    overflow: auto;
    max-height: calc(100vh - 180px);
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 212, 255, 0.3) rgba(20, 20, 35, 0.5);
}
.table-scroll::-webkit-scrollbar { width: 10px; height: 12px; }
.table-scroll::-webkit-scrollbar-track { background: rgba(20, 20, 35, 0.5); }
.table-scroll::-webkit-scrollbar-thumb { background: rgba(0, 212, 255, 0.3); border-radius: 6px; border: 2px solid rgba(20, 20, 35, 0.5); }
.table-scroll::-webkit-scrollbar-thumb:hover { background: rgba(0, 212, 255, 0.5); }
.table-scroll::-webkit-scrollbar-corner { background: rgba(20, 20, 35, 0.5); }

/* When in freeze mode, ensure proper scrollbar positioning */
.table-scroll.freeze-mode {
    /* The scrollbar will still start at 0, but content scrolls properly under frozen cols */
}

.matrix-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: max-content;
}

.matrix-table th,
.matrix-table td {
    border-right: 1px solid rgba(58, 58, 92, 0.6);
    border-bottom: 1px solid rgba(58, 58, 92, 0.6);
    padding: 8px 10px;
    text-align: left;
    vertical-align: middle;
}

/* First column gets left border */
.matrix-table th:first-child,
.matrix-table td:first-child {
    border-left: 1px solid rgba(58, 58, 92, 0.6);
}

/* Top row gets top border */
.matrix-table thead tr:first-child th {
    border-top: 1px solid rgba(58, 58, 92, 0.6);
}

.matrix-table th {
    background: linear-gradient(180deg, #1a1a3a 0%, #151530 100%);
    color: #00d4ff;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    position: sticky;
    z-index: 10;
}
/* Main header row sticks at top */
.matrix-table thead tr:first-child th { top: 0; z-index: 10; }
/* Filter row sticks below the main header */
.matrix-table thead tr.filter-header-row th { top: 36px; z-index: 10; background: #151530; }
/* Frozen header cells always on top of everything */
.freeze-mode thead tr:first-child th.col-freeze { z-index: 35; }
.freeze-mode thead tr.filter-header-row th.col-freeze { z-index: 34; }

/* === GROUP BY ACTIVITY === */
.action-btn.group-btn {
    border-color: rgba(16, 185, 129, 0.5);
    color: #10b981;
}

.action-btn.group-btn:hover {
    background: rgba(16, 185, 129, 0.15);
    border-color: #10b981;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
}

/* Type-group dividers — visible vertical line between different activity groups */
.type-group-first {
    border-left: 3px solid rgba(255, 255, 255, 0.18) !important;
}

th.type-group-first {
    border-left: 3px solid rgba(255, 255, 255, 0.25) !important;
}

/* === COLUMN ARROW BUTTONS === */
.col-arrows {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
}

.col-arrow-btn {
    width: 18px;
    height: 18px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
    color: #667;
    font-size: 9px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.15s;
}

.col-arrow-btn:hover {
    background: rgba(0, 212, 255, 0.2);
    border-color: #00d4ff;
    color: #00d4ff;
    box-shadow: 0 0 8px rgba(0, 212, 255, 0.3);
}

/* Flash red on invalid move attempt */
.test-column.col-invalid {
    animation: colInvalidFlash 0.4s ease;
}

@keyframes colInvalidFlash {
    0%, 100% { box-shadow: none; }
    50% { box-shadow: inset 0 0 20px rgba(239, 68, 68, 0.3); }
}

/* === COLUMN WIDTHS === */
.col-delete { width: 40px; min-width: 40px; max-width: 40px; text-align: center; }
.col-item { width: 70px; min-width: 50px; }
.col-desc { width: 220px; min-width: 100px; }
.col-partno { width: 80px; min-width: 60px; }
.col-qty { width: 50px; min-width: 40px; text-align: center; }
.col-workpack { width: 80px; min-width: 60px; }
.col-stakeholder { width: 95px; min-width: 70px; }
.col-melqty { width: 60px; min-width: 45px; text-align: center; }

/* === COLUMN RESIZING === */
.matrix-table th {
    position: relative;
}

.resize-handle {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 5px;
    cursor: col-resize;
    background: transparent;
    z-index: 30;
    transition: background 0.2s;
}

.resize-handle:hover,
.resize-handle.resizing {
    background: linear-gradient(180deg, #00d4ff, #8b5cf6);
}

.matrix-table.resizing {
    cursor: col-resize;
    user-select: none;
}

.matrix-table.resizing * {
    cursor: col-resize !important;
}

/* === FREEZE MODE === */
.freeze-mode {
    position: relative;
}

/* All frozen columns - both th and td */
.freeze-mode .col-freeze {
    position: sticky;
    z-index: 20;
    background: #151530 !important;
    /* Extend background 1px left to cover border of cell behind */
    background-clip: padding-box;
}

/* Frozen column positions — pixel-perfect with no gaps */
.freeze-mode .col-freeze-0 { left: 0; z-index: 26; }
.freeze-mode .col-freeze-1 { left: var(--col-0-width, 40px); z-index: 25; }
.freeze-mode .col-freeze-2 { left: calc(var(--col-0-width, 40px) + var(--col-1-width, 70px)); z-index: 24; }
.freeze-mode .col-freeze-3 { left: calc(var(--col-0-width, 40px) + var(--col-1-width, 70px) + var(--col-2-width, 220px)); z-index: 23; }
.freeze-mode .col-freeze-4 { left: calc(var(--col-0-width, 40px) + var(--col-1-width, 70px) + var(--col-2-width, 220px) + var(--col-3-width, 80px)); z-index: 22; }
.freeze-mode .col-freeze-5 { left: calc(var(--col-0-width, 40px) + var(--col-1-width, 70px) + var(--col-2-width, 220px) + var(--col-3-width, 80px) + var(--col-4-width, 60px)); z-index: 21; }
.freeze-mode .col-freeze-6 { left: calc(var(--col-0-width, 40px) + var(--col-1-width, 70px) + var(--col-2-width, 220px) + var(--col-3-width, 80px) + var(--col-4-width, 60px) + var(--col-5-width, 50px)); z-index: 20; }
.freeze-mode .col-freeze-7 { left: calc(var(--col-0-width, 40px) + var(--col-1-width, 70px) + var(--col-2-width, 220px) + var(--col-3-width, 80px) + var(--col-4-width, 60px) + var(--col-5-width, 50px) + var(--col-6-width, 80px)); z-index: 19; }

/* Header frozen cells - highest z-index so they win over everything */
.freeze-mode th.col-freeze {
    z-index: 30;
    background: #1a1a3a !important;
}

/* Data row frozen cells - solid opaque background matching row color */
.freeze-mode .data-row .col-freeze {
    background: #151530 !important;
}
.freeze-mode .data-row:nth-child(even) .col-freeze {
    background: #171730 !important;
}
.freeze-mode .data-row:hover .col-freeze {
    background: #1a2535 !important;
}

/* Section header frozen cells */
.freeze-mode .section-header .col-freeze {
    z-index: 28;
    background: #1a2535 !important;
}
.freeze-mode .section-header:hover .col-freeze {
    background: #1e2a40 !important;
}

/* Section test cells stay behind frozen */
.freeze-mode .section-header .section-test-cell {
    background: #151530 !important;
    z-index: 1;
}
.freeze-mode .section-header:hover .section-test-cell {
    background: #181830 !important;
}

/* Add row frozen cell */
.freeze-mode .add-row-row .col-freeze {
    z-index: 27;
    background: #151530 !important;
    border-right: 2px solid rgba(0, 212, 255, 0.5) !important;
    box-shadow: 3px 0 12px rgba(0, 0, 0, 0.6);
}
.freeze-mode .add-row-row .add-row-cell.test-column {
    background: #151530 !important;
    z-index: 1;
}

/* Last frozen column - visual separator */
.freeze-mode .col-freeze-7 {
    border-right: 2px solid rgba(0, 212, 255, 0.5) !important;
    box-shadow: 3px 0 12px rgba(0, 0, 0, 0.6);
}

/* Test columns - ensure they stay behind frozen columns */
.freeze-mode .test-column,
.freeze-mode td.test-column {
    z-index: 1;
}
.freeze-mode th.test-column,
.freeze-mode th.test-header {
    z-index: 5;
}

/* === TEST COLUMNS === */
.test-column {
    min-width: 150px;
    width: 150px;
    background: rgba(20, 20, 45, 0.8);
    user-select: none;
    transition: all 0.3s;
}

.test-column:hover {
    background: rgba(30, 30, 60, 0.9);
}

.test-header {
    position: relative;
    vertical-align: top !important;
    padding: 6px 8px 10px !important;
}

/* Toolbar row: arrows left, action buttons right */
.test-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
    gap: 4px;
}

.test-toolbar-right {
    display: flex;
    gap: 3px;
}

.test-name {
    font-weight: 600;
    color: #fff;
    font-size: 12px;
    margin-bottom: 6px;
}

.test-name input {
    background: transparent;
    border: none;
    border-bottom: 1px dashed rgba(0, 212, 255, 0.4);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    width: 100%;
    padding: 2px 0;
    transition: all 0.3s;
}

.test-name input:focus {
    outline: none;
    border-bottom-color: #00d4ff;
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}

.test-action-btn {
    background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
    color: #fff;
    border: none;
    border-radius: 4px;
    width: 22px;
    height: 22px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.test-action-btn:hover {
    transform: scale(1.1);
}

.test-action-btn.delete {
    background: linear-gradient(135deg, #ff4757 0%, #ff3344 100%);
}

.test-action-btn.export {
    background: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%);
}

.test-action-btn.save-test {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    font-size: 11px;
}

.test-action-btn.uid-btn {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    font-weight: 700;
    font-size: 12px;
}

.test-action-btn.info-btn {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    font-size: 10px;
}

/* === TEST INFO DROPDOWNS === */
.test-info {
    font-size: 9px;
}

.test-info select,
.test-info input[type="date"] {
    width: 100%;
    padding: 3px 4px;
    border: 1px solid rgba(58, 58, 92, 0.6);
    border-radius: 3px;
    background: rgba(0, 0, 0, 0.3);
    color: #e0e0e0;
    font-size: 10px;
    margin-bottom: 3px;
    transition: all 0.3s;
}

.test-info select:focus,
.test-info input[type="date"]:focus {
    outline: none;
    border-color: #00d4ff;
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.3);
}

.test-info label {
    display: block;
    font-size: 8px;
    color: #888;
    margin-bottom: 1px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* === ADD TEST COLUMN === */
.add-test-col {
    min-width: 70px;
    width: 70px;
    text-align: center;
    vertical-align: middle;
    background: rgba(10, 10, 20, 0.5);
}

.add-buttons-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.add-test-btn {
    background: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%);
    border: none;
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 20px rgba(0, 212, 255, 0.4);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.add-test-btn:hover {
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 6px 30px rgba(0, 212, 255, 0.6);
}

.import-table-btn {
    background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
    border: none;
    color: #fff;
    width: 40px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
}

.import-table-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(139, 92, 246, 0.6);
}

.import-table-btn .line {
    width: 3px;
    height: 16px;
    background: #fff;
    border-radius: 2px;
}

/* === SECTION HEADERS === */
.section-header td {
    background: linear-gradient(90deg, #1a2535 0%, #181830 50%, #151530 100%) !important;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    padding: 0 !important;
    height: 48px;
    border-color: rgba(0, 212, 255, 0.2) !important;
}

/* Section name cell - spans across frozen columns with colspan */
.section-header .section-name-cell {
    padding: 14px 20px !important;
    font-weight: 700;
    color: #fff;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1px;
    white-space: nowrap;
    overflow: visible;
}

.section-header .section-name-cell::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, #00d4ff, #8b5cf6);
}

/* In freeze mode, right border for section header spanning cell */
.freeze-mode .section-header .section-name-cell {
    border-right: 2px solid rgba(0, 212, 255, 0.5) !important;
    box-shadow: 3px 0 12px rgba(0, 0, 0, 0.6);
}

/* Make section toggle span across the frozen area */
.section-header .section-toggle {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    position: relative;
    z-index: 5;
}

/* Section test cells - scrollable area */
.section-header .section-test-cell {
    background: #151530 !important;
}

.section-header:hover td {
    background: linear-gradient(90deg, #1e2a40 0%, #1c1c38 50%, #181830 100%) !important;
}

.section-header:hover .section-test-cell {
    background: #181830 !important;
}

.toggle-icon {
    transition: transform 0.3s;
    font-size: 10px;
    color: #00d4ff;
}

.section-header.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

/* === DATA ROWS === */
.data-row td {
    transition: all 0.2s;
    background: #151525;
    height: 42px;
}

.data-row:nth-child(even) td {
    background: #171732;
}

.data-row:hover td {
    background: #1a2535;
}

.data-row.hidden {
    display: none;
}

.data-row td input {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    color: #e0e0e0;
    font-size: 12px;
    transition: all 0.2s;
}

.data-row td input:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

.data-row td input:focus {
    outline: 2px solid rgba(0, 212, 255, 0.3);
    outline-offset: -1px;
    border-color: #00d4ff;
    background: rgba(0, 212, 255, 0.1);
}

.qty-input {
    text-align: center !important;
    font-weight: 600;
    color: #00d4ff !important;
}

/* === DELETE ROW BUTTON === */
.delete-row-btn {
    background: transparent;
    border: none;
    color: #666;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.delete-row-btn:hover {
    background: rgba(255, 71, 87, 0.2);
    color: #ff4757;
}

/* === ADD ROW BUTTON === */
.add-row-btn {
    background: transparent;
    border: 1px dashed rgba(0, 212, 255, 0.4);
    color: #00d4ff;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

.add-row-btn:hover {
    background: rgba(0, 212, 255, 0.15);
    border-color: #00d4ff;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
    transform: translateY(-1px);
}

/* === ADD ROW ROW === */
.add-row-row td {
    background: #121220 !important;
    height: 42px;
    border-color: rgba(58, 58, 92, 0.4) !important;
}

.add-row-row .add-row-cell {
    padding: 6px 10px;
}

.add-row-row.hidden {
    display: none;
}

/* === MODALS === */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: linear-gradient(135deg, #1a1a3a 0%, #0f0f25 100%);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 16px;
    padding: 30px;
    max-width: 700px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(0, 212, 255, 0.2);
}

.modal h3 {
    color: #fff;
    margin-bottom: 20px;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-content {
    position: relative;
}

.file-drop-zone {
    border: 2px dashed rgba(0, 212, 255, 0.4);
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    transition: all 0.3s;
    cursor: pointer;
}

.file-drop-zone:hover,
.file-drop-zone.dragover {
    border-color: #00d4ff;
    background: rgba(0, 212, 255, 0.1);
}

.file-drop-zone svg {
    width: 48px;
    height: 48px;
    color: #00d4ff;
    margin-bottom: 15px;
}

.file-drop-zone p {
    color: #888;
    margin-bottom: 10px;
}

.file-drop-zone .formats {
    font-size: 11px;
    color: #666;
}

.file-input {
    display: none;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

.modal-btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.modal-btn.primary {
    background: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%);
    color: #fff;
}

.modal-btn.secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #888;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.modal-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

/* === EXPORT PREVIEW === */
.export-preview {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    max-height: 300px;
    overflow-y: auto;
}

.export-preview table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}

.export-preview th,
.export-preview td {
    padding: 8px;
    border: 1px solid rgba(58, 58, 92, 0.6);
    text-align: left;
}

.export-preview th {
    background: rgba(0, 212, 255, 0.2);
    color: #00d4ff;
}

.export-info {
    background: rgba(0, 212, 255, 0.1);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 8px;
    padding: 12px 15px;
    margin-bottom: 15px;
    font-size: 12px;
}

.export-info strong {
    color: #00d4ff;
}

.duplicate-warning {
    background: rgba(255, 193, 7, 0.15);
    border: 1px solid rgba(255, 193, 7, 0.5);
    color: #ffc107;
}

/* === GUIDE POPUP === */
.guide-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9000;
    backdrop-filter: blur(3px);
    justify-content: center;
    align-items: flex-start;
    padding-top: 100px;
}

.guide-overlay.open {
    display: flex;
}

.guide-panel {
    position: relative;
    background: rgba(20, 20, 42, 0.98);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 14px;
    padding: 24px 28px 20px;
    max-width: 340px;
    width: 90%;
    font-size: 12px;
    color: #aab;
    box-shadow: 0 16px 60px rgba(0, 0, 0, 0.6), 0 0 40px rgba(0, 212, 255, 0.12);
    backdrop-filter: blur(12px);
    animation: guideIn 0.2s ease;
}

@keyframes guideIn {
    from { opacity: 0; transform: translateY(-12px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.guide-close {
    position: absolute;
    top: 10px;
    right: 12px;
    background: none;
    border: none;
    color: #667;
    font-size: 20px;
    cursor: pointer;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.15s;
}

.guide-close:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.guide-panel h4 {
    color: #00d4ff;
    margin-bottom: 14px;
    font-size: 14px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.guide-panel ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.guide-panel li {
    margin-bottom: 8px;
    padding-left: 18px;
    position: relative;
    line-height: 1.5;
}

.guide-panel li::before {
    content: "›";
    position: absolute;
    left: 0;
    color: #8b5cf6;
    font-weight: bold;
    font-size: 14px;
}

.guide-panel li strong {
    color: #dde;
}

/* Guide header button */
.action-btn.guide-btn {
    border-color: rgba(0, 212, 255, 0.3);
}

.action-btn.guide-btn:hover {
    background: rgba(0, 212, 255, 0.1);
    border-color: #00d4ff;
    box-shadow: 0 0 16px rgba(0, 212, 255, 0.25);
}

/* === FILTER BAR === */
.filter-bar {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px 0 0 0;
    margin-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.filter-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-label {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #888;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 70px;
}

.filter-chips {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    color: #aaa;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    letter-spacing: 0.5px;
}

.filter-chip:hover {
    border-color: var(--chip-border);
    background: var(--chip-bg);
    color: var(--chip-color);
    box-shadow: 0 0 12px color-mix(in srgb, var(--chip-color) 25%, transparent);
}

.filter-chip.active {
    border-color: var(--chip-border);
    background: var(--chip-bg);
    color: var(--chip-color);
    box-shadow: 0 0 16px color-mix(in srgb, var(--chip-color) 30%, transparent), inset 0 0 8px color-mix(in srgb, var(--chip-color) 10%, transparent);
}

.chip-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.4;
    transition: opacity 0.25s;
}

.filter-chip.active .chip-dot {
    opacity: 1;
    box-shadow: 0 0 6px currentColor;
}

.filter-clear {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #888;
    font-size: 10px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.25s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    flex-shrink: 0;
}

.filter-clear:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.4);
    color: #ef4444;
}

.filter-clear.hidden {
    display: none;
}

/* Highlight All button */
.highlight-all-btn {
    --chip-color: #dde;
    --chip-bg: rgba(255, 255, 255, 0.08);
    --chip-border: rgba(255, 255, 255, 0.3);
    flex-shrink: 0;
}

.highlight-all-btn.active {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.4);
    color: #fff;
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.15);
}

/* Column filter indicator in filter bar */
.filter-col-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    white-space: nowrap;
    flex-shrink: 0;
}

.filter-col-x {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 14px;
    padding: 0 2px;
    opacity: 0.6;
    transition: opacity 0.15s;
}

.filter-col-x:hover { opacity: 1; }

/* === TABLE FILTER ROW (column-aligned inputs) === */
.filter-header-row th {
    padding: 3px 4px !important;
    background: rgba(0, 0, 0, 0.25) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

.filter-cell {
    vertical-align: middle !important;
}

.col-filter-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    color: #dde;
    font-size: 10px;
    padding: 4px 6px;
    outline: none;
    transition: all 0.2s;
    box-sizing: border-box;
}

.col-filter-input:focus {
    border-color: #00d4ff;
    background: rgba(0, 212, 255, 0.06);
    box-shadow: 0 0 6px rgba(0, 212, 255, 0.15);
}

.col-filter-input::placeholder {
    color: #445;
    font-size: 11px;
}

/* Total qty display in filter row under test columns */
.col-total-qty {
    display: block;
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    color: #00d4ff;
    padding: 2px 0;
    opacity: 0.8;
}

/* Per-column filter button in main header (⧫) */
.col-filter-btn {
    font-size: 10px;
    opacity: 0.5;
    transition: all 0.2s;
}

.col-filter-btn.active {
    opacity: 1;
    color: #00d4ff;
    text-shadow: 0 0 6px rgba(0, 212, 255, 0.6);
}

.col-filter-btn:hover { opacity: 0.8; }

/* === UID POPUP === */
.uid-popup {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    backdrop-filter: blur(4px);
}

.uid-popup-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 12px;
    padding: 24px;
    width: 340px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.uid-popup-title {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 8px;
}

.uid-popup-desc {
    font-size: 12px;
    color: #889;
    line-height: 1.5;
    margin-bottom: 16px;
}

.uid-popup-field label {
    display: block;
    font-size: 9px;
    color: #667;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.uid-popup-field input {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 6px;
    color: #fff;
    font-size: 14px;
    font-family: 'Courier New', monospace;
    font-weight: 600;
    padding: 8px 12px;
    outline: none;
    transition: all 0.2s;
    box-sizing: border-box;
}

.uid-popup-field input:focus {
    border-color: #6366f1;
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.3);
}

.uid-popup-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 16px;
}

/* === EXPORT PATH CHOOSER === */
.export-path-chooser {
    margin-top: 16px;
    padding: 12px 14px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
}

.path-label {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #667;
    margin-bottom: 8px;
}

.path-display {
    display: flex;
    align-items: center;
    gap: 10px;
}

.path-text {
    flex: 1;
    font-size: 12px;
    color: #667;
    font-family: 'Courier New', monospace;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.path-btn {
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #aab;
    font-size: 11px;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.path-btn:hover {
    background: rgba(0, 212, 255, 0.1);
    border-color: #00d4ff;
    color: #00d4ff;
}

/* === EXPORT TOAST === */
.export-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    background: rgba(16, 185, 129, 0.9);
    color: #fff;
    padding: 10px 24px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    z-index: 99999;
    pointer-events: none;
    opacity: 0;
    transition: all 0.3s ease;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.export-toast.error {
    background: rgba(239, 68, 68, 0.9);
}

.export-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* === SCROLLBAR === */
::-webkit-scrollbar {
    height: 8px;
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #0a0a12;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #00d4ff, #8b5cf6);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #00e5ff, #9d6fff);
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .header-top {
        flex-direction: column;
    }
    
    .header-title {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* === MANAGE ACTIVITIES MODAL === */
.manage-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
}
.manage-overlay.active { display: flex; }

.manage-modal {
    background: linear-gradient(135deg, #1a1a3a, #0f0f25);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 14px;
    padding: 0;
    width: 480px;
    max-width: 90vw;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 30px rgba(0, 212, 255, 0.15);
}

.manage-header {
    padding: 20px 24px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.manage-header h3 { color: #fff; margin: 0 0 4px; font-size: 16px; }
.manage-hint { font-size: 11px; color: #667; }

.manage-toolbar {
    padding: 10px 24px;
    display: flex;
    gap: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.manage-action-btn {
    padding: 5px 12px;
    border-radius: 6px;
    border: 1px solid rgba(0, 212, 255, 0.2);
    background: rgba(0, 212, 255, 0.06);
    color: #00d4ff;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
}
.manage-action-btn:hover {
    background: rgba(0, 212, 255, 0.15);
    border-color: rgba(0, 212, 255, 0.4);
}

.manage-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 16px;
    min-height: 200px;
    max-height: 400px;
}

.manage-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    margin-bottom: 4px;
    transition: all 0.2s;
    border: 1px solid transparent;
}
.manage-item:hover { background: rgba(255, 255, 255, 0.06); }
.manage-item.manage-hidden { opacity: 0.4; }
.manage-item.manage-dragging { opacity: 0.5; border-color: #00d4ff; }
.manage-item.manage-drop-above { border-top: 2px solid #00d4ff; }
.manage-item.manage-drop-below { border-bottom: 2px solid #00d4ff; }

.manage-grip {
    cursor: grab;
    color: #445;
    font-size: 14px;
    user-select: none;
}
.manage-grip:active { cursor: grabbing; }

.manage-type-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.manage-name {
    flex: 1;
    color: #dde;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.manage-type {
    color: #667;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-width: 40px;
    text-align: right;
}

.manage-toggle {
    position: relative;
    display: inline-block;
    width: 34px;
    height: 18px;
    flex-shrink: 0;
}
.manage-toggle input { opacity: 0; width: 0; height: 0; }
.manage-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 18px;
    transition: 0.2s;
}
.manage-slider::before {
    content: '';
    position: absolute;
    height: 14px; width: 14px;
    left: 2px; bottom: 2px;
    background: #667;
    border-radius: 50%;
    transition: 0.2s;
}
.manage-toggle input:checked + .manage-slider { background: rgba(0, 212, 255, 0.3); }
.manage-toggle input:checked + .manage-slider::before { transform: translateX(16px); background: #00d4ff; }

.manage-footer {
    padding: 14px 24px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* === ACTIVITY DETAIL MODAL (index.html) === */
.ad-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.ad-overlay.active {
    display: flex;
}

.ad-modal {
    background: #121228;
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 14px;
    width: 90%;
    max-width: 820px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.ad-header {
    padding: 16px 20px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.ad-header h3 {
    margin: 0;
    font-size: 16px;
    color: #fff;
}

.ad-meta {
    font-size: 11px;
    color: #778;
    margin-top: 4px;
}

.ad-body {
    display: flex;
    gap: 16px;
    padding: 14px 20px;
    overflow-y: auto;
    flex: 1;
}

.ad-editors {
    flex: 4;
    min-width: 0;
}

.ad-equipment {
    flex: 1.5;
    min-width: 0;
}

.ad-section-label {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #667;
    margin: 8px 0 4px;
}

.ad-toolbar {
    display: flex;
    gap: 2px;
    margin-bottom: 4px;
    padding: 3px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px 6px 0 0;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-bottom: none;
}

.ad-toolbar .wysiwyg-btn {
    background: none;
    border: 1px solid transparent;
    color: #889;
    cursor: pointer;
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 11px;
    transition: all 0.15s;
}

.ad-toolbar .wysiwyg-btn:hover {
    background: rgba(0, 212, 255, 0.1);
    color: #00d4ff;
    border-color: rgba(0, 212, 255, 0.2);
}

.ad-editor {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0 0 6px 6px;
    padding: 8px 10px;
    min-height: 60px;
    max-height: 150px;
    overflow-y: auto;
    color: #ccd;
    font-size: 12px;
    line-height: 1.5;
    outline: none;
    background: rgba(0, 0, 0, 0.2);
}

.ad-editor:focus {
    border-color: rgba(0, 212, 255, 0.25);
}

.ad-editor-notes {
    min-height: 80px;
    max-height: 200px;
}

.ad-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 9px;
}

.ad-table th {
    text-align: left;
    font-size: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #556;
    padding: 3px 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    position: sticky;
    top: 0;
    background: #121228;
}

.ad-table td {
    padding: 3px 4px;
    color: #aab;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    word-break: break-word;
}

.ad-sec {
    color: #667;
    font-style: italic;
}

.ad-qty {
    text-align: center;
    font-weight: 600;
    color: #00d4ff;
}

.ad-item-count {
    font-size: 9px;
    color: #556;
    margin-bottom: 4px;
}

.ad-empty {
    font-size: 11px;
    color: #445;
    font-style: italic;
    padding: 12px 0;
}

.ad-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 12px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.ad-actions .btn-cancel,
.ad-actions .btn-save {
    padding: 6px 18px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
}

.ad-actions .btn-cancel {
    background: rgba(255, 255, 255, 0.05);
    color: #889;
}

.ad-actions .btn-cancel:hover {
    background: rgba(255, 255, 255, 0.1);
}

.ad-actions .btn-save {
    background: rgba(0, 212, 255, 0.15);
    border-color: rgba(0, 212, 255, 0.3);
    color: #00d4ff;
}

.ad-actions .btn-save:hover {
    background: rgba(0, 212, 255, 0.25);
}

@media (max-width: 700px) {
    .ad-body { flex-direction: column; }
}

/* ========================================
   EXCEL-LIKE TABLE INTERACTIONS
   ======================================== */

/* Cell selection highlight — use outline, NOT position:relative (breaks sticky) */
.data-row td.cell-selected {
    background: rgba(0, 212, 255, 0.12) !important;
    outline: 1.5px solid rgba(0, 212, 255, 0.5);
    outline-offset: -1.5px;
}

/* Improve input feel — more spreadsheet-like */
.data-row td input {
    border-color: transparent !important;
    transition: border-color 0.1s, background 0.1s;
}
.data-row td input:focus {
    border-color: rgba(0, 212, 255, 0.6) !important;
    background: rgba(0, 0, 0, 0.4) !important;
    outline: 2px solid rgba(0, 212, 255, 0.25);
    outline-offset: -1px;
}
.data-row td input:hover:not(:focus) {
    border-color: rgba(255, 255, 255, 0.1) !important;
}

/* Paste toast notification */
.clipboard-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(17, 24, 32, 0.95);
    border: 1px solid rgba(0, 212, 255, 0.4);
    color: #00d4ff;
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 12px;
    font-family: inherit;
    font-weight: 500;
    letter-spacing: 0.5px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    z-index: 10000;
    backdrop-filter: blur(10px);
}
.clipboard-toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Slight row number feel — show row index on hover */
.data-row:hover td.col-delete .delete-row-btn {
    opacity: 1;
}
.data-row td.col-delete .delete-row-btn {
    opacity: 0.3;
    transition: opacity 0.15s;
}

/* Paste hint in header */
.paste-hint {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    color: #5c6370;
    letter-spacing: 0.3px;
    margin-left: 12px;
}
.paste-hint kbd {
    display: inline-block;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    padding: 1px 5px;
    font-size: 9px;
    font-family: inherit;
    color: #8b929a;
}

/* Lock button in manage panel */
.manage-lock-btn {
    background: none; border: none; cursor: pointer; font-size: 12px; padding: 2px 6px;
    border-radius: 4px; opacity: 0.5; transition: all 0.15s;
}
.manage-lock-btn:hover { opacity: 1; background: rgba(255,255,255,0.08); }
.manage-lock { font-size: 10px; color: #f59e0b; margin-left: 4px; }

/* Header right-click context menu */
.header-ctx-menu {
    position: fixed; z-index: 3000; background: rgba(20,24,32,0.97); border: 1px solid rgba(0,212,255,0.25);
    border-radius: 8px; min-width: 180px; padding: 6px 0; box-shadow: 0 12px 40px rgba(0,0,0,0.6);
    display: none; backdrop-filter: blur(12px);
}
.header-ctx-menu.visible { display: block; }
.header-ctx-menu .ctx-item {
    padding: 7px 14px; font-size: 12px; color: #e0e0e0; cursor: pointer;
    display: flex; align-items: center; gap: 8px; transition: background 0.1s;
}
.header-ctx-menu .ctx-item:hover { background: rgba(0,212,255,0.1); }
.header-ctx-menu .ctx-divider { height: 1px; background: rgba(255,255,255,0.06); margin: 4px 0; }
.header-ctx-menu .ctx-header { padding: 6px 14px; font-size: 10px; color: #5c6370; text-transform: uppercase; letter-spacing: 1px; }

/* QTY auto-sum display */
.qty-sum {
    display: block;
    text-align: center;
    font-weight: 600;
    color: #00d4ff;
    font-size: 12px;
    padding: 4px 0;
    opacity: 0.8;
}

/* Workpack dropdown */
.wp-select {
    width: 100%;
    background: transparent;
    border: 1px solid transparent;
    color: #e0e0e0;
    font-family: inherit;
    font-size: 12px;
    padding: 4px 4px;
    border-radius: 4px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5' viewBox='0 0 8 5'%3E%3Cpath d='M0 0l4 5 4-5z' fill='%23667'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 6px center;
    padding-right: 18px;
    transition: border-color 0.15s, background 0.15s;
}
.wp-select:hover {
    border-color: rgba(255,255,255,0.1);
}
.wp-select:focus {
    border-color: rgba(0,212,255,0.6);
    background: rgba(0,0,0,0.4);
    outline: 2px solid rgba(0,212,255,0.25);
    outline-offset: -1px;
}
.wp-select option {
    background: #151530;
    color: #e0e0e0;
}

/* Modal form fields */
.modal-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.modal-field label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #5c6370;
    font-weight: 500;
}
.modal-field input,
.modal-field select {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: #e0e0e0;
    font-family: inherit;
    font-size: 13px;
    padding: 8px 10px;
    transition: border-color 0.15s;
}
.modal-field input:focus,
.modal-field select:focus {
    border-color: rgba(0, 212, 255, 0.5);
    outline: none;
    background: rgba(0, 0, 0, 0.5);
}
.modal-field select option {
    background: #151530;
    color: #e0e0e0;
}

/* ═══════════════════════════════════════════
   WP SUB-HEADERS (collapsible groups within sections)
   ═══════════════════════════════════════════ */

.wp-subheader td {
    background: rgba(20, 22, 38, 0.95) !important;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0 !important;
    height: 32px;
    border-color: rgba(255, 255, 255, 0.04) !important;
}

.wp-subheader:hover td {
    background: rgba(28, 30, 50, 0.95) !important;
}

.wp-sub-name-cell {
    padding: 6px 20px 6px 36px !important;
    font-weight: 600;
    color: #aab;
    font-size: 11px;
    letter-spacing: 0.5px;
    white-space: nowrap;
    position: relative;
}

.wp-sub-name-cell::before {
    content: '';
    position: absolute;
    left: 12px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 1px;
}

.wp-sub-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.wp-toggle-icon {
    font-size: 8px;
    color: #5c6370;
    transition: color 0.15s;
    width: 10px;
}
.wp-subheader:hover .wp-toggle-icon {
    color: #aab;
}

.wp-sub-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.wp-sub-count {
    font-weight: 400;
    color: #5c6370;
    font-size: 10px;
    margin-left: 2px;
}

.wp-sub-test-cell {
    background: rgba(18, 18, 35, 0.9) !important;
}
.wp-subheader:hover .wp-sub-test-cell {
    background: rgba(24, 24, 45, 0.9) !important;
}

.wp-subheader.hidden { display: none; }

/* Freeze mode support for WP sub-headers */
.freeze-mode .wp-subheader .col-freeze {
    z-index: 27;
    background: rgba(20, 22, 38, 0.98) !important;
}
.freeze-mode .wp-subheader:hover .col-freeze {
    background: rgba(28, 30, 50, 0.98) !important;
}
.freeze-mode .wp-subheader .wp-sub-name-cell {
    border-right: 2px solid rgba(0, 212, 255, 0.5) !important;
    box-shadow: 3px 0 12px rgba(0, 0, 0, 0.6);
}

/* ══════════════════════════════════════════════════════════
   SETTINGS MODAL — Location Manager
   ══════════════════════════════════════════════════════════ */

.settings-overlay {
    position: fixed; inset: 0; z-index: 9999;
    background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none;
    transition: opacity 0.2s;
}
.settings-overlay.open { opacity: 1; pointer-events: auto; }

.settings-modal {
    background: #12121f; border: 1px solid rgba(0,212,255,0.15);
    border-radius: 12px; width: 560px; max-width: 95vw; max-height: 85vh;
    display: flex; flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6), 0 0 30px rgba(0,212,255,0.06);
    transform: translateY(20px); transition: transform 0.2s;
}
.settings-overlay.open .settings-modal { transform: translateY(0); }

.settings-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid rgba(255,255,255,0.06);
}
.settings-header h3 {
    margin: 0; font-size: 16px; font-weight: 600; color: #e2e8f0;
    font-family: 'Space Grotesk', 'Segoe UI', system-ui, sans-serif;
}
.settings-close {
    background: none; border: none; color: #64748b; font-size: 22px;
    cursor: pointer; padding: 4px 8px; border-radius: 6px;
    transition: all 0.15s;
}
.settings-close:hover { background: rgba(255,255,255,0.06); color: #e2e8f0; }

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

.settings-section-title {
    font-size: 13px; font-weight: 700; color: #00d4ff;
    text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 4px;
}
.settings-section-hint {
    font-size: 11px; color: #64748b; margin-bottom: 14px;
}

.settings-loc-list {
    display: flex; flex-direction: column; gap: 4px;
    max-height: 340px; overflow-y: auto;
    margin-bottom: 14px; padding-right: 4px;
}

.settings-loc-item {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px; border-radius: 8px;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.04);
    transition: background 0.15s;
}
.settings-loc-item:hover { background: rgba(255,255,255,0.04); }

.settings-loc-color-wrap {
    position: relative; width: 22px; height: 22px; flex-shrink: 0;
}
.settings-loc-color-input {
    position: absolute; inset: 0; opacity: 0; cursor: pointer;
    width: 22px; height: 22px;
}
.settings-loc-dot {
    width: 22px; height: 22px; border-radius: 50%;
    pointer-events: none;
}

.settings-loc-name {
    flex: 1; font-size: 13px; color: #cbd5e1;
    font-family: 'JetBrains Mono', 'Consolas', monospace;
}

.settings-loc-badge {
    font-size: 9px; color: #10b981; background: rgba(16,185,129,0.12);
    padding: 2px 8px; border-radius: 10px; text-transform: uppercase;
    letter-spacing: 0.5px; font-weight: 600;
}

.settings-loc-del {
    background: none; border: none; color: #64748b; cursor: pointer;
    padding: 4px; border-radius: 6px; transition: all 0.15s;
    display: flex; align-items: center; justify-content: center;
}
.settings-loc-del:hover:not(:disabled) { background: rgba(239,68,68,0.15); color: #ef4444; }
.settings-loc-del:disabled { opacity: 0.25; cursor: not-allowed; }

.settings-add-row {
    display: flex; gap: 8px; align-items: center;
}
.settings-add-row input[type="text"] {
    flex: 1; padding: 8px 12px; border-radius: 8px;
    background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08);
    color: #e2e8f0; font-size: 13px;
    font-family: 'JetBrains Mono', 'Consolas', monospace;
    outline: none; transition: border-color 0.15s;
}
.settings-add-row input[type="text"]:focus {
    border-color: rgba(0,212,255,0.3);
}
.settings-add-row input[type="text"]::placeholder { color: #475569; }

.settings-add-row input[type="color"] {
    width: 34px; height: 34px; border: none; border-radius: 8px;
    background: rgba(255,255,255,0.04); cursor: pointer; padding: 2px;
}

.settings-add-btn {
    padding: 8px 16px; border-radius: 8px; border: 1px solid rgba(0,212,255,0.3);
    background: rgba(0,212,255,0.08); color: #00d4ff;
    font-size: 12px; font-weight: 600; cursor: pointer;
    transition: all 0.15s; white-space: nowrap;
}
.settings-add-btn:hover { background: rgba(0,212,255,0.18); }

.settings-footer {
    padding: 14px 20px; border-top: 1px solid rgba(255,255,255,0.06);
    display: flex; justify-content: flex-end; gap: 10px;
}

.settings-empty {
    padding: 20px; text-align: center; color: #475569; font-size: 12px;
}

.settings-btn {
    border-color: rgba(0,212,255,0.2) !important;
}
.settings-btn:hover {
    border-color: rgba(0,212,255,0.5) !important;
    background: rgba(0,212,255,0.06) !important;
}

/* =============================================
   SETTINGS MODAL — Location Manager
   ============================================= */

.settings-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
}
.settings-overlay.open {
    display: flex;
}

.settings-modal {
    background: #12141e;
    border: 1px solid rgba(0, 212, 255, 0.15);
    border-radius: 12px;
    width: 560px;
    max-width: 95vw;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 30px rgba(0, 212, 255, 0.08);
}

.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.settings-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: #e0e6ed;
    margin: 0;
}
.settings-close {
    background: none;
    border: none;
    color: #64748b;
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.15s;
}
.settings-close:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

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

.settings-section {
    margin-bottom: 20px;
}
.settings-section-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #00d4ff;
    margin-bottom: 6px;
}
.settings-section-hint {
    font-size: 11px;
    color: #5c6370;
    margin-bottom: 12px;
}

.settings-loc-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 320px;
    overflow-y: auto;
    margin-bottom: 12px;
}

.settings-loc-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 6px;
    transition: background 0.15s;
}
.settings-loc-item:hover {
    background: rgba(0, 212, 255, 0.04);
    border-color: rgba(0, 212, 255, 0.1);
}

.settings-loc-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 6px rgba(0, 0, 0, 0.3);
}

.settings-loc-name {
    flex: 1;
    font-size: 12px;
    color: #c8cdd4;
    font-weight: 500;
}

.settings-loc-color-input {
    width: 28px;
    height: 28px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    cursor: pointer;
    background: none;
    padding: 1px;
}
.settings-loc-color-input::-webkit-color-swatch-wrapper { padding: 0; }
.settings-loc-color-input::-webkit-color-swatch { border: none; border-radius: 3px; }

.settings-loc-delete {
    background: none;
    border: none;
    color: #5c6370;
    font-size: 18px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    line-height: 1;
    transition: all 0.15s;
}
.settings-loc-delete:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.settings-loc-empty {
    font-size: 12px;
    color: #5c6370;
    padding: 16px;
    text-align: center;
}

.settings-add-row {
    display: flex;
    gap: 8px;
    align-items: center;
}
.settings-add-row input[type="text"] {
    flex: 1;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    color: #e0e6ed;
    font-size: 12px;
    outline: none;
    transition: border-color 0.2s;
}
.settings-add-row input[type="text"]:focus {
    border-color: rgba(0, 212, 255, 0.3);
}
.settings-add-row input[type="color"] {
    width: 34px;
    height: 34px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    cursor: pointer;
    background: none;
    padding: 2px;
}
.settings-add-btn {
    padding: 8px 16px;
    background: rgba(0, 212, 255, 0.12);
    border: 1px solid rgba(0, 212, 255, 0.25);
    border-radius: 6px;
    color: #00d4ff;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}
.settings-add-btn:hover {
    background: rgba(0, 212, 255, 0.2);
    border-color: rgba(0, 212, 255, 0.4);
}

.settings-footer {
    padding: 12px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.settings-btn {
    color: #8b929a;
}
.settings-btn:hover {
    color: #00d4ff;
}

/* ═══════════════════════════════════════════════════
   SETTINGS MODAL
   ═══════════════════════════════════════════════════ */

.settings-overlay {
    position: fixed; inset: 0; z-index: 9000;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center; justify-content: center;
}
.settings-overlay.open {
    display: flex;
}
.settings-modal {
    background: #0d1117;
    border: 1px solid rgba(0,212,255,0.15);
    border-radius: 12px;
    width: min(560px, 92vw);
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 40px rgba(0,212,255,0.05);
}
.settings-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.settings-header h3 {
    margin: 0; font-size: 15px; color: #e0e4ea; font-weight: 600;
}
.settings-close {
    background: none; border: none; color: #64748b; font-size: 22px;
    cursor: pointer; padding: 0 4px; line-height: 1;
}
.settings-close:hover { color: #ef4444; }

.settings-body {
    padding: 16px 20px;
    overflow-y: auto;
    flex: 1;
}
.settings-section-title {
    font-size: 12px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.8px; color: #00d4ff; margin-bottom: 4px;
}
.settings-section-hint {
    font-size: 11px; color: #64748b; margin-bottom: 12px;
}

/* Location list */
.settings-loc-list {
    display: flex; flex-direction: column; gap: 4px;
    max-height: 340px; overflow-y: auto;
    padding-right: 4px;
    margin-bottom: 12px;
}
.settings-loc-item {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 8px;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.04);
    border-radius: 6px;
    transition: background 0.15s;
}
.settings-loc-item:hover {
    background: rgba(0,212,255,0.04);
    border-color: rgba(0,212,255,0.12);
}
.settings-loc-color-wrap {
    flex-shrink: 0;
}
.settings-loc-color {
    width: 28px; height: 28px; border: none;
    border-radius: 50%; cursor: pointer;
    background: none; padding: 0;
}
.settings-loc-color::-webkit-color-swatch-wrapper { padding: 2px; }
.settings-loc-color::-webkit-color-swatch { border-radius: 50%; border: 2px solid rgba(255,255,255,0.15); }
.settings-loc-name {
    flex: 1; font-size: 12px; color: #c9d1d9; font-weight: 500;
}
.settings-loc-rename, .settings-loc-delete {
    background: none; border: none; cursor: pointer;
    font-size: 14px; padding: 2px 6px; border-radius: 4px;
    opacity: 0.4; transition: opacity 0.15s;
}
.settings-loc-rename:hover { opacity: 1; }
.settings-loc-delete:hover { opacity: 1; color: #ef4444; }

/* Add row */
.settings-add-row {
    display: flex; gap: 8px; align-items: center;
}
.settings-add-row input[type="text"] {
    flex: 1; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px; padding: 7px 10px; font-size: 12px; color: #e0e4ea;
    outline: none; font-family: inherit;
}
.settings-add-row input[type="text"]:focus {
    border-color: rgba(0,212,255,0.4);
}
.settings-add-row input[type="color"] {
    width: 32px; height: 32px; border: none; border-radius: 50%;
    cursor: pointer; background: none; padding: 0;
}
.settings-add-row input[type="color"]::-webkit-color-swatch-wrapper { padding: 2px; }
.settings-add-row input[type="color"]::-webkit-color-swatch { border-radius: 50%; border: 2px solid rgba(255,255,255,0.15); }
.settings-add-btn {
    background: rgba(0,212,255,0.12); border: 1px solid rgba(0,212,255,0.3);
    color: #00d4ff; font-size: 11px; font-weight: 600; padding: 7px 14px;
    border-radius: 6px; cursor: pointer; white-space: nowrap;
    transition: all 0.15s;
}
.settings-add-btn:hover {
    background: rgba(0,212,255,0.2); border-color: rgba(0,212,255,0.5);
}

.settings-empty {
    font-size: 12px; color: #64748b; padding: 16px 0; text-align: center;
}

.settings-footer {
    padding: 12px 20px; border-top: 1px solid rgba(255,255,255,0.06);
    display: flex; justify-content: flex-end;
}

/* Settings button in header */
.settings-btn {
    color: #a0a8b4 !important;
}
.settings-btn:hover {
    color: #00d4ff !important;
    background: rgba(0,212,255,0.08) !important;
}

/* ══════════════════════════════════════════
   SETTINGS MODAL
   ══════════════════════════════════════════ */

.settings-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
}
.settings-overlay.open {
    display: flex;
}

.settings-modal {
    background: #0d1117;
    border: 1px solid rgba(0, 212, 255, 0.15);
    border-radius: 12px;
    width: 520px;
    max-width: 90vw;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5), 0 0 40px rgba(0, 212, 255, 0.08);
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.settings-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #e6edf3;
}
.settings-close {
    background: none;
    border: none;
    color: #8b949e;
    font-size: 22px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.15s;
}
.settings-close:hover { color: #ef4444; }

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

.settings-section {
    margin-bottom: 20px;
}
.settings-section-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #00d4ff;
    margin-bottom: 4px;
}
.settings-section-hint {
    font-size: 11px;
    color: #8b949e;
    margin-bottom: 12px;
}

.settings-loc-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
    max-height: 340px;
    overflow-y: auto;
}

.settings-loc-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 6px;
    transition: background 0.15s;
}
.settings-loc-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

.settings-loc-color-wrap {
    position: relative;
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}
.settings-loc-swatch {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
}
.settings-color-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.settings-loc-name {
    flex: 1;
    font-size: 12px;
    color: #c9d1d9;
    font-weight: 500;
}

.settings-loc-delete {
    background: none;
    border: none;
    color: #8b949e;
    cursor: pointer;
    padding: 2px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    opacity: 0;
}
.settings-loc-item:hover .settings-loc-delete {
    opacity: 1;
}
.settings-loc-delete:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.settings-add-row {
    display: flex;
    gap: 8px;
    align-items: center;
}
.settings-add-row input[type="text"] {
    flex: 1;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    padding: 8px 10px;
    color: #e6edf3;
    font-size: 12px;
    outline: none;
    transition: border-color 0.2s;
}
.settings-add-row input[type="text"]:focus {
    border-color: rgba(0, 212, 255, 0.4);
}
.settings-add-row input[type="text"]::placeholder {
    color: #484f58;
}
.settings-add-row input[type="color"] {
    width: 34px;
    height: 34px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    padding: 2px;
}
.settings-add-btn {
    background: rgba(0, 212, 255, 0.1);
    border: 1px solid rgba(0, 212, 255, 0.25);
    color: #00d4ff;
    font-size: 11px;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
}
.settings-add-btn:hover {
    background: rgba(0, 212, 255, 0.2);
    border-color: rgba(0, 212, 255, 0.4);
}

.settings-footer {
    padding: 12px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* Settings button style */
.settings-btn {
    color: #8b949e !important;
}
.settings-btn:hover {
    color: #00d4ff !important;
}

/* ══════════════════════════════════════════════════════════
   SETTINGS MODAL — Location Manager
   ══════════════════════════════════════════════════════════ */

.settings-btn {
    background: rgba(139, 92, 246, 0.08) !important;
    border-color: rgba(139, 92, 246, 0.25) !important;
    color: #a78bfa !important;
}
.settings-btn:hover {
    background: rgba(139, 92, 246, 0.18) !important;
    border-color: rgba(139, 92, 246, 0.4) !important;
}

.settings-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
    justify-content: center;
    align-items: center;
}
.settings-overlay.open {
    display: flex;
}

.settings-modal {
    width: 560px;
    max-width: 92vw;
    max-height: 80vh;
    background: #0e1117;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: settingsSlideIn 0.2s ease;
}
@keyframes settingsSlideIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.settings-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #e2e4e9;
    display: flex;
    align-items: center;
}
.settings-close {
    background: none;
    border: none;
    color: #64748b;
    font-size: 22px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.15s;
}
.settings-close:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #e2e4e9;
}

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

.settings-section {
    margin-bottom: 20px;
}
.settings-section-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #8b929a;
    margin-bottom: 6px;
}
.settings-section-hint {
    font-size: 11px;
    color: #5c6370;
    margin-bottom: 14px;
}

.settings-loc-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 14px;
    max-height: 340px;
    overflow-y: auto;
}
.settings-loc-empty {
    font-size: 12px;
    color: #5c6370;
    padding: 12px;
    text-align: center;
}

.settings-loc-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    transition: background 0.15s;
}
.settings-loc-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

.settings-loc-color-wrap {
    flex-shrink: 0;
}
.settings-loc-color-input {
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    padding: 0;
    background: none;
}
.settings-loc-color-input::-webkit-color-swatch-wrapper { padding: 0; }
.settings-loc-color-input::-webkit-color-swatch { border-radius: 50%; border: 2px solid rgba(255,255,255,0.12); }

.settings-loc-name {
    flex: 1;
    font-size: 13px;
    color: #c8cdd3;
    font-weight: 500;
}

.settings-loc-rename-btn,
.settings-loc-delete-btn {
    background: none;
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 13px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.15s;
    opacity: 0.4;
}
.settings-loc-item:hover .settings-loc-rename-btn,
.settings-loc-item:hover .settings-loc-delete-btn {
    opacity: 0.8;
}
.settings-loc-rename-btn:hover {
    background: rgba(59, 130, 246, 0.12);
    border-color: rgba(59, 130, 246, 0.25);
    opacity: 1 !important;
}
.settings-loc-delete-btn:hover {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.25);
    opacity: 1 !important;
}

.settings-add-row {
    display: flex;
    gap: 8px;
    align-items: center;
}
.settings-add-row input[type="text"] {
    flex: 1;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    color: #e2e4e9;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}
.settings-add-row input[type="text"]:focus {
    border-color: rgba(6, 182, 212, 0.4);
}
.settings-add-row input[type="color"] {
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    padding: 0;
    background: none;
    flex-shrink: 0;
}
.settings-add-row input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.settings-add-row input[type="color"]::-webkit-color-swatch { border-radius: 50%; border: 2px solid rgba(255,255,255,0.12); }

.settings-add-btn {
    padding: 8px 16px;
    background: rgba(6, 182, 212, 0.12);
    border: 1px solid rgba(6, 182, 212, 0.3);
    border-radius: 8px;
    color: #06b6d4;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
}
.settings-add-btn:hover {
    background: rgba(6, 182, 212, 0.22);
    border-color: rgba(6, 182, 212, 0.5);
}

.settings-footer {
    padding: 12px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    justify-content: flex-end;
}

/* ── Settings: rename + color input ────────────────────── */
.settings-loc-rename {
    background: none;
    border: none;
    color: #5c6370;
    font-size: 14px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    line-height: 1;
    transition: all 0.15s;
}
.settings-loc-rename:hover {
    color: #00d4ff;
    background: rgba(0, 212, 255, 0.1);
}
.settings-loc-color {
    width: 24px;
    height: 24px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    cursor: pointer;
    background: none;
    padding: 1px;
}
.settings-loc-color::-webkit-color-swatch-wrapper { padding: 0; }
.settings-loc-color::-webkit-color-swatch { border: none; border-radius: 3px; }

/* ── Settings: location info + coords ────────────────── */
.settings-loc-info {
    flex: 1;
    min-width: 0;
}
.settings-loc-info .settings-loc-name {
    font-size: 12px;
    color: #c8cdd4;
    font-weight: 500;
}
.settings-loc-coords {
    font-size: 9px;
    color: #64748b;
    font-family: 'JetBrains Mono', 'Consolas', monospace;
    margin-top: 1px;
}
.settings-loc-no-coords {
    color: #3b4252;
    font-style: italic;
}
.settings-loc-coord-btn {
    background: none;
    border: none;
    font-size: 14px;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    transition: all 0.15s;
    opacity: 0.5;
}
.settings-loc-coord-btn:hover {
    opacity: 1;
    background: rgba(0, 212, 255, 0.1);
}
.settings-coord-hint {
    font-size: 10px;
    color: #475569;
    white-space: nowrap;
}
.settings-add-row input[type="number"] {
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    color: #e0e6ed;
    font-size: 12px;
    outline: none;
    transition: border-color 0.2s;
}
.settings-add-row input[type="number"]:focus {
    border-color: rgba(0, 212, 255, 0.3);
}
.settings-add-row input[type="number"]::placeholder {
    color: #475569;
}

/* ── Settings footer Save & Close button ────────────── */
.settings-footer .btn-save {
    padding: 8px 20px;
    border-radius: 8px;
    background: rgba(0, 212, 255, 0.15);
    border: 1px solid rgba(0, 212, 255, 0.35);
    color: #00d4ff;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}
.settings-footer .btn-save:hover {
    background: rgba(0, 212, 255, 0.25);
    border-color: rgba(0, 212, 255, 0.5);
}

/* ── Hide number input spinners ──────────────────────── */
.settings-add-row input[type="number"]::-webkit-inner-spin-button,
.settings-add-row input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.settings-add-row input[type="number"] {
    -moz-appearance: textfield;
}

/* ══════ Inline location editor rows ══════ */
.sloc-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    border-radius: 6px;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.04);
    transition: all 0.2s;
}
.sloc-row:hover { background: rgba(0,212,255,0.03); border-color: rgba(0,212,255,0.08); }
.sloc-row.sloc-saved { background: rgba(16,185,129,0.1); border-color: rgba(16,185,129,0.3); }

.sloc-color {
    width: 28px; height: 28px; min-width: 28px;
    border: 1px solid rgba(255,255,255,0.1); border-radius: 6px;
    cursor: pointer; background: none; padding: 1px;
}
.sloc-color::-webkit-color-swatch-wrapper { padding: 0; }
.sloc-color::-webkit-color-swatch { border: none; border-radius: 4px; }

.sloc-name {
    flex: 1; min-width: 120px;
    padding: 5px 8px; font-size: 12px; font-weight: 500;
    background: rgba(0,0,0,0.25); border: 1px solid rgba(255,255,255,0.06);
    border-radius: 4px; color: #e0e6ed; outline: none;
    font-family: 'JetBrains Mono', 'Consolas', monospace;
    transition: border-color 0.2s;
}
.sloc-name:focus { border-color: rgba(0,212,255,0.4); }

.sloc-coord {
    width: 64px; min-width: 54px;
    padding: 5px 6px; font-size: 11px;
    background: rgba(0,0,0,0.25); border: 1px solid rgba(255,255,255,0.06);
    border-radius: 4px; color: #8b929a; outline: none; text-align: center;
    font-family: 'JetBrains Mono', 'Consolas', monospace;
    transition: border-color 0.2s;
    -moz-appearance: textfield;
}
.sloc-coord::-webkit-inner-spin-button,
.sloc-coord::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.sloc-coord:focus { border-color: rgba(0,212,255,0.4); color: #e0e6ed; }
.sloc-coord::placeholder { color: #3b4252; font-size: 10px; }

.sloc-save {
    width: 26px; height: 26px; min-width: 26px;
    border-radius: 4px; border: 1px solid rgba(16,185,129,0.3);
    background: rgba(16,185,129,0.1); color: #10b981;
    font-size: 13px; cursor: pointer; display: flex;
    align-items: center; justify-content: center;
    transition: all 0.15s; padding: 0;
}
.sloc-save:hover { background: rgba(16,185,129,0.2); border-color: rgba(16,185,129,0.5); }

.sloc-del {
    width: 26px; height: 26px; min-width: 26px;
    border-radius: 4px; border: 1px solid rgba(239,68,68,0.2);
    background: transparent; color: #5c6370;
    font-size: 16px; cursor: pointer; display: flex;
    align-items: center; justify-content: center;
    transition: all 0.15s; padding: 0; line-height: 1;
}
.sloc-del:hover { background: rgba(239,68,68,0.12); color: #ef4444; border-color: rgba(239,68,68,0.4); }

/* Location list column headers */
.sloc-header {
    display: flex; align-items: center; gap: 6px;
    padding: 0 8px 4px; margin-bottom: 2px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.sloc-header span { font-size: 9px; color: #475569; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }
.sloc-h-color { width: 28px; min-width: 28px; }
.sloc-h-name { flex: 1; min-width: 120px; }
.sloc-h-coord { width: 64px; min-width: 54px; text-align: center; }
.sloc-h-actions { width: 58px; min-width: 58px; }

/* ══════ LOCATION LIST (simple rows) ══════ */
.sloc-row { display:flex; align-items:center; gap:10px; padding:7px 10px; border-radius:6px; background:rgba(255,255,255,0.02); border:1px solid rgba(255,255,255,0.04); margin-bottom:3px; }
.sloc-row:hover { background:rgba(0,212,255,0.03); border-color:rgba(0,212,255,0.1); }
.sloc-dot { width:12px; height:12px; border-radius:50%; flex-shrink:0; box-shadow:0 0 4px rgba(0,0,0,0.3); }
.sloc-name { flex:1; font-size:12px; color:#c8cdd4; font-weight:500; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.sloc-coords { font-size:10px; color:#5c6370; font-family:'JetBrains Mono',monospace; white-space:nowrap; min-width:80px; text-align:right; }
.sloc-no-coords { color:#3b4252; font-style:italic; }
.sloc-edit-btn { padding:3px 10px; border-radius:4px; background:rgba(0,212,255,0.08); border:1px solid rgba(0,212,255,0.2); color:#00d4ff; font-size:10px; font-weight:600; cursor:pointer; transition:all 0.15s; }
.sloc-edit-btn:hover { background:rgba(0,212,255,0.18); border-color:rgba(0,212,255,0.4); }
.sloc-del-btn { background:none; border:none; color:#3b4252; font-size:16px; cursor:pointer; padding:2px 4px; border-radius:4px; transition:all 0.15s; line-height:1; }
.sloc-del-btn:hover { color:#ef4444; background:rgba(239,68,68,0.1); }

/* ══════ LOCATION EDIT POPUP ══════ */
.settings-edit-overlay { position:fixed; inset:0; z-index:10001; background:rgba(0,0,0,0.7); backdrop-filter:blur(4px); display:none; justify-content:center; align-items:center; }
.settings-edit-overlay.active { display:flex; }
.settings-edit-popup { background:#12141e; border:1px solid rgba(0,212,255,0.2); border-radius:12px; padding:20px; width:380px; max-width:90vw; box-shadow:0 20px 60px rgba(0,0,0,0.6); }
.settings-edit-popup h3 { font-size:14px; font-weight:600; color:#e0e6ed; margin:0 0 16px; }
.sedit-field { margin-bottom:12px; }
.sedit-field label { display:block; font-size:10px; color:#8b929a; text-transform:uppercase; letter-spacing:0.5px; margin-bottom:4px; }
.sedit-field input[type="text"],.sedit-field input[type="number"] { width:100%; padding:8px 10px; background:rgba(0,0,0,0.3); border:1px solid rgba(255,255,255,0.1); border-radius:6px; color:#e2e8f0; font-size:13px; outline:none; transition:border-color 0.2s; box-sizing:border-box; -moz-appearance:textfield; }
.sedit-field input:focus { border-color:rgba(0,212,255,0.4); }
.sedit-field input::-webkit-inner-spin-button,.sedit-field input::-webkit-outer-spin-button { -webkit-appearance:none; margin:0; }
.sedit-color-row { display:flex; align-items:center; gap:12px; }
.sedit-color-row input[type="color"] { width:36px; height:36px; border:1px solid rgba(255,255,255,0.1); border-radius:8px; cursor:pointer; background:none; padding:2px; }
.sedit-color-row input[type="color"]::-webkit-color-swatch-wrapper { padding:0; }
.sedit-color-row input[type="color"]::-webkit-color-swatch { border:none; border-radius:6px; }
.sedit-preview { display:flex; align-items:center; gap:8px; padding:6px 12px; background:rgba(255,255,255,0.03); border-radius:6px; flex:1; }
.sedit-row { display:flex; gap:12px; }
.sedit-row .sedit-field { flex:1; }
.sedit-actions { display:flex; gap:8px; justify-content:flex-end; margin-top:16px; padding-top:12px; border-top:1px solid rgba(255,255,255,0.06); }
.sedit-actions .btn-cancel { padding:7px 16px; border-radius:6px; background:transparent; border:1px solid rgba(255,255,255,0.1); color:#8b929a; font-size:12px; cursor:pointer; transition:all 0.15s; }
.sedit-actions .btn-cancel:hover { background:rgba(255,255,255,0.05); }
.sedit-actions .btn-save { padding:7px 16px; border-radius:6px; background:rgba(0,212,255,0.15); border:1px solid rgba(0,212,255,0.35); color:#00d4ff; font-size:12px; font-weight:600; cursor:pointer; transition:all 0.15s; }
.sedit-actions .btn-save:hover { background:rgba(0,212,255,0.25); }
