/* ============================================================
   CERA+ Brew — design system
   ============================================================ */
:root {
    --bg: #0c0907;
    --bg-2: #16100c;
    --surface-1: rgba(8, 6, 5, 0.55);
    --surface: rgba(32, 24, 19, 0.72);
    --surface-2: rgba(255, 238, 220, 0.085);
    --border: rgba(255, 220, 185, 0.13);
    --border-strong: rgba(255, 210, 165, 0.28);
    --text: #fbf5ef;
    --text-dim: #cabaa9;
    --text-faint: #8c7a6b;

    --crema: #fbbf24;
    --crema-2: #f97316;
    --ember: #ef4444;
    --ice: #38bdf8;
    --ice-2: #0284c7;
    --ok: #34d399;
    --cyan: #22d3ee;
    --danger: #f43f5e;

    --grad-hot: linear-gradient(135deg, #fde047 0%, #fb923c 50%, #ea580c 100%);
    --grad-cold: linear-gradient(135deg, #7dd3fc 0%, #0284c7 100%);

    --radius: 20px;
    --radius-sm: 13px;
    --shadow: 0 22px 50px -16px rgba(0, 0, 0, 0.82), 0 1px 0 rgba(255, 240, 220, 0.12) inset;
    --font: 'Outfit', system-ui, -apple-system, Segoe UI, sans-serif;
    --mono: 'JetBrains Mono', ui-monospace, monospace;
    --ease: cubic-bezier(.2, .8, .2, 1);
}

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

html {
    -webkit-text-size-adjust: 100%;
    overflow-x: hidden;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.45;
    overflow-x: hidden;
    padding-bottom: env(safe-area-inset-bottom);
}

button,
input,
select {
    font: inherit;
    color: inherit;
}

button {
    cursor: pointer;
    border: none;
    background: none;
}

code {
    font-family: var(--mono);
    font-size: .88em;
    background: var(--surface-2);
    padding: .1em .4em;
    border-radius: 6px;
    color: var(--crema);
}

.hidden {
    display: none !important;
}

.bg-glow {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(65rem 45rem at 88% -8%, rgba(249, 115, 22, 0.22), transparent 62%),
        radial-gradient(55rem 40rem at 50% 45%, rgba(251, 191, 36, 0.08), transparent 65%),
        radial-gradient(55rem 38rem at -8% 108%, rgba(6, 182, 212, 0.12), transparent 60%),
        linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
}

body.cold .bg-glow {
    background:
        radial-gradient(65rem 45rem at 85% -10%, rgba(56, 189, 248, 0.22), transparent 60%),
        radial-gradient(50rem 35rem at -10% 110%, rgba(14, 165, 233, 0.16), transparent 60%),
        linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
}

.glass {
    background: linear-gradient(165deg, rgba(38, 28, 22, 0.86) 0%, rgba(18, 13, 10, 0.92) 100%);
    border: 1px solid var(--border);
    border-top-color: rgba(255, 225, 190, 0.22);
    backdrop-filter: blur(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
    box-shadow: var(--shadow);
}

/* ============ BUTTONS ============ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .7rem 1.2rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: .95rem;
    transition: transform .15s var(--ease), box-shadow .25s var(--ease), background .25s, opacity .2s;
    white-space: nowrap;
}

.btn:active {
    transform: scale(.97);
}

.btn:disabled {
    opacity: .45;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--grad-hot);
    color: #2a1408;
    box-shadow: 0 8px 24px -8px rgba(239, 138, 60, .7);
}

.btn-primary:hover:not(:disabled) {
    box-shadow: 0 12px 32px -8px rgba(239, 138, 60, .9);
    transform: translateY(-1px);
}

.btn-ghost {
    background: var(--surface-2);
    border: 1px solid var(--border);
}

.btn-ghost:hover:not(:disabled) {
    border-color: var(--border-strong);
    background: rgba(255, 240, 225, .12);
}

.btn-danger {
    background: rgba(230, 70, 80, .12);
    color: #ff9ca3;
    border: 1px solid rgba(230, 70, 80, .3);
}

.btn-danger:hover {
    background: rgba(230, 70, 80, .2);
}

.btn-warning {
    background: #e07a22;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.btn-warning:hover:not(:disabled) {
    background: #f28b33;
}

.btn-sm {
    padding: 0.4rem 0.85rem;
    font-size: 0.82rem;
}

.btn-lg {
    padding: 1rem 1.8rem;
    font-size: 1.05rem;
}

.btn-block {
    width: 100%;
    margin-top: 1.25rem;
}

.btn.connected {
    background: var(--surface-2);
    color: var(--text);
    box-shadow: none;
    border: 1px solid var(--border);
}

.chip {
    padding: .35rem .75rem;
    border-radius: 999px;
    font-size: .8rem;
    font-weight: 600;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-dim);
    transition: all .2s;
}

.chip:hover {
    color: var(--text);
    border-color: var(--border-strong);
}

.icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    font-size: 1.25rem;
    font-weight: 500;
    background: var(--surface-2);
    border: 1px solid var(--border);
    transition: all .15s var(--ease);
}

.icon-btn:hover:not(:disabled) {
    border-color: var(--crema);
    color: var(--crema);
}

.icon-btn:active:not(:disabled) {
    transform: scale(.92);
}

.icon-btn:disabled {
    opacity: .35;
}

/* ============ TOPBAR ============ */
.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .65rem clamp(1rem, 3vw, 2rem);
    padding-top: calc(.65rem + env(safe-area-inset-top));
    background: linear-gradient(180deg, rgba(18, 13, 10, .92), rgba(18, 13, 10, .6));
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
}

.brand {
    display: flex;
    align-items: center;
    gap: .75rem;
    min-width: 0;
}

.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    font-size: 1.3rem;
    background: var(--grad-hot);
    box-shadow: 0 6px 20px -6px rgba(239, 138, 60, .8);
}

.brand h1 {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: .01em;
}

.brand .plus {
    color: var(--crema);
}

.brand-sub {
    font-size: .78rem;
    color: var(--text-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: .6rem;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .35rem .75rem;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 500;
    color: var(--text-dim);
    background: var(--surface);
    border: 1px solid var(--border);
    white-space: nowrap;
    flex-shrink: 0;
}

.status-pill .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-faint);
}

.status-pill.busy .dot {
    background: var(--crema);
    animation: pulse 1s infinite;
}

.status-pill.ok {
    color: var(--ok);
}

.status-pill.ok .dot {
    background: var(--ok);
    box-shadow: 0 0 10px var(--ok);
}

@keyframes pulse {
    50% {
        opacity: .3;
    }
}

@media (max-width: 560px) {
    .status-pill {
        display: none;
    }

    .brand-sub {
        max-width: 40vw;
    }
}

/* ============ WELCOME ============ */
.welcome {
    display: grid;
    place-items: center;
    padding: clamp(1.5rem, 6vw, 4rem) 1rem;
    min-height: calc(100vh - 80px);
}

.welcome-card {
    width: min(920px, 100%);
    border-radius: 32px;
    padding: clamp(1.5rem, 5vw, 3rem);
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 2.5rem;
    align-items: center;
    animation: rise .7s var(--ease) both;
}

.welcome-visual {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 320px;
}

.halo {
    position: absolute;
    width: 280px;
    height: 280px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(246, 193, 119, .85) 0%, rgba(239, 138, 60, .25) 45%, transparent 70%);
    filter: blur(4px);
    animation: breathe 5s ease-in-out infinite;
}

.product-img {
    position: relative;
    height: 320px;
    width: auto;
    border-radius: 24px;
    mix-blend-mode: multiply;
    filter: contrast(1.05);
    animation: float 6s ease-in-out infinite;
}

.welcome-text h2 {
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    line-height: 1.1;
    font-weight: 700;
    margin-bottom: .9rem;
    background: linear-gradient(120deg, #fff 20%, var(--crema) 80%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.welcome-text p {
    color: var(--text-dim);
    margin-bottom: 1.6rem;
}

.bt-icon {
    font-weight: 800;
}

.check {
    display: flex;
    align-items: center;
    gap: .55rem;
    margin-top: 1.2rem;
    font-size: .88rem;
    color: var(--text-dim);
    cursor: pointer;
}

.check input {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 5px;
    background: rgba(0, 0, 0, 0.5);
    border: 1.5px solid rgba(255, 220, 185, 0.35);
    display: inline-grid;
    place-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: all .2s var(--ease);
}

.check input::before {
    content: "";
    width: 9px;
    height: 5px;
    border-left: 2px solid #1f0d03;
    border-bottom: 2px solid #1f0d03;
    transform: rotate(-45deg) scale(0);
    transition: transform .15s var(--ease);
    margin-top: -1px;
}

.check input:checked {
    background: var(--grad-hot);
    border-color: var(--crema);
    box-shadow: 0 0 10px rgba(249, 115, 22, 0.5);
}

.check input:checked::before {
    transform: rotate(-45deg) scale(1);
}

.check.small {
    margin: 0;
    font-size: .78rem;
}

.hint {
    margin-top: 1rem;
    font-size: .82rem;
    color: #ffb38a;
}

.bt-ios-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .55rem;
    margin-top: .55rem;
    align-items: center;
}

@media (max-width: 760px) {
    .bt-ios-actions {
        justify-content: center;
    }
    .welcome-card {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 1rem;
    }

    .welcome-visual {
        min-height: 240px;
    }

    .product-img {
        height: 240px;
    }

    .halo {
        width: 210px;
        height: 210px;
    }

    .check {
        justify-content: center;
    }
}

@keyframes float {
    50% {
        transform: translateY(-10px);
    }
}

@keyframes breathe {
    50% {
        transform: scale(1.08);
        opacity: .8;
    }
}

@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(24px);
    }
}

/* ============ DASHBOARD GRID ============ */
.dashboard {
    width: min(1760px, 96vw);
    margin: 0 auto;
    padding: .75rem clamp(.75rem, 1.5vw, 1.6rem) 5rem;
    display: grid;
    gap: .8rem;
    grid-template-columns: repeat(12, 1fr);
    align-items: stretch;
    grid-template-areas:
        "hero hero hero scale scale scale scale scale prof prof prof prof"
        "brew brew brew scale scale scale scale scale prof prof prof prof"
        "hist hist hist hist  hist  hist  hist  hist  hist hist hist hist"
        "set  set  set  set   set   set   set   set   ap   ap   ap   ap"
        "set  set  set  set   set   set   set   set   dev  dev  dev  dev";
}

.hero {
    grid-area: hero;
    justify-content: space-between;
}

.scale-card {
    grid-area: scale;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: .38rem;
}

.brew {
    grid-area: brew;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.settings {
    grid-area: set;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.appoint {
    grid-area: ap;
}

.profile {
    grid-area: prof;
    container-type: inline-size;
    display: flex;
    flex-direction: column;
}

.history-card {
    grid-area: hist;
}

.device {
    grid-area: dev;
}

/* Medium desktops & laptops (921px - 1279px) */
@media (max-width: 1279px) and (min-width: 921px) {
    .dashboard {
        width: min(1260px, 96vw);
        grid-template-areas:
            "hero hero hero scale scale scale scale scale prof prof prof prof"
            "brew brew brew scale scale scale scale scale prof prof prof prof"
            "hist hist hist hist  hist  hist  hist  hist  hist hist hist hist"
            "set  set  set  set   set   set   set   set   ap   ap   ap   ap"
            "set  set  set  set   set   set   set   set   dev  dev  dev  dev";
    }
}

/* Tablets portrait & Mobile (<= 920px) */
@media (max-width: 920px) {
    .dashboard {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        grid-template-columns: minmax(0, 1fr);
        gap: .75rem;
        padding: .75rem .6rem 4rem;
        grid-template-areas:
            "hero"
            "scale"
            "brew"
            "prof"
            "hist"
            "set"
            "ap"
            "dev";
    }
}

.card {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    border-radius: var(--radius);
    padding: 1.15rem 1.25rem;
    animation: rise .6s var(--ease) both;
}

.card:nth-child(2) {
    animation-delay: .05s;
}

.card:nth-child(3) {
    animation-delay: .1s;
}

.card:nth-child(4) {
    animation-delay: .15s;
}

.card:nth-child(5) {
    animation-delay: .2s;
}

.card-title {
    font-size: 1.02rem;
    font-weight: 600;
    letter-spacing: .01em;
    margin-bottom: 1rem;
    color: var(--text);
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.card-head .card-title {
    margin: 0;
}

.tag {
    font-size: .72rem;
    padding: .2rem .6rem;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--text-faint);
}

/* ============ HERO / GAUGE ============ */
.hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(circle at 50% 62%, rgba(251, 146, 60, 0.16) 0%, rgba(245, 158, 11, 0.04) 48%, transparent 72%),
        linear-gradient(165deg, rgba(42, 30, 22, 0.9) 0%, rgba(18, 13, 10, 0.95) 100%);
}

body.cold .hero {
    background:
        radial-gradient(circle at 50% 62%, rgba(56, 189, 248, 0.16) 0%, rgba(14, 165, 233, 0.04) 48%, transparent 72%),
        linear-gradient(165deg, rgba(22, 32, 42, 0.9) 0%, rgba(12, 16, 22, 0.95) 100%);
}

.hero-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: auto;
}

.battery {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    font-size: .82rem;
    font-weight: 600;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    padding: .28rem .65rem;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--border);
}

.battery-body {
    position: relative;
    width: 32px;
    height: 15px;
    border: 2px solid var(--text-dim);
    border-radius: 4px;
    padding: 1px;
}

.battery-body::after {
    content: '';
    position: absolute;
    right: -5px;
    top: 3px;
    width: 3px;
    height: 5px;
    border-radius: 0 2px 2px 0;
    background: var(--text-dim);
}

.battery-fill {
    height: 100%;
    width: 0%;
    border-radius: 2px;
    background: var(--ok);
    box-shadow: 0 0 8px rgba(52, 211, 153, 0.6);
    transition: width .6s var(--ease), background .3s;
}

.battery.low .battery-fill {
    background: var(--danger);
    box-shadow: 0 0 8px rgba(244, 63, 94, 0.6);
}

.battery.mid .battery-fill {
    background: var(--crema);
}

.bolt {
    color: var(--crema);
    animation: pulse 1.4s infinite;
}

.cups-badge {
    font-size: .8rem;
    font-weight: 600;
    color: var(--crema);
    padding: .28rem .75rem;
    border-radius: 999px;
    background: rgba(251, 191, 36, 0.12);
    border: 1px solid rgba(251, 191, 36, 0.28);
}

.gauge-wrap {
    position: relative;
    width: clamp(135px, 18vh, 175px);
    aspect-ratio: 1;
    margin: auto;
    min-height: 0;
    flex-shrink: 0;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(12, 9, 7, 0.85) 0%, rgba(20, 14, 10, 0.45) 58%, transparent 70%);
    box-shadow: 0 0 40px rgba(249, 115, 22, 0.12);
}

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

.gauge-track {
    fill: none;
    stroke: rgba(255, 235, 215, .1);
    stroke-width: 15;
}

.gauge-value {
    fill: none;
    stroke: url(#gaugeHot);
    stroke-width: 15;
    stroke-linecap: round;
    stroke-dasharray: 628.3;
    stroke-dashoffset: 628.3;
    transition: stroke-dashoffset 1s var(--ease);
    filter: drop-shadow(0 0 12px rgba(251, 146, 60, .75));
}

body.cold .gauge-value {
    stroke: url(#gaugeCold);
    filter: drop-shadow(0 0 12px rgba(56, 189, 248, .75));
}

.gauge-target {
    fill: #fff;
    stroke: #ea580c;
    stroke-width: 3.5;
    transform-origin: 120px 120px;
    transition: transform 1s var(--ease);
    filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.9));
}

.gauge-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.temp-now {
    font-size: clamp(2.15rem, 3.8vw, 2.75rem);
    font-weight: 800;
    line-height: 1;
    letter-spacing: -.03em;
    font-variant-numeric: tabular-nums;
    color: #fff;
    text-shadow: 0 2px 16px rgba(251, 146, 60, 0.45);
}

.temp-now sup {
    font-size: .42em;
    font-weight: 600;
    color: var(--crema);
    vertical-align: super;
    margin-left: .08em;
}

.temp-target {
    margin-top: .2rem;
    font-size: .8rem;
    font-weight: 500;
    color: var(--text-dim);
}

.temp-target strong {
    color: var(--crema);
    font-weight: 700;
}

body.cold .temp-target strong {
    color: var(--ice);
}

.state-label {
    margin-top: .38rem;
    padding: .22rem .75rem;
    border-radius: 999px;
    font-size: .74rem;
    font-weight: 600;
    background: rgba(52, 211, 153, 0.14);
    border: 1px solid rgba(52, 211, 153, 0.35);
    color: #6ee7b7;
    transition: all .3s;
}

.hero.busy .state-label {
    color: #1f0d03;
    background: var(--grad-hot);
    border-color: transparent;
    box-shadow: 0 0 14px rgba(249, 115, 22, 0.6);
}

body.cold .hero.busy .state-label {
    background: var(--grad-cold);
    color: #04223d;
    box-shadow: 0 0 14px rgba(56, 189, 248, 0.6);
}

.hero.done .state-label {
    color: var(--ok);
    border-color: rgba(52, 211, 153, .5);
}

.steam {
    position: absolute;
    top: 10%;
    display: flex;
    gap: 6px;
    opacity: 0;
    transition: opacity .5s;
}

.hero.busy:not(.is-cold) .steam {
    opacity: 1;
}

.steam span {
    width: 4px;
    height: 18px;
    border-radius: 4px;
    background: linear-gradient(to top, rgba(255, 255, 255, .45), transparent);
    animation: steam 2.2s ease-in-out infinite;
}

.steam span:nth-child(2) {
    animation-delay: .5s;
    height: 24px;
}

.steam span:nth-child(3) {
    animation-delay: 1s;
}

@keyframes steam {
    0% {
        transform: translateY(8px) scaleY(.6);
        opacity: 0;
    }

    40% {
        opacity: 1;
    }

    100% {
        transform: translateY(-18px) scaleY(1.1);
        opacity: 0;
    }
}

.alert {
    width: 100%;
    margin-top: .8rem;
    padding: .8rem 1rem;
    border-radius: var(--radius-sm);
    background: rgba(230, 70, 80, .12);
    border: 1px solid rgba(230, 70, 80, .35);
    color: #ffb3b8;
    font-size: .88rem;
    display: flex;
    gap: .6rem;
    align-items: flex-start;
    animation: shake .5s;
}

.alert::before {
    content: '⚠';
}

@keyframes shake {
    25% {
        transform: translateX(-4px);
    }

    75% {
        transform: translateX(4px);
    }
}

/* ============ BREW MODES ============ */
.modes {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .65rem;
}

.mode {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .25rem;
    padding: .85rem .65rem;
    border-radius: 16px;
    text-align: center;
    background: rgba(0, 0, 0, 0.32);
    border: 1px solid var(--border);
    transition: all .25s var(--ease);
    overflow: hidden;
}

.mode::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity .3s;
    background: radial-gradient(120% 100% at 50% 0%, rgba(251, 146, 60, .34), rgba(245, 158, 11, 0.08) 70%, transparent 100%);
}

.mode.cold::before {
    background: radial-gradient(120% 100% at 50% 0%, rgba(56, 189, 248, .34), rgba(14, 165, 233, 0.08) 70%, transparent 100%);
}

.mode:hover {
    border-color: var(--border-strong);
    transform: translateY(-2px);
    background: rgba(255, 240, 225, 0.06);
}

.mode.active {
    border-color: var(--crema);
    background: rgba(249, 115, 22, 0.12);
    box-shadow: 0 0 0 1.5px var(--crema) inset, 0 10px 26px -10px rgba(249, 115, 22, .65);
}

.mode.cold.active {
    border-color: var(--ice);
    background: rgba(56, 189, 248, 0.12);
    box-shadow: 0 0 0 1.5px var(--ice) inset, 0 10px 26px -10px rgba(56, 189, 248, .65);
}

.mode.active::before {
    opacity: 1;
}

.mode>* {
    position: relative;
}

.mode-icon {
    font-size: 1.55rem;
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: .15rem;
}

.mode.active .mode-icon {
    background: rgba(251, 191, 36, 0.2);
    border-color: rgba(251, 191, 36, 0.45);
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.35);
}

.mode.cold.active .mode-icon {
    background: rgba(56, 189, 248, 0.2);
    border-color: rgba(56, 189, 248, 0.45);
    box-shadow: 0 4px 12px rgba(56, 189, 248, 0.35);
}

.mode-name {
    font-weight: 700;
    font-size: .92rem;
    color: var(--text);
}

.mode-desc {
    font-size: .73rem;
    color: var(--text-dim);
}

.modes.locked .mode:not(.active) {
    opacity: .4;
    pointer-events: none;
}

@media (max-width: 480px) {
    .mode {
        padding: .65rem .45rem;
    }

    .mode-name {
        font-size: .82rem;
    }

    .mode-desc {
        display: none;
    }
}

.btn-brew {
    position: relative;
    width: 100%;
    margin-top: .85rem;
    padding: 1rem 1.2rem;
    border-radius: 16px;
    font-size: 1.12rem;
    font-weight: 800;
    letter-spacing: .03em;
    text-transform: uppercase;
    color: #230f02;
    background: var(--grad-hot);
    border: 1px solid rgba(255, 255, 255, 0.28);
    overflow: hidden;
    box-shadow: 0 12px 32px -8px rgba(249, 115, 22, .85), 0 2px 0 rgba(255, 255, 255, 0.35) inset;
    transition: transform .15s var(--ease), box-shadow .3s;
}

.btn-brew:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 18px 44px -12px rgba(239, 138, 60, 1);
}

.btn-brew:active:not(:disabled) {
    transform: scale(.98);
}

.btn-brew:disabled {
    opacity: .5;
    cursor: not-allowed;
}

body.cold .btn-brew {
    background: var(--grad-cold);
    color: #04223d;
    box-shadow: 0 14px 36px -12px rgba(79, 168, 255, .8);
}

.btn-brew.stop {
    background: linear-gradient(135deg, #ff7b7b, #d83b4b);
    color: #fff;
    box-shadow: 0 14px 36px -12px rgba(216, 59, 75, .85);
}

.btn-brew-ring {
    position: absolute;
    inset: 0;
    background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .45) 50%, transparent 70%);
    transform: translateX(-100%);
    animation: shine 3.2s infinite;
}

.btn-brew.stop .btn-brew-ring {
    animation-duration: 1.4s;
}

.btn-brew-label {
    position: relative;
}

@keyframes shine {

    60%,
    100% {
        transform: translateX(100%);
    }
}

/* ============ SETTINGS ============ */
.field {
    display: flex;
    flex-direction: column;
    gap: .45rem;
    margin-bottom: 1.2rem;
}

.field label {
    font-size: .84rem;
    color: var(--text-dim);
    font-weight: 500;
}

.field-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.field-value {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--crema);
    font-variant-numeric: tabular-nums;
}

.slider-row {
    display: flex;
    align-items: center;
    gap: .7rem;
}

.range-hint {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: .72rem;
    color: var(--text-faint);
    padding: 0 50px;
}

.temp-machine-limit {
    color: var(--crema-2);
    font-weight: 500;
}

input[type=range] {
    -webkit-appearance: none;
    appearance: none;
    flex: 1;
    height: 8px;
    border-radius: 99px;
    outline: none;
    background: linear-gradient(90deg, var(--crema) 0%, var(--crema-2) var(--fill, 50%), rgba(255, 240, 225, .1) var(--fill, 50%));
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: grab;
    background: #fff;
    border: 4px solid var(--crema-2);
    box-shadow: 0 4px 14px rgba(0, 0, 0, .5);
    transition: transform .15s;
}

input[type=range]::-webkit-slider-thumb:active {
    transform: scale(1.15);
    cursor: grabbing;
}

input[type=range]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    border: 4px solid var(--crema-2);
}

.segmented {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    padding: 4px;
    border-radius: 14px;
    background: rgba(0, 0, 0, .25);
    border: 1px solid var(--border);
}

.segmented button {
    padding: .6rem;
    border-radius: 10px;
    font-size: .88rem;
    font-weight: 600;
    color: var(--text-dim);
    transition: all .25s var(--ease);
}

.segmented button.active {
    background: var(--grad-hot);
    color: #2a1408;
    box-shadow: 0 6px 16px -6px rgba(239, 138, 60, .8);
}

.segmented button:disabled {
    opacity: .3;
    cursor: not-allowed;
}

.steppers {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .5rem;
}

.stepper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .4rem;
    padding: .75rem .35rem;
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, .18);
    border: 1px solid var(--border);
    min-width: 0;
}

.stepper-label {
    font-size: .78rem;
    color: var(--text-dim);
    font-weight: 500;
    white-space: nowrap;
}

.stepper-ctl {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .28rem;
    width: 100%;
}

.stepper-ctl .icon-btn {
    width: 28px;
    height: 28px;
    border-radius: 9px;
    font-size: 1rem;
}

.stepper-value {
    min-width: 2.5rem;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.stepper-value b {
    font-size: 1.3rem;
    font-weight: 700;
}

.stepper-value small {
    font-size: .75rem;
    color: var(--text-dim);
    margin-left: 2px;
}

.stepper-range {
    font-size: .7rem;
    color: var(--text-faint);
}

@media (max-width: 420px) {
    .stepper-ctl .icon-btn {
        width: 28px;
        height: 28px;
    }

    .stepper-value {
        min-width: 2.4rem;
    }
}

/* ============ APPOINTMENT ============ */
.appoint-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .8rem;
}

.time-box {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .7rem 1rem;
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, .2);
    border: 1px solid var(--border);
}

.time-box input {
    background: none;
    border: none;
    font-size: 2.2rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color-scheme: dark;
    outline: none;
}

.time-hint {
    font-size: .78rem;
    color: var(--text-faint);
}

.appoint .field {
    margin: 0;
}

select {
    appearance: none;
    padding: .65rem .9rem;
    border-radius: 12px;
    background: rgba(0, 0, 0, .25) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23b9a796' stroke-width='2' fill='none'/%3E%3C/svg%3E") no-repeat right .9rem center;
    border: 1px solid var(--border);
    color-scheme: dark;
    outline: none;
}

select:focus {
    border-color: var(--crema-2);
}

.appoint.off .appoint-grid {
    opacity: .45;
}

.switch input {
    display: none;
}

.switch-track {
    display: block;
    width: 50px;
    height: 28px;
    border-radius: 99px;
    background: rgba(255, 240, 225, .12);
    position: relative;
    cursor: pointer;
    transition: background .3s;
}

.switch-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    transition: transform .3s var(--ease);
    box-shadow: 0 2px 6px rgba(0, 0, 0, .4);
}

.switch input:checked+.switch-track {
    background: var(--crema-2);
}

.switch input:checked+.switch-track .switch-thumb {
    transform: translateX(22px);
}

/* ============ DEVICE ============ */
.device-row {
    display: flex;
    gap: 1.2rem;
    align-items: center;
}

.device-thumb {
    width: 84px;
    height: 84px;
    border-radius: 20px;
    flex-shrink: 0;
    overflow: hidden;
    background: radial-gradient(circle at 50% 40%, #fff7ee, #e9d8c5);
    display: grid;
    place-items: center;
}

.device-thumb img {
    height: 76px;
    mix-blend-mode: multiply;
}

.device-info {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: .6rem 1.2rem;
    flex: 1;
}

.device-info dt {
    font-size: .72rem;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: .06em;
}

.device-info dd {
    font-weight: 600;
    font-size: .95rem;
    word-break: break-all;
}

.device-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    margin-top: 1.2rem;
}

@media (max-width: 720px) {
    .device-info {
        grid-template-columns: 1fr 1fr;
    }
}

/* ============ CONSOLE ============ */
.console-fab {
    position: fixed;
    right: 1.1rem;
    bottom: calc(1.1rem + env(safe-area-inset-bottom));
    z-index: 30;
    width: 52px;
    height: 52px;
    border-radius: 18px;
    font-size: 1.3rem;
    background: rgba(40, 30, 24, .9);
    border: 1px solid var(--border-strong);
    box-shadow: var(--shadow);
    transition: transform .2s var(--ease);
}

.console-fab:hover {
    transform: translateY(-2px);
}

.fab-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--crema-2);
    box-shadow: 0 0 8px var(--crema-2);
}

.console {
    position: fixed;
    z-index: 40;
    right: 1rem;
    bottom: 1rem;
    top: 5.5rem;
    width: min(560px, calc(100vw - 2rem));
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: rgba(22, 16, 13, .94);
    transform: translateX(calc(100% + 2rem));
    transition: transform .4s var(--ease);
}

.console.open {
    transform: none;
}

.console-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .5rem;
    padding: 1rem 1.1rem;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.console-head h2 {
    font-size: .95rem;
    font-weight: 600;
}

.console-tools {
    display: flex;
    align-items: center;
    gap: .4rem;
}

.console-log {
    flex: 1;
    overflow-y: auto;
    padding: .6rem .9rem;
    font-family: var(--mono);
    font-size: .74rem;
    line-height: 1.65;
}

.log-line {
    display: flex;
    gap: .6rem;
    white-space: pre-wrap;
    word-break: break-all;
}

.log-line .t {
    color: var(--text-faint);
    flex-shrink: 0;
}

.log-line .k {
    flex-shrink: 0;
    width: 1.2em;
    text-align: center;
}

.log-line.tx .k {
    color: var(--crema);
}

.log-line.rx .k,
.log-line.rx-state .k {
    color: var(--ok);
}

.log-line.err {
    color: #ff9ca3;
}

.log-line.sys {
    color: var(--text-dim);
}

.log-line.rx-state {
    opacity: .6;
}

.console-send {
    display: grid;
    grid-template-columns: 1fr 2fr auto;
    gap: .5rem;
    padding: .8rem .9rem 0;
    border-top: 1px solid var(--border);
}

.console-send input {
    padding: .6rem .8rem;
    border-radius: 10px;
    background: rgba(0, 0, 0, .3);
    border: 1px solid var(--border);
    font-family: var(--mono);
    font-size: .82rem;
    outline: none;
    min-width: 0;
}

.console-send input:focus {
    border-color: var(--crema-2);
}

.console-hint {
    padding: .5rem .9rem .9rem;
    font-size: .72rem;
    color: var(--text-faint);
}

@media (max-width: 600px) {
    .console {
        top: auto;
        height: 75vh;
        left: .5rem;
        right: .5rem;
        width: auto;
        bottom: .5rem;
        transform: translateY(calc(100% + 2rem));
    }
}

/* ============ TOAST ============ */
.toast {
    position: fixed;
    left: 50%;
    bottom: calc(1.5rem + env(safe-area-inset-bottom));
    z-index: 50;
    transform: translate(-50%, 150%);
    padding: .8rem 1.2rem;
    border-radius: 14px;
    font-size: .9rem;
    font-weight: 500;
    background: rgba(40, 30, 24, .96);
    border: 1px solid var(--border-strong);
    box-shadow: var(--shadow);
    transition: transform .4s var(--ease);
    max-width: calc(100vw - 2rem);
    text-align: center;
}

.toast.show {
    transform: translate(-50%, 0);
}

.toast.error {
    border-color: rgba(230, 70, 80, .5);
    color: #ffb3b8;
}

.toast.success {
    border-color: rgba(80, 200, 140, .5);
    color: #a8f0c8;
}

/* Disabled dashboard while not connected */
.dashboard.offline .card:not(.device):not(.scale-card):not(.history-card) {
    opacity: .5;
    pointer-events: none;
    filter: grayscale(.3);
}

/* ============ PRESSURE PROFILE ============ */
.brew-hint {
    margin-top: .7rem;
    font-size: .8rem;
    color: var(--crema);
    text-align: center;
}

body.cold .brew-hint {
    color: var(--ice);
}

.card-sub {
    font-size: .8rem;
    color: var(--text-dim);
    margin-top: .25rem;
}

.tag.beta {
    vertical-align: middle;
    margin-left: .4rem;
    color: #2a1408;
    background: var(--grad-hot);
    font-weight: 700;
}

.profile .card-head {
    align-items: flex-start;
    gap: 1rem;
}

.prof-toolbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: .8rem;
    margin-bottom: .85rem;
}

.prof-presets-wrap {
    display: flex;
    align-items: center;
    gap: .45rem;
    flex-wrap: wrap;
    flex: 1;
}

.prof-presets {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
}

.prof-presets .chip.active {
    color: #2a1408;
    background: var(--grad-hot);
    border-color: transparent;
    box-shadow: 0 0 12px rgba(239, 138, 60, .35);
}

.chip-add-preset {
    background: rgba(255, 240, 225, 0.05);
    border: 1px dashed var(--border-strong);
    color: var(--crema);
    cursor: pointer;
    font-weight: 600;
    transition: all .2s var(--ease);
}

.chip-add-preset:hover {
    background: rgba(239, 138, 60, 0.16);
    border-color: var(--crema);
    color: #fff;
    box-shadow: 0 0 10px rgba(239, 138, 60, .2);
}

.prof-profile-manage-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .8rem;
    padding: .45rem .85rem;
    margin-bottom: .85rem;
    border-radius: 12px;
    background: rgba(0, 0, 0, .2);
    border: 1px solid var(--border);
    flex-wrap: wrap;
}

.prof-cur-info {
    display: flex;
    align-items: center;
    gap: .45rem;
    font-size: .84rem;
}

.prof-cur-label {
    color: var(--text-faint);
}

.prof-cur-name {
    color: var(--crema);
    font-weight: 600;
}

.prof-manage-btns {
    display: flex;
    align-items: center;
    gap: .35rem;
    flex-wrap: wrap;
}

.btn-prof-action {
    background: var(--surface-2);
    border-color: var(--border);
    color: var(--text-dim);
    transition: all .2s var(--ease);
}

.btn-prof-action:hover:not(:disabled) {
    color: var(--text);
    border-color: var(--border-strong);
}

.btn-prof-action:disabled {
    opacity: .35;
    cursor: not-allowed;
}

.btn-prof-action.dirty {
    background: rgba(239, 138, 60, .2);
    border-color: var(--crema-2);
    color: var(--crema);
    font-weight: 600;
    box-shadow: 0 0 10px rgba(239, 138, 60, .25);
}

.btn-prof-action.dirty:hover:not(:disabled) {
    background: rgba(239, 138, 60, .32);
    color: #fff;
    box-shadow: 0 0 14px rgba(239, 138, 60, .4);
}

.btn-prof-action.btn-prof-del-preset:hover:not(:disabled),
#btnProfCancelPreset:hover:not(:disabled) {
    color: var(--danger);
    border-color: rgba(255, 75, 75, 0.4);
    background: rgba(255, 75, 75, 0.1);
}

.prof-preset-reset-all {
    width: 26px;
    height: 26px;
    font-size: .75rem;
    border-radius: 6px;
    color: var(--text-faint);
}

.prof-preset-reset-all:hover {
    color: var(--text);
    border-color: var(--border-strong);
}

.prof-ref {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .82rem;
    color: var(--text-dim);
}

.prof-ref select {
    padding: .45rem 2.2rem .45rem .8rem;
    font-size: .82rem;
}

.profile.off .prof-body {
    opacity: .88;
}

.profile.off .prof-toolbar,
.profile.off .prof-profile-manage-bar,
.profile.off .prof-timing-bar {
    opacity: .75;
}

.prof-timing-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .6rem .8rem;
    margin-bottom: .9rem;
    border-radius: 12px;
    background: rgba(0, 0, 0, .2);
    border: 1px solid var(--border);
    flex-wrap: wrap;
}

.prof-delay-wrap {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .82rem;
    color: var(--text-dim);
    flex-wrap: wrap;
}

.prof-delay-input-box {
    display: flex;
    align-items: center;
    gap: .25rem;
}

.prof-delay-input-box input {
    width: 60px;
    padding: .35rem .45rem;
    border-radius: 8px;
    background: rgba(0, 0, 0, .35);
    border: 1px solid var(--border);
    font-size: .88rem;
    font-weight: 600;
    color: var(--crema);
    text-align: center;
    font-variant-numeric: tabular-nums;
    outline: none;
    color-scheme: dark;
}

.prof-delay-input-box input:focus {
    border-color: var(--crema-2);
}

.prof-delay-input-box .prof-unit {
    font-size: .78rem;
    color: var(--text-faint);
}

.prof-delay-actions {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    flex-wrap: wrap;
}

.chip-sm {
    padding: .22rem .55rem;
    font-size: .75rem;
    font-weight: 500;
    line-height: 1.25;
    border-radius: 999px;
    cursor: pointer;
    user-select: none;
    transition: all .2s var(--ease);
}

.btn-prof-set-default {
    background: rgba(239, 138, 60, .14);
    border-color: rgba(239, 138, 60, .35);
    color: var(--crema);
}

.btn-prof-set-default:hover:not(:disabled) {
    background: rgba(239, 138, 60, .25);
    border-color: var(--crema);
    color: #fff;
    box-shadow: 0 0 10px rgba(239, 138, 60, .2);
}

.btn-prof-set-default.is-default {
    background: rgba(46, 213, 115, .1);
    border-color: rgba(46, 213, 115, .28);
    color: #4cd98b;
}

.btn-prof-set-default.is-default:hover:not(:disabled) {
    background: rgba(46, 213, 115, .18);
    border-color: #4cd98b;
}

.btn-prof-reset-default {
    background: var(--surface-2);
    border-color: var(--border);
    color: var(--text-faint);
}

.btn-prof-reset-default:hover:not(:disabled) {
    color: var(--text);
    border-color: var(--border-strong);
}

.btn-prof-reset-default:disabled {
    opacity: .35;
    cursor: not-allowed;
}

.prof-learn-box {
    display: flex;
    align-items: center;
    gap: .4rem;
}

.prof-learn-badge {
    font-size: .72rem;
    padding: .2rem .55rem;
    border-radius: 999px;
    background: rgba(239, 138, 60, .14);
    color: var(--crema);
    border: 1px solid rgba(239, 138, 60, .28);
}

.prof-learn-badge.learned {
    background: rgba(46, 213, 115, .14);
    color: #4cd98b;
    border-color: rgba(46, 213, 115, .3);
}

.prof-learn-reset {
    width: 24px;
    height: 24px;
    font-size: .75rem;
    border-radius: 6px;
    color: var(--text-faint);
}

.prof-body {
    display: grid;
    grid-template-columns: 1.25fr 1fr;
    gap: 1.15rem;
    width: 100%;
    align-items: start;
}

.prof-chart {
    width: 100%;
    height: auto;
    aspect-ratio: 600 / 180;
    border-radius: var(--radius-sm);
    background: linear-gradient(180deg, rgba(10, 8, 6, 0.85) 0%, rgba(18, 13, 10, 0.92) 100%);
    border: 1px solid rgba(251, 146, 60, 0.28);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45) inset;
    overflow: visible;
}

.prof-chart .band {
    opacity: .65;
}

.prof-chart .band-soak {
    fill: rgba(56, 189, 248, .10);
}

.prof-chart .band-stand {
    fill: rgba(255, 255, 255, .04);
}

.prof-chart .band-ext {
    fill: rgba(249, 115, 22, .11);
}

.prof-chart .band-label {
    fill: var(--text-dim);
    font-size: 11px;
    font-weight: 600;
    font-family: var(--font);
}

.prof-chart .grid {
    stroke: rgba(255, 235, 210, .10);
    stroke-dasharray: 3 4;
}

.prof-chart .axis {
    fill: var(--text-dim);
    font-size: 11px;
    font-family: var(--mono);
}

.prof-chart .prof-area {
    fill: rgba(249, 115, 22, .22);
}

.prof-chart .prof-line {
    fill: none;
    stroke: #fb923c;
    stroke-width: 3.5;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
    filter: drop-shadow(0 0 8px rgba(249, 115, 22, .85));
}

.prof-chart .prof-dot {
    fill: #fff;
    stroke: #f97316;
    stroke-width: 2.5;
    vector-effect: non-scaling-stroke;
}

.prof-chart .prof-cursor {
    stroke: var(--ok);
    stroke-width: 2.5;
    vector-effect: non-scaling-stroke;
    filter: drop-shadow(0 0 8px var(--ok));
}

.prof-steps-wrap {
    width: 100%;
}

.prof-steps-head,
.prof-step {
    display: grid;
    grid-template-columns: 1.5rem 10.8rem 1fr 2.1rem 28px;
    gap: .5rem;
    align-items: center;
}

@media (max-width: 480px) {
    .prof-steps-head,
    .prof-step {
        grid-template-columns: 1.3rem 9.6rem 1fr 1.8rem 26px;
        gap: .32rem;
    }
}

.prof-steps-head {
    font-size: .72rem;
    color: var(--text-dim);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    padding: 0 .5rem .4rem;
}

.prof-steps-head span:last-child {
    grid-column: 3 / -1;
}

.prof-steps {
    display: flex;
    flex-direction: column;
    gap: .45rem;
    margin-bottom: .75rem;
    max-height: 280px;
    overflow-y: auto;
    padding-right: 4px;
}

.prof-steps::-webkit-scrollbar {
    width: 5px;
}

.prof-steps::-webkit-scrollbar-thumb {
    background: rgba(251, 191, 36, 0.35);
    border-radius: 999px;
}

#btnProfAdd {
    width: 100%;
    border-style: dashed;
    color: var(--crema);
    border-color: rgba(251, 191, 36, 0.35);
}

.prof-step {
    padding: .45rem .6rem;
    border-radius: 12px;
    background: rgba(10, 8, 6, .55);
    border: 1px solid rgba(255, 225, 190, .14);
}

.prof-idx {
    font-size: .78rem;
    font-weight: 700;
    color: var(--crema);
    text-align: center;
}

.prof-t {
    display: flex;
    align-items: center;
    gap: .25rem;
    font-size: .76rem;
    color: var(--text-dim);
    min-width: 0;
}

.prof-step-by {
    appearance: none;
    background: rgba(251, 191, 36, 0.12);
    border: 1px solid rgba(251, 191, 36, 0.35);
    color: #fde68a;
    border-radius: 7px;
    padding: .24rem .38rem;
    font-size: .72rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    outline: none;
    color-scheme: dark;
    flex-shrink: 0;
}

.prof-step-by:focus {
    border-color: var(--crema);
    box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.2);
}

.prof-step-start-tag {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    padding: .22rem .55rem;
    border-radius: 7px;
    background: rgba(52, 211, 153, 0.14);
    border: 1px solid rgba(52, 211, 153, 0.35);
    color: #6ee7b7;
    font-size: .72rem;
    font-weight: 700;
    white-space: nowrap;
}

.prof-step-drip-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: .22rem .42rem;
    border-radius: 7px;
    background: rgba(56, 189, 248, 0.16);
    border: 1px solid rgba(56, 189, 248, 0.4);
    color: #7dd3fc;
    font-size: .72rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.prof-t input {
    width: 52px;
    min-width: 44px;
    padding: .24rem .32rem;
    border-radius: 7px;
    background: rgba(0, 0, 0, .45);
    border: 1px solid var(--border);
    font-weight: 700;
    color: #fff;
    font-variant-numeric: tabular-nums;
    outline: none;
    color-scheme: dark;
    text-align: right;
}

.prof-t-unit {
    font-size: .72rem;
    font-weight: 600;
    color: var(--crema);
}

.prof-t input:disabled {
    opacity: .6;
}

.prof-t input:focus {
    border-color: var(--crema);
}

.prof-p {
    text-align: center;
    font-size: 1.05rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: var(--crema);
}

.prof-del {
    width: 32px;
    height: 32px;
    font-size: .8rem;
    border-radius: 10px;
}

.prof-status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .6rem;
    margin-top: auto;
    padding-top: 1rem;
    flex-wrap: wrap;
}

.prof-status {
    font-size: .84rem;
    color: var(--text-dim);
    font-variant-numeric: tabular-nums;
}

.prof-status.live {
    color: var(--ok);
}

.prof-status.live::before {
    content: '●';
    margin-right: .4rem;
    animation: pulse 1s infinite;
}

.btn-prof-sync {
    background: linear-gradient(135deg, #ef8a3c, #e2513a);
    color: #fff !important;
    border: none !important;
    font-weight: 600;
    padding: .45rem .85rem;
    border-radius: 999px;
    box-shadow: 0 4px 14px rgba(239, 138, 60, .4);
    transition: transform .15s, box-shadow .2s;
    cursor: pointer;
}

.btn-prof-sync:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(239, 138, 60, .6);
}

.btn-prof-sync.urgent {
    animation: urgentPulse 1.2s infinite;
}

@keyframes urgentPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(239, 138, 60, .7);
    }
    50% {
        transform: scale(1.04);
        box-shadow: 0 0 0 8px rgba(239, 138, 60, 0);
    }
}

/* ============ BLE LOGGER PANEL (V4.3) ============ */
.quick-pump-mark-row {
    margin-top: .75rem;
    display: flex;
    justify-content: center;
}

.btn-pump-quick {
    background: rgba(239, 138, 60, .15);
    border: 1px solid rgba(239, 138, 60, .4);
    color: var(--crema-2);
    font-size: .82rem;
    font-weight: 600;
    padding: .4rem .9rem;
    border-radius: 999px;
    cursor: pointer;
    transition: all .2s;
    font-family: inherit;
}

.btn-pump-quick:hover {
    background: rgba(239, 138, 60, .3);
    color: #fff;
    transform: translateY(-1px);
}

.ble-logger-panel {
    background: rgba(255, 255, 255, .04);
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 12px;
    padding: .75rem .9rem;
    margin: .6rem 1rem 0;
    display: flex;
    flex-direction: column;
    gap: .6rem;
}

.ble-logger-status {
    display: flex;
    align-items: center;
    gap: .8rem;
    font-size: .78rem;
    color: var(--text-dim);
    flex-wrap: wrap;
}

.ble-log-rec-badge {
    font-weight: 600;
    padding: .2rem .55rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, .08);
    color: var(--text-dim);
}

.ble-log-rec-badge.recording {
    background: rgba(239, 68, 68, .2);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, .4);
    animation: pulse 1.2s infinite;
}

.ble-logger-actions {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
}

.ble-note-box {
    display: flex;
    align-items: center;
    gap: .3rem;
    flex: 1;
    min-width: 180px;
}

.ble-note-box input {
    flex: 1;
    background: rgba(0, 0, 0, .25);
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 8px;
    padding: .35rem .6rem;
    color: var(--text);
    font-size: .8rem;
    font-family: inherit;
}

.prof-draft-badge {
    font-size: .72rem;
    padding: .15rem .5rem;
    border-radius: 999px;
    background: rgba(245, 158, 11, .2);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, .4);
    font-weight: 600;
    margin-left: .5rem;
    display: inline-block;
    vertical-align: middle;
}

.prof-storage-notice,
.prof-port-notice {
    font-size: .8rem;
    padding: .4rem .7rem;
    border-radius: 8px;
    margin-top: .6rem;
    line-height: 1.4;
}

.prof-storage-notice {
    background: rgba(239, 68, 68, .12);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, .25);
}

.prof-port-notice {
    display: none !important;
}

@container (max-width: 680px) {
    .prof-body {
        grid-template-columns: 1fr;
        gap: .35rem;
        margin-bottom: .35rem;
    }

    .profile .card-head {
        margin-bottom: .35rem;
        gap: .4rem;
    }

    .profile .card-title {
        font-size: .95rem;
    }

    .profile .card-sub {
        font-size: .7rem;
        margin-top: .08rem;
    }

    .prof-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: .3rem;
        margin-bottom: .35rem;
    }

    .prof-presets-wrap {
        width: 100%;
        gap: .28rem;
    }

    .prof-presets {
        gap: .28rem;
    }

    .prof-presets .chip,
    .chip-add-preset {
        padding: .2rem .55rem;
        font-size: .74rem;
    }

    .prof-ref {
        font-size: .74rem;
        justify-content: space-between;
    }

    .prof-ref select {
        padding: .22rem 1.8rem .22rem .55rem;
        font-size: .74rem;
    }

    .prof-chart {
        height: 136px;
        max-height: 145px;
    }

    .prof-steps-head {
        font-size: .66rem;
        padding: 0 .35rem .18rem;
    }

    .prof-steps {
        max-height: 152px;
        gap: .25rem;
        margin-bottom: .3rem;
    }

    .prof-step {
        padding: .2rem .4rem;
        gap: .35rem;
    }

    .prof-step-by {
        padding: .15rem .32rem;
        font-size: .69rem;
    }

    .prof-step-start-tag,
    .prof-step-drip-tag {
        padding: .15rem .42rem;
        font-size: .69rem;
    }

    .prof-t input {
        width: 46px;
        min-width: 40px;
        padding: .15rem .28rem;
        font-size: .74rem;
    }

    .prof-p {
        font-size: .92rem;
    }

    .prof-del {
        width: 24px;
        height: 24px;
    }

    #btnProfAdd {
        padding: .28rem .6rem;
        font-size: .76rem;
    }

    .prof-profile-manage-bar {
        padding: .25rem .5rem;
        margin-bottom: .28rem;
        gap: .25rem;
    }

    .prof-cur-info {
        font-size: .74rem;
    }

    .prof-manage-btns {
        gap: .22rem;
    }

    .prof-manage-btns .chip-sm {
        padding: .14rem .42rem;
        font-size: .68rem;
    }

    .prof-storage-notice {
        font-size: .68rem;
        padding: .2rem .45rem;
        margin-top: 0;
        margin-bottom: .28rem;
    }

    .prof-timing-bar {
        padding: .25rem .5rem;
        margin-bottom: .25rem;
        gap: .25rem;
    }

    .prof-delay-wrap {
        font-size: .72rem;
        gap: .3rem;
    }

    .prof-delay-input-box input {
        width: 46px;
        padding: .14rem .28rem;
        font-size: .75rem;
    }

    .prof-delay-actions .chip-sm {
        padding: .14rem .4rem;
        font-size: .67rem;
    }

    .prof-learn-badge {
        font-size: .65rem;
        padding: .12rem .4rem;
    }

    .prof-status-row {
        padding-top: .2rem;
    }

    .prof-status {
        font-size: .74rem;
    }
}

/* ============ BLUETOOTH SCALE (SmartScale_S3) ============ */
.welcome-btns-row {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    align-items: center;
}

.scale-card {
    transition: border-color .3s, box-shadow .3s;
}

.scale-card.scale-disconnected {
    align-self: start;
    padding: .8rem 1.2rem;
}

.scale-card.scale-disconnected .scale-metrics,
.scale-card.scale-disconnected .scale-settings,
.scale-card.scale-disconnected .scale-presets-row,
.scale-card.scale-disconnected .scale-ratio-display,
.scale-card.scale-disconnected .scale-progress-bar-wrap,
.scale-card.scale-disconnected .scale-autostop-box,
.scale-card.scale-disconnected .scale-chart-wrap,
.scale-card.scale-disconnected .scale-learning-box,
.scale-card.scale-disconnected .scale-actions {
    display: none !important;
}

.scale-card.scale-disconnected .card-head {
    margin-bottom: 0;
}

.scale-title-wrap {
    display: flex;
    align-items: baseline;
    gap: .5rem;
    flex-wrap: wrap;
}

.scale-name {
    font-size: .73rem;
    color: var(--crema);
    font-weight: 600;
    padding: .12rem .5rem;
    border-radius: 999px;
    background: rgba(251, 191, 36, 0.12);
    border: 1px solid rgba(251, 191, 36, 0.28);
}

.scale-head-actions {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.status-pill.status-pill-scale.stale {
    border-color: rgba(245, 158, 11, .5);
    color: #fbbf24;
}

.status-pill.status-pill-scale.stale .dot {
    background: #f59e0b;
    box-shadow: 0 0 8px #f59e0b;
}

.scale-card .card-head {
    margin-bottom: 0;
}

.scale-metrics {
    display: grid;
    grid-template-columns: 1.25fr 1fr;
    gap: .65rem;
    background: linear-gradient(180deg, rgba(8, 6, 5, 0.88) 0%, rgba(18, 13, 10, 0.94) 100%);
    border: 1px solid rgba(251, 191, 36, 0.28);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5) inset, 0 0 20px rgba(245, 158, 11, 0.06);
    border-radius: 13px;
    padding: .48rem .75rem;
    margin-top: 0;
    align-items: center;
}

.scale-metric-main {
    display: flex;
    flex-direction: column;
    gap: .08rem;
}

.scale-weight-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .4rem;
    flex-wrap: nowrap;
}

.scale-metric-label,
.scale-sub-label {
    font-size: .64rem;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: .04em;
    white-space: nowrap;
}

.scale-weight-val {
    font-size: 1.95rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: #fef3c7;
    text-shadow: 0 0 16px rgba(251, 191, 36, 0.35);
    line-height: 1;
    transition: opacity .25s ease;
    white-space: nowrap;
}

.scale-unit {
    font-size: .88rem;
    font-weight: 600;
    color: var(--crema);
    margin-left: .15rem;
}

#btnScaleTare {
    background: rgba(251, 191, 36, 0.15);
    border: 1px solid rgba(251, 191, 36, 0.4);
    color: #fde68a;
    font-weight: 700;
    padding: .24rem .55rem;
    font-size: .74rem;
    white-space: nowrap;
}

#btnScaleTare:hover:not(:disabled) {
    background: rgba(251, 191, 36, 0.28);
    border-color: #fbbf24;
    color: #fff;
}

.scale-metric-sub {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .45rem;
    border-left: 1px solid rgba(255, 225, 190, 0.16);
    padding-left: .65rem;
}

.scale-sub-val {
    font-size: 1.05rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--text);
    white-space: nowrap;
}

#scaleFlow {
    color: var(--cyan);
    text-shadow: 0 0 12px rgba(34, 211, 238, 0.35);
}

#scaleTime {
    color: var(--ok);
    text-shadow: 0 0 12px rgba(52, 211, 153, 0.3);
}

.scale-sub-val small {
    font-size: .7rem;
    color: var(--text-dim);
}

.scale-card.scale-stale .scale-weight-val,
.scale-card.scale-stale .scale-sub-val {
    opacity: .4;
}

.scale-ratio-box {
    background: rgba(12, 9, 7, 0.55);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: .42rem .68rem;
    margin-top: 0;
}

.scale-input-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .55rem;
}

.scale-input-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .4rem;
}

.scale-input-group label {
    display: inline-block;
    font-size: .72rem;
    font-weight: 600;
    color: var(--text-dim);
    margin-bottom: 0;
    white-space: nowrap;
}

.scale-input-wrap {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(255, 225, 190, 0.18);
    border-radius: 8px;
    padding: 0 .45rem;
    width: 86px;
    transition: border-color .2s, box-shadow .2s;
}

.scale-input-wrap:focus-within {
    border-color: var(--crema);
    box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.18);
}

.scale-input-wrap input {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: #fff;
    font-size: .88rem;
    font-family: inherit;
    font-weight: 700;
    padding: .18rem 0;
    text-align: right;
    padding-right: .2rem;
}

.scale-unit-tag {
    font-size: .74rem;
    font-weight: 600;
    color: var(--crema);
}

.scale-presets-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .4rem;
    flex-wrap: wrap;
    margin-top: .3rem;
}

.scale-ratio-display {
    display: flex;
    align-items: center;
    gap: .45rem;
    font-size: .78rem;
    font-weight: 700;
}

.scale-ratio-text {
    color: #fbbf24;
}

.scale-progress-text {
    color: #1f0d03;
    background: var(--grad-hot);
    font-weight: 800;
    padding: .06rem .42rem;
    border-radius: 999px;
    font-variant-numeric: tabular-nums;
}

.scale-progress-bar-wrap {
    width: 100%;
    height: 6px;
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    overflow: hidden;
    margin-top: .28rem;
}

.scale-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #fbbf24 0%, #f97316 60%, #ef4444 100%);
    box-shadow: 0 0 12px rgba(249, 115, 22, 0.7);
    border-radius: 999px;
    transition: width .2s ease;
}

.scale-chart-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, rgba(8, 6, 5, 0.85) 0%, rgba(15, 11, 8, 0.92) 100%);
    border: 1px solid rgba(251, 191, 36, 0.22);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45) inset;
    border-radius: 14px;
    padding: .5rem .7rem;
    margin-top: 0;
}

.scale-telemetry-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .35rem;
    flex-wrap: wrap;
    padding: .28rem .5rem;
    margin-bottom: .35rem;
    border-radius: 9px;
    background: rgba(0, 0, 0, 0.42);
    border: 1px solid rgba(255, 235, 210, 0.09);
}

.telemetry-pill {
    display: inline-flex;
    align-items: baseline;
    gap: .28rem;
    font-size: .72rem;
}

.telemetry-label,
.t-label {
    color: var(--text-dim);
    font-weight: 600;
}

.telemetry-val,
.telemetry-pill strong {
    font-family: var(--mono);
    font-weight: 700;
    color: #f3e8ff;
    font-variant-numeric: tabular-nums;
}

.btn.dirty {
    box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.55), 0 8px 22px rgba(245, 158, 11, 0.28);
}

#scaleResistance {
    color: #c084fc;
}

#scaleFirstDrip {
    color: #38bdf8;
}

#scaleTempDelta {
    color: #fb923c;
}

.telemetry-diag-badge {
    font-size: .7rem;
    font-weight: 700;
    padding: .12rem .48rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-dim);
    white-space: nowrap;
}

.telemetry-diag-badge.ok {
    background: rgba(16, 185, 129, 0.16);
    border-color: rgba(16, 185, 129, 0.4);
    color: #34d399;
}

.telemetry-diag-badge.warn {
    background: rgba(245, 158, 11, 0.18);
    border-color: rgba(245, 158, 11, 0.45);
    color: #fbbf24;
}

.telemetry-diag-badge.danger {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.48);
    color: #fca5a5;
}

.scale-chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .35rem;
    flex-wrap: wrap;
    margin-bottom: .3rem;
}

.scale-chart-legends {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    font-size: .72rem;
    font-weight: 600;
    color: var(--text-dim);
}

.scale-chart-legend {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .14rem .44rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-faint);
    font-size: .71rem;
    font-weight: 600;
    cursor: pointer;
    opacity: 0.45;
    transition: all .18s ease;
}

.scale-chart-legend.active {
    opacity: 1;
    color: var(--text);
    background: rgba(255, 240, 225, 0.09);
    border-color: rgba(255, 230, 200, 0.24);
}

.scale-chart-legend:hover {
    border-color: rgba(251, 191, 36, 0.45);
}

.legend-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.weight-dot {
    background: #fbbf24;
    box-shadow: 0 0 6px #fbbf24;
}

.flow-dot {
    background: #22d3ee;
    box-shadow: 0 0 6px #22d3ee;
}

.pressure-dot {
    background: #fb923c;
    box-shadow: 0 0 6px #fb923c;
}

.resistance-dot {
    background: #c084fc;
    box-shadow: 0 0 6px #c084fc;
}

.scale-canvas {
    flex: 1;
    width: 100%;
    height: 205px;
    min-height: 185px;
    display: block;
    border-radius: 10px;
    background: rgba(4, 3, 2, .78);
    border: 1px solid rgba(255, 235, 210, 0.12);
}

@media (max-height: 820px) and (min-width: 921px) {
    .scale-canvas {
        height: 148px;
        min-height: 135px;
    }
}

.scale-alert-row {
    font-size: .78rem;
    color: var(--text-dim);
}

.scale-alert-row .check {
    margin-top: 0;
    font-size: .78rem;
}

.scale-alert-row .check input:checked + span {
    color: #fbbf24;
}

.scale-actions {
    display: flex;
    align-items: center;
}

.scale-card.target-reached {
    border-color: #f59e0b;
    box-shadow: 0 0 20px rgba(245, 158, 11, .5);
    animation: scalePulse 1.2s infinite alternate;
}

@keyframes scalePulse {
    from {
        box-shadow: 0 0 10px rgba(245, 158, 11, .3);
    }
    to {
        box-shadow: 0 0 25px rgba(245, 158, 11, .8);
    }
}

/* ============ AUTO-STOP & PRESETS (Phần D) ============ */
.scale-presets-row {
    display: flex;
    gap: .35rem;
    flex-wrap: wrap;
}

.scale-autostop-box {
    margin-top: 0;
    padding: .42rem .68rem;
    border-radius: 12px;
    background: rgba(0, 0, 0, .28);
    border: 1px solid rgba(255, 255, 255, .09);
    display: flex;
    flex-direction: column;
    gap: .28rem;
}

.scale-autostop-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .5rem;
}

.scale-autostop-badges {
    display: flex;
    align-items: center;
    gap: .4rem;
}

.autostop-toggle-label {
    margin-top: 0 !important;
    cursor: pointer;
    font-size: .86rem;
    color: var(--text);
}

.autostop-toggle-label input:checked + .autostop-title-text strong {
    color: #ef4444;
}

.autostop-status-badge {
    font-size: .75rem;
    padding: .2rem .55rem;
    border-radius: 9999px;
    background: rgba(255, 255, 255, .06);
    color: var(--text-dim);
    border: 1px solid rgba(255, 255, 255, .1);
    white-space: nowrap;
}

.autostop-status-badge.armed {
    background: rgba(16, 185, 129, .15);
    color: #34d399;
    border-color: rgba(16, 185, 129, .35);
}

.autostop-status-badge.tracking {
    background: rgba(245, 158, 11, .15);
    color: #fbbf24;
    border-color: rgba(245, 158, 11, .35);
}

.autostop-status-badge.stopped {
    background: rgba(239, 68, 68, .2);
    color: #f87171;
    border-color: rgba(239, 68, 68, .4);
    font-weight: 600;
}

.badge-sim {
    font-size: .7rem;
    padding: .15rem .45rem;
    border-radius: 4px;
    background: rgba(6, 182, 212, .18);
    color: #38bdf8;
    border: 1px solid rgba(6, 182, 212, .3);
}

.scale-lead-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .65rem;
    font-size: .8rem;
}

.scale-lead-group {
    display: flex;
    align-items: center;
    gap: .45rem;
}

.scale-lead-wrap input {
    width: 60px !important;
    padding: .25rem .4rem !important;
    font-size: .85rem !important;
}

.scale-learning-box {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
    padding: .35rem .6rem;
    background: rgba(245, 158, 11, .1);
    border: 1px dashed rgba(245, 158, 11, .3);
    border-radius: var(--radius-sm);
}

.scale-learning-text {
    font-size: .78rem;
    color: #fbbf24;
}

.autostop-brew-badge {
    font-size: .78rem;
    padding: .25rem .6rem;
    border-radius: 9999px;
    background: rgba(239, 68, 68, .18);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, .4);
    margin-top: .4rem;
    display: inline-block;
    align-self: center;
}

/* ============ SHOT HISTORY & COMPARISON ============ */
.history-head {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: .75rem;
}

.history-head-actions {
    display: flex;
    align-items: center;
    gap: .45rem;
    flex-wrap: wrap;
}

.btn-shot-clear-all:hover {
    color: var(--danger);
    border-color: rgba(239, 68, 68, .4);
    background: rgba(239, 68, 68, .1);
}

.shot-meta-bar {
    display: grid;
    grid-template-columns: 1.2fr 1.8fr .9fr;
    gap: .75rem;
    padding: .75rem .9rem;
    background: rgba(0, 0, 0, .22);
    border: 1px solid var(--border);
    border-radius: 14px;
    margin-bottom: .9rem;
    align-items: end;
}

@media (max-width: 920px) {
    .shot-meta-bar {
        grid-template-columns: 1fr;
        gap: .5rem;
    }
}

.shot-meta-field {
    display: flex;
    flex-direction: column;
    gap: .25rem;
}

.shot-meta-field label {
    font-size: .74rem;
    color: var(--text-dim);
    font-weight: 500;
}

.shot-meta-field input,
.shot-meta-field select {
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: .42rem .65rem;
    font-size: .85rem;
    color: var(--text);
    outline: none;
    width: 100%;
}

.shot-meta-field input:focus,
.shot-meta-field select:focus {
    border-color: var(--crema-2);
}

.shot-compare-panel {
    background: linear-gradient(145deg, rgba(255, 240, 225, 0.05), rgba(0, 0, 0, 0.28));
    border: 1px solid var(--border-strong);
    border-radius: 16px;
    padding: .9rem 1rem;
    margin-bottom: 1rem;
}

.shot-compare-grid {
    display: grid;
    grid-template-columns: 1.05fr 1.25fr;
    gap: 1rem;
    align-items: start;
}

@media (max-width: 1100px) {
    .shot-compare-grid {
        grid-template-columns: 1fr;
    }
}

.shot-compare-chart-box {
    background: rgba(0, 0, 0, .28);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: .75rem;
}

.shot-compare-chart-head {
    display: flex;
    flex-direction: column;
    gap: .4rem;
    margin-bottom: .55rem;
    font-size: .82rem;
    color: var(--text);
}

.shot-compare-legends {
    display: flex;
    flex-wrap: wrap;
    gap: .65rem;
    font-size: .76rem;
}

.shot-legend-item {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .15rem .5rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, .05);
    border: 1px solid rgba(255, 255, 255, .08);
}

.shot-legend-swatch {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.shot-compare-canvas {
    width: 100%;
    height: 190px;
    display: block;
    border-radius: 8px;
    background: rgba(0, 0, 0, .3);
}

.shot-compare-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(0, 0, 0, .24);
}

.shot-compare-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .8rem;
    text-align: left;
}

.shot-compare-table th,
.shot-compare-table td {
    padding: .45rem .65rem;
    border-bottom: 1px solid rgba(255, 225, 195, .07);
    vertical-align: middle;
}

.shot-compare-table th {
    background: rgba(255, 240, 225, .05);
    color: var(--text-dim);
    font-weight: 600;
    white-space: nowrap;
}

.shot-compare-table td.param-col {
    color: var(--text-dim);
    font-weight: 500;
    white-space: nowrap;
    background: rgba(0, 0, 0, .15);
}

.shot-diff-tag {
    display: inline-block;
    margin-left: .35rem;
    padding: .08rem .38rem;
    border-radius: 999px;
    font-size: .7rem;
    font-weight: 600;
    background: rgba(255, 255, 255, .08);
    color: var(--crema);
    font-variant-numeric: tabular-nums;
}

.shot-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
    gap: .75rem;
    max-height: 360px;
    overflow-y: auto;
    padding-right: 4px;
}

.shot-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 1.4rem;
    color: var(--text-dim);
    font-size: .86rem;
    background: rgba(0, 0, 0, .18);
    border: 1px dashed var(--border);
    border-radius: 12px;
}

.shot-item {
    background: rgba(0, 0, 0, .22);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: .75rem .9rem;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    transition: border-color .2s, box-shadow .2s;
}

.shot-item.selected {
    border-color: var(--crema-2);
    box-shadow: 0 0 0 1px var(--crema-2) inset, 0 6px 20px -10px rgba(239, 138, 60, .45);
}

.shot-item-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
}

.shot-select-label {
    display: flex;
    align-items: center;
    gap: .45rem;
    cursor: pointer;
    font-weight: 600;
    font-size: .88rem;
    color: var(--text);
    min-width: 0;
}

.shot-select-label input {
    accent-color: var(--crema-2);
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.shot-title-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.shot-time-badge {
    font-size: .72rem;
    color: var(--text-faint);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.shot-metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .4rem;
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, .05);
    border-radius: 10px;
    padding: .45rem .55rem;
    font-size: .76rem;
}

.shot-metric-cell {
    display: flex;
    flex-direction: column;
    gap: .08rem;
}

.shot-metric-cell span {
    font-size: .68rem;
    color: var(--text-faint);
}

.shot-metric-cell strong {
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.shot-notes-line {
    font-size: .76rem;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
}

.shot-stars {
    color: #fbbf24;
    letter-spacing: 1px;
}

.shot-item-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .35rem;
    margin-top: auto;
    padding-top: .25rem;
}

@media (max-width: 600px) {
    .topbar {
        padding: .2rem .65rem;
        padding-top: calc(.2rem + env(safe-area-inset-top));
        gap: .3rem;
    }

    .topbar-actions .btn,
    .topbar-actions .chip {
        padding: .15rem .4rem;
        font-size: .75rem;
    }

    .brand-mark {
        width: 26px;
        height: 26px;
        font-size: .85rem;
        border-radius: 8px;
    }

    .brand h1 {
        font-size: .88rem;
    }

    .brand-sub {
        display: none;
    }

    .dashboard {
        padding: .35rem .35rem 2.5rem;
        gap: .35rem;
    }

    .card {
        padding: .4rem .6rem;
        border-radius: 14px;
    }

    /* Hero */
    .hero-top {
        margin-bottom: .08rem;
    }

    .cups-badge {
        font-size: .68rem;
        padding: .12rem .45rem;
    }

    .gauge-wrap {
        width: clamp(75px, 8.5vh, 85px);
        margin: .05rem auto;
    }

    .temp-now {
        font-size: 1.4rem;
    }

    .temp-target {
        font-size: .62rem;
        margin-top: 0;
    }

    .state-label {
        font-size: .62rem;
        padding: .08rem .4rem;
        margin-top: .08rem;
    }

    /* Scale Card */
    .scale-card .card-head {
        margin-bottom: .1rem;
    }

    .scale-card .card-title {
        font-size: .82rem;
    }

    .scale-head-actions .btn {
        padding: .12rem .4rem;
        font-size: .7rem;
    }

    .scale-metrics {
        padding: .25rem .45rem;
        gap: .3rem;
        margin-top: .15rem;
        border-radius: 10px;
    }

    .scale-metric-label,
    .scale-sub-label {
        font-size: .6rem;
    }

    .scale-weight-val {
        font-size: 1.5rem;
    }

    .scale-sub-val {
        font-size: .78rem;
    }

    .scale-metric-sub {
        display: flex;
        gap: .5rem;
    }

    .scale-ratio-box {
        margin-top: .15rem;
    }

    .scale-input-row {
        gap: .3rem;
    }

    .scale-input-group label {
        font-size: .62rem;
        margin-bottom: .03rem;
    }

    .scale-input-wrap {
        padding: 0 .3rem;
    }

    .scale-input-wrap input {
        font-size: .75rem;
        padding: .08rem 0;
    }

    .scale-presets-row {
        margin-top: .12rem;
        gap: .18rem;
    }

    .scale-presets-row .chip {
        padding: .1rem .35rem;
        font-size: .65rem;
    }

    .scale-ratio-display {
        margin-top: .12rem;
        font-size: .65rem;
    }

    .scale-progress-bar-wrap {
        margin-top: .08rem;
        height: 3px;
    }

    .scale-autostop-box {
        margin-top: .15rem;
        padding: .2rem .4rem;
        border-radius: 8px;
    }

    .autostop-title-text {
        font-size: .7rem;
    }

    .scale-lead-row {
        margin-top: .08rem;
        gap: .25rem;
    }

    .scale-lead-group label {
        font-size: .62rem;
    }

    .scale-chart-wrap {
        margin-top: .15rem;
        padding: .2rem .4rem;
        border-radius: 8px;
    }

    .scale-telemetry-strip {
        padding: .15rem .35rem;
        margin-bottom: .18rem;
        gap: .25rem;
    }

    .telemetry-pill {
        font-size: .6rem;
        gap: .15rem;
    }

    .telemetry-diag-badge {
        font-size: .58rem;
        padding: .06rem .32rem;
    }

    .scale-chart-header {
        margin-bottom: .1rem;
    }

    .scale-chart-legends {
        font-size: .58rem;
        gap: .2rem;
    }

    .scale-chart-legend {
        padding: .08rem .28rem;
        font-size: .58rem;
        gap: .2rem;
    }

    .scale-canvas {
        height: 68px;
        min-height: 64px;
    }

    .scale-alert-row {
        margin-top: .1rem;
        font-size: .65rem;
        line-height: 1.15;
    }

    .scale-actions {
        margin-top: .1rem;
    }

    .scale-actions .btn {
        padding: .15rem .45rem;
        font-size: .7rem;
    }

    /* Brew Card */
    .brew .card-title {
        font-size: .82rem;
        margin-bottom: .15rem;
    }

    .modes {
        gap: .25rem;
    }

    .mode {
        padding: .3rem .2rem;
    }

    .mode-icon {
        font-size: .9rem;
    }

    .mode-name {
        font-size: .72rem;
    }

    .mode-desc {
        display: none;
    }

    .btn-brew {
        margin-top: .2rem;
        padding: .5rem;
        font-size: .88rem;
        border-radius: 12px;
    }

    .quick-pump-mark-row {
        margin-top: .15rem;
    }

    .btn-pump-quick {
        padding: .18rem .4rem;
        font-size: .65rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .steam span,
    .gauge-value,
    .gauge-target,
    .card,
    .bolt,
    .product-img,
    .halo {
        animation: none !important;
        transition: none !important;
    }
}