* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: Arial, sans-serif;
    background: #f4f6f8;
    color: #1f2937;
}

header {
    position: relative;
    background: #111827;
    color: white;
    padding: 25px;
    margin-bottom: 25px;
}

.session-controls {
    position: absolute;
    top: 25px;
    right: 25px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.session-controls span {
    max-width: 220px;
    overflow: hidden;
    color: #d1d5db;
    font-size: 13px;
    text-overflow: ellipsis;
}

.session-button {
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid #64748b;
    border-radius: 4px;
    background: transparent;
    color: white;
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
}

.session-button:hover {
    background: #1f2937;
}

.auth-gate {
    display: grid;
    min-height: 100vh;
    padding: 24px;
    place-items: center;
    background: #f4f6f8;
}

.auth-card {
    display: grid;
    width: min(100%, 420px);
    gap: 18px;
    padding: 32px;
    border: 1px solid #dce2e5;
    border-radius: 8px;
    background: white;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.1);
}

.auth-card[hidden] {
    display: none;
}

.auth-card h1 {
    color: #111827;
    font-size: 28px;
}

.auth-card > p:not(.auth-eyebrow):not(.auth-status) {
    color: #52616a;
    line-height: 1.5;
}

.auth-eyebrow {
    color: #087e8b;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.auth-status {
    min-height: 20px;
    color: #9f2d20;
    font-size: 14px;
}

.auth-switch {
    color: #52616a;
    font-size: 14px;
}

.auth-link {
    padding: 0;
    border: 0;
    background: none;
    color: #087e8b;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    text-decoration: underline;
}

.auth-link:hover {
    color: #075c65;
}

header h1 {
    font-size: 28px;
    margin-bottom: 5px;
}

.brand-row {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.2);
    background: #0f172a;
}

.brand-mark svg {
    display: block;
    width: 100%;
    height: 100%;
}

.business-name {
    color: #8ecae6;
    font-size: 12px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-weight: 700;
    margin: 0;
}

header p {
    color: #9ca3af;
    margin-bottom: 12px;
}

.status {
    display: inline-block;
    background: #166534;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 14px;
}

.status.warning {
    background: #d97706;
    color: white;
}

.status.normal {
    background: #166534;
    color: white;
}

.status.critical {
    background: #dc2626;
    color: white;
}

main {
    display: flex;
    align-items: flex-start;
    gap: 24px;
    width: 96%;
    max-width: 1600px;
    margin: auto;
}

.primary-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 220px;
    flex-shrink: 0;
    padding: 14px;
    border: 1px solid #d5dce1;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.view-tab {
    min-height: 48px;
    padding: 0 16px;
    border: 0;
    border-left: 3px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: #52616a;
    cursor: pointer;
    font: inherit;
    font-weight: 600;
    text-align: left;
}

.view-tab.active {
    border-left-color: #087e8b;
    background: #ecf9fb;
    color: #075c65;
}

.page-view {
    flex: 1;
    min-width: 0;
}

.view-tab:focus-visible,
.history-category-card:focus-visible,
.back-button:focus-visible {
    outline: 3px solid #087e8b;
    outline-offset: 2px;
}

.page-view[hidden],
.history-detail[hidden],
.history-table-wrap[hidden],
.history-empty[hidden] {
    display: none;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.sensor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.sensor-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.sensor-card h2 {
    font-size: 16px;
    color: #6b7280;
    margin-bottom: 15px;
}

.value {
    font-size: 30px;
    font-weight: bold;
    margin-bottom: 10px;
}

.normal {
    color: #16a34a;
    font-weight: bold;
}

.warning {
    color: #d97706;
    font-weight: bold;
}
.critical {
    color: #dc2626;
    font-weight: bold;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 25px;
}

.panel {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 20px;
}

.panel h2 {
    margin-bottom: 20px;
}

.machine {
    display: block;
    width: 100%;
    background: #ecfdf5;
    border: 2px solid #22c55e;
    border-radius: 12px;
    padding: 22px 20px 14px;
    text-align: center;
    margin-bottom: 15px;
    box-shadow: inset 0 0 0 1px rgba(34, 197, 94, 0.12);
    color: inherit;
    cursor: pointer;
    font: inherit;
}

.machine:focus-visible {
    outline: 3px solid #25766a;
    outline-offset: 3px;
}

.digital-twin-findings {
    margin: 0 0 16px;
    padding: 14px;
    border: 1px solid #dbe5df;
    border-radius: 4px;
    background: #f7faf7;
}

.digital-twin-findings h3 {
    margin: 0 0 10px;
    color: var(--ink);
    font-size: 16px;
}

.digital-twin-finding + .digital-twin-finding {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #dbe5df;
}

.digital-twin-finding h4 {
    margin-bottom: 5px;
    font-size: 14px;
}

.digital-twin-finding p,
.digital-twin-empty {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.digital-twin-finding p strong {
    color: var(--ink);
}

.machine-visual {
    width: 190px;
    height: 120px;
    margin: 0 auto 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 6px 12px rgba(15, 23, 42, 0.12));
}

.machine-visual svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}

.machine-gear {
    transform-box: fill-box;
    transform-origin: center;
    animation: industrialGearTurn 2.8s linear infinite;
}

.machine-gear.gear-small {
    animation-duration: 2.1s;
    animation-direction: reverse;
}

.machine-base,
.machine-pipes,
.machine-legs {
    opacity: 1;
}

.status-light {
    animation: liveIndicator 1.2s ease-in-out infinite;
    transform-origin: center;
}

.machine p {
    font-size: 18px;
    margin-top: 8px;
}

@keyframes industrialGearTurn {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes liveIndicator {
    0%, 100% {
        opacity: 0.7;
        transform: scale(0.95);
    }
    50% {
        opacity: 1;
        transform: scale(1.1);
    }
}

.alert {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 16px;
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border-left: 5px solid #dc2626;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 8px;
    box-shadow: 0 0 0 1px rgba(220, 38, 38, 0.12), 0 6px 14px rgba(220, 38, 38, 0.12);
}

.alert-message {
    flex: 1 1 220px;
    color: #111827;
    font-weight: 700;
}

.alert-time {
    color: #4b5563;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.over-normal {
    margin-top: 8px;
    font-size: 13px;
    line-height: 1.45;
}

.over-normal.warning {
    color: #b45309;
}

.over-normal.critical {
    color: #b91c1c;
}

.diagnostic-note {
    margin-top: 10px;
    color: #6b7280;
    font-size: 12px;
    line-height: 1.45;
}

.trends {
    margin-bottom: 25px;
}

.trends-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.trend-controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 12px;
}

.trends-heading h2 {
    font-size: 22px;
}

.trends-heading p {
    color: #6b7280;
    font-size: 14px;
}

.range-controls {
    display: inline-flex;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    overflow: hidden;
}

.range-controls button {
    min-width: 42px;
    padding: 7px 10px;
    border: 0;
    border-right: 1px solid #d1d5db;
    background: white;
    color: #374151;
    cursor: pointer;
    font: inherit;
    font-size: 13px;
}

.range-controls button:last-child {
    border-right: 0;
}

.range-controls button[aria-pressed="true"] {
    background: #166534;
    color: white;
}

.range-controls button:focus-visible {
    outline: 2px solid #087e8b;
    outline-offset: -2px;
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    margin-bottom: 14px;
    color: #4b5563;
    font-size: 13px;
}

.chart-legend span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.legend-swatch {
    display: inline-block;
    width: 18px;
    height: 3px;
    background: #087e8b;
}

.legend-swatch.normal-line {
    background: #16a34a;
}

.legend-swatch.warning-line {
    background: #d97706;
}

.legend-swatch.critical-line {
    background: #dc2626;
}

.chart-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.chart-card {
    min-width: 0;
    padding: 18px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.chart-card h3 {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 16px;
}

.chart-card h3 span {
    color: #6b7280;
    font-size: 13px;
    font-weight: normal;
}

.sensor-chart {
    display: block;
    width: 100%;
    height: 210px;
}

.chart-readout {
    min-height: 18px;
    margin-top: 6px;
    color: #4b5563;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.page-heading,
.history-detail-heading,
.observation-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
}

.page-heading h2,
.observation-heading h2 {
    margin-top: 3px;
    font-size: 26px;
}

.page-heading > p,
.history-detail-heading p,
.observation-heading > p {
    color: #64717a;
    font-size: 14px;
}

.observation-results {
    margin: 26px 0;
}

.observation-summary {
    margin-top: 24px;
}

.observation-summary h3 {
    margin-bottom: 6px;
    font-size: 18px;
}

.observation-summary > p {
    margin-bottom: 12px;
    color: #64717a;
    font-size: 14px;
}

.eyebrow {
    color: #087e8b;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.history-category-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.history-category-card {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    min-height: 84px;
    padding: 16px;
    border: 1px solid #dce2e5;
    border-radius: 6px;
    background: white;
    color: #1f2937;
    cursor: pointer;
    text-align: left;
}

.history-category-card:hover {
    border-color: #087e8b;
    background: #f7fbfb;
}

.history-unit {
    display: grid;
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    place-items: center;
    border-radius: 4px;
    background: #e6f4f3;
    color: #075c65;
    font-size: 14px;
    font-weight: 700;
}

.history-category-copy {
    display: grid;
    min-width: 0;
    gap: 5px;
}

.history-category-copy strong {
    font-size: 16px;
}

.history-category-copy small {
    color: #64717a;
    font-size: 13px;
}

.history-arrow {
    margin-left: auto;
    color: #087e8b;
    font-size: 22px;
}

.history-detail {
    padding-top: 22px;
    border-top: 1px solid #dce2e5;
}

.history-detail-heading {
    align-items: center;
    margin-bottom: 16px;
}

.history-detail-heading h3 {
    margin-bottom: 5px;
    font-size: 20px;
}

.back-button {
    min-height: 40px;
    padding: 0 12px;
    border: 1px solid #cbd5da;
    border-radius: 4px;
    background: white;
    color: #37474f;
    cursor: pointer;
    font: inherit;
    font-size: 14px;
}

.back-button:hover {
    background: #f4f7f8;
}

.history-table-wrap {
    overflow-x: auto;
    border: 1px solid #dce2e5;
    border-radius: 6px;
    background: white;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.history-table th,
.history-table td {
    padding: 12px 14px;
    border-bottom: 1px solid #e6eaec;
    white-space: nowrap;
}

.history-table th {
    background: #f2f6f6;
    color: #52616a;
    font-size: 12px;
    font-weight: 700;
}

.history-table td {
    color: #27343a;
    font-size: 14px;
    font-variant-numeric: tabular-nums;
}

.history-table tbody tr:last-child td {
    border-bottom: 0;
}

.history-empty {
    padding: 18px;
    border: 1px solid #dce2e5;
    border-radius: 6px;
    background: white;
    color: #64717a;
}

.machine-profile-form {
    display: grid;
    gap: 24px;
    margin-bottom: 32px;
}

.profile-section {
    min-width: 0;
    padding: 20px 0;
    border-top: 1px solid #dce2e5;
}

.profile-section h3 {
    margin-bottom: 14px;
    font-size: 18px;
}

.profile-section-heading p {
    margin-top: -6px;
    margin-bottom: 16px;
    color: #64717a;
    font-size: 14px;
}

.machine-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.form-field {
    display: grid;
    min-width: 0;
    gap: 7px;
    color: #3f4c53;
    font-size: 13px;
    font-weight: 600;
}

.form-field input {
    width: 100%;
    min-height: 42px;
    padding: 9px 11px;
    border: 1px solid #cbd5da;
    border-radius: 4px;
    background: white;
    color: #1f2937;
    font: inherit;
    font-size: 15px;
}

.form-field input:focus-visible {
    outline: 2px solid #087e8b;
    outline-offset: 1px;
}

.limit-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.limit-card {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    min-width: 0;
    padding: 16px;
    border: 1px solid #dce2e5;
    border-radius: 6px;
    background: white;
}

.limit-card legend {
    padding: 0 5px;
    font-size: 15px;
    font-weight: 700;
}

.limit-card legend span {
    margin-left: 4px;
    color: #64717a;
    font-size: 12px;
    font-weight: 500;
}

.profile-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
}

.save-profile-button {
    min-height: 44px;
    padding: 0 16px;
    border: 0;
    border-radius: 4px;
    background: #087e8b;
    color: white;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
}

.save-profile-button:hover {
    background: #075c65;
}

#profile-save-status,
#user-profile-save-status {
    color: #52616a;
    font-size: 14px;
}

@media (max-width: 800px) {
    .sensor-grid {
        grid-template-columns: 1fr 1fr;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .chart-grid {
        grid-template-columns: 1fr;
    }

    .history-category-grid {
        grid-template-columns: 1fr;
    }

    .limit-grid {
        grid-template-columns: 1fr;
    }

    .page-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }

    .observation-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }
}

@media (max-width: 500px) {
    header {
        padding: 22px;
    }

    .session-controls {
        position: static;
        justify-content: space-between;
        flex-wrap: wrap;
        margin-top: 18px;
    }

    .session-controls span {
        max-width: calc(100% - 100px);
    }

    #sync-status {
        flex-basis: 100%;
        max-width: 100%;
        order: 1;
        white-space: normal;
    }

    .sensor-grid {
        grid-template-columns: 1fr;
    }

    .trends-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .trend-controls {
        justify-content: space-between;
        width: 100%;
    }

    .history-detail-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .history-table th,
    .history-table td {
        padding: 10px;
    }

    .machine-fields {
        grid-template-columns: 1fr;
    }

    .limit-card {
        grid-template-columns: 1fr;
    }
}

:root {
    color-scheme: light;
    --ink: #24312e;
    --muted: #687571;
    --line: #dce3df;
    --paper: #f2f4f1;
    --surface: #ffffff;
    --accent: #25766a;
    --accent-soft: #e8f2ef;
}

body {
    background: var(--paper);
    color: var(--ink);
    font-family: "Aptos", "Segoe UI", sans-serif;
    line-height: 1.5;
}

header {
    margin-bottom: 28px;
    padding: 24px max(3vw, calc((100vw - 1560px) / 2));
    background: #243632;
    color: #f8faf8;
}

.brand-row {
    gap: 10px;
    margin-bottom: 12px;
}

.brand-mark {
    width: 34px;
    height: 34px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 7px;
    box-shadow: none;
}

.business-name {
    color: #c4d5ce;
    font-size: 11px;
    letter-spacing: 0.1em;
}

header h1 {
    margin-bottom: 2px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 30px;
    font-weight: 500;
}

header p {
    margin-bottom: 10px;
    color: #c3cfca;
}

.session-controls span {
    color: #c3cfca;
}

.status {
    padding: 5px 10px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.status.normal {
    background: #31594a;
}

.status.warning {
    background: #91621e;
}

.status.critical {
    background: #923f38;
}

main {
    width: min(96%, 1560px);
    gap: 22px;
    padding-bottom: 40px;
}

.primary-nav {
    position: sticky;
    top: 16px;
    gap: 4px;
    width: 204px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fbfcfa;
    box-shadow: 0 2px 8px rgba(36, 49, 46, 0.035);
}

.view-tab {
    min-height: 42px;
    padding: 0 12px;
    border-left-width: 2px;
    border-radius: 3px;
    color: #56635f;
    font-size: 14px;
    font-weight: 600;
}

.view-tab.active {
    border-left-color: var(--accent);
    background: var(--accent-soft);
    color: #20594f;
}

.view-tab:focus-visible,
.history-category-card:focus-visible,
.back-button:focus-visible {
    outline-color: var(--accent);
}

.sensor-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 155px), 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.live-measurements-heading {
    margin-bottom: 12px;
    color: var(--ink);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 23px;
    font-weight: 500;
}

.measurement-toggle-icon {
    display: inline-grid;
    width: 24px;
    height: 24px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 50%;
    color: var(--accent);
    font-family: "Segoe UI", sans-serif;
    font-size: 17px;
    line-height: 1;
}

.sensor-toggle[aria-expanded="true"] .measurement-toggle-icon {
    transform: rotate(45deg);
}

.sensor-card,
.panel,
.chart-card {
    border: 1px solid var(--line);
    border-radius: 5px;
    background: var(--surface);
    box-shadow: 0 2px 7px rgba(36, 49, 46, 0.035);
}

.sensor-card {
    min-width: 0;
    padding: 0;
    border-top: 2px solid #c7d9d2;
}

.sensor-card.expanded {
    grid-column: 1 / -1;
    border-color: #a9c8bc;
}

.sensor-toggle {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 24px;
    grid-template-areas:
        "name icon"
        "value icon"
        "status icon";
    align-items: center;
    gap: 5px 10px;
    width: 100%;
    min-height: 130px;
    padding: 15px 16px 14px;
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font: inherit;
    text-align: left;
}

.sensor-toggle:hover {
    background: #f8faf8;
}

.sensor-toggle:focus-visible {
    position: relative;
    z-index: 1;
    outline: 2px solid var(--accent);
    outline-offset: -3px;
}

.sensor-name {
    grid-area: name;
    color: var(--muted);
    font-size: 12px;
    font-weight: 650;
    letter-spacing: 0.025em;
}

.value {
    grid-area: value;
    color: var(--ink);
    font-size: 27px;
    font-variant-numeric: tabular-nums;
    font-weight: 650;
    line-height: 1.15;
}

.sensor-status {
    grid-area: status;
    width: fit-content;
    font-size: 12px;
    font-weight: 650;
}

.sensor-graph {
    padding: 0 12px 12px;
    border-top: 1px solid var(--line);
}

.sensor-graph[hidden] {
    display: none;
}

.sensor-graph .sensor-chart {
    height: 280px;
}

.sensor-graph .chart-readout {
    min-height: 18px;
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.normal {
    color: #317454;
}

.warning {
    color: #a36a18;
}

.critical {
    color: #ad443c;
}

.dashboard-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    margin-bottom: 22px;
}

.recent-alerts-panel {
    margin-bottom: 18px;
    padding: 14px 18px;
}

.recent-alerts-panel h2 {
    margin-bottom: 4px;
}

.panel {
    min-width: 0;
    margin-bottom: 0;
    padding: 21px;
}

.panel h2,
.trends-heading h2,
.page-heading h2,
.observation-heading h2 {
    color: var(--ink);
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 500;
}

.panel h2 {
    margin-bottom: 15px;
    font-size: 21px;
}

.machine {
    margin-bottom: 14px;
    padding: 12px 16px 10px;
    border: 1px solid #dbe5df;
    border-radius: 4px;
    background: #f3f6f3;
    box-shadow: none;
}

.machine-visual {
    width: min(190px, 75%);
    filter: saturate(0.72) drop-shadow(0 4px 8px rgba(36, 49, 46, 0.08));
}

.machine-gear {
    animation-duration: 8s;
}

.machine-gear.gear-small {
    animation-duration: 6s;
}

.machine p {
    color: var(--ink);
    font-size: 15px;
    font-weight: 600;
}

.alert {
    border: 1px solid #fecaca;
    border-left: 4px solid #dc2626;
    border-radius: 4px;
    background: #fff1f2;
    box-shadow: none;
}

.alert-message {
    color: #991b1b;
    font-weight: 700;
}

.alert-time {
    color: #7f1d1d;
}

.alert {
    display: block;
    padding: 0;
    overflow: hidden;
}

.alert-summary {
    display: flex;
    align-items: center;
    gap: 8px 16px;
    padding: 13px;
    cursor: pointer;
    list-style: none;
}

.alert-summary::-webkit-details-marker {
    display: none;
}

.alert-summary::after {
    margin-left: auto;
    color: #8d5149;
    content: "+";
    font-size: 18px;
    font-weight: 600;
}

.alert[open] .alert-summary {
    border-bottom: 1px solid #efdfdc;
}

.alert[open] .alert-summary::after {
    content: "-";
}

.alert-summary:focus-visible {
    outline: 2px solid #25766a;
    outline-offset: -3px;
}

.alert-recommendation {
    padding: 10px 13px 13px;
    background: #fffaf9;
}

.alert-recommendation p {
    margin-top: 5px;
    color: #68534f;
    font-size: 13px;
    line-height: 1.5;
}

.alert-recommendation p strong {
    color: #493d3a;
}

.empty-state {
    padding: 15px 0;
    color: var(--muted);
    font-size: 14px;
}

.trends {
    margin-bottom: 18px;
}

.trends-heading {
    margin-bottom: 12px;
}

.trends-heading h2 {
    font-size: 23px;
}

.trends-heading p,
.observation-heading > p,
.page-heading > p,
.history-detail-heading p {
    color: var(--muted);
}

.range-controls {
    border-color: #d5dfda;
    border-radius: 4px;
}

.range-controls button {
    border-color: #d5dfda;
    color: #4f5c57;
}

.range-controls button[aria-pressed="true"] {
    background: var(--accent);
}

.range-controls button:focus-visible {
    outline-color: var(--accent);
}

.chart-legend {
    color: #58645f;
    font-size: 12px;
}

.legend-swatch {
    background: var(--accent);
}

.chart-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.chart-card {
    padding: 15px 16px 12px;
}

.chart-card h3 {
    color: var(--ink);
    font-size: 14px;
}

.chart-card h3 span,
.chart-readout {
    color: var(--muted);
}

.sensor-chart {
    height: 185px;
}

.page-heading,
.observation-heading {
    margin: 5px 0 22px;
}

.page-heading h2,
.observation-heading h2 {
    font-size: 27px;
}

.eyebrow {
    color: var(--accent);
    font-size: 11px;
    letter-spacing: 0.07em;
}

.observation-results {
    margin: 5px 0 26px;
}

.history-category-card,
.history-table-wrap,
.history-empty,
.limit-card {
    border-color: var(--line);
    border-radius: 5px;
    box-shadow: none;
}

.history-category-card:hover {
    border-color: #a8c6ba;
    background: #f7faf8;
}

.history-unit {
    background: var(--accent-soft);
    color: #275d52;
}

.history-arrow {
    color: var(--accent);
}

.back-button {
    border-color: #cbd7d1;
    border-radius: 4px;
}

.history-table th {
    background: #eef2ef;
    color: #55625d;
}

.history-table th,
.history-table td {
    border-color: #e6ebe8;
}

.form-field {
    color: #53605b;
}

.form-field input {
    border-color: #cbd7d1;
    border-radius: 4px;
}

.form-field input:focus-visible {
    outline-color: var(--accent);
}

.password-field {
    position: relative;
}

.password-field input {
    padding-right: 64px;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 10px;
    padding: 4px;
    border: 0;
    background: transparent;
    color: var(--accent);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transform: translateY(-50%);
}

.password-toggle:focus-visible {
    border-radius: 3px;
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.profile-section {
    border-color: var(--line);
}

.limit-card {
    background: #fbfcfa;
}

.save-profile-button {
    border-radius: 4px;
    background: var(--accent);
}

.save-profile-button:hover {
    background: #1e6157;
}

@media (max-width: 1100px) {
    .sensor-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 800px) {
    header {
        padding: 22px 4%;
    }

    main {
        flex-direction: column;
        gap: 14px;
        width: 92%;
    }

    .primary-nav {
        position: static;
        flex-direction: row;
        width: 100%;
        overflow-x: auto;
        padding: 6px;
    }

    .view-tab {
        flex: 0 0 auto;
        min-height: 40px;
        border-left: 0;
        border-bottom: 2px solid transparent;
        white-space: nowrap;
    }

    .view-tab.active {
        border-bottom-color: var(--accent);
    }

    .chart-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    header {
        padding: 18px 5%;
    }

    header h1 {
        max-width: 18ch;
        font-size: 25px;
        line-height: 1.2;
    }

    .session-controls {
        position: static;
        margin-top: 14px;
    }

    .session-controls span,
    #sync-status {
        max-width: 100%;
        white-space: normal;
    }

    main {
        width: 92%;
    }

    .sensor-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 9px;
    }

    .sensor-card {
        padding: 13px 12px;
    }

    .value {
        font-size: 23px;
    }

    .panel {
        padding: 17px;
    }

    .chart-grid {
        grid-template-columns: 1fr;
    }

    .chart-card {
        padding: 13px;
    }

    .sensor-chart {
        height: 165px;
    }

    .sensor-graph .sensor-chart {
        height: 230px;
    }

    .trends-heading {
        align-items: flex-start;
    }

    .chart-legend {
        gap: 9px 14px;
    }

    .range-controls button {
        min-width: 40px;
    }
}

.dashboard-footer {
    display: grid;
    grid-template-columns: minmax(180px, 0.7fr) minmax(0, 2fr);
    align-items: center;
    gap: 24px;
    margin-top: 36px;
    padding: 24px max(4%, calc((100vw - 1400px) / 2));
    background: #243632;
    color: #f8faf8;
}

.dashboard-footer-brand {
    display: grid;
    gap: 4px;
}

.dashboard-footer-eyebrow {
    color: #9fd6c7;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

.dashboard-footer-title {
    font-size: 16px;
    font-weight: 700;
}

.dashboard-footer-details {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px 24px;
}

.dashboard-contact-item {
    display: grid;
    min-width: 0;
    gap: 4px;
}

.dashboard-contact-item span {
    color: #aabbb4;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

.dashboard-contact-item a,
.dashboard-contact-item address {
    color: #f8faf8;
    font-size: 13px;
    font-style: normal;
    overflow-wrap: anywhere;
    text-decoration: none;
}

.dashboard-contact-item a:hover {
    color: #9fd6c7;
    text-decoration: underline;
}

@media (max-width: 700px) {
    .dashboard-footer {
        grid-template-columns: 1fr;
        gap: 18px;
        padding: 22px 5%;
    }

    .dashboard-footer-details {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 16px;
    }
}

@media (max-width: 400px) {
    .dashboard-footer-details {
        grid-template-columns: 1fr;
    }
}
