body {
    margin: 0;
    background-color: #111;
    color: white;
    font-family: Arial, sans-serif;
}

.dashboard {
    max-width: 900px;
    margin: auto;
    padding: 30px;
}


/* HEADER */

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.topbar h1 {
    margin-bottom: 5px;
}

.topbar p {
    margin-top: 0;
    color: #aaa;
}

.online-status {
    font-size: 14px;
}


/* OVERALL AIR QUALITY */

.air-status {
    margin-top: 30px;
    padding: 25px;
    background-color: #1c1c1c;
    border-radius: 16px;
}

.air-status .label {
    color: #aaa;
    margin-bottom: 5px;
}

.air-status h2 {
    font-size: 36px;
    margin: 5px 0;
}


/* SENSOR READINGS */

.readings-grid {
    display: grid;
    /* auto-fit means a new sensor card just flows in - no breakpoint edit. */
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.reading-card {
    background-color: #1c1c1c;
    padding: 20px;
    border-radius: 14px;
}

.reading-card p {
    margin-top: 0;
    color: #aaa;
}

.reading-card h2 {
    display: inline;
    font-size: 32px;
}

.reading-card span {
    margin-left: 5px;
    color: #aaa;
}


/* RECOMMENDATION */

.recommendation {
    margin-top: 25px;
    padding: 20px;
    background-color: #1c1c1c;
    border-radius: 14px;
}

.bottom-nav {
    margin-top: 25px;
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.bottom-nav a {
    flex: 1;
    text-align: center;
    padding: 12px;
    background-color: #1c1c1c;
    border-radius: 10px;
    color: white;
    text-decoration: none;
}


/* PHONE */

@media (max-width: 600px) {

    .dashboard {
        padding: 18px;
    }

    .readings-grid {
        grid-template-columns: 1fr;
    }
}

.feedback-options {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.feedback-options button,
.submit-feedback {
    padding: 12px 18px;
    background-color: #2a2a2a;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
}

.feedback-options button:hover,
.submit-feedback:hover {
    background-color: #3a3a3a;
}

.feedback-text {
    width: 100%;
    box-sizing: border-box;
    margin-top: 10px;
    padding: 12px;
    background-color: #111;
    color: white;
    border: 1px solid #444;
    border-radius: 10px;
    resize: vertical;
}

.submit-feedback {
    margin-top: 15px;
}


/* STATUS COLOUR
   ------------------------------------------------------------------
   The colour is chosen from the status LABEL the server sent, never
   from a threshold compared here. All judgement lives in
   air_quality.py. Status is also spelled out in text on every card,
   so the meaning does not depend on colour vision. */

.status-good  { --status-color: #4ade80; }   /* green  */
.status-fair  { --status-color: #fbbf24; }   /* amber  */
.status-poor  { --status-color: #f87171; }   /* red    */
.status-none  { --status-color: #666;    }   /* no reading */

/* A left edge rather than a full fill: readable, and it survives the
   card being any colour later. */
.reading-card[data-metric] {
    border-left: 4px solid var(--status-color, #666);
}

.air-status {
    border-left: 6px solid var(--status-color, #666);
}

.air-status h2 {
    color: var(--status-color, white);
}

.card-status {
    margin: 10px 0 0 0;
    font-size: 13px;
    letter-spacing: 0.05em;
    color: var(--status-color, #aaa);
}

.card-status:empty {
    display: none;
}

.online-status {
    color: var(--status-color, #aaa);
}


/* OUTSTANDING ISSUES */

.issue-list {
    margin: 10px 0 0 0;
    padding-left: 20px;
    color: #ccc;
}

.issue-list li {
    margin-bottom: 6px;
}

.issue-list:empty {
    display: none;
}


/* FRESHNESS LINE */

.last-updated {
    margin-top: 20px;
    font-size: 13px;
    color: #888;
}

.device-tag {
    margin-left: 8px;
    padding: 2px 8px;
    background-color: #1c1c1c;
    border-radius: 6px;
}


/* NAV - mark the current page */

.bottom-nav a.active {
    background-color: #2a2a2a;
}


/* HISTORY - RANGE PICKER */

.range-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0 6px 0;
}

.range-option {
    padding: 8px 14px;
    background-color: #2a2a2a;
    border-radius: 8px;
    color: #ccc;
    text-decoration: none;
    font-size: 14px;
}

.range-option:hover {
    background-color: #3a3a3a;
}

.range-option.active {
    background-color: #4ade80;
    color: #111;
}

.range-detail {
    margin: 4px 0 0 0;
    font-size: 13px;
    color: #888;
}


/* HISTORY - CHARTS */

.chart-section h3 {
    margin-bottom: 8px;
}

.chart-unit {
    font-size: 13px;
    font-weight: normal;
    color: #888;
}

.chart-card {
    background-color: #1c1c1c;
    border-radius: 14px;
    padding: 14px;
    /* Charts are wide. On a phone the chart scrolls inside this box rather
       than making the whole page scroll sideways. */
    overflow-x: auto;
}

.chart-svg {
    display: block;
    width: 100%;
    min-width: 320px;
    height: 200px;
}

.chart-svg .grid {
    stroke: #333;
    stroke-width: 1;
}

.chart-svg .series {
    fill: none;
    stroke: #4ade80;
    stroke-width: 2;
    stroke-linejoin: round;
    stroke-linecap: round;
    /* Do not scale the stroke when the SVG is stretched to fit. */
    vector-effect: non-scaling-stroke;
}

.chart-svg .series-dot {
    fill: #4ade80;
}

.chart-svg .axis-label {
    fill: #888;
    font-size: 11px;
    font-family: Arial, sans-serif;
}

.chart-empty {
    margin: 0;
    padding: 60px 0;
    text-align: center;
    color: #666;
}


/* HISTORY - EXPORT */

.export-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}

.export-links a {
    display: inline-block;
    text-decoration: none;
}


/* DEVICE PAGE */

.device-block {
    margin-bottom: 35px;
    padding-bottom: 20px;
    border-bottom: 1px solid #262626;
}

.device-block:last-of-type {
    border-bottom: none;
}

.device-block .readings-grid {
    margin-top: 15px;
}

/* Device values are words ("never", "unknown"), not big numbers, so they
   need a smaller size than the sensor cards use. */
.device-value {
    display: inline;
    font-size: 20px;
}

.chip-card {
    margin-top: 10px;
    border-left: 4px solid var(--status-color, #666);
}

.chip-note {
    margin: 4px 0 0 0;
    font-size: 13px;
    color: #888;
}


/* FEEDBACK FORM */

.field-label {
    display: block;
    margin-top: 14px;
    margin-bottom: 4px;
    font-size: 14px;
    color: #aaa;
}

select.feedback-text {
    /* Match the dark theme - a bare <select> renders white on Windows. */
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, #888 50%),
                      linear-gradient(135deg, #888 50%, transparent 50%);
    background-position: calc(100% - 18px) center, calc(100% - 13px) center;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    padding-right: 36px;
}

/* Radio buttons styled as the buttons the page already had, so the look is
   unchanged but the answers can actually be submitted. */
.choice input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.choice span {
    display: inline-block;
    padding: 12px 18px;
    background-color: #2a2a2a;
    border: 2px solid transparent;
    border-radius: 10px;
    cursor: pointer;
}

.choice span:hover {
    background-color: #3a3a3a;
}

.choice input[type="radio"]:checked + span {
    background-color: #4ade80;
    color: #111;
}

/* Keyboard focus must stay visible - the real radio is invisible. */
.choice input[type="radio"]:focus-visible + span {
    border-color: #4ade80;
}


/* FEEDBACK RESPONSES */

.summary-row {
    margin-top: 16px;
}

.summary-question {
    margin: 0 0 6px 0;
    color: #aaa;
    font-size: 14px;
}

.summary-counts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.summary-chip {
    padding: 6px 12px;
    background-color: #2a2a2a;
    border-radius: 8px;
    font-size: 14px;
}

.response-card .response-item {
    margin-top: 12px;
}

.response-question {
    margin: 0;
    font-size: 13px;
    color: #888;
}

.response-answer {
    margin: 2px 0 0 0;
}