:root {
    --accent: #d4a017;
    --accent-hover: #b8860b;
    --accent-light: #e6b830;
    --accent-rgb: 212, 160, 23;
}

html, body {
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

body {
    display: flex;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}

.main {
    flex: 1;
    min-height: calc(100vh - 250px);
}

footer { margin-top: auto; }
footer a:hover { color: var(--accent) !important; text-decoration: underline !important; }

.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 0.2rem rgba(var(--accent-rgb), 0.25);
}

/* Accent color overrides */
.bg-accent { background-color: var(--accent) !important; }
.text-accent { color: var(--accent) !important; }
.border-accent { border-color: var(--accent) !important; }
.btn-accent {
    background-color: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.btn-accent:hover {
    background-color: var(--accent-hover);
    border-color: var(--accent-hover);
    color: #fff;
}
.btn-outline-accent {
    color: var(--accent);
    border-color: var(--accent);
}
.btn-outline-accent:hover {
    background-color: var(--accent);
    color: #fff;
}

/* Navbar */
.navbar-accent { background-color: var(--accent) !important; }

/* Quintile input styling */
.quintile-input-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.75rem;
}

.quintile-input-group label {
    min-width: 140px;
    font-weight: 500;
    font-size: 0.9rem;
}

.quintile-input-group input {
    width: 80px;
    text-align: center;
    font-weight: 600;
}

.quintile-sum {
    font-size: 1.1rem;
    font-weight: 700;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
}

.quintile-sum.valid { background-color: #d4edda; color: #155724; }
.quintile-sum.invalid { background-color: #f8d7da; color: #721c24; }

/* Quintile stacked bar */
.qbar-q1 { background-color: #4292c6; }
.qbar-q2 { background-color: #41ab5d; }
.qbar-q3 { background-color: #fe9929; }
.qbar-q4 { background-color: #f03b20; }
.qbar-q5 { background-color: #99000d; }

.quintile-bar {
    display: flex;
    height: 44px;
    border-radius: 0.375rem;
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.1);
}

.qbar-segment {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: width 0.2s ease;
    min-width: 0;
    overflow: hidden;
}

.qbar-label {
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    white-space: nowrap;
}

.qbar-legend {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: #6c757d;
}

.qbar-legend-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.qbar-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    flex-shrink: 0;
}

.qbar-q5-auto-note {
    font-size: 0.75rem;
    color: #6c757d;
    white-space: nowrap;
}

input.qbar-q5-readonly {
    background-color: #f8f9fa;
    color: #6c757d;
}

input.qbar-q5-error {
    background-color: #f8d7da !important;
    color: #721c24 !important;
}

/* Chart container */
.chart-container {
    position: relative;
    max-width: 700px;
    margin: 1.5rem auto;
}

.projector-chart {
    max-width: 900px;
}

.metric-card {
    border-color: rgba(var(--accent-rgb), 0.25);
    box-shadow: 0 8px 24px rgba(33, 37, 41, 0.06);
}

.metric-label {
    color: #6c757d;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.metric-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.1;
    margin-top: 0.35rem;
    color: #212529;
}

.metric-note,
.metric-inline {
    color: #6c757d;
    font-size: 0.9rem;
    margin-top: 0.4rem;
}

/* Progress steps */
.step-indicator {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.step-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #dee2e6;
}

.step-dot.active { background-color: var(--accent); }
.step-dot.completed { background-color: #198754; }

/* Backoffice table actions */
.actions-cell { white-space: nowrap; }
.actions-cell form { display: inline-block; margin: 0; }
.actions-cell .btn { min-width: 8rem; text-align: center; margin-right: 0.25rem; margin-bottom: 0.25rem; }

/* Fixed width badges */
.fixed-width-badge { display: inline-block; min-width: 75px; text-align: center; }

/* Country dropdown with search */
.country-select { max-width: 400px; }

/* Data quality indicators */
.quality-high { color: #198754; }
.quality-medium { color: var(--accent); }
.quality-estimated { color: #6c757d; font-style: italic; }

/* Screen reader only utility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media print {
    footer,
    .no-print {
        display: none !important;
    }

    .main {
        min-height: auto;
    }

    .card {
        break-inside: avoid;
    }
}
