:root {
    color-scheme: light;
    font-family: "Inter", "Segoe UI", system-ui, sans-serif;
    --bg: #b4b4b4;
    --panel: #e8e8e8;
    --panel-gradient: linear-gradient(180deg, #f0f0f0 0%, #e0e0e0 100%);
    --border: #333333;
    --muted: #5a5a5a;
    --accent: #4a5568;
    --accent-soft: rgba(74, 85, 104, 0.15);
    --text: #1a1a1a;
    --muted-border: #666666;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.2);
    --shadow-xl: 0 12px 24px rgba(0, 0, 0, 0.25);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(255, 255, 255, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(0, 0, 0, 0.05) 0%, transparent 50%);
    color: var(--text);
}

.hidden {
    display: none !important;
}

.cct-message--invalid {
    margin: 8px 0;
    padding: 8px 12px;
    border-width: 1px;
    border-style: solid;
    border-radius: 4px;
    color: red;
    border-color: red;
    background-color: rgba(255, 0, 0, 0.08);
}

.duv-message--unacceptable {
    margin: 8px 0;
    padding: 8px 12px;
    border-width: 1px;
    border-style: solid;
    border-radius: 4px;
    color: #cc5500;
    border-color: #cc5500;
    background-color: rgba(204, 85, 0, 0.08);
}

.app-shell {
    min-height: 100vh;
    padding: 0px 12px 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.app-header {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.app-header > div {
    display: flex;
    align-items: center;
    gap: 12px;
}

#app-title {
    display: flex;
    align-items: flex-end;
    gap: 12px;
}

.app-logo {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
}

.app-header h1 {
    margin: 0;
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.app-header .version {
    font-size: 0.85rem;
    color: var(--muted);
    font-weight: 500;
    padding: 2px 8px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0.1) 100%);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    margin-left: 4px;
    align-self: flex-end;
    box-shadow: var(--shadow-sm);
}

.app-header .tagline {
    margin: 8px 0 0;
    max-width: 600px;
    color: var(--muted);
}

.app-header__actions {
    display: flex;
    align-items: center;
    gap: 12px;
    align-self: center;
}

.ghost-button,
.primary-button {
    border-radius: 999px;
    font-weight: 600;
    border: 1px solid var(--border);
    padding: 10px 18px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.05) 100%);
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    position: relative;
}

.ghost-button:hover,
.primary-button:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.ghost-button:active,
.primary-button:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.primary-button:disabled,
.ghost-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.primary-button {
    background: linear-gradient(180deg, #5a6578 0%, var(--accent) 100%);
    border-color: var(--accent);
    color: #fff;
    box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.info-button {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    /* background: linear-gradient(180deg, #4a90e2 0%, #357abd 100%); */
    background: var(--accent);
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.info-button:hover {
    /* background: linear-gradient(180deg, #5aa0f2 0%, #458acd 100%); */
    background: var(--accent-soft);
    box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.4);
    /* transform: translateY(-1px); */
}

.info-button:active {
    /* transform: translateY(0); */
    box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.info-button:focus {
    outline: 2px solid #4a90e2;
    outline-offset: 2px;
}

.primary-button:hover {
    background: linear-gradient(180deg, #657085 0%, #556070 100%);
    box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.common-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    padding-bottom: 12px;
    border-bottom: 2px solid rgba(0, 0, 0, 0.15);
    box-shadow: 0 2px 0 rgba(255, 255, 255, 0.1);
}

.common-controls .control {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--muted);
}

.common-controls label {
    text-transform: uppercase;
    font-size: 0.65rem;
    letter-spacing: 0.08em;
}

select,
input {
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--panel-gradient);
    color: var(--text);
    padding: 10px 14px;
    font-size: 1rem;
    transition: all 0.2s ease;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1), 0 1px 0 rgba(255, 255, 255, 0.5);
}

select:focus,
input:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1), 0 1px 0 rgba(255, 255, 255, 0.5), 0 0 0 3px rgba(74, 85, 104, 0.2);
}

select:hover,
input:hover {
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.12), 0 1px 0 rgba(255, 255, 255, 0.6);
}

.tab-bar {
    display: flex;
    gap: 8px;
    border-bottom: 2px solid rgba(0, 0, 0, 0.15);
    overflow-x: visible;
    box-shadow: 0 2px 0 rgba(255, 255, 255, 0.1);
    flex-wrap: wrap;
}

.tab-bar::-webkit-scrollbar {
    height: 4px;
}

.tab-bar::-webkit-scrollbar-track {
    background: transparent;
}

.tab-bar::-webkit-scrollbar-thumb {
    background: var(--muted-border);
    border-radius: 2px;
}

.tab {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 1.2rem;
    padding: 8px 10px;
    background: linear-gradient(180deg, #d0d0d0 0%, #c0c0c0 100%);
    border-radius: 12px 12px 0 0;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-bottom: none;
    color: var(--muted);
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
    box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
}

.tab-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1em;
    line-height: 1;
    flex-shrink: 0;
}

.tab-icon img {
    width: 18px;
    height: 18px;
    display: block;
}

.tab-label {
    display: inline-block;
}

.tab:hover:not(.active) {
    background: linear-gradient(180deg, #d8d8d8 0%, #c8c8c8 100%);
    box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.15);
}

.tab.active {
    background: var(--panel-gradient);
    color: var(--text);
    border-color: var(--border);
    border-bottom-color: var(--panel);
    box-shadow: 0 -4px 8px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.5);
    z-index: 1;
}

/* .tab-panels {

    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px 12px 12px 12px;
    padding: 12px;
    min-height: 500px;
} */

.tab-panel {
    display: none;
}

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

.editor-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
}

.editor-tab-panel {
    display: none;
}

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

.panel-heading h2 {
    margin: 0 0 8px;
}

.panel-heading-title {
    display: flex;
    /* align-items: center; */
    gap: 12px;
}

.panel-heading p {
    margin: 0 0 8px;
    color: var(--muted);
}

.library-database-actions {
    margin-top: 4px;
}

#load-large-database-btn:disabled {
    opacity: 0.7;
    cursor: default;
}

.library-layout,
.editor-layout {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.spectral-list,
.spectral-detail,
.editor-card,
.editor-preview {
    background: var(--panel-gradient);
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.2);
    padding: 16px;
    box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.6);
    transition: box-shadow 0.2s ease;
}

.spectral-list:hover,
.spectral-detail:hover,
.editor-card:hover,
.editor-preview:hover {
    box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.spectral-list .list-header,
.spectral-detail .detail-heading,
.editor-preview h3,
.editor-column h3 {
    margin: 0 0 12px;
}

.list-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 420px;
    overflow-y: auto;
    padding-right: 4px;
}

.list-table-wrapper {
    max-height: 560px;
    overflow-y: auto;
}

.spectral-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.spectral-table th,
.spectral-table td {
    padding: 8px 6px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    font-size: 0.85rem;
    vertical-align: middle;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    overflow: hidden;
    max-width: 0;
}

.spectral-table th {
    letter-spacing: 0.08em;
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--text);
}

.spectral-table tr.list-row {
    transition: background 0.2s ease;
}

.spectral-table tr.list-row.selected {
    background: linear-gradient(90deg, rgba(95, 120, 255, 0.15) 0%, rgba(95, 120, 255, 0.08) 100%);
    box-shadow: inset 3px 0 0 rgba(95, 120, 255, 0.5);
}

.spectral-table tr.list-row:hover:not(.selected) {
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
    box-shadow: inset 2px 0 0 rgba(0, 0, 0, 0.1);
}

.spectral-table td strong {
    display: block;
}

.list-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-bottom: 12px;
}

.list-filters input:not([type="checkbox"]),
.list-filters select {
    flex: 1 1 160px;
}

.filter-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    cursor: pointer;
    user-select: none;
    padding: 8px 12px;
    border-radius: 8px;
    transition: all 0.2s ease;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.filter-checkbox:hover {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0.1) 100%);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.filter-checkbox input[type="checkbox"] {
    flex: 0 0 auto !important;
    width: 18px !important;
    height: 18px !important;
    margin: 0 !important;
    padding: 0 !important;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--panel-gradient);
    position: relative;
    transition: all 0.2s ease;
    box-sizing: border-box;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 0 rgba(255, 255, 255, 0.5);
}

.filter-checkbox input[type="checkbox"]:hover {
    border-color: var(--accent);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.12), 0 1px 0 rgba(255, 255, 255, 0.6);
}

.filter-checkbox input[type="checkbox"]:checked {
    background: linear-gradient(180deg, #5a6578 0%, var(--accent) 100%);
    border-color: var(--accent);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3), 0 1px 0 rgba(255, 255, 255, 0.3);
}

.filter-checkbox input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.filter-checkbox input[type="checkbox"]:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.filter-checkbox span {
    font-size: 0.9rem;
    color: var(--text);
    white-space: nowrap;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    padding-top: 12px;
    border-top: 2px solid rgba(0, 0, 0, 0.15);
    margin-top: 12px;
    box-shadow: 0 -2px 0 rgba(255, 255, 255, 0.1);
}

.pagination [data-pagination-info] {
    display: flex;
    align-items: center;
    gap: 4px;
}

.pagination [data-pagination-info] input[type="number"] {
    width: 50px;
    padding: 4px 6px;
    text-align: center;
    font-size: 0.9rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--panel-gradient);
    color: var(--text);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 0 rgba(255, 255, 255, 0.5);
    /* Remove spinner arrows */
    -moz-appearance: textfield;
    appearance: textfield;
}

.pagination [data-pagination-info] input[type="number"]::-webkit-outer-spin-button,
.pagination [data-pagination-info] input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.pagination [data-pagination-info] input[type="number"]:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
    border-color: var(--accent);
}

.detail-selected {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.detail-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.control-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text);
}

.control-field select {
    border: 1px solid var(--border);
    padding: 6px 10px;
    border-radius: 8px;
    background: var(--panel-gradient);
    color: var(--text);
    font-size: 0.85rem;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 0 rgba(255, 255, 255, 0.5);
    transition: all 0.2s ease;
}

.control-field select:hover {
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.12), 0 1px 0 rgba(255, 255, 255, 0.6);
}

.control-field select:focus {
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 0 rgba(255, 255, 255, 0.5), 0 0 0 3px rgba(74, 85, 104, 0.2);
}

.chip {
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(95, 95, 95, 0.2) 0%, rgba(95, 95, 95, 0.1) 100%);
    color: var(--text);
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: var(--shadow-sm);
}

.spectral-detail {
    display: flex;
    flex-direction: column;
}

.overview-label {
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.detail-chart {
    min-height: 220px;
    /* border: 1px dashed var(--border); */
    display: flex;
    align-items: center;
    overflow: hidden;
    position: relative;
    justify-content: center;
    font-size: 0.9rem;
    color: var(--muted);
}

.detail-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.detail-table th,
.detail-table td {
    padding: 2px;
    border-bottom: 1px solid var(--muted-border);
    text-align: left;
}

.detail-table th {
    /* text-transform: uppercase; */
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    color: var(--text);
}

.color-patch-button {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    cursor: pointer;
    padding: 0;
    position: relative;
    background-color: inherit;
}

.color-patch-button:hover {
    border-color: rgba(0, 0, 0, 0.4);
    box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.4);
    transform: scale(1.05);
}

.color-patch-cross {
    display: none;
    color: #ff0000;
    font-size: 24px;
    font-weight: bold;
    line-height: 1;
    text-shadow: 0 0 2px rgba(0, 0, 0,1), 0 0 4px rgba(0, 0, 0, 1);
    pointer-events: none;
}

.color-patch-button:hover .color-patch-cross {
    display: block;
}

.editor-layout {
    grid-template-columns: 320px 1fr;
}

.editor-column {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.editor-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.editor-card p {
    margin: 0;
    color: var(--muted);
}

.file-input {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 16px;
    border-radius: 12px;
    border: 2px dashed rgba(0, 0, 0, 0.3);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.file-input:hover {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.08) 100%);
    border-color: var(--accent);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.file-input input {
    display: none;
}

.editor-field-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 4px;
}

.editor-field-group input.invalid,
.editor-field-group select.invalid {
    border-color: #d32f2f;
    background-color: rgba(211, 47, 47, 0.05);
}

.editor-field-group input.invalid:focus,
.editor-field-group select.invalid:focus {
    outline-color: #d32f2f;
    border-color: #d32f2f;
}

.editor-actions {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--muted-border, rgba(255, 255, 255, 0.1));
}

.editor-actions .muted-note {
    margin-top: 8px;
    margin-bottom: 0;
}

#add-to-library-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#generator-params-container {
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 16px;
    padding-top: 0;
    /* margin-top: 16px; */
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0.1) 100%);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1), 0 1px 0 rgba(255, 255, 255, 0.5);
}

.muted-note {
    margin: 0;
    font-size: 0.85rem;
    color: var(--muted);
}

.editor-preview .detail-table th,
.editor-preview .detail-table td {
    color: var(--text);
}

@media (max-width: 1024px) {
    .library-layout,
    .editor-layout {
        grid-template-columns: 1fr;
    }

    .tab {
        font-size: 1rem;
        padding: 8px 12px;
        min-width: 48px;
    }
    
    .tab-label {
        display: none;
    }
    
    .tab-icon {
        font-size: 1.3em;
    }
    
    .tab-icon img {
        width: 20px;
        height: 20px;
    }
}

@media (max-width: 640px) {
    .app-shell {
        padding: 0px 8px 8px 8px;
    }

    .tab-panels {
        padding: 8px;
    }

    .tab {
        font-size: 0.9rem;
        padding: 8px 10px;
        min-width: 44px;
    }
    
    .tab-label {
        display: none;
    }
    
    .tab-icon {
        font-size: 1.4em;
    }
    
    .tab-icon img {
        width: 22px;
        height: 22px;
    }

    .app-header h1 {
        font-size: 1.8rem;
    }

    .app-logo {
        width: 40px;
        height: 40px;
    }

    .app-header .version {
        font-size: 0.75rem;
        padding: 2px 6px;
    }

    .detail-summary {
        flex-direction: column;
    }
}

/* Color Rendition Module Styles */
.rendition-tabs,
.rendition-metric-tabs {
    display: flex;
    gap: 8px;
    border-bottom: 2px solid rgba(0, 0, 0, 0.15);
    margin-bottom: 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: 0 2px 0 rgba(255, 255, 255, 0.1);
}

.rendition-tab-container {
    display: flex;
    align-items: flex;
    gap: 0;
    position: relative;
    background: linear-gradient(180deg, #d0d0d0 0%, #c0c0c0 100%);
    border-radius: 12px 12px 0 0;
    border: 1px solid rgba(0, 0, 0, 0.25);
    border-bottom: none;
    box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.15);
    transition: none;
}
.rendition-tab-container.active {
    background: var(--panel-gradient);
    border-color: var(--border);
    border-bottom-color: var(--panel);
    /* box-shadow: 0 -4px 8px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.5); */
    z-index: 1;
}

.rendition-tabs .tab {
    flex: 0 1 auto;
    min-width: auto;
    padding: 8px 8px 8px 10px;
    font-size: 0.95rem;
    white-space: nowrap;
    background: transparent;
    border: none;
    border-radius: 0;
    color: var(--text);
    font-weight: 600;
    cursor: pointer;
    transition: none;
    box-shadow: none;
}
.rendition-tabs .tab:hover {
    background: transparent;
    box-shadow: none;
}

.rendition-metric-tabs .tab {
    flex: 0 1 auto;
    min-width: auto;
    padding: 8px 8px 8px 10px;
    font-size: 0.95rem;
    white-space: nowrap;
    background: rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 6px 6px 0 0;
    color: var(--text);
    font-weight: 600;
    cursor: pointer;
    transition: none;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.08);
}
.rendition-metric-tabs .tab:hover {
    background: rgba(0, 0, 0, 0.12);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.08);
}
.rendition-metric-tabs .tab.active {
    background: transparent;
    border-color: var(--border);
    border-bottom-color: var(--panel);
    box-shadow: none;
}

.tab-close {
    background: transparent;
    border: none;
    font-size: 1.2rem;
    line-height: 1;
    color: var(--text);
    cursor: pointer;
    padding: 0px 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0;
    transition: opacity 0.2s ease, background-color 0.2s ease;
    opacity: 0;
    visibility: hidden;
    flex-shrink: 0;
    width: 24px;
    min-width: 24px;
    overflow: hidden;
    box-shadow: none;
}

.rendition-tab-container:hover .tab-close {
    opacity: 1;
    visibility: visible;
}

.rendition-tab-container:hover .tab-close:hover {
    background: rgba(0, 0, 0, 0.15);
    opacity: 1;
    border-radius: 4px;
}

.tab-close:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.rendition-content {
    min-height: 400px;
}

.rendition-tab-panel[data-rendition-tab-panel] {
    display: none;
}

.rendition-tab-panel[data-rendition-tab-panel].active {
    display: block;
}

.rendition-tab-panel h3 {
    margin: 0 0 16px;
    font-size: 1.3rem;
    color: var(--text);
}

.rendition-plots {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
}

.rendition-plot {
    background: var(--panel-gradient);
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 8px;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.6);
    transition: box-shadow 0.2s ease;
    box-sizing: border-box;
    flex: 0 1 auto;
}

.diagram-select-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    padding: 4px 0;
}

.diagram-select-container label {
    color: var(--text);
    white-space: nowrap;
}

.diagram-select-container select {
    flex: 1;
    padding: 4px 8px;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    background: var(--panel-gradient);
    color: var(--text);
    font-size: 0.9rem;
    cursor: pointer;
}

.rendition-plot [data-plot-CIE-3d],
.rendition-plot [data-plot-CIE-2d] {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    width: 100%;
    position: relative;
    overflow: hidden;
}

.rendition-plot [data-plot-CIE-3d] > div,
.rendition-plot [data-plot-CIE-2d] > div {
    width: 100%;
    height: 100%;
    position: relative;
}

.rendition-plot [data-plot-CIE-3d] canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
    object-fit: contain;
}

.rendition-plot canvas {
    max-width: 100%;
    height: auto;
}

.rendition-plot:hover {
    box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.rendition-plot h4 {
    margin: 0 0 12px;
    font-size: 1.1rem;
    color: var(--text);
}

@media (max-width: 768px) {
    .rendition-plots {
        flex-direction: column;
    }
    
    .rendition-plot {
        width: 100%;
    }
}

/* Dialog Styles */
.dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.dialog.active {
    opacity: 1;
    visibility: visible;
}

.dialog-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.dialog-content {
    position: relative;
    background: var(--panel-gradient);
    border: 1px solid rgba(0, 0, 0, 0.3);
    border-radius: 16px;
    /* max-width: 600px; */
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl), inset 0 1px 0 rgba(255, 255, 255, 0.6);
    z-index: 1001;
    transform: scale(0.95);
    transition: transform 0.2s ease;
}

.dialog.active .dialog-content {
    transform: scale(1);
}

.dialog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 2px solid rgba(0, 0, 0, 0.15);
    box-shadow: 0 2px 0 rgba(255, 255, 255, 0.1);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.1) 0%, transparent 100%);
}

.dialog-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text);
}

.dialog-close {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
    border: 1px solid rgba(0, 0, 0, 0.1);
    font-size: 2rem;
    line-height: 1;
    color: var(--text);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.dialog-close:hover {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0.1) 100%);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.dialog-close:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.dialog-close:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.dialog-body {
    padding: 24px;
}

.dialog-body section {
    margin-bottom: 24px;
}

.dialog-body section:last-child {
    margin-bottom: 0;
}

.dialog-body h3 {
    margin: 0 0 12px 0;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text);
}

.dialog-body p {
    margin: 0 0 12px 0;
    line-height: 1.6;
    color: var(--text);
}

.dialog-body ul {
    margin: 12px 0;
    padding-left: 24px;
    color: var(--text);
}

.dialog-body li {
    margin-bottom: 8px;
    line-height: 1.5;
}

/* Material Color Rendition Styles */
.material-color-group {
    margin-bottom: 24px;
}

.material-color-group:last-child {
    margin-bottom: 0;
}

.material-color-group-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 12px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.material-color-grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 4px;
    padding: 0px;
}

.material-color-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.material-color-patch {
    width: 100px;
    height: 100px;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.2);
    box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    flex-shrink: 0;
}

.material-color-label {
    font-size: 0.85rem;
    color: var(--text);
    text-align: center;
    word-break: break-word;
    max-width: 100px;
}

.database-status {
    background: var(--panel);
    color: var(--text);
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 20px;
    pointer-events: none;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    align-self: center;
}

.database-status-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.database-status.loading .database-status-icon {
    animation: rotate 1s linear infinite;
}

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

.database-status-text {
    white-space: nowrap;
}

/* Sensor Color Transform Matrix */
#sensor-matrix{
    display: inline-block;
}

#sensor-matrix h3 {
    margin: 4px 0 12px 0;
    font-size: 1rem;
    color: var(--text);
    /* width: 100%; */
}

#sensor-matrix table {
    border-collapse: collapse;
    margin: 0;
    /* font-family: 'Courier New', 'Consolas', monospace; */
    font-size: 1.0rem;
    position: relative;
    border: 2px solid rgba(0, 0, 0, 0.15);
}

#sensor-matrix table th {
    padding: 8px;
    font-size: 0.9rem;
    text-align: center;
    border: 1px solid rgba(0, 0, 0, 0.15);

}
#sensor-matrix table td {
    padding: 8px;
    text-align: center;
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(0, 0, 0, 0.15);
    min-width: 100px;
}

#sensor-matrix button {
    display: block;
    margin: 8px;
}

#sensor-color-difference{
    display: inline-block;
}

#sensor-color-difference h3 {
    margin: 4px 0 12px 0;
    font-size: 1rem;
    color: var(--text);
    /* width: 100%; */
}

.diagram-label {
    position: absolute;
    background-color: rgba(0,0,0,0);
    color: var(--text);
    /* padding: 4px 8px;
    border-radius: 4px; */
    font-size: 1.0rem;
    pointer-events: none;
    /* z-index: 1000; */
    white-space: nowrap;
    /* font-weight: 600; */

}