:root {
    --bg-canvas: #efe8de;
    --bg-canvas-soft: #f7f1e8;
    --bg-panel: rgba(251, 246, 239, 0.82);
    --bg-panel-strong: #fbf8f3;
    --bg-panel-muted: rgba(255, 255, 255, 0.46);
    --bg-sidebar: rgba(248, 241, 232, 0.88);

    --text-main: #231b15;
    --text-sub: #7b6a5d;
    --text-soft: #a29082;

    --line: rgba(90, 67, 50, 0.12);
    --line-strong: rgba(90, 67, 50, 0.2);

    --primary: #ba5a2b;
    --primary-strong: #8f431d;
    --primary-soft: rgba(186, 90, 43, 0.14);
    --accent: #5d7141;
    --accent-soft: rgba(93, 113, 65, 0.14);
    --sun: #d7a34d;
    --danger: #a4412a;
    --warning: #b7831f;
    --success: #4f6d37;
    --info: #476f79;

    --chart-line: #b45a31;
    --chart-fill: rgba(180, 90, 49, 0.18);

    --shadow-sm: 0 8px 22px rgba(61, 42, 29, 0.06);
    --shadow-md: 0 22px 50px rgba(61, 42, 29, 0.1);
    --shadow-lg: 0 30px 80px rgba(61, 42, 29, 0.12);

    --radius-xl: 34px;
    --radius-lg: 24px;
    --radius-md: 18px;
    --radius-sm: 12px;
}

[data-theme="dark"] {
    --bg-canvas: #1a1713;
    --bg-canvas-soft: #201c17;
    --bg-panel: rgba(35, 30, 25, 0.82);
    --bg-panel-strong: #28231d;
    --bg-panel-muted: rgba(255, 255, 255, 0.04);
    --bg-sidebar: rgba(27, 23, 19, 0.9);

    --text-main: #f4ede3;
    --text-sub: #b8ab9d;
    --text-soft: #8c7d6d;

    --line: rgba(236, 223, 207, 0.08);
    --line-strong: rgba(236, 223, 207, 0.16);

    --primary: #d57849;
    --primary-strong: #f0a072;
    --primary-soft: rgba(213, 120, 73, 0.16);
    --accent: #8ba56d;
    --accent-soft: rgba(139, 165, 109, 0.16);
    --sun: #d7a34d;
    --danger: #dc6d53;
    --warning: #d2a042;
    --success: #8cb06a;
    --info: #7cb0ba;

    --chart-line: #d57849;
    --chart-fill: rgba(213, 120, 73, 0.18);

    --shadow-sm: 0 10px 24px rgba(0, 0, 0, 0.24);
    --shadow-md: 0 24px 54px rgba(0, 0, 0, 0.28);
    --shadow-lg: 0 36px 84px rgba(0, 0, 0, 0.34);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    overflow: hidden;
    background:
        radial-gradient(circle at 12% 10%, rgba(215, 163, 77, 0.18), transparent 24%),
        radial-gradient(circle at 88% 16%, rgba(186, 90, 43, 0.18), transparent 22%),
        linear-gradient(180deg, var(--bg-canvas) 0%, var(--bg-canvas-soft) 100%);
    color: var(--text-main);
    font-family: 'Manrope', sans-serif;
    position: relative;
}

body::before,
body::after {
    content: "";
    inset: 0;
    pointer-events: none;
    position: fixed;
    z-index: 0;
}

body::before {
    background:
        repeating-linear-gradient(
            180deg,
            transparent 0,
            transparent 32px,
            rgba(72, 54, 40, 0.03) 32px,
            rgba(72, 54, 40, 0.03) 33px
        );
    opacity: 0.9;
}

body::after {
    background:
        radial-gradient(circle at 24% 78%, rgba(93, 113, 65, 0.1), transparent 18%),
        radial-gradient(circle at 82% 72%, rgba(186, 90, 43, 0.08), transparent 18%);
}

h1, h2, h3 {
    font-family: 'Syne', sans-serif;
    letter-spacing: -0.03em;
}

button,
input,
select {
    font: inherit;
}

.app-shell {
    display: grid;
    gap: 24px;
    grid-template-columns: 320px minmax(0, 1fr);
    height: 100vh;
    padding: 22px;
    position: relative;
    z-index: 1;
}

.app-sidebar,
.app-header,
.hero-card,
.card,
.sidebar-card,
.timeline-card {
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.app-sidebar {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.42), transparent 32%),
        var(--bg-sidebar);
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    gap: 18px;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 24px;
    position: relative;
}

.app-sidebar::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at top left, rgba(215, 163, 77, 0.14), transparent 26%),
        linear-gradient(150deg, rgba(186, 90, 43, 0.08), transparent 24%);
    pointer-events: none;
}

.sidebar-brand-block,
.side-nav,
.sidebar-card,
.theme-toggle-wrap {
    position: relative;
    z-index: 1;
}

.sidebar-brand-block {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

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

.brand-logo {
    align-items: center;
    background:
        linear-gradient(145deg, var(--primary), var(--primary-strong));
    border-radius: 22px;
    box-shadow: 0 14px 30px rgba(143, 67, 29, 0.22);
    color: #fff9f2;
    display: flex;
    font-size: 22px;
    height: 60px;
    justify-content: center;
    width: 60px;
}

.brand-name h1 {
    align-items: baseline;
    color: var(--text-main);
    display: flex;
    font-size: 1.28rem;
    gap: 8px;
}

.brand-name h1 span {
    color: var(--primary);
}

.brand-name p {
    color: var(--text-sub);
    font-size: 0.72rem;
    letter-spacing: 0.22em;
    margin-top: 4px;
    text-transform: uppercase;
}

.brand-manifesto {
    color: var(--text-sub);
    font-size: 0.86rem;
    line-height: 1.6;
    max-width: 26ch;
}

.side-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-link {
    align-items: center;
    border: 1px solid transparent;
    border-radius: 18px;
    color: var(--text-sub);
    display: flex;
    gap: 12px;
    min-height: 54px;
    padding: 0 16px;
    position: relative;
    text-decoration: none;
    transition: transform 0.22s ease, border-color 0.22s ease, background 0.22s ease, color 0.22s ease;
}

.nav-link i {
    align-items: center;
    background: var(--bg-panel-muted);
    border: 1px solid var(--line);
    border-radius: 14px;
    display: inline-flex;
    height: 34px;
    justify-content: center;
    width: 34px;
}

.nav-link span {
    font-size: 0.95rem;
    font-weight: 700;
}

.nav-link:hover {
    border-color: var(--line-strong);
    color: var(--text-main);
    transform: translateX(3px);
}

.nav-link.active {
    background: linear-gradient(135deg, var(--bg-panel-strong), rgba(255, 255, 255, 0.08));
    border-color: var(--line-strong);
    box-shadow: var(--shadow-sm);
    color: var(--text-main);
}

.nav-link.active i {
    background: var(--primary-soft);
    border-color: rgba(186, 90, 43, 0.22);
    color: var(--primary);
}

.sidebar-card {
    background: var(--bg-panel-muted);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 18px;
}

.module-header {
    color: var(--text-soft);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    margin-bottom: 12px;
    text-transform: uppercase;
}

.btn-stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn-primary-gradient,
.btn-outline,
.btn-small,
.btn-action-primary,
.theme-btn {
    align-items: center;
    border-radius: 16px;
    cursor: pointer;
    display: inline-flex;
    font-weight: 800;
    gap: 10px;
    justify-content: center;
    min-height: 48px;
    transition: transform 0.22s ease, box-shadow 0.22s ease, background 0.22s ease, color 0.22s ease, border-color 0.22s ease;
}

.btn-primary-gradient:hover,
.btn-outline:hover,
.btn-small:hover,
.btn-action-primary:hover,
.theme-btn:hover {
    transform: translateY(-1px);
}

.btn-primary-gradient {
    background: linear-gradient(135deg, var(--primary), var(--primary-strong));
    border: none;
    box-shadow: 0 16px 28px rgba(186, 90, 43, 0.18);
    color: #fff9f2;
    padding: 0 16px;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--line-strong);
    color: var(--text-main);
    padding: 0 16px;
}

.status-indicator {
    align-items: center;
    border-radius: 999px;
    display: inline-flex;
    font-size: 0.88rem;
    font-weight: 700;
    gap: 10px;
    min-height: 40px;
    padding: 0 14px;
    width: fit-content;
}

.status-indicator.waiting {
    background: rgba(90, 67, 50, 0.06);
    color: var(--text-sub);
}

.status-indicator.online {
    background: rgba(79, 109, 55, 0.12);
    color: var(--success);
}

.pulse-dot {
    animation: pulse 1.7s infinite;
    background: currentColor;
    border-radius: 50%;
    height: 8px;
    width: 8px;
}

.calibration-summary,
.side-note {
    margin-top: 2px;
}

.cal-row {
    align-items: center;
    display: flex;
    font-size: 0.92rem;
    justify-content: space-between;
    margin-bottom: 10px;
}

.cal-row span {
    color: var(--text-sub);
}

.cal-row strong {
    color: var(--text-main);
}

.side-note p {
    color: var(--text-sub);
    font-size: 0.88rem;
    line-height: 1.6;
}

.theme-toggle-wrap {
    margin-top: auto;
}

.theme-btn {
    background: var(--bg-panel-strong);
    border: 1px solid var(--line);
    color: var(--text-main);
    width: 100%;
}

.app-main {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow-y: auto;
    padding-right: 4px;
}

.app-header {
    align-items: center;
    background: rgba(250, 245, 238, 0.62);
    border: 1px solid var(--line);
    border-radius: 28px;
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: space-between;
    margin-bottom: 24px;
    min-height: 104px;
    padding: 22px 24px;
    position: sticky;
    top: 0;
    z-index: 20;
}

.header-left {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.header-kicker {
    color: var(--primary);
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.header-left h2 {
    font-size: clamp(1.28rem, 1.6vw, 1.95rem);
    line-height: 1.08;
    max-width: 20ch;
}

.header-right {
    align-items: flex-end;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.live-info,
.top-badges {
    align-items: center;
    display: flex;
    gap: 14px;
}

.live-info {
    color: var(--text-sub);
    font-size: 0.95rem;
    font-weight: 700;
}

#header-clock {
    color: var(--text-main);
    font-size: 1.08rem;
    font-weight: 800;
}

.divider {
    background: var(--line-strong);
    border-radius: 999px;
    height: 8px;
    width: 8px;
}

.session-stat,
.user-badge {
    align-items: center;
    background: var(--bg-panel-strong);
    border: 1px solid var(--line);
    border-radius: 999px;
    display: inline-flex;
    gap: 10px;
    min-height: 44px;
    padding: 0 16px;
}

.session-stat .label {
    color: var(--text-soft);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.session-stat .value,
.user-badge {
    color: var(--text-main);
    font-size: 0.92rem;
    font-weight: 800;
}

.page-view {
    display: none;
    opacity: 0;
    transform: translateY(12px);
}

.page-view.active {
    animation: fade-slide 0.42s ease forwards;
    display: block;
}

.dashboard-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding-bottom: 30px;
}

.hero-stage {
    display: grid;
    gap: 24px;
    grid-template-columns: minmax(0, 1.45fr) 400px;
}

.hero-card {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.34), transparent 30%),
        var(--bg-panel);
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    position: relative;
}

.hero-card::before {
    content: "";
    pointer-events: none;
    position: absolute;
    inset: 0;
}

.hero-card-main {
    display: grid;
    gap: 24px;
    grid-template-columns: minmax(0, 1.15fr) 350px;
    padding: 26px;
}

.hero-card-main::before {
    background:
        radial-gradient(circle at 18% 18%, rgba(215, 163, 77, 0.16), transparent 22%),
        linear-gradient(135deg, rgba(186, 90, 43, 0.08), transparent 32%);
}

.hero-copy,
.hero-sensor,
.hero-card-side > * {
    position: relative;
    z-index: 1;
}

.hero-copy {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.hero-copy h3 {
    font-size: clamp(1.26rem, 1.8vw, 1.92rem);
    line-height: 1.1;
    max-width: 22ch;
}

.hero-copy p {
    color: var(--text-sub);
    font-size: 0.94rem;
    line-height: 1.65;
    max-width: 58ch;
}

.stats-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 8px;
}

.stat-card {
    align-items: center;
    background: var(--bg-panel-muted);
    border: 1px solid var(--line);
    border-radius: 22px;
    display: flex;
    gap: 14px;
    min-height: 86px;
    padding: 16px;
}

.stat-icon {
    align-items: center;
    border-radius: 18px;
    display: inline-flex;
    font-size: 1.2rem;
    height: 52px;
    justify-content: center;
    width: 52px;
}

.u-avg { background: rgba(186, 90, 43, 0.12); color: var(--primary); }
.u-min { background: rgba(215, 163, 77, 0.14); color: var(--warning); }
.u-max { background: rgba(93, 113, 65, 0.12); color: var(--success); }
.u-pump { background: rgba(71, 111, 121, 0.12); color: var(--info); }

.stat-data {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stat-data label {
    color: var(--text-soft);
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.stat-data .val {
    align-items: baseline;
    color: var(--text-main);
    display: flex;
    gap: 4px;
    font-size: 1.62rem;
    font-weight: 800;
}

.stat-data .val small {
    color: var(--text-sub);
    font-size: 0.74rem;
    font-weight: 700;
}

.hero-sensor {
    display: flex;
    flex-direction: column;
    gap: 18px;
    justify-content: center;
}

.sensor-monolith {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.4), transparent 42%),
        rgba(255, 255, 255, 0.32);
    border: 1px solid var(--line);
    border-radius: 32px;
    padding: 20px;
    text-align: center;
}

.gauge-container {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.gauge-header {
    align-items: flex-start;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    text-align: left;
}

.gauge-header h3 {
    font-size: 0.96rem;
}

.gauge-header span {
    color: var(--text-soft);
    font-size: 0.76rem;
    font-weight: 700;
}

.gauge-body {
    height: 196px;
    margin: 0 auto;
    position: relative;
    width: 196px;
}

.ring-gauge {
    height: 100%;
    transform: rotate(-90deg);
    width: 100%;
}

.ring-bg {
    fill: none;
    stroke: rgba(90, 67, 50, 0.08);
    stroke-width: 8;
}

.ring-fill {
    fill: none;
    stroke: var(--primary);
    stroke-dasharray: 282.7;
    stroke-linecap: round;
    stroke-width: 8;
    transition: stroke-dashoffset 0.8s ease, stroke 0.25s ease;
}

.gauge-labels {
    left: 50%;
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
}

.u-value {
    font-family: 'Syne', sans-serif;
    font-size: clamp(2.15rem, 3.8vw, 3.25rem);
    line-height: 0.96;
}

.k-value {
    color: var(--text-sub);
    font-size: 0.82rem;
    font-weight: 700;
    margin-top: 8px;
}

.gauge-footer {
    display: flex;
    justify-content: center;
}

.badge {
    align-items: center;
    background: var(--bg-panel-strong);
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--text-sub);
    display: inline-flex;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    min-height: 36px;
    padding: 0 14px;
    text-transform: uppercase;
}

.badge.danger { background: rgba(164, 65, 42, 0.12); color: var(--danger); }
.badge.success { background: rgba(79, 109, 55, 0.12); color: var(--success); }
.badge.warning { background: rgba(183, 131, 31, 0.12); color: var(--warning); }
.badge.neutral { background: rgba(90, 67, 50, 0.08); color: var(--text-sub); }

.saturation-ribbon {
    background: var(--bg-panel-muted);
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 16px 18px;
}

.prog-info {
    align-items: center;
    display: flex;
    font-size: 0.82rem;
    font-weight: 700;
    justify-content: space-between;
    margin-bottom: 10px;
}

.prog-info span {
    color: var(--text-sub);
}

.prog-track {
    background: rgba(90, 67, 50, 0.08);
    border-radius: 999px;
    height: 12px;
    overflow: hidden;
    width: 100%;
}

.prog-fill {
    border-radius: 999px;
    height: 100%;
    transition: width 0.8s ease;
}

.bar-10 {
    background: linear-gradient(90deg, var(--primary) 0%, var(--sun) 100%);
}

.hero-card-side {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 22px;
}

.system-block,
.diagnostics-grid,
.compact-card,
.timeline-card {
    position: relative;
    z-index: 1;
}

.pump-status-card {
    background: var(--bg-panel-muted);
    border: 1px solid var(--line);
    border-radius: 24px;
    padding: 16px;
}

.pump-visual {
    align-items: center;
    display: flex;
    gap: 14px;
}

.pump-icon-bg {
    align-items: center;
    background: rgba(90, 67, 50, 0.08);
    border: 1px solid var(--line);
    border-radius: 22px;
    color: var(--text-sub);
    display: inline-flex;
    font-size: 1.16rem;
    height: 56px;
    justify-content: center;
    width: 56px;
}

.pump-icon-bg.active {
    background: var(--primary-soft);
    border-color: rgba(186, 90, 43, 0.2);
    color: var(--primary);
}

.pump-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pump-info strong {
    font-family: 'Syne', sans-serif;
    font-size: 1.06rem;
}

.pump-info p {
    color: var(--text-sub);
    font-size: 0.8rem;
}

.diagnostics-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.diagnostic-tile {
    background: var(--bg-panel-muted);
    border: 1px solid var(--line);
    border-radius: 20px;
    min-height: 124px;
    padding: 16px;
}

.tile-label {
    color: var(--text-soft);
    display: block;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.diagnostic-tile strong {
    display: block;
    font-family: 'Syne', sans-serif;
    font-size: 0.92rem;
    line-height: 1.15;
    margin-bottom: 10px;
}

.diagnostic-tile p {
    color: var(--text-sub);
    font-size: 0.78rem;
    line-height: 1.6;
}

.card {
    background: var(--bg-panel);
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    padding: 22px;
    position: relative;
}

.card:hover,
.sidebar-card:hover,
.hero-card:hover,
.timeline-card:hover {
    box-shadow: 0 26px 62px rgba(61, 42, 29, 0.12);
}

.compact-card {
    margin: 0;
    padding: 20px;
}

.card-header {
    align-items: flex-start;
    display: flex;
    gap: 14px;
    justify-content: space-between;
    margin-bottom: 18px;
}

.card-header.slim {
    margin-bottom: 14px;
}

.card-header h3,
.memory-hero h3,
.settings-card h3,
.insight-card h3 {
    font-size: 1.08rem;
}

.card-header p,
.memory-hero p,
.settings-card p,
.insight-card p,
.support-copy,
.microcopy {
    color: var(--text-sub);
    font-size: 0.9rem;
    line-height: 1.7;
}

.toggle-control {
    align-items: center;
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    min-height: 52px;
}

.toggle-control:last-of-type {
    border-bottom: none;
}

.switch {
    display: inline-block;
    height: 24px;
    position: relative;
    width: 44px;
}

.switch input {
    height: 0;
    opacity: 0;
    width: 0;
}

.slider {
    background: rgba(90, 67, 50, 0.18);
    border-radius: 999px;
    cursor: pointer;
    inset: 0;
    position: absolute;
    transition: 0.22s ease;
}

.slider:before {
    background: var(--bg-panel-strong);
    border-radius: 50%;
    bottom: 3px;
    content: "";
    height: 18px;
    left: 3px;
    position: absolute;
    transition: 0.22s ease;
    width: 18px;
}

input:checked + .slider {
    background: linear-gradient(90deg, var(--primary), var(--primary-strong));
}

input:checked + .slider:before {
    transform: translateX(20px);
}

.alert-status {
    align-items: center;
    border-radius: 18px;
    display: flex;
    gap: 10px;
    margin-top: 16px;
    min-height: 52px;
    padding: 0 16px;
}

.alert-status.idle {
    background: rgba(90, 67, 50, 0.08);
    color: var(--text-sub);
}

.alert-status.danger {
    background: rgba(164, 65, 42, 0.14);
    color: var(--danger);
}

.alert-status.warning {
    background: rgba(183, 131, 31, 0.14);
    color: var(--warning);
}

.timeline-card {
    background: var(--bg-panel-muted);
    border: 1px solid var(--line);
    border-radius: 24px;
    padding: 16px;
}

.event-feed {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 164px;
    overflow-y: auto;
}

.feed-empty {
    color: var(--text-soft);
    font-size: 0.8rem;
    line-height: 1.6;
    padding: 8px 0;
}

.feed-item {
    background: rgba(255, 255, 255, 0.24);
    border: 1px solid var(--line);
    border-left: 3px solid var(--line-strong);
    border-radius: 16px;
    font-size: 0.78rem;
    line-height: 1.5;
    padding: 12px 14px;
}

.feed-item strong {
    display: block;
    font-size: 0.74rem;
    letter-spacing: 0.12em;
    margin-bottom: 6px;
}

.feed-item.on { border-left-color: var(--primary); }
.feed-item.off { border-left-color: var(--success); }

.lower-grid {
    display: grid;
    gap: 24px;
    grid-template-columns: minmax(0, 1fr) 320px;
}

.chart-card {
    min-height: 420px;
}

.chart-box {
    height: 330px;
}

.insight-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
    justify-content: space-between;
}

.insight-lines {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.insight-line {
    align-items: center;
    background: var(--bg-panel-muted);
    border: 1px solid var(--line);
    border-radius: 18px;
    display: flex;
    justify-content: space-between;
    min-height: 58px;
    padding: 0 16px;
}

.insight-line span {
    color: var(--text-sub);
    font-size: 0.78rem;
    font-weight: 700;
}

.insight-line strong {
    color: var(--text-main);
    font-size: 0.8rem;
}

.memory-hero {
    align-items: end;
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

.header-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.btn-small {
    background: var(--bg-panel-strong);
    border: 1px solid var(--line);
    color: var(--text-main);
    padding: 0 16px;
}

.btn-small.primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-strong));
    border-color: transparent;
    color: #fff9f2;
}

.btn-small.danger {
    background: rgba(164, 65, 42, 0.12);
    border-color: rgba(164, 65, 42, 0.18);
    color: var(--danger);
}

.history-card {
    padding-top: 18px;
}

.history-filters {
    align-items: center;
    background: var(--bg-panel-muted);
    border: 1px solid var(--line);
    border-radius: 20px;
    display: flex;
    justify-content: space-between;
    margin-bottom: 18px;
    padding: 14px 16px;
}

.filter-group {
    align-items: center;
    display: flex;
    gap: 14px;
}

.filter-group label {
    color: var(--text-sub);
    font-size: 0.78rem;
    font-weight: 700;
}

.table-scroll {
    overflow-x: auto;
}

table {
    border-collapse: collapse;
    width: 100%;
}

thead th {
    border-bottom: 1px solid var(--line-strong);
    color: var(--text-soft);
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    padding: 16px 14px;
    text-align: left;
    text-transform: uppercase;
}

tbody td {
    border-bottom: 1px solid var(--line);
    font-size: 0.84rem;
    padding: 16px 14px;
}

tbody tr:hover td {
    background: rgba(255, 255, 255, 0.18);
}

.history-main {
    font-weight: 700;
}

.history-meta {
    color: var(--text-soft);
    display: block;
    font-size: 0.7rem;
    margin-top: 6px;
}

.history-tag {
    align-items: center;
    border: 1px solid transparent;
    border-radius: 999px;
    display: inline-flex;
    font-size: 0.64rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    margin-top: 8px;
    min-height: 24px;
    padding: 0 10px;
    text-transform: uppercase;
}

.history-tag.auto {
    background: rgba(93, 113, 65, 0.12);
    border-color: rgba(93, 113, 65, 0.16);
    color: var(--success);
}

.history-tag.manual {
    background: rgba(215, 163, 77, 0.12);
    border-color: rgba(215, 163, 77, 0.18);
    color: var(--warning);
}

.empty-table {
    color: var(--text-sub);
    text-align: center;
}

.settings-mosaic {
    display: grid;
    gap: 24px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.settings-card-large {
    grid-column: 1 / -1;
}

.settings-section {
    border-top: 1px solid var(--line);
    margin-top: 20px;
    padding-top: 20px;
}

.settings-section.no-divider {
    border-top: none;
    margin-top: 0;
    padding-top: 0;
}

.input-row {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 14px;
}

.input-row.single {
    grid-template-columns: 1fr;
}

.input-wrap label {
    color: var(--text-sub);
    display: block;
    font-size: 0.76rem;
    font-weight: 800;
    margin-bottom: 8px;
}

.input-wrap input,
.input-wrap select {
    background: rgba(255, 255, 255, 0.42);
    border: 1px solid var(--line);
    border-radius: 16px;
    color: var(--text-main);
    min-height: 52px;
    outline: none;
    padding: 0 14px;
    width: 100%;
}

.input-wrap input:focus,
.input-wrap select:focus {
    border-color: rgba(186, 90, 43, 0.42);
    box-shadow: 0 0 0 4px rgba(186, 90, 43, 0.1);
}

.btn-action-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-strong));
    border: none;
    color: #fff9f2;
    padding: 0 18px;
    width: 100%;
}

.alt-info {
    background: linear-gradient(135deg, #557987, #355763);
}

.alt-primary {
    background: linear-gradient(135deg, var(--accent), #485930);
}

.alt-danger {
    background: linear-gradient(135deg, var(--danger), #7d2f1d);
}

.lab-actions {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 12px;
}

.support-copy {
    font-size: 0.8rem;
}

.field-msg {
    font-size: 0.78rem;
    font-weight: 700;
    min-height: 18px;
    margin-top: 12px;
}

.field-msg.success { color: var(--success); }
.field-msg.error { color: var(--danger); }
.field-msg.idle { color: var(--text-sub); }

.info-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 12px;
}

.info-item {
    align-items: center;
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.info-item span {
    color: var(--text-sub);
}

.green-text {
    color: var(--success);
}

hr {
    border: none;
    border-top: 1px solid var(--line);
    margin: 20px 0 0;
}

.mt-4 {
    margin-top: 16px;
}

.microcopy {
    font-size: 0.82rem;
}

@keyframes fade-slide {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.4);
    }
}

@media (max-width: 1380px) {
    .hero-stage,
    .lower-grid {
        grid-template-columns: 1fr;
    }

    .hero-card-main {
        grid-template-columns: 1fr;
    }

    .chart-card {
        min-height: 0;
    }
}

@media (max-width: 1080px) {
    body {
        overflow: auto;
    }

    .app-shell {
        grid-template-columns: 1fr;
        height: auto;
        min-height: 100vh;
    }

    .app-sidebar {
        overflow: visible;
    }

    .app-main {
        overflow: visible;
        padding-right: 0;
    }

    .app-header {
        position: relative;
        top: auto;
    }

    .settings-mosaic {
        grid-template-columns: 1fr;
    }

    .settings-card-large {
        grid-column: auto;
    }
}

@media (max-width: 820px) {
    .app-shell {
        padding: 16px;
    }

    .app-header,
    .hero-card-main,
    .hero-card-side,
    .card,
    .sidebar-card,
    .timeline-card {
        padding: 20px;
    }

    .app-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 16px;
    }

    .header-right,
    .top-badges,
    .memory-hero,
    .filter-group {
        align-items: flex-start;
        flex-direction: column;
    }

    .stats-grid,
    .diagnostics-grid,
    .input-row,
    .lab-actions {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 620px) {
    .brand {
        align-items: flex-start;
        flex-direction: column;
    }

    .live-info {
        flex-wrap: wrap;
    }

    .gauge-body {
        height: 168px;
        width: 168px;
    }

    .u-value {
        font-size: 2.7rem;
    }

    .header-btns {
        width: 100%;
    }

    .header-btns .btn-small {
        width: 100%;
    }
}
