:root {
    color-scheme: light;
    --bg: #d8d8d8;
    --panel: #eeeeee;
    --card: #f8f8f8;
    --text: #222;
    --muted: #5e5e5e;
    --border: #b9b9b9;
    --border-strong: #777;
    --accent: #1d6fd6;
    --danger: #9d1b1e;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    background: #111;
    color: var(--text);
    font-family: Verdana, Geneva, Tahoma, sans-serif;
}

button,
input,
select,
textarea {
    font: inherit;
}

button,
.file-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    border: 1px solid var(--border-strong);
    border-radius: 4px;
    background: #f4f4f4;
    color: var(--text);
    padding: 6px 12px;
    cursor: pointer;
    box-shadow: 0 1px 0 rgba(0, 0, 0, .12);
    white-space: nowrap;
}

button:hover,
.file-button:hover {
    background: #fff;
}

button:disabled {
    color: #888;
    background: #d7d7d7;
    cursor: not-allowed;
}

input,
select,
textarea {
    border: 1px solid var(--border-strong);
    border-radius: 4px;
    background: #fff;
    color: var(--text);
    padding: 6px 8px;
}

textarea {
    width: 100%;
    resize: vertical;
}

.app-shell {
    min-height: 100vh;
    background: var(--bg);
    outline: none;
}

.topbar {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: center;
    min-height: 102px;
    border-bottom: 1px solid #aaa;
    padding: 18px 24px;
}

.topbar h1 {
    margin: 0 0 4px;
    font-size: 30px;
    line-height: 1.05;
}

.topbar p {
    margin: 0;
    color: var(--muted);
    font-size: 16px;
}

.top-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.workspace {
    display: grid;
    grid-template-columns: 290px minmax(0, 1fr) 330px;
    gap: 16px;
    padding: 16px 16px 18px;
}

.workspace.modules-hidden {
    grid-template-columns: minmax(0, 1fr) 330px;
}

.workspace.session-hidden {
    grid-template-columns: 290px minmax(0, 1fr);
}

.workspace.modules-hidden.session-hidden {
    grid-template-columns: minmax(0, 1fr);
}

.panel {
    border: 1px solid #aaa;
    background: var(--panel);
    padding: 14px;
}

.module-panel,
.session-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.module-panel h2,
.session-panel h2,
.mode-header h2 {
    margin: 0 0 8px;
    font-size: 18px;
}

.module-panel button {
    justify-content: flex-start;
}

.module-panel button.active {
    border-color: var(--accent);
    box-shadow: inset 4px 0 0 var(--accent), 0 1px 0 rgba(0, 0, 0, .12);
}

.module-panel hr {
    width: 100%;
    border: 0;
    border-top: 1px solid #999;
    margin: 8px 0;
}

.hint-card {
    display: grid;
    gap: 6px;
    margin-top: 18px;
    border: 1px solid #c4c4c4;
    background: #f6f6f6;
    padding: 12px;
    color: var(--muted);
}

.hint-card strong {
    color: var(--text);
}

.main-panel {
    min-width: 0;
}

.mode-header,
.session-title {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
}

.mode-tools,
.control-row,
.navigation-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.control-row {
    margin: 10px 0 12px;
}

.control-row label {
    display: inline-flex;
    gap: 6px;
    align-items: center;
}

.control-row input {
    width: 110px;
}

.file-button {
    position: relative;
    overflow: hidden;
}

.file-button input[type=file] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.file-button.primary {
    background: #fff;
    border-color: var(--accent);
}

.file-button.inline {
    width: fit-content;
}

.alert {
    margin: 12px 0;
    padding: 10px 12px;
    border: 1px solid var(--danger);
    background: #fff4f4;
    color: var(--danger);
}

.empty-state {
    display: grid;
    place-items: start;
    gap: 12px;
    min-height: 420px;
    border: 1px solid var(--border);
    background: #f7f7f7;
    padding: 28px;
}

.empty-state.compact {
    min-height: 260px;
}

.empty-state h3,
.empty-state p {
    margin: 0;
}

.plot-frame {
    width: 100%;
    overflow: hidden;
    border: 1px solid #c8c8c8;
    background: #fff;
}

.plot-svg {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1100 / 520;
    min-height: 360px;
}

.navigation-row {
    margin-top: 10px;
    border: 1px solid #c8c8c8;
    background: #f4f4f4;
    padding: 10px;
}

.navigation-row span {
    color: var(--muted);
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 14px;
}

.info-card {
    border: 1px solid #c4c4c4;
    background: var(--card);
    padding: 12px;
}

.info-card h3 {
    margin: 0 0 8px;
    font-size: 16px;
}

.info-card p {
    margin: 2px 0;
}

.info-card-content {
    display: grid;
    gap: 6px;
}

.session-panel .info-card {
    background: #f7f7f7;
}

.swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    align-items: center;
    margin-bottom: 8px;
}

.swatch {
    width: 26px;
    height: 26px;
    min-height: 26px;
    padding: 0;
    border: 2px solid #6f6f6f;
    border-radius: 3px;
    box-shadow: none;
}

.swatch:hover {
    background: inherit;
}

.swatch.selected {
    outline: 3px solid #111;
    outline-offset: 2px;
}

.color-input {
    width: 42px;
    height: 30px;
    padding: 2px;
}

.slider-field {
    display: grid;
    gap: 4px;
}

.slider-field input {
    width: 100%;
}

.check-line {
    display: flex;
    align-items: center;
    gap: 8px;
}

.check-line input {
    width: 18px;
    height: 18px;
}

.statusbar {
    border-top: 1px solid #aaa;
    padding: 10px 16px;
    min-height: 42px;
    background: #d0d0d0;
}

#blazor-error-ui {
    display: none;
    position: fixed;
    inset: auto 0 0 0;
    z-index: 1000;
    padding: 12px 16px;
    background: #fff4b8;
    border-top: 1px solid #d4b300;
}

@media (max-width: 1200px) {
    .workspace,
    .workspace.modules-hidden,
    .workspace.session-hidden,
    .workspace.modules-hidden.session-hidden {
        grid-template-columns: 1fr;
    }

    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .top-actions {
        flex-wrap: wrap;
    }

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