.lh-panel {
    margin: 14px;
}

.lh-panel .panel-header {
    margin-bottom: 14px;
}

.lh-panel .panel-header h1 {
    font-size: 28px;
    font-weight: 700;
}

.lh-subtitle {
    margin-top: 6px;
    color: #6b7280;
    font-size: 13px;
}

.lh-panel .wrap {
    background: #ffffff;
    border: 1px solid #e8ebf3;
    border-radius: 10px;
    padding: 18px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

.setup-notice {
    background: #fff7e6;
    border: 1px solid #f1d18a;
    color: #7a5412;
    border-radius: 8px;
    padding: 16px;
    line-height: 1.6;
	margin-bottom: 10px;
}

.setup-notice code {
    display: block;
    margin-top: 10px;
    background: #1f2937;
    color: #d1fae5;
    padding: 10px 12px;
    border-radius: 6px;
    white-space: pre-wrap;
    word-break: break-word;
}

.stats,
.score-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.sc {
    min-width: 110px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px 14px;
}

.sc .n {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.1;
    color: #111827;
}

.sc .l {
    margin-top: 4px;
    font-size: 12px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.cn-pass,
.cn-good {
    color: #16a34a;
}

.cn-fail,
.cn-bad {
    color: #dc2626;
}

.cn-grey {
    color: #6b7280;
}

.cn-mid {
    color: #d97706;
}

.lh-panel .toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 16px;
}

.lh-panel .toolbar input[type="text"] {
    width: 260px;
    flex: 0 0 260px;
    min-width: 220px;
    min-height: 36px;
    padding: 0 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #ffffff;
    font-size: 13px;
}

.lh-panel .toolbar select {
    width: auto;
    min-width: 170px;
    flex: 0 0 auto;
    min-height: 36px;
    padding: 0 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #ffffff;
    font-size: 13px;
}

.lh-panel .toolbar .btn {
    width: auto;
    min-width: 0;
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #ffffff;
    cursor: pointer;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.lh-panel .toolbar .btn.active {
    background: #111827;
    color: #ffffff;
    border-color: #111827;
}

.lh-panel .toolbar .rc {
    margin-left: auto;
    width: auto;
    flex: 0 0 auto;
    white-space: nowrap;
    font-size: 12px;
    color: #6b7280;
}

.tbl-wrap {
    overflow-x: auto;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.tbl-wrap tbody tr {
    cursor: pointer;
}

.tbl-wrap tbody tr .btn-reset {
    cursor: pointer;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
}

thead th {
    background: #f9fafb;
    text-align: left;
    padding: 11px 12px;
    font-size: 12px;
    font-weight: 700;
    color: #374151;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

tbody td {
    padding: 11px 12px;
    border-top: 1px solid #f1f5f9;
    font-size: 13px;
    vertical-align: middle;
    white-space: nowrap;
}

tbody tr:hover {
    background: #fafcff;
}

.empty td {
    text-align: center;
    color: #6b7280;
    padding: 28px 12px;
}

.badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.bp {
    background: #dcfce7;
    color: #166534;
}

.bf {
    background: #fee2e2;
    color: #991b1b;
}

.be {
    background: #e5e7eb;
    color: #374151;
}

.score-good,
.score-mid,
.score-bad {
    font-weight: 700;
}

.score-good {
    color: #16a34a;
}

.score-mid {
    color: #d97706;
}

.score-bad {
    color: #dc2626;
}

.score-na {
    color: #9ca3af;
}

.reset-col {
    text-align: right;
}

.btn-reset {
    width: 30px;
    height: 30px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #ffffff;
    cursor: pointer;
}

/* ==========================================================================
   Popup
   ========================================================================== */

#ov.overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    padding: 24px;
    background: rgba(17, 24, 39, 0.55);
    align-items: center;
    justify-content: center;
}

#ov.overlay.show {
    display: flex;
}

#ov.overlay .popup {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    bottom: auto;
    z-index: auto;
    width: min(1180px, 96vw);
    max-width: 1180px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin: auto;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.22);
}

.pop-hd {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding: 18px 20px;
    border-bottom: 1px solid #e5e7eb;
}

.pop-hd h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.2;
}

.pop-close {
    border: none;
    background: transparent;
    font-size: 22px;
    cursor: pointer;
}

.pop-body {
    padding: 20px;
    overflow: auto;
}

.pop-meta {
    margin-top: 6px;
    color: #6b7280;
    font-size: 13px;
}

.tabbar,
.modebar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.tabbar button,
.modebar button {
    min-height: 34px;
    padding: 0 12px;
    border: 1px solid #d1d5db;
    border-radius: 999px;
    background: #ffffff;
    cursor: pointer;
}

.tabbar button.active,
.modebar button.active {
    background: #111827;
    color: #ffffff;
    border-color: #111827;
}

.audit-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.audit-score {
    min-width: 120px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px;
    text-align: center;
}

.audit-score .n {
    font-size: 28px;
    font-weight: 700;
}

.audit-score .l {
    margin-top: 4px;
    font-size: 12px;
    color: #6b7280;
    text-transform: uppercase;
}

.audit-item {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
}

.audit-item.warn {
    border-color: #facc15;
}

.audit-title {
    font-weight: 700;
    margin-bottom: 6px;
}

.audit-desc {
    color: #4b5563;
    line-height: 1.55;
    font-size: 13px;
}

.audit-val {
    color: #111827;
    font-size: 12px;
    margin-bottom: 6px;
}

.loading,
.none {
    color: #6b7280;
    padding: 8px 0;
}

/* ==========================================================================
   Dark mode overrides aligned to WMD SED dark theme
   ========================================================================== */

body.dark-mode .lh-panel .wrap {
    background: var(--content-background-color);
    color: var(--content-text-color);
    border: 1px solid var(--border-color);
    box-shadow: var(--subtle-box-shadow);
    backdrop-filter: var(--content-backdrop-filter);
}

body.dark-mode .lh-panel .panel-header h1 {
    color: var(--heading-text-color);
}

body.dark-mode .lh-subtitle {
    color: var(--subheading-text-color);
}

body.dark-mode .setup-notice {
    background: rgba(251, 191, 36, 0.10);
    border: 1px solid var(--btn-border-color-danger);
    color: #fde68a;
}

body.dark-mode .setup-notice code {
    background: rgba(15, 23, 42, 0.85);
    color: #e0e7ff;
    border: 1px solid rgba(129, 140, 248, 0.25);
}

body.dark-mode .sc,
body.dark-mode .audit-score {
    background: var(--panel-background-color);
    border: 1px solid var(--border-color);
    box-shadow: var(--subtle-box-shadow);
}

body.dark-mode .sc .n,
body.dark-mode .audit-score .n {
    color: var(--heading-text-color);
}

body.dark-mode .sc .l,
body.dark-mode .audit-score .l {
    color: var(--subheading-text-color);
}

body.dark-mode .cn-pass,
body.dark-mode .cn-good {
    color: var(--metric-ok);
}

body.dark-mode .cn-fail,
body.dark-mode .cn-bad {
    color: var(--metric-critical);
}

body.dark-mode .cn-grey {
    color: var(--chart-axis);
}

body.dark-mode .cn-mid {
    color: var(--metric-warning);
}

body.dark-mode .lh-panel .toolbar input[type="text"],
body.dark-mode .lh-panel .toolbar select {
    background: var(--form-control-background-color);
    color: var(--form-control-color);
    border: 1px solid var(--form-control-border-color);
}

body.dark-mode .lh-panel .toolbar input[type="text"]::placeholder {
    color: var(--form-control-placeholder-color);
}

body.dark-mode .lh-panel .toolbar input[type="text"]:focus,
body.dark-mode .lh-panel .toolbar select:focus {
    border-color: var(--form-control-border-focus-color);
    outline: 1px solid var(--form-control-outline-color);
    outline-offset: 0;
}

body.dark-mode .lh-panel .toolbar .btn {
    background: var(--btn-background-color-default);
    color: var(--btn-color-default);
    border: var(--button-border);
    box-shadow: var(--button-box-shadow);
}

body.dark-mode .lh-panel .toolbar .btn:hover {
    background: var(--btn-hover-background-color-default);
    color: var(--btn-hover-color-default);
}

body.dark-mode .lh-panel .toolbar .btn.active {
    background: var(--btn-active-background-color-display-group);
    color: var(--btn-active-color-display-group);
    border-color: var(--btn-border-color-display-group);
}

body.dark-mode .lh-panel .toolbar .rc {
    color: var(--subheading-text-color);
}

body.dark-mode .tbl-wrap {
    border: 1px solid var(--border-color);
    background: var(--panel-background-color);
}

body.dark-mode table {
    background: transparent;
}

body.dark-mode thead th {
    background: var(--table-row-header-background-color);
    color: var(--table-row-header-text-color);
    border-bottom: 1px solid var(--table-row-border-color);
}

body.dark-mode tbody tr:nth-child(odd) {
    background: var(--table-row-background-odd);
    color: var(--table-row-text-odd);
}

body.dark-mode tbody tr:nth-child(even) {
    background: var(--table-row-background-even);
    color: var(--table-row-text-even);
}

body.dark-mode tbody td {
    border-top: 1px solid var(--table-row-border-color);
}

body.dark-mode tbody tr:hover {
    background: var(--table-row-background-hover);
    color: var(--table-row-color-hover);
}

body.dark-mode .badge.bp {
    background: rgba(22, 163, 74, 0.18);
    color: var(--btn-color-success);
    border: 1px solid var(--btn-border-color-success);
}

body.dark-mode .badge.bf {
    background: rgba(220, 38, 38, 0.18);
    color: var(--btn-color-danger);
    border: 1px solid var(--btn-border-color-danger);
}

body.dark-mode .badge.be {
    background: rgba(148, 163, 184, 0.10);
    color: var(--btn-color-cancel);
    border: 1px solid var(--btn-border-color-cancel);
}

body.dark-mode .score-good {
    color: var(--metric-ok);
}

body.dark-mode .score-mid {
    color: var(--metric-warning);
}

body.dark-mode .score-bad {
    color: var(--metric-critical);
}

body.dark-mode .score-na {
    color: var(--chart-axis);
}

body.dark-mode .btn-reset {
    background: var(--btn-background-color-cancel);
    color: var(--btn-color-cancel);
    border: 1px solid var(--btn-border-color-cancel);
}

body.dark-mode .btn-reset:hover {
    background: var(--btn-hover-background-color-cancel);
    color: var(--btn-hover-color-cancel);
}

body.dark-mode #ov.overlay {
    background: rgba(0, 0, 0, 0.65);
}

body.dark-mode #ov.overlay .popup {
    background: var(--popup-background-color);
    color: var(--popup-text-color);
    box-shadow: var(--popup-box-shadow);
    border: 1px solid var(--border-color);
}

body.dark-mode .pop-hd {
    border-bottom: 1px solid var(--border-color);
}

body.dark-mode .pop-hd h2 {
    color: var(--heading-text-color);
}

body.dark-mode .pop-meta {
    color: var(--subheading-text-color);
}

body.dark-mode .pop-close {
    color: var(--content-text-color);
}

body.dark-mode .tabbar button,
body.dark-mode .modebar button {
    background: var(--btn-background-color-default);
    color: var(--btn-color-default);
    border: 1px solid var(--btn-border-color-display-group);
}

body.dark-mode .tabbar button:hover,
body.dark-mode .modebar button:hover {
    background: var(--btn-hover-background-color-default);
    color: var(--btn-hover-color-default);
}

body.dark-mode .tabbar button.active,
body.dark-mode .modebar button.active {
    background: var(--btn-active-background-color-display-group);
    color: var(--btn-active-color-display-group);
    border-color: var(--btn-border-color-display-group);
}

body.dark-mode .audit-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
}

body.dark-mode .audit-item.warn {
    border-color: var(--metric-warning);
    background: rgba(251, 191, 36, 0.08);
}

body.dark-mode .audit-title {
    color: var(--heading-text-color);
}

body.dark-mode .audit-desc,
body.dark-mode .audit-val,
body.dark-mode .loading,
body.dark-mode .none {
    color: var(--content-text-color);
}

@media (max-width: 900px) {
    .stats,
    .score-stats,
    .audit-grid {
        gap: 10px;
    }

    .sc,
    .audit-score {
        min-width: calc(50% - 5px);
    }
}

@media (max-width: 640px) {
    .lh-panel {
        margin: 10px;
    }

    .lh-panel .wrap {
        padding: 14px;
    }

    .lh-panel .panel-header h1 {
        font-size: 24px;
    }

    .lh-panel .toolbar {
        align-items: stretch;
    }

    .lh-panel .toolbar input[type="text"],
    .lh-panel .toolbar select,
    .lh-panel .toolbar .btn {
        width: 100%;
        flex: 1 1 100%;
    }

    .lh-panel .toolbar .rc {
        margin-left: 0;
        width: 100%;
    }

    .sc,
    .audit-score {
        min-width: 100%;
    }

    #ov.overlay {
        padding: 10px;
    }

    #ov.overlay .popup {
        width: 100%;
        max-width: none;
        max-height: 92vh;
        border-radius: 8px;
    }

    .pop-hd,
    .pop-body {
        padding: 14px;
    }
}