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

body {
    font-family: var(--fx-font-family, 'Inter', system-ui, sans-serif);
    background: #0c0e12;
    min-height: 100vh;
    color: #e2e8f0;
    user-select: none;
}

.app-header {
    position: relative;
    z-index: 2;
    background: #0f1218;
    border-bottom: 1px solid #18222e;
    display: flex;
    align-items: center;
    padding: 0 20px;
    height: 46px;
    overflow: visible;
}

.app-header-start,
.app-header-end {
    display: flex;
    align-items: center;
}

.app-header-start {
    gap: 14px;
}

.app-header-end {
    position: absolute;
    top: 0;
    right: 0;
    height: 94px;
    padding: 0 20px 0 180px;
    gap: 12px;
    z-index: 3;
}

.app-header-end::before,
.app-header-end::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.app-header-end::before {
    background: #0f1218;
    clip-path: polygon(
        calc(180px * 46 / 94) 45px,
        100% 45px,
        100% calc(100% - 1px),
        calc(180px + 1px) calc(100% - 1px)
    );
}

.app-header-end::after {
    background: #18222e;
    clip-path: polygon(
        calc(180px * 46 / 94) 46px,
        180px 100%,
        100% 100%,
        100% calc(100% - 1px),
        calc(180px + 1px) calc(100% - 1px),
        calc(180px * 46 / 94 + 1px) 46px
    );
}

.app-header-end > * {
    position: relative;
    z-index: 1;
}

.brand {
    font-family: var(--fx-font-family, 'Inter', system-ui, sans-serif);
    font-weight: 800;
    font-size: 1.2rem;
    letter-spacing: .03em;
    color: #e2e8f0;
}

.brand-mark {
    color: #f59e0b;
}

.brand-meta {
    font-size: .6rem;
    color: #243040;
    font-weight: 500;
    margin-left: 6px;
    letter-spacing: .14em;
}

.header-rule {
    width: 1px;
    height: 22px;
    background: #18222e;
}

.pill {
    font-size: 8px;
    font-weight: 700;
    letter-spacing: .14em;
    padding: 3px 8px;
    border-radius: 3px;
}

.pill-ok {
    color: #10b981;
    border: 1px solid #052e16;
}

.pill-warn {
    color: #f59e0b;
    border: 1px solid #431407;
}

.page {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    box-sizing: border-box;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    align-items: stretch;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.grid-controls {
    display: grid;
    grid-template-columns: 200px 1fr 1fr 200px;
    gap: 16px;
    align-items: stretch;
}

.grid-controls > fx-group-box {
    min-height: 0;
}

.stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.stack-6 {
    gap: 6px;
}

.stack-8 {
    gap: 8px;
}

.stack-10 {
    gap: 10px;
}

.stack-12 {
    gap: 12px;
}

.stack-grow {
    flex: 1;
}

.temps {
    display: flex;
    justify-content: space-around;
    align-items: flex-start;
    width: 100%;
    gap: 8px;
    flex: 1;
    min-height: 280px;
}

.readings {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 6px;
}

.grid-readings {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    flex: 1;
    min-height: 0;
    gap: 12px;
}

.grid-display {
    width: 100%;
    --fx-display-width: 100%;
}

.sema-grid {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    box-sizing: border-box;
}

.caption {
    font-size: 8px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .12em;
}

.caption-rose {
    color: #fb7185;
}

.caption-pink {
    color: #fda4af;
}

.caption-teal {
    color: #14b8a6;
}

.caption-cyan {
    color: #2dd4bf;
}

.caption-amber {
    color: #f59e0b;
}

.caption-lime {
    color: #84cc16;
}

.caption-violet {
    color: #a78bfa;
}

.caption-muted {
    color: #243040;
}

.split {
    border-top: 1px solid #1c2530;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.split-14 {
    padding-top: 14px;
    gap: 8px;
}

.split-12 {
    padding-top: 12px;
    gap: 10px;
}

.blades {
    display: flex;
    justify-content: space-around;
    align-items: stretch;
    width: 100%;
    height: 100%;
    min-height: 0;
    gap: 12px;
}

.blades-box::part(content) {
    flex: 1;
    min-height: 0;
}

.blades .stack {
    height: 100%;
    min-height: 0;
}

.fader-b1,
.fader-b2,
.bar-torque {
    height: 100%;
    --fx-bar-height: 100%;
}

.turbine {
    display: flex;
    gap: 16px;
    width: 100%;
    align-items: flex-start;
    justify-content: center;
    flex-wrap: wrap;
}

.turbine-side {
    display: flex;
    flex-direction: column;
    gap: 14px;
    align-items: center;
    flex: 1;
    min-width: 180px;
}

fx-separator {
    width: 100%;
}

.gauge-rpm {
    --fx-gauge-size: 205px;
    --fx-gauge-gradient-start: #fde68a;
    --fx-gauge-gradient-middle: #f59e0b;
    --fx-gauge-gradient-end: #ea580c;
}

.gauge-dc {
    --fx-gauge-size: 220px;
    --fx-gauge-gradient-start: #ddd6fe;
    --fx-gauge-gradient-middle: #a78bfa;
    --fx-gauge-gradient-end: #6d28d9;
}

.gauge-power {
    --fx-gauge-size: 205px;
    --fx-gauge-gradient-start: #d9f99d;
    --fx-gauge-gradient-middle: #84cc16;
    --fx-gauge-gradient-end: #4d7c0f;
}

.needle-power {
    --fx-gauge-needle-gradient-start: #bef264;
    --fx-gauge-needle-gradient-end: #65a30d;
}

.gauge-gearbox {
    --fx-linear-gauge-width: 72px;
    --fx-linear-gauge-height: 230px;
    --fx-linear-gauge-gradient-start: #86efac;
    --fx-linear-gauge-gradient-middle: #fb7185;
    --fx-linear-gauge-gradient-end: #dc2626;
}

.gauge-farm {
    display: flex;
    width: 100%;
    align-self: stretch;
    --fx-linear-gauge-width: 100% !important;
    --fx-linear-gauge-height: 72px;
    --fx-linear-gauge-gradient-start: #d9f99d;
    --fx-linear-gauge-gradient-middle: #84cc16;
    --fx-linear-gauge-gradient-end: #4d7c0f;
}

.bar-heat {
    --fx-bar-gradient-start: #86efac;
    --fx-bar-gradient-middle: #fb7185;
    --fx-bar-gradient-end: #dc2626;
}

.pot-pitch {
    --fx-potentiometer-size: 155px;
    --fx-potentiometer-theme-color: #14b8a6;
}

.fader-b1 {
    --fx-bar-width: 72px;
    --fx-bar-gradient-start: #99f6e4;
    --fx-bar-gradient-middle: #14b8a6;
    --fx-bar-gradient-end: #0f766e;
}

.fader-b2 {
    --fx-bar-width: 72px;
    --fx-bar-gradient-start: #99f6e4;
    --fx-bar-gradient-middle: #2dd4bf;
    --fx-bar-gradient-end: #0d9488;
}

.bar-torque {
    --fx-bar-width: 72px;
    --fx-bar-gradient-start: #fde68a;
    --fx-bar-gradient-middle: #f59e0b;
    --fx-bar-gradient-end: #ea580c;
}

.rotary-bus {
    --fx-size: 160px;
}

.clock-card::part(content) {
    flex: 1;
    min-height: 0;
    align-items: center;
    justify-content: center;
}

.pot-dc {
    --fx-potentiometer-size: 155px;
    --fx-potentiometer-theme-color: #a78bfa;
}

.led-mode {
    --fx-led-size: 15px;
}

.chart-bars,
.chart-bars-sm {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    background: #080b10;
    border-radius: 4px;
}

.chart-bars {
    height: 90px;
    padding: 6px 6px 0;
}

.chart-bars-sm {
    height: 60px;
    padding: 4px 4px 0;
}

.chart-bar {
    flex: 1;
    border-radius: 2px 2px 0 0;
    min-height: 2px;
    height: var(--bar-h);
    background: var(--bar-c);
}

.trend {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chart-axis,
.trend-row,
.trend-kpi {
    display: flex;
    justify-content: space-between;
}

.chart-axis {
    padding: 0 2px;
}

.trend-kpi {
    align-items: baseline;
}

.chart-tick {
    font-size: .58rem;
    color: #334155;
    font-family: monospace;
}

.chart-tick-now {
    font-weight: 700;
}

.chart-tick-power {
    color: #84cc16;
}

.chart-tick-wind {
    color: #38bdf8;
}

.chart-tick-temp {
    color: #fb7185;
}

.chart-tick-dc {
    color: #a78bfa;
}

.trend-label {
    font-size: .65rem;
    color: #64748b;
}

.trend-label-caps {
    text-transform: uppercase;
    letter-spacing: .08em;
}

.trend-note {
    font-size: .65rem;
    color: #334155;
}

.trend-warn {
    font-size: .65rem;
    color: #f59e0b;
    letter-spacing: .08em;
}

.trend-meta {
    font-size: .72rem;
    font-weight: 600;
}

.trend-meta-avg {
    color: #4d7c0f;
}

.trend-meta-warn {
    color: #f59e0b;
}

.trend-meta-dc {
    color: #a78bfa;
}

.kpi {
    font-size: 1.2rem;
    font-weight: 700;
}

.kpi-sm {
    font-size: 1.1rem;
}

.kpi-unit {
    font-size: .7rem;
}

.kpi-sm .kpi-unit {
    font-size: .65rem;
}

.kpi-power {
    color: #84cc16;
}

.kpi-power .kpi-unit {
    color: #65a30d;
}

.kpi-wind {
    color: #38bdf8;
}

.kpi-wind .kpi-unit {
    color: #0ea5e9;
}

.kpi-temp {
    color: #fb7185;
}

.kpi-temp .kpi-unit {
    color: #e11d48;
}

.kpi-rpm {
    color: #f59e0b;
}

.kpi-volt {
    color: #38bdf8;
}

.kpi-freq {
    color: #a78bfa;
}

.kpi-energy {
    color: #10b981;
}

.kpi-dc {
    color: #a78bfa;
}

.kpi-pitch {
    color: #14b8a6;
}

.kpi-blade {
    color: #2dd4bf;
}

.kpi-torque {
    color: #f59e0b;
}

.kpi-gen {
    color: #fda4af;
}

.kpi-amps {
    color: #38bdf8;
}

.kpi-pf {
    color: #2dd4bf;
}

.kpi-q {
    color: #84cc16;
}
