﻿* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #f4f6f8;
    color: #1f2933;
}

.page {
    width: calc(100vw - 64px);
    max-width: none;
    margin: 0 auto;
    padding: 24px;
}
@media (max-width: 900px) {
    .page {
        width: calc(100vw - 24px);
    }
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

.header h1 {
    margin: 0;
    font-size: 32px;
}

.header p {
    margin: 6px 0 0;
    color: #667085;
}

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
}

.tab-button {
    background: #e2e8f0;
    color: #1f2937;
}

.tab-button:hover {
    background: #cbd5e1;
}

.tab-button.active {
    background: #2563eb;
    color: #ffffff;
}

.tab-panel {
    display: none;
}

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

.card {
    background: #ffffff;
    border: 1px solid #d0d5dd;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 18px;
    box-shadow: 0 4px 12px rgba(16, 24, 40, 0.06);
}

.card h2 {
    margin-top: 0;
    font-size: 22px;
}

.row {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 14px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 14px;
}

label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 14px;
    color: #344054;
}

input,
select {
    height: 38px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 0 10px;
    font-size: 14px;
}

button {
    height: 38px;
    border: 0;
    border-radius: 8px;
    padding: 0 14px;
    background: #2563eb;
    color: #ffffff;
    cursor: pointer;
    font-weight: 600;
}

button:hover {
    background: #1d4ed8;
}

button.secondary {
    background: #64748b;
}

button.secondary:hover {
    background: #475569;
}

button.danger {
    background: #dc2626;
}

button.danger:hover {
    background: #b91c1c;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 14px;
}

th,
td {
    border-bottom: 1px solid #e5e7eb;
    padding: 10px;
    text-align: left;
    font-size: 14px;
    vertical-align: middle;
}

th {
    background: #f8fafc;
    color: #475467;
}

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

.exports {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.exports button {
    background: #0f766e;
}

.exports button:hover {
    background: #115e59;
}

.log-card pre {
    min-height: 80px;
    max-height: 260px;
    overflow: auto;
    background: #111827;
    color: #d1fae5;
    border-radius: 8px;
    padding: 12px;
    white-space: pre-wrap;
}

.muted {
    color: #667085;
}

@media (max-width: 1000px) {
    .grid,
    .exports {
        grid-template-columns: 1fr;
    }

    .row {
        flex-direction: column;
        align-items: stretch;
    }

    .table-actions {
        flex-direction: column;
    }
}


.summary-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 14px;
}

.summary-item {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 14px;
    background: #f8fafc;
}

.summary-label {
    display: block;
    color: #64748b;
    font-size: 14px;
    margin-bottom: 6px;
}

.summary-value {
    display: block;
    color: #0f172a;
    font-size: 28px;
    font-weight: 700;
}

.summary-row {
    margin-bottom: 0;
}

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

.equipment-address-select {
    margin-top: 6px;
    width: 100%;
    font-size: 13px;
}

.equipment-original-input-hidden {
    display: none !important;
}

.equipment-catalog-select {
    width: 100%;
    min-height: 38px;
    padding: 8px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #ffffff;
    font-size: 14px;
}
/* Hide internal database ID columns from user tables */
table tr > th:first-child,
table tr > td:first-child {
  display: none !important;
  width: 0 !important;
  min-width: 0 !important;
  max-width: 0 !important;
  padding: 0 !important;
  border: 0 !important;
}
.lighting-group-code-column {
    color: #dc2626;
}
.table-actions-column {
    width: 250px;
    min-width: 250px;
    white-space: nowrap;
    text-align: right;
    position: sticky;
    right: 0;
    background: #ffffff;
    z-index: 2;
}
th.table-actions-column {
    z-index: 3;
    background: #f8fafc;
}
.table-actions-column .table-actions {
    flex-direction: row !important;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: nowrap;
}
.table-actions-column .table-actions button {
    white-space: nowrap;
    flex-shrink: 0;
}
.inline-edit-input,
.inline-edit-select {
    width: 100%;
    min-width: 60px;
    box-sizing: border-box;
    height: 32px;
    font-size: 13px;
}
.engineering-table-wrap {
    width: 100%;
    overflow-x: auto;
    position: relative;
}
.engineering-table-wrap table {
    min-width: max-content;
}
.engineering-table-wrap::before,
.engineering-table-wrap::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    width: 36px;
    pointer-events: none;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.2s;
}
.engineering-table-wrap::before {
    left: 0;
    background: linear-gradient(to right, rgba(15, 23, 42, 0.14), rgba(15, 23, 42, 0));
}
.engineering-table-wrap::after {
    right: 0;
    background: linear-gradient(to left, rgba(15, 23, 42, 0.14), rgba(15, 23, 42, 0));
}
.engineering-table-wrap.has-overflow-left::before,
.engineering-table-wrap.has-overflow-right::after {
    opacity: 1;
}
.lighting-filters-panel {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-end;
    padding: 10px 0;
    margin-bottom: 2px;
    border-bottom: 1px solid #e5e7eb;
}
.lighting-filter-label {
    display: inline-flex;
    flex-direction: column;
    font-size: 11px;
    color: #64748b;
    gap: 2px;
}
.lighting-filter-select {
    font-size: 12px;
    height: 28px;
    min-width: 90px;
    max-width: 160px;
    padding: 0 4px;
}
.lighting-filter-reset-btn {
    font-size: 12px;
    padding: 4px 10px;
    height: 28px;
    background: transparent;
    color: #dc2626;
    border: 1px solid #fca5a5;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
    margin-bottom: 0;
    align-self: flex-end;
}
.lighting-filter-reset-btn:hover {
    background: #fef2f2;
}
.lighting-filter-reset-btn.hidden {
    display: none;
}
.ets-preview-devices-table tr > td:first-child {
    display: table-cell !important;
    width: auto !important;
    min-width: auto !important;
    max-width: none !important;
    padding: 8px !important;
    border: 1px solid #ddd !important;
}
.cad-summary-grid {
    max-width: 420px;
    margin-top: 8px;
}
.cad-summary-row {
    display: grid;
    grid-template-columns: minmax(160px, 1fr) 70px;
    gap: 16px;
    padding: 3px 0;
    border-bottom: 1px solid #f1f5f9;
}
.cad-summary-label {
    font-weight: 500;
    color: #475569;
}
.cad-summary-value {
    font-weight: 600;
    color: #1e293b;
    text-align: right;
}
.cad-summary-table tr > td:first-child,
.cad-issues-table tr > td:first-child,
.cad-plan-table tr > td:first-child,
.cad-warnings-table tr > td:first-child,
.cad-fixtures-table tr > td:first-child {
    display: table-cell !important;
    width: auto !important;
    min-width: auto !important;
    max-width: none !important;
    padding: 8px !important;
    border: 1px solid #ddd !important;
}
.cad-summary-table tr > th:first-child,
.cad-issues-table tr > th:first-child,
.cad-plan-table tr > th:first-child,
.cad-warnings-table tr > th:first-child,
.cad-fixtures-table tr > th:first-child {
    display: table-cell !important;
    width: auto !important;
    min-width: auto !important;
    max-width: none !important;
    padding: 8px !important;
    border: 1px solid #ddd !important;
}