/* ================================================================
   HES Noise Predictor — Sonic Architect Design System
   Surfaces: #f8f9fa (base) › #f3f4f5 (low) › #ffffff (card)
   Primary: #002462  Container: #143a84  Gradient: 135deg
   Text: #191c1d (on-surface)   Link/Focus: #0061a6
   Accent (CTA only): #ec7018
================================================================ */

/* ── Reset & tokens ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

:root {
    --surface:            #f8f9fa;
    --surface-low:        #f3f4f5;
    --surface-card:       #ffffff;
    --primary:            #002462;
    --primary-container:  #143a84;
    --gradient-primary:   linear-gradient(135deg, #143a84 0%, #002462 100%);
    --on-primary:         #ffffff;
    --on-surface:         #191c1d;
    --on-surface-muted:   #6b7280;
    --secondary:          #0061a6;
    --accent:             #ec7018;
    --success:            #166534;
    --success-bg:         #dcfce7;
    --danger:             #991b1b;
    --danger-bg:          #fee2e2;
    --radius:             4px;
    --shadow-ambient:     0 16px 32px rgba(0, 36, 98, 0.06);
}

body {
    font-family: 'Inter', Arial, sans-serif;
    background-color: var(--surface);
    color: var(--on-surface);
    margin: 0;
    padding: 0;
    font-size: 15px;
    line-height: 1.5;
}

h1, h2, h3, h4,
.section-heading,
.prediction-heading {
    font-family: 'Manrope', Arial, sans-serif;
}

/* ── App shell ──────────────────────────────────────────────── */
.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Navbar ─────────────────────────────────────────────────── */
.hes-navbar {
    background: var(--gradient-primary);
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    flex-shrink: 0;
}

.navbar-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-box {
    background-color: var(--accent);
    color: #fff;
    font-family: 'Manrope', Arial, sans-serif;
    font-size: 14px;
    font-weight: 800;
    padding: 5px 9px;
    border-radius: var(--radius);
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.logo-brand {
    color: rgba(255,255,255,0.85);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1.8px;
    text-transform: uppercase;
    font-family: 'Inter', Arial, sans-serif;
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.navbar-disclaimer-btn {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.35);
    color: rgba(255,255,255,0.85);
    font-family: 'Inter', Arial, sans-serif;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.05em;
    padding: 4px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.navbar-disclaimer-btn:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.6);
}

.navbar-linkedin {
    display: flex;
    align-items: center;
    opacity: 0.75;
    transition: opacity 0.15s;
}

.navbar-linkedin:hover {
    opacity: 1;
}

/* ── Modal components ───────────────────────────────────────── */
.modal-title-block {
    display: flex;
    flex-direction: column;
}

.modal-title-main {
    font-family: 'Manrope', Arial, sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--on-surface);
    line-height: 1.3;
}

.modal-title-sub {
    font-size: 12px;
    color: var(--on-surface-muted);
    margin-top: 2px;
}

.text-caption-modal {
    font-size: 12px;
    color: var(--on-surface-muted);
    margin-top: 12px;
}

.link-btn {
    background: none;
    border: none;
    color: var(--secondary);
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
    padding: 0;
    text-decoration: underline;
    display: inline;
}

.link-btn:hover {
    color: var(--primary);
}

.modal-footer-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    text-align: center;
}

.privacy-heading {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--on-surface-muted);
    margin: 16px 0 6px;
    font-family: 'Inter', Arial, sans-serif;
}

/* ── Page body ──────────────────────────────────────────────── */
.page-body {
    flex: 1;
    max-width: 1300px;
    margin: 0 auto;
    width: 100%;
    padding: 28px 28px 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ── Top panels (side-by-side) ──────────────────────────────── */
.top-panels {
    display: flex;
    gap: 0;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-ambient);
}

/* ── Config panel (left) ────────────────────────────────────── */
.config-panel {
    background: var(--surface-card);
    padding: 32px 36px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* ── Prediction panel (right, dark gradient) ────────────────── */
.prediction-panel {
    background: var(--gradient-primary);
    padding: 32px 36px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* ── Typography ─────────────────────────────────────────────── */
.overline {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--on-surface-muted);
    margin-bottom: 6px;
    font-family: 'Inter', Arial, sans-serif;
}

.overline-light {
    color: rgba(255,255,255,0.5);
}

.section-heading {
    font-size: 1.9rem;
    font-weight: 700;
    color: var(--on-surface);
    margin: 0 0 24px 0;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.section-heading-sm {
    font-size: 1.25rem;
    margin-bottom: 2px;
}

.section-sub {
    font-size: 12px;
    color: var(--on-surface-muted);
    margin: 0 0 16px 0;
}

.prediction-heading {
    font-size: 1rem;
    font-weight: 600;
    color: rgba(255,255,255,0.75);
    margin: 0;
    letter-spacing: 0.01em;
}

/* ── SEL result display ─────────────────────────────────────── */
.sel-description {
    font-size: 11px;
    color: rgba(255,255,255,0.55);
    margin: -8px 0 20px;
    font-style: italic;
}

.sel-display {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.sel-number {
    font-family: 'Manrope', Arial, sans-serif;
    font-size: 3.5rem;
    font-weight: 800;
    color: var(--accent);
    line-height: 1;
    letter-spacing: -0.02em;
}

.sel-unit {
    font-size: 1rem;
    color: rgba(255,255,255,0.65);
    font-weight: 400;
}

/* Colour variants set by callback className */
.sel-above { color: var(--accent); }
.sel-below { color: var(--accent); }

/* ── Compliance badge ───────────────────────────────────────── */
.compliance-hidden { display: none; }

.badge-compliant {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(134, 239, 172, 0.15);
    color: #86efac;
    border: 1px solid rgba(134, 239, 172, 0.35);
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 4px 12px;
    margin-bottom: 24px;
    width: fit-content;
}

.badge-exceeded {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(252, 165, 165, 0.15);
    color: #fca5a5;
    border: 1px solid rgba(252, 165, 165, 0.35);
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 4px 12px;
    margin-bottom: 24px;
    width: fit-content;
}

/* ── Regulatory threshold rows ──────────────────────────────── */
.threshold-label {
    margin-top: auto;
    padding-top: 24px;
    margin-bottom: 10px;
}

.thresholds-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.threshold-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.threshold-row:last-child {
    border-bottom: none;
}

.threshold-name {
    font-size: 13px;
    color: rgba(255,255,255,0.9);
    font-weight: 500;
    margin-bottom: 2px;
}

.threshold-sub {
    font-size: 11px;
    color: rgba(255,255,255,0.4);
}

.threshold-value {
    font-size: 14px;
    font-weight: 700;
    color: rgba(255,255,255,0.9);
    font-family: 'Manrope', Arial, sans-serif;
}

/* ── Input grid ─────────────────────────────────────────────── */
.input-row {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.input-field {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.input-label-caps {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.1em;
    color: var(--on-surface-muted);
    margin-bottom: 6px;
    display: block;
}

/* Ghost-border input — override Dash 4 container defaults */
.ghost-input.dash-input-container {
    width: 100% !important;
    border: 1px solid rgba(0, 36, 98, 0.18) !important;
    border-radius: var(--radius) !important;
    background: var(--surface-card) !important;
    padding: 0 !important;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.ghost-input.dash-input-container:focus-within {
    border-color: var(--secondary) !important;
    box-shadow: 0 0 0 3px rgba(0, 97, 166, 0.15) !important;
}

.ghost-input .dash-input-stepper {
    display: none !important;
}

.ghost-input .dash-input-element {
    border: none !important;
    background: transparent !important;
    width: 100% !important;
    padding: 9px 12px !important;
    font-size: 14px !important;
    color: var(--on-surface) !important;
    outline: none !important;
    box-shadow: none !important;
    border-radius: var(--radius) !important;
}

/* ── Hint text ──────────────────────────────────────────────── */
.hint-text {
    font-size: 11px;
    color: var(--on-surface-muted);
    font-style: italic;
    margin-bottom: 20px;
    min-height: 16px;
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn-primary-gradient {
    background: var(--gradient-primary);
    color: var(--on-primary);
    border: none;
    border-radius: var(--radius);
    font-family: 'Manrope', Arial, sans-serif;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
    padding: 12px 24px;
    cursor: pointer;
    width: 100%;
    text-align: center;
    transition: opacity 0.15s;
}

.btn-primary-gradient:hover { opacity: 0.88; }
.btn-primary-gradient:active { opacity: 0.75; }

.btn-secondary {
    background: #f0f4f8;
    color: var(--primary);
    border: none;
    border-radius: var(--radius);
    font-size: 12px;
    font-weight: 600;
    padding: 6px 14px;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-secondary:hover { background: #dce8f5; }

/* modal footer: force equal height for <a> and <button> siblings */
.btn-secondary.modal-footer-btn {
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Error message ──────────────────────────────────────────── */
.error-msg {
    color: #dc2626;
    font-size: 12px;
    margin-top: 8px;
    min-height: 18px;
}

.warning-msg {
    color: #ec7018;
    font-size: 12px;
    margin-top: 8px;
    min-height: 18px;
}

/* ── Benchmarking library panel ─────────────────────────────── */
.library-panel {
    background: var(--surface-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-ambient);
    overflow: hidden;
}

.library-inner {
    padding: 28px 32px;
}

.library-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

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

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

.reference-link {
    display: block;
    font-size: 11px;
    color: var(--secondary);
    margin-top: 12px;
    text-decoration: none;
}

.reference-link:hover { text-decoration: underline; }

.table-footer-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 12px;
}

.table-range-note {
    font-size: 11px;
    color: var(--on-surface-muted);
}

.table-privacy-note {
    font-size: 11px;
    color: var(--on-surface-muted);
    margin-top: 4px;
}

/* ── DataTable: hide number spinners ────────────────────────── */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
    -webkit-appearance: none; margin: 0;
}
input[type=number] { -moz-appearance: textfield; }

/* ── Services panel (mirrors config-panel, white) ────────────── */
.services-panel {
    background: var(--surface-card);
    padding: 32px 36px;
    flex: 1;
    display: flex;
    flex-direction: column;
    /* subtle left border to separate from prediction panel */
    border-left: 1px solid rgba(0,0,0,0.05);
}

/* Service list — matches the visual density of the input rows */
.service-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-bottom: 20px;
}

.service-item {
    display: flex;
    flex-direction: column;
    padding: 9px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.045);
}

.service-item:last-child {
    border-bottom: none;
}

.service-item-title {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--on-surface);
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 2px;
}

.service-item-title::before {
    content: "";
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background-color: var(--accent);
    flex-shrink: 0;
}

.service-item-sub {
    font-size: 11px;
    color: var(--on-surface-muted);
    line-height: 1.4;
    padding-left: 12px;
}

/* ── CTA buttons (services panel) ───────────────────────────── */
.btn-cta-orange,
.btn-cta-blue {
    display: block;
    color: #ffffff;
    text-decoration: none;
    font-family: 'Manrope', Arial, sans-serif;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 12px 20px;
    border-radius: var(--radius);
    text-align: center;
    transition: background-color 0.15s, transform 0.12s;
}

.btn-cta-orange {
    background-color: var(--accent);
    margin-top: auto;
}

.btn-cta-blue {
    background-color: var(--secondary);
    margin-top: auto;
    margin-bottom: 10px;
}

.btn-cta-orange:hover {
    background-color: #d4601a;
    color: #ffffff;
    text-decoration: none;
    transform: translateY(-2px);
}

.btn-cta-blue:hover {
    background-color: #004f8a;
    color: #ffffff;
    text-decoration: none;
    transform: translateY(-2px);
}

/* ── Threshold value group (dot + value) ───────────────────── */
.threshold-value-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Hidden by default; shown and coloured by callback className */
.threshold-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    display: none;
}

.threshold-dot-exceeded {
    display: block;
    background-color: #fca5a5;
    box-shadow: 0 0 4px rgba(252, 165, 165, 0.6);
}

.threshold-heading-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ── Formula info button ────────────────────────────────────── */
.prediction-heading-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.formula-info-btn {
    background: rgba(255,255,255,0.05);
    border: none;
    box-shadow: 0 0 0 1.5px rgba(255,255,255,0.45);
    text-transform: none;
    color: rgba(255,255,255,0.6);
    border-radius: 50%;
    width: 12px;
    height: 12px;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 8px;
    font-weight: 200;
    font-style: italic;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    -webkit-font-smoothing: antialiased;
    /* transition: background 0.15s, box-shadow 0.15s; */
}

.formula-info-btn:hover {
    background: rgba(255,255,255,0.22);
    box-shadow: 0 0 0 1.5px rgba(255,255,255,0.8);
    color: #fff;
}

/* ── Formula modal ──────────────────────────────────────────── */
.formula-block {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 6px;
    background: #f3f4f6;
    border-radius: 4px;
    padding: 14px 18px;
    margin: 12px 0;
    font-family: 'Inter', monospace;
    font-size: 13px;
}

.formula-lhs {
    font-weight: 700;
    color: var(--on-surface);
}

.formula-eq {
    color: var(--on-surface-muted);
}

.formula-op {
    color: var(--on-surface-muted);
    font-weight: 600;
}

.formula-term {
    color: var(--on-surface);
}

.formula-muted {
    color: var(--on-surface-muted);
    font-style: italic;
    font-size: 12px;
}

.formula-note {
    font-size: 12px;
    color: var(--on-surface-muted);
    margin-top: 8px;
}

/* ── Hide delete button on system-provided (HES) rows ──────── */
/* HES rows have font-style:italic set inline by style_data_conditional;
   user rows do not, so their delete buttons remain visible. */
#ref-table tr:has(td[style*="italic"]) .dash-delete-cell {
    color: transparent !important;
    pointer-events: none !important;
}
#ref-table tr:has(td[style*="italic"]) .dash-delete-cell * {
    visibility: hidden !important;
}

/* ── Hide Plotly debug toolbar ──────────────────────────────── */
.dash-debug-menu, #_dash-debug-menu, .dash-dev-tools {
    display: none !important;
}
