.settings-page-body {
    display: grid;
    gap: 10px;
}

.settings-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.settings-stat-card {
    min-width: 0;
    padding: 8px;
    background: #dfdfdf;
    border-top: 1px solid #ffffff;
    border-left: 1px solid #ffffff;
    border-right: 1px solid #808080;
    border-bottom: 1px solid #808080;
    box-shadow: inset 1px 1px 0 #f7f7f7, inset -1px -1px 0 #b0b0b0;
}

.settings-stat-card.is-info { background: linear-gradient(180deg, #d7e6fb, #bfd7f8); }
.settings-stat-card.is-ok { background: linear-gradient(180deg, #dbf4dc, #c3ebc5); }
.settings-stat-card.is-warning { background: linear-gradient(180deg, #fff1c9, #ffe39f); }
.settings-stat-card.is-danger { background: linear-gradient(180deg, #ffd8d8, #f1b3b3); }

.settings-stat-label {
    margin: 0 0 4px;
    font-size: 12px;
    line-height: 12px;
    text-transform: uppercase;
    color: #333333;
}

.settings-stat-value {
    margin: 0;
    font-size: 24px;
    line-height: 24px;
    font-weight: bold;
}

.settings-stat-note {
    margin: 6px 0 0;
    display: inline-flex;
    align-items: center;
    min-height: 18px;
    padding: 0 6px;
    color: #222222;
    background: rgba(255,255,255,.65);
    border-top: 1px solid #ffffff;
    border-left: 1px solid #ffffff;
    border-right: 1px solid #a0a0a0;
    border-bottom: 1px solid #a0a0a0;
    font-size: 12px;
    line-height: 12px;
}

.settings-main-grid {
    display: grid;
    grid-template-columns: 238px minmax(0, 1fr);
    gap: 10px;
    min-height: 0;
}

.settings-sidebar-panel {
    min-width: 0;
}

.settings-sidebar {
    position: sticky;
    top: 48px;
}

.settings-workbench {
    display: grid;
    gap: 10px;
    min-width: 0;
}

.settings-panel,
.settings-hero-panel {
    min-width: 0;
    background: #ffffff;
    border-top: 1px solid #808080;
    border-left: 1px solid #808080;
    border-right: 1px solid #ffffff;
    border-bottom: 1px solid #ffffff;
    box-shadow: inset 1px 1px 0 rgba(255,255,255,.7), inset -1px -1px 0 rgba(0,0,0,.08);
}

.settings-panel {
    display: flex;
    flex-direction: column;
}

.settings-panel-header {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 34px;
    padding: 6px 8px;
    background: #dfdfdf;
    border-bottom: 1px solid #b0b0b0;
    box-shadow: inset 1px 1px 0 #f7f7f7;
}

.settings-panel-title {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    min-height: 22px;
    font-weight: bold;
    font-size: 15px;
    line-height: 15px;
}

.settings-panel-sub {
    color: #444444;
    font-size: 12px;
    line-height: 12px;
    font-weight: normal;
}

.settings-panel-tools {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.settings-panel-body {
    flex: 1 1 auto;
    min-height: 0;
    padding: 10px;
    overflow: hidden;
    background-color: #ffffff;
    background-image: linear-gradient(180deg, rgba(255,255,255,.9), rgba(238,238,238,.58));
}

.settings-hero-panel {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr);
    gap: 10px;
    padding: 10px;
    background-image: linear-gradient(180deg, rgba(255,255,255,.92), rgba(238,238,238,.58));
}

.settings-hero-copy h2 {
    margin: 0 0 6px;
    font-size: 18px;
    line-height: 18px;
}

.settings-hero-copy p {
    margin: 0;
    color: #222222;
    font-size: 13px;
    line-height: 16px;
}

.settings-hero-legend {
    display: grid;
    gap: 6px;
}

.settings-legend-row {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #222222;
    font-size: 12px;
    line-height: 12px;
}

.settings-search {
    display: grid;
    gap: 6px;
    margin-bottom: 8px;
}

.settings-search label {
    font-weight: bold;
    font-size: 13px;
    line-height: 13px;
}

.settings-input,
.settings-select {
    width: 100%;
    min-width: 0;
    color: #000000;
    background: #ffffff;
    border-top: 1px solid #808080;
    border-left: 1px solid #808080;
    border-right: 1px solid #ffffff;
    border-bottom: 1px solid #ffffff;
    padding: 4px 6px;
    font-family: inherit;
    font-size: 13px;
}

.settings-input,
.settings-select {
    height: 28px;
}

.settings-category-list {
    display: grid;
    gap: 4px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.settings-category-button {
    width: 100%;
    min-height: 30px;
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr) auto;
    align-items: center;
    gap: 7px;
    padding: 4px 6px;
    color: #000000;
    background: #dfdfdf;
    border-top: 1px solid #ffffff;
    border-left: 1px solid #ffffff;
    border-right: 1px solid #808080;
    border-bottom: 1px solid #808080;
    font-family: inherit;
    text-align: left;
}

.settings-category-button.is-active {
    color: #ffffff;
    background: #000078;
    border-top-color: #000000;
    border-left-color: #000000;
    border-right-color: #ffffff;
    border-bottom-color: #ffffff;
}

.settings-category-count,
.settings-dirty-chip,
.settings-badge {
    display: inline-flex;
    align-items: center;
    min-height: 18px;
    padding: 0 6px;
    color: #222222;
    background: #f1f1f1;
    border-top: 1px solid #ffffff;
    border-left: 1px solid #ffffff;
    border-right: 1px solid #b0b0b0;
    border-bottom: 1px solid #b0b0b0;
    font-size: 12px;
    line-height: 12px;
}

.settings-category-button.is-active .settings-category-count {
    color: #000000;
    background: #ffffcc;
}

.settings-dirty-chip {
    min-width: 78px;
    justify-content: center;
}

.settings-dirty-chip.is-dirty {
    background: #ffffcc;
    border: 3px solid transparent;
    border-image: repeating-linear-gradient(45deg, #111111 0 8px, #ffcc00 8px 16px) 3;
}

.badge-default { background: #ececec; }
.badge-env { background: #c7d8f2; }
.badge-db { background: #d2efcf; }
.badge-hard { background: #ffd9d9; }

.settings-tool-button,
.settings-mini-button,
.settings-popup-close {
    min-width: 64px;
    height: 24px;
    padding: 0 8px;
    font-size: 12px;
    line-height: 12px;
}

.settings-action-summary {
    margin-bottom: 8px;
    padding: 8px;
    color: #000000;
    background: #ffffcc;
    border-top: 1px solid #ffffff;
    border-left: 1px solid #ffffff;
    border-right: 1px solid #a08000;
    border-bottom: 1px solid #a08000;
    font-size: 12px;
    line-height: 15px;
}

.settings-groups {
    display: grid;
    gap: 10px;
    min-height: 0;
    max-height: 700px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 2px;
}

.settings-group {
    display: grid;
    gap: 0;
}

.settings-group[hidden] {
    display: none;
}

.settings-group-title {
    min-height: 28px;
    padding: 6px 8px;
    color: #000000;
    background: #dfdfdf;
    border-top: 1px solid #ffffff;
    border-left: 1px solid #ffffff;
    border-right: 1px solid #808080;
    border-bottom: 1px solid #808080;
    font-weight: bold;
    font-size: 14px;
    line-height: 14px;
}

.settings-table-wrap {
    border-top: 2px solid #606060;
    border-left: 2px solid #606060;
    border-right: 2px solid #ffffff;
    border-bottom: 2px solid #ffffff;
    background: #ffffff;
}

.settings-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    color: #000000;
    font-size: 12px;
    line-height: 14px;
}

.settings-table th,
.settings-table td {
    padding: 6px;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid #e1e1e1;
}

.settings-table th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #dfdfdf;
    box-shadow: inset 0 1px 0 #ffffff;
}

.settings-table tbody tr:nth-child(odd) { background: rgba(255,255,255,.96); }
.settings-table tbody tr:nth-child(even) { background: rgba(240,244,255,.9); }
.setting-row.is-locked { color: #555555; background: #efefef; }
.setting-row.is-hidden { display: none; }
.setting-row.is-invalid { background: #fff1c9; }

.setting-meta {
    display: grid;
    gap: 4px;
}

.setting-meta strong {
    font-size: 13px;
    line-height: 13px;
}

.setting-meta code {
    color: #1b325f;
    font-size: 11px;
    line-height: 12px;
    word-break: break-word;
}

.setting-control {
    display: grid;
    gap: 4px;
}

.setting-input-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.setting-hint {
    color: #444444;
    font-size: 11px;
    line-height: 13px;
}

.setting-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.settings-modal-backdrop {
    position: fixed;
    inset: 0;
    display: none;
    background: rgba(0,0,0,.35);
    z-index: 90;
}

.settings-modal-backdrop.is-visible {
    display: block;
}

.settings-popup {
    position: fixed;
    left: 50%;
    top: 50%;
    width: min(520px, calc(100vw - 24px));
    display: none;
    transform: translate(-50%, -50%);
    color: #000000;
    background: var(--w98-gray);
    border-top: 2px solid #ffffff;
    border-left: 2px solid #ffffff;
    border-right: 2px solid #000000;
    border-bottom: 2px solid #000000;
    box-shadow: 6px 6px 0 rgba(0,0,0,.35);
    z-index: 95;
}

.settings-popup.is-visible {
    display: block;
}

.settings-popup-titlebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 28px;
    padding: 4px 6px;
    color: #ffffff;
    background: #000078;
}

.settings-popup-body {
    padding: 10px;
    background: #f5f5f5;
    font-size: 13px;
    line-height: 16px;
}

.settings-popup-body p,
.settings-popup-body ul {
    margin: 0 0 8px;
}

@media (max-width: 1100px) {
    .settings-summary-grid,
    .settings-main-grid,
    .settings-hero-panel {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .settings-sidebar-panel,
    .settings-workbench {
        grid-column: 1 / -1;
    }

    .settings-sidebar {
        position: static;
    }
}

@media (max-width: 720px) {
    .settings-summary-grid,
    .settings-main-grid,
    .settings-hero-panel {
        grid-template-columns: minmax(0, 1fr);
    }

    .settings-panel-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .settings-category-list {
        grid-template-columns: minmax(0, 1fr);
    }

    .settings-table-wrap {
        overflow-x: auto;
    }

    .settings-table {
        min-width: 760px;
    }
}
