/* ============================================================
   SMART KAMAR KOS - VOXIE-INSPIRED DARK COLORFUL DASHBOARD
   Struktur ID/class dipertahankan agar sesuai dengan script.js
   ============================================================ */

:root {
    /* Canvas & surface */
    --bg-page: #080706;
    --surface: #151312;
    --surface-2: #1c1917;
    --surface-3: #262220;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.15);

    /* Editorial palette */
    --yellow: #FFD72F;
    --orange: #F6532B;
    --pink: #F35BAA;
    --turq: #17C9B4;
    --flame: #FF613F;
    --ink: #0d0c0b;

    /* Teks */
    --text-primary: #F5F2EF;
    --text-secondary: #B0AAA4;
    --text-muted: #85807D;

    /* Alias semantik (dipakai oleh script.js) */
    --color-success: #2BD9A8;
    --color-success-soft: rgba(43, 217, 168, 0.14);
    --color-warning: #FFB020;
    --color-warning-soft: rgba(255, 176, 32, 0.16);
    --color-danger: #FF4D5E;
    --color-danger-soft: rgba(255, 77, 94, 0.16);
    --color-purple: #F35BAA;
    --accent-blue: #4EA8FF;
    --accent-blue-soft: rgba(78, 168, 255, 0.16);
    --highlight: #FFD72F;

    --success: var(--color-success);
    --success-soft: var(--color-success-soft);
    --warning: var(--color-warning);
    --warning-soft: var(--color-warning-soft);
    --danger: var(--color-danger);
    --danger-soft: var(--color-danger-soft);

    --radius-lg: 18px;
    --radius-md: 16px;
    --radius-sm: 12px;
    --radius-pill: 999px;

    --font-sans: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-display: "Sora", "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;

    --sidebar-w: 200px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-page);
    background-image:
        radial-gradient(720px 420px at 100% 0%, rgba(243, 91, 170, 0.07), transparent 60%),
        radial-gradient(680px 420px at 0% 100%, rgba(23, 201, 180, 0.06), transparent 60%);
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.55;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ==================== SHELL / LAYOUT ==================== */
.app-shell {
    display: flex;
    gap: 14px;
    padding: 16px;
    min-height: 100vh;
    align-items: flex-start;
}

.main {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.content {
    width: 100%;
    max-width: 1360px;
    padding: 6px 8px 40px;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.page-section {
    display: flex;
    flex-direction: column;
    gap: 18px;
    scroll-margin-top: 92px;
}

/* ==================== SIDEBAR ==================== */
.sidebar {
    flex: 0 0 var(--sidebar-w);
    width: var(--sidebar-w);
    position: sticky;
    top: 16px;
    height: calc(100vh - 32px);
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 18px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    z-index: 60;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 2px 4px;
}

.brand-mark {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    border-radius: 11px;
    background: var(--yellow);
    color: var(--ink);
}

.brand-mark svg {
    width: 20px;
    height: 20px;
}

.brand-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.brand-text strong {
    font-family: var(--font-display);
    font-size: 0.86rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    color: var(--text-primary);
}

.brand-text small {
    font-size: 0.6rem;
    letter-spacing: 0.12em;
    color: var(--text-muted);
}

.sidebar-divider {
    height: 1px;
    background: var(--border);
    margin: 2px 2px 0;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 11px;
    border-radius: 10px;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.16s ease, color 0.16s ease;
}

.nav-item .nav-icon {
    width: 17px;
    height: 17px;
    flex-shrink: 0;
    opacity: 0.9;
}

.nav-item .nav-icon svg {
    width: 17px;
    height: 17px;
}

.nav-item:hover {
    background: var(--surface-2);
    color: var(--text-primary);
}

.nav-item.is-active {
    background: var(--surface-3);
    color: var(--text-primary);
}

.nav-item.is-active .nav-icon {
    color: var(--yellow);
    opacity: 1;
}

.sidebar-status {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    border-radius: 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
}

.sidebar-status-label {
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.device-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 11px;
    border-radius: 10px;
    background: var(--surface-3);
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.device-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    flex-shrink: 0;
}

.device-chip.status-connected {
    color: var(--color-success);
}
.device-chip.status-connected .device-dot {
    background: var(--color-success);
    animation: pulse 1.8s infinite;
}
.device-chip.status-warning {
    color: var(--color-warning);
}
.device-chip.status-warning .device-dot {
    background: var(--color-warning);
    animation: pulse 1.8s infinite;
}
.device-chip.status-disconnected {
    color: var(--color-danger);
}
.device-chip.status-disconnected .device-dot {
    background: var(--color-danger);
}

.sidebar-status-note {
    font-size: 0.68rem;
    color: var(--text-muted);
}

.sidebar-status-note strong {
    color: var(--text-secondary);
    font-weight: 700;
}

.sidebar-overlay {
    display: none;
}

/* ==================== TOPBAR ==================== */
.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 8px;
    background: rgba(8, 7, 6, 0.75);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.menu-toggle {
    display: none;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--surface);
    color: var(--text-primary);
    cursor: pointer;
    place-items: center;
}

.menu-toggle svg {
    width: 19px;
    height: 19px;
}

.topbar-heading {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar-title {
    font-family: var(--font-display);
    font-size: 1.02rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    line-height: 1.2;
}

.topbar-breadcrumb {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.crumb-sep {
    padding: 0 2px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-left: auto;
    flex-wrap: wrap;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 13px;
    border-radius: var(--radius-pill);
    background: var(--surface);
    border: 1px solid var(--border);
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--text-secondary);
    white-space: nowrap;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--text-muted);
    flex-shrink: 0;
}

.status-pill.status-connected {
    color: var(--color-success);
}
.status-pill.status-connected .status-dot {
    background: var(--color-success);
    animation: pulse 1.8s infinite;
}
.status-pill.status-warning {
    color: var(--color-warning);
}
.status-pill.status-warning .status-dot {
    background: var(--color-warning);
    animation: pulse 1.8s infinite;
}
.status-pill.status-disconnected {
    color: var(--color-danger);
}
.status-pill.status-disconnected .status-dot {
    background: var(--color-danger);
}

.header-time {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 12px;
    min-width: 88px;
    text-align: center;
}

/* ==================== FEATURE BANNERS ==================== */
.banners {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.banner {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-md);
    min-height: 168px;
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    color: var(--ink);
    isolation: isolate;
}

.banner-yellow {
    background: var(--yellow);
}

.banner-orange {
    background: var(--orange);
}

.banner-pill {
    align-self: flex-start;
    background: var(--ink);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 5px 10px;
    border-radius: var(--radius-pill);
}

.banner-body {
    max-width: 66%;
    position: relative;
    z-index: 2;
}

.banner-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: -0.02em;
}

.banner-desc {
    margin-top: 6px;
    font-size: 0.76rem;
    font-weight: 600;
    line-height: 1.4;
    opacity: 0.86;
}

.banner-btn {
    align-self: flex-start;
    margin-top: auto;
    position: relative;
    z-index: 2;
    background: var(--ink);
    color: #fff;
    text-decoration: none;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 8px 15px;
    border-radius: var(--radius-pill);
    transition: transform 0.15s ease, opacity 0.15s ease;
}

.banner-btn:hover {
    transform: translateY(-1px);
    opacity: 0.92;
}

.banner-art {
    position: absolute;
    right: 12px;
    bottom: 10px;
    width: 138px;
    height: auto;
    z-index: 1;
    opacity: 0.96;
    pointer-events: none;
}

/* ==================== SECTION HEADING ==================== */
.section-heading-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 6px 2px 0;
}

.section-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 0 2px;
}

.section-heading {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.section-subheading {
    display: block;
    margin-top: 3px;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.hero-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border-radius: var(--radius-pill);
    background: var(--surface);
    border: 1px solid var(--border);
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--text-secondary);
}

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

.hero-status.status-connected {
    color: var(--color-success);
}
.hero-status.status-connected .hero-status-dot {
    background: var(--color-success);
    animation: pulse 1.8s infinite;
}
.hero-status.status-warning {
    color: var(--color-warning);
}
.hero-status.status-warning .hero-status-dot {
    background: var(--color-warning);
    animation: pulse 1.8s infinite;
}
.hero-status.status-disconnected {
    color: var(--color-danger);
}
.hero-status.status-disconnected .hero-status-dot {
    background: var(--color-danger);
}

/* ==================== SENSOR METRIC ROW ==================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.stat-card {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 158px;
    padding: 16px;
    border-radius: var(--radius-md);
    color: var(--ink);
    transition: transform 0.18s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
}

.tone-pink { background: var(--pink); }
.tone-turq { background: var(--turq); }
.tone-flame { background: var(--flame); }
.tone-yellow { background: var(--yellow); }

.stat-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    position: relative;
    z-index: 2;
}

.stat-label {
    font-size: 0.64rem;
    font-weight: 800;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.stat-icon {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: rgba(13, 12, 11, 0.16);
    color: var(--ink);
}

.stat-icon svg {
    width: 19px;
    height: 19px;
}

.stat-value {
    display: flex;
    align-items: baseline;
    gap: 5px;
    font-family: var(--font-display);
    font-size: 2.1rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.02em;
    position: relative;
    z-index: 2;
    overflow-wrap: anywhere;
}

.stat-value small {
    font-size: 0.85rem;
    font-weight: 700;
    opacity: 0.7;
}

.stat-card .sensor-status-badge,
.category-tile .sensor-status-badge {
    align-self: flex-start;
    position: relative;
    z-index: 2;
    background: #292524;
    color: #FFFFFF;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
}

.stat-card .sensor-status-badge.status-ok,
.category-tile .sensor-status-badge.status-ok {
    background: #0E3B20;
    color: #FFFFFF;
}

.stat-card .sensor-status-badge.status-warn,
.category-tile .sensor-status-badge.status-warn {
    background: #573110;
    color: #FFFFFF;
}

.stat-card .sensor-status-badge.status-danger,
.category-tile .sensor-status-badge.status-danger {
    background: #681717;
    color: #FFFFFF;
}

.stat-card .sensor-status-badge.status-dark,
.category-tile .sensor-status-badge.status-dark {
    background: #292524;
    color: #FFFFFF;
}

.stat-foot {
    font-size: 0.68rem;
    font-weight: 600;
    opacity: 0.72;
    position: relative;
    z-index: 2;
    margin-top: auto;
}

.stat-art {
    position: absolute;
    right: -6px;
    bottom: -4px;
    width: 110px;
    z-index: 1;
    pointer-events: none;
}

/* ==================== ALERT BANNER ==================== */
.alert-banner {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border-radius: var(--radius-md);
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--text-muted);
    transition: border-color 0.3s ease, background 0.3s ease;
}

.alert-icon {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: var(--surface-2);
    color: var(--text-secondary);
}

.alert-icon svg {
    width: 21px;
    height: 21px;
}

.alert-content {
    flex: 1 1 auto;
    min-width: 0;
}

.alert-content h4 {
    font-family: var(--font-display);
    font-size: 0.94rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.alert-content p {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.alert-timestamp {
    flex-shrink: 0;
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--text-muted);
}

.alert-banner.alert-normal {
    border-left-color: var(--color-success);
}
.alert-banner.alert-normal .alert-icon {
    background: var(--color-success-soft);
    color: var(--color-success);
}

.alert-banner.alert-warning {
    border-left-color: var(--color-warning);
}
.alert-banner.alert-warning .alert-icon {
    background: var(--color-warning-soft);
    color: var(--color-warning);
}

.alert-banner.alert-danger {
    border-left-color: var(--color-danger);
    background: rgba(255, 77, 94, 0.07);
}
.alert-banner.alert-danger .alert-icon {
    background: var(--color-danger-soft);
    color: var(--color-danger);
    animation: pulse 1.4s infinite;
}
.alert-banner.alert-danger #alert-title {
    color: var(--color-danger);
}

.alert-banner.alert-disconnected {
    border-left-color: var(--text-muted);
}
.alert-banner.alert-disconnected .alert-icon {
    background: var(--surface-3);
    color: var(--text-secondary);
}

/* ==================== CARD (umum) ==================== */
.card {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.card-title-group {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
}

.section-icon {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: var(--surface-2);
    color: var(--yellow);
}

.section-icon svg {
    width: 18px;
    height: 18px;
}

.card-title {
    font-family: var(--font-display);
    font-size: 0.98rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

.badge {
    padding: 5px 12px;
    border-radius: var(--radius-pill);
    background: var(--surface-2);
    border: 1px solid var(--border);
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-secondary);
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ==================== SUMMARY ==================== */
.summary-lead {
    font-size: 0.94rem;
    color: var(--text-primary);
    margin-bottom: 14px;
}

.summary-details {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.summary-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.summary-item-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    border-radius: 7px;
    background: var(--surface-2);
    color: var(--yellow);
}

.summary-item-icon svg {
    width: 14px;
    height: 14px;
}

/* ==================== FILTER CHIPS ==================== */
.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chart-tab {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: var(--radius-pill);
    font-family: var(--font-sans);
    font-size: 0.76rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.chart-tab:hover {
    color: var(--text-primary);
    border-color: var(--border-strong);
}

.chart-tab.active {
    background: var(--yellow);
    border-color: var(--yellow);
    color: var(--ink);
}

/* ==================== SENSOR CARDS ==================== */
.category-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.category-tile {
    position: relative;
    overflow: hidden;
    text-align: left;
    border: none;
    cursor: pointer;
    border-radius: var(--radius-md);
    min-height: 204px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: var(--ink);
    font-family: var(--font-sans);
    line-height: 1.15;
    transition: transform 0.18s ease;
}

.category-tile:hover {
    transform: translateY(-3px);
}

.category-tile:focus-visible {
    outline: 2px solid var(--ink);
    outline-offset: 2px;
}

.tile-pink { background: var(--pink); }
.tile-turq { background: var(--turq); }
.tile-flame { background: var(--flame); }
.tile-yellow { background: var(--yellow); }

.tile-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    position: relative;
    z-index: 2;
}

.tile-label {
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.tile-icon {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: rgba(13, 12, 11, 0.16);
    color: var(--ink);
}

.tile-icon svg {
    width: 18px;
    height: 18px;
}

.tile-value {
    display: flex;
    align-items: baseline;
    gap: 5px;
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.02em;
    margin-top: 4px;
    position: relative;
    z-index: 2;
}

.tile-value small {
    font-size: 0.78rem;
    font-weight: 700;
    opacity: 0.7;
}

.tile-meta {
    font-size: 0.68rem;
    font-weight: 600;
    opacity: 0.72;
    position: relative;
    z-index: 2;
}

.tile-threshold {
    font-size: 0.68rem;
    font-weight: 800;
    opacity: 0.9;
    position: relative;
    z-index: 2;
}

.tile-meter {
    width: 100%;
    height: 7px;
    margin-top: auto;
    border-radius: var(--radius-pill);
    background: rgba(13, 12, 11, 0.2);
    overflow: hidden;
    position: relative;
    z-index: 2;
}

.sensor-status-badge {
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    white-space: nowrap;
    background: var(--surface-2);
    color: var(--text-secondary);
}

.sensor-status-badge.status-ok {
    background: var(--color-success-soft);
    color: var(--color-success);
}

.sensor-status-badge.status-warn {
    background: var(--color-warning-soft);
    color: var(--color-warning);
}

.sensor-status-badge.status-danger {
    background: var(--color-danger-soft);
    color: var(--color-danger);
}

.sensor-status-badge.status-dark {
    background: var(--surface-3);
    color: var(--text-secondary);
}

.meter-fill {
    height: 100%;
    border-radius: var(--radius-pill);
    background: var(--ink);
    transition: width 0.4s ease, background-color 0.4s ease;
}

/* ==================== CHART ==================== */
.chart-section {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.chart-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.chart-subtitle {
    display: block;
    margin-top: 3px;
    font-size: 0.76rem;
    color: var(--text-muted);
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    font-size: 0.74rem;
    color: var(--text-secondary);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-dot {
    width: 9px;
    height: 9px;
    border-radius: 3px;
}

.dot-suhu { background-color: var(--pink); }
.dot-kelembapan { background-color: var(--turq); }
.dot-gas { background-color: var(--flame); }
.dot-cahaya { background-color: var(--yellow); }

.canvas-wrapper {
    position: relative;
    width: 100%;
    height: 262px;
    padding: 6px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
}

#monitoring-chart {
    width: 100%;
    height: 100%;
    display: block;
}

/* ==================== AI + KALIBRASI ==================== */
.ai-dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    align-items: stretch;
}

.ai-analysis-card,
.calibration-card {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.ai-status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    max-width: 200px;
    padding: 6px 12px;
    border-radius: var(--radius-pill);
    background: var(--surface-2);
    color: var(--text-secondary);
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ai-state-normal {
    background: var(--color-success-soft);
    color: var(--color-success);
}

.ai-state-anomaly,
.ai-state-failed {
    background: var(--color-danger-soft);
    color: var(--color-danger);
}

.ai-state-calibration,
.ai-state-training {
    background: var(--color-warning-soft);
    color: var(--color-warning);
}

.ai-state-neutral {
    background: var(--surface-2);
    color: var(--text-secondary);
}

.ai-status-main {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    min-height: 80px;
}

.ai-status-symbol {
    width: 50px;
    height: 50px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: var(--surface-2);
    color: var(--yellow);
}

.ai-status-symbol svg {
    width: 25px;
    height: 25px;
}

.ai-status-copy h4 {
    font-family: var(--font-display);
    font-size: 0.94rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 2px 0 4px;
}

.ai-status-copy p,
.calibration-description {
    font-size: 0.81rem;
    line-height: 1.55;
    color: var(--text-secondary);
}

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

.ai-metric,
.calibration-stat {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    min-width: 0;
    padding: 12px;
    border-radius: 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
}

.ai-metric-label {
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.ai-metric-value {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    overflow-wrap: anywhere;
}

.ai-metric-date {
    font-size: 0.8rem;
    font-family: var(--font-sans);
}

.ai-disclaimer {
    margin-top: auto;
    padding-top: 13px;
    border-top: 1px solid var(--border);
    font-size: 0.74rem;
    line-height: 1.55;
    color: var(--text-muted);
}

.calibration-progress-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.calibration-progress-heading strong {
    font-family: var(--font-display);
    font-size: 0.98rem;
    color: var(--text-primary);
    letter-spacing: 0;
}

.calibration-progress-track {
    width: 100%;
    height: 11px;
    border-radius: var(--radius-pill);
    background: var(--surface-3);
    overflow: hidden;
}

.calibration-progress-fill {
    width: 0%;
    height: 100%;
    border-radius: var(--radius-pill);
    background: var(--yellow);
    transition: width 0.3s ease;
}

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

.calibration-stat strong {
    font-family: var(--font-display);
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--text-primary);
    overflow-wrap: anywhere;
}

.calibration-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.calibration-hint {
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--surface-2);
    border-left: 3px solid var(--accent-blue);
    font-size: 0.74rem;
    line-height: 1.55;
    color: var(--text-secondary);
}

/* ==================== 4 TIME SLOTS & AI BANNER ==================== */
.ai-active-slot-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(234, 179, 8, 0.12), rgba(14, 165, 233, 0.08));
    border: 1px solid rgba(234, 179, 8, 0.28);
}

.slot-banner-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--yellow);
    flex-shrink: 0;
}

.slot-banner-icon svg {
    width: 22px;
    height: 22px;
}

.slot-banner-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.slot-banner-label {
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.slot-banner-info strong {
    font-family: var(--font-display);
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--yellow);
    letter-spacing: 0.01em;
}

.slot-source-pill {
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: rgba(34, 197, 94, 0.15);
    color: var(--color-success);
    border: 1px solid rgba(34, 197, 94, 0.25);
    white-space: nowrap;
}

.slot-source-pill.is-default {
    background: var(--surface-3);
    color: var(--accent-blue);
    border-color: rgba(14, 165, 233, 0.25);
}

.time-slots-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 2px;
}

.time-slots-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}

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

@media (max-width: 600px) {
    .time-slots-grid {
        grid-template-columns: 1fr;
    }
}

.time-slot-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
    cursor: pointer;
    user-select: none;
}

.time-slot-card:hover {
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

.time-slot-card.is-active-slot {
    border-color: var(--yellow);
    background: linear-gradient(145deg, rgba(234, 179, 8, 0.1), var(--surface-2));
    box-shadow: 0 0 14px rgba(234, 179, 8, 0.18);
}

.time-slot-card.is-selected-target {
    border-color: var(--accent-blue);
    background: linear-gradient(145deg, rgba(14, 165, 233, 0.14), var(--surface-2));
    box-shadow: 0 0 16px rgba(14, 165, 233, 0.28);
}

.time-slot-card.is-active-slot.is-selected-target {
    border-color: var(--accent-blue);
    box-shadow: 0 0 16px rgba(14, 165, 233, 0.35);
}

.time-slot-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.time-slot-icon {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--yellow);
    flex-shrink: 0;
}

.time-slot-icon svg {
    width: 18px;
    height: 18px;
}

#slot-card-pagi .time-slot-icon {
    color: #f59e0b;
}

#slot-card-siang .time-slot-icon {
    color: #eab308;
}

#slot-card-sore .time-slot-icon {
    color: #f97316;
}

#slot-card-malam .time-slot-icon {
    color: #818cf8;
}

.time-slot-title-group {
    display: flex;
    flex-direction: column;
    gap: 1px;
    flex: 1;
}

.time-slot-name {
    font-family: var(--font-display);
    font-size: 0.86rem;
    font-weight: 700;
    color: var(--text-primary);
}

.time-slot-hours {
    font-size: 0.66rem;
    color: var(--text-muted);
    font-weight: 500;
}

.time-slot-pill {
    padding: 3px 8px;
    border-radius: var(--radius-pill);
    font-size: 0.58rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
}

.time-slot-pill.pill-calibrated {
    background: var(--color-success-soft);
    color: var(--color-success);
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.time-slot-pill.pill-default {
    background: var(--surface-3);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.time-slot-meta {
    font-size: 0.7rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.calibration-target-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 10px;
    background: rgba(14, 165, 233, 0.08);
    border: 1px solid rgba(14, 165, 233, 0.2);
    font-size: 0.76rem;
    color: var(--text-secondary);
}

.target-banner-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-blue);
    flex-shrink: 0;
}

.target-banner-icon svg {
    width: 17px;
    height: 17px;
}

.target-banner-text strong {
    color: var(--accent-blue);
    font-weight: 700;
}

.target-banner-text small {
    color: var(--text-muted);
    margin-left: 4px;
}

.btn-calibration-reset {
    color: var(--text-secondary);
    background: transparent;
    border-color: var(--border);
}

.btn-calibration-reset:hover:not(:disabled) {
    background: rgba(239, 68, 68, 0.1);
    color: var(--color-danger);
    border-color: rgba(239, 68, 68, 0.3);
}

/* ==================== RIWAYAT TABLE ==================== */
.table-wrapper {
    width: 100%;
    overflow-x: auto;
    border-radius: 14px;
}

.history-table {
    width: 100%;
    min-width: 660px;
    border-collapse: collapse;
    font-size: 0.81rem;
}

.history-table thead th {
    text-align: left;
    padding: 11px 15px;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.history-table tbody td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    white-space: nowrap;
}

.history-table tbody tr:last-child td {
    border-bottom: none;
}

.history-table tbody tr:hover {
    background: var(--surface-2);
}

.history-table .cell-time {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.empty-state {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 42px 20px;
    text-align: center;
}

.empty-state.show {
    display: flex;
}

.empty-icon {
    width: 50px;
    height: 50px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: var(--surface-2);
    color: var(--text-muted);
    margin-bottom: 6px;
}

.empty-icon svg {
    width: 24px;
    height: 24px;
}

.empty-state p {
    font-weight: 700;
    color: var(--text-secondary);
}

.empty-state span {
    font-size: 0.76rem;
    color: var(--text-muted);
}

/* ==================== OUTPUT / ACTUATOR ==================== */
.outputs-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.output-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.output-header {
    display: flex;
    align-items: center;
    gap: 13px;
}

.output-icon-wrapper {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: var(--surface-2);
    color: var(--text-secondary);
    transition: background 0.3s ease, color 0.3s ease;
}

.output-icon svg {
    width: 22px;
    height: 22px;
}

.output-name {
    font-family: var(--font-display);
    font-size: 0.94rem;
    font-weight: 700;
    color: var(--text-primary);
}

.output-pin {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.output-state-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 11px 15px;
    border-radius: 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
}

.output-state-text {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

.output-state-pill {
    padding: 4px 11px;
    border-radius: var(--radius-pill);
    background: var(--surface-3);
    font-size: 0.64rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-secondary);
    white-space: nowrap;
}

.pill-off {
    background: var(--surface-3);
    color: var(--text-secondary);
}

.pill-on {
    background: var(--color-success-soft);
    color: var(--color-success);
}

.pill-danger-on {
    background: var(--color-danger-soft);
    color: var(--color-danger);
    animation: pulse 1.2s infinite;
}

.pill-muted {
    background: var(--color-warning-soft);
    color: var(--color-warning);
}

.output-desc {
    font-size: 0.76rem;
    line-height: 1.5;
    color: var(--text-secondary);
}

.output-action-row {
    margin-top: auto;
    padding-top: 4px;
}

.btn-buzzer-mute {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-secondary);
    font-family: var(--font-display);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
}

.btn-buzzer-mute svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.btn-buzzer-mute:hover:not(:disabled) {
    background: var(--surface-3);
    color: var(--text-primary);
    border-color: var(--border-hover);
    transform: translateY(-1px);
}

.btn-buzzer-mute:active:not(:disabled) {
    transform: translateY(0);
}

.btn-buzzer-mute:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* 1. TAMPILAN BUAT SENYAPKAN (Saat Alarm Berbunyi) */
.btn-buzzer-mute.state-alarm,
.btn-buzzer-mute.active-alarm {
    background: var(--flame);
    color: #ffffff;
    border-color: rgba(255, 97, 63, 0.7);
    box-shadow: 0 4px 16px rgba(255, 97, 63, 0.35);
    animation: pulseMuteAlarm 1.2s infinite alternate ease-in-out;
}

.btn-buzzer-mute.state-alarm:hover:not(:disabled),
.btn-buzzer-mute.active-alarm:hover:not(:disabled) {
    background: #ff7555;
    box-shadow: 0 6px 20px rgba(255, 97, 63, 0.55);
    transform: translateY(-1px);
}

/* 2. TAMPILAN BUAT MENYALAKAN (Saat Buzzer Sedang Disenyapkan) */
.btn-buzzer-mute.state-muted,
.btn-buzzer-mute.is-muted {
    background: rgba(255, 176, 32, 0.16);
    color: var(--yellow);
    border-color: rgba(255, 215, 47, 0.45);
    box-shadow: 0 2px 10px rgba(255, 215, 47, 0.12);
}

.btn-buzzer-mute.state-muted:hover:not(:disabled),
.btn-buzzer-mute.is-muted:hover:not(:disabled) {
    background: rgba(255, 176, 32, 0.28);
    border-color: var(--yellow);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(255, 215, 47, 0.25);
    transform: translateY(-1px);
}

/* 3. TAMPILAN STANDBY / NORMAL */
.btn-buzzer-mute.state-idle {
    background: var(--surface-2);
    color: var(--text-muted);
    border-color: var(--border);
}

.btn-buzzer-mute.state-idle:hover:not(:disabled) {
    background: var(--surface-3);
    color: var(--text-secondary);
    border-color: var(--border-hover);
}

.btn-spinner {
    width: 13px;
    height: 13px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: inline-block;
}

@keyframes pulseMuteAlarm {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 97, 63, 0.5);
    }
    100% {
        box-shadow: 0 0 0 8px rgba(255, 97, 63, 0);
    }
}

/* State aktif aktual */
.state-led-on {
    border-color: rgba(255, 215, 47, 0.5);
}
.state-led-on .led-icon-wrapper {
    background: rgba(255, 215, 47, 0.16);
    color: var(--yellow);
}
.state-led-on .output-state-text {
    color: var(--yellow);
}

.state-buzzer-on {
    border-color: rgba(255, 77, 94, 0.5);
}
.state-buzzer-on .buzzer-icon-wrapper {
    background: var(--color-danger-soft);
    color: var(--color-danger);
    animation: buzzerRinging 0.5s infinite alternate;
}
.state-buzzer-on .output-state-text {
    color: var(--color-danger);
}

.state-buzzer-muted {
    border-color: rgba(255, 176, 32, 0.45);
}
.state-buzzer-muted .buzzer-icon-wrapper {
    background: var(--color-warning-soft);
    color: var(--color-warning);
}
.state-buzzer-muted .output-state-text {
    color: var(--color-warning);
}

.state-kipas-on {
    border-color: rgba(78, 168, 255, 0.5);
}
.state-kipas-on .fan-icon-wrapper {
    background: var(--accent-blue-soft);
    color: var(--accent-blue);
}
.state-kipas-on .fan-icon {
    display: inline-block;
    animation: spin 0.8s linear infinite;
}
.state-kipas-on .output-state-text {
    color: var(--accent-blue);
}

/* ==================== SYSTEM INFO ==================== */
.system-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.info-list {
    display: flex;
    flex-direction: column;
}

.info-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 2px;
    border-bottom: 1px solid var(--border);
    font-size: 0.81rem;
}

.info-item:last-child {
    border-bottom: none;
}

.info-label {
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.info-val {
    font-weight: 700;
    color: var(--text-primary);
    text-align: right;
    overflow-wrap: anywhere;
}

.code-font {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--yellow);
}

/* ==================== TOMBOL ==================== */
.btn-sm {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 13px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 0.76rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.btn-sm svg {
    width: 14px;
    height: 14px;
}

.btn-sm:hover {
    background: var(--surface-2);
    border-color: var(--border-strong);
    color: var(--text-primary);
}

.btn-calibration {
    min-height: 44px;
    padding: 10px 18px;
    border: 1px solid transparent;
    border-radius: 11px;
    font-family: var(--font-sans);
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, opacity 0.18s ease;
}

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

.btn-calibration-primary {
    color: var(--ink);
    background: var(--yellow);
}

.btn-calibration-primary:hover:not(:disabled) {
    background: #ffdf5c;
}

.btn-calibration-primary:disabled {
    background: var(--surface-3);
    color: var(--text-muted);
}

.btn-calibration-secondary {
    color: var(--text-primary);
    background: var(--surface-2);
    border-color: var(--border);
}

.btn-calibration-secondary:hover:not(:disabled) {
    border-color: var(--border-strong);
}

:focus-visible {
    outline: 2px solid var(--yellow);
    outline-offset: 2px;
    border-radius: 6px;
}

/* ==================== FOOTER ==================== */
.app-footer {
    margin-top: 4px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 0.74rem;
    color: var(--text-muted);
}

/* ==================== ANIMASI ==================== */
@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes buzzerRinging {
    0% { transform: rotate(-8deg); }
    100% { transform: rotate(8deg); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1180px) {
    .outputs-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 1080px) {
    .ai-dashboard-grid {
        grid-template-columns: 1fr;
    }
    .ai-status-pill {
        max-width: none;
    }
    .stats-grid,
    .category-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 1000px) {
    .menu-toggle {
        display: grid;
    }

    .sidebar {
        position: fixed;
        top: 16px;
        left: 16px;
        height: calc(100vh - 32px);
        transform: translateX(calc(-100% - 24px));
        transition: transform 0.28s ease;
        z-index: 70;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 55;
        background: rgba(0, 0, 0, 0.6);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.25s ease, visibility 0.25s ease;
    }

    body.nav-open .sidebar-overlay {
        opacity: 1;
        visibility: visible;
    }

    body.nav-open {
        overflow: hidden;
    }
}

@media (max-width: 760px) {
    .app-shell {
        padding: 10px;
        gap: 0;
    }

    .topbar {
        margin: 0;
        padding: 10px 4px;
    }

    .content {
        padding: 4px 4px 32px;
        gap: 24px;
    }

    .page-section {
        scroll-margin-top: 84px;
    }

    .banners {
        grid-template-columns: 1fr;
    }

    .banner-body {
        max-width: 72%;
    }

    .header-time {
        display: none;
    }

    .btn-sm-text {
        display: none;
    }

    .btn-sm {
        padding: 9px;
    }

    .ai-metrics-grid,
    .calibration-stats {
        grid-template-columns: 1fr;
    }

    .calibration-actions {
        flex-direction: column;
    }

    .btn-calibration {
        width: 100%;
    }

    .canvas-wrapper {
        height: 220px;
    }

    .alert-banner {
        flex-wrap: wrap;
    }

    .alert-timestamp {
        width: 100%;
    }
}

@media (max-width: 520px) {
    .stats-grid,
    .category-grid,
    .outputs-grid {
        grid-template-columns: 1fr;
    }

    .topbar-heading {
        order: 3;
        width: 100%;
    }

    .banner-body {
        max-width: 66%;
    }
}


/* ============================================================
   3D DIGITAL TWIN & HUMAN-FRIENDLY MONITORING STYLES
   ============================================================ */

.badge-twin {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: var(--radius-pill);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.8px;
    background: rgba(255, 215, 47, 0.15);
    color: var(--yellow);
    border: 1px solid rgba(255, 215, 47, 0.35);
}

.topbar-title-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-demo-mode {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 14px;
    border-radius: var(--radius-pill);
    background: rgba(255, 215, 47, 0.12);
    color: var(--yellow);
    border: 1px solid rgba(255, 215, 47, 0.35);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-demo-mode:hover {
    background: rgba(255, 215, 47, 0.22);
    border-color: var(--yellow);
    box-shadow: 0 0 14px rgba(255, 215, 47, 0.3);
}

.btn-demo-mode.is-active {
    background: var(--yellow);
    color: var(--ink);
    border-color: var(--yellow);
    box-shadow: 0 0 16px rgba(255, 215, 47, 0.45);
}

/* ==================== 3D TWIN HERO GRID ==================== */
.twin-hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

/* LEFT: 3D STAGE & SENSOR STACK */
.twin-left-column {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

/* LEFT: 3D STAGE CARD */
.stage-3d-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.45);
    flex: 0 0 auto;
}

.stage-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
    height: 64px;
    min-height: 64px;
    max-height: 64px;
    background: rgba(21, 19, 18, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    z-index: 12;
    gap: 14px;
    flex-wrap: nowrap;
    box-sizing: border-box;
    overflow: hidden;
}

.human-verdict {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
}

.verdict-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--color-success);
    box-shadow: 0 0 12px var(--color-success);
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.verdict-dot.status-warn {
    background: var(--color-warning);
    box-shadow: 0 0 12px var(--color-warning);
}

.verdict-dot.status-danger {
    background: var(--color-danger);
    box-shadow: 0 0 14px var(--color-danger);
    animation: pulse-danger 1s infinite;
}

.verdict-dot.status-offline {
    background: var(--text-muted);
    box-shadow: none;
}

@keyframes pulse-danger {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.35); opacity: 0.7; }
}

.verdict-texts {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
    gap: 2px;
}

.verdict-title {
    font-family: var(--font-display);
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.verdict-subtitle {
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 3D STAGE CONTROLS GROUP (BUKA ATAP, AUTO-FOKUS, RESET) */
.stage-controls-group {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-shrink: 0;
    white-space: nowrap;
}

.btn-stage-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 13px;
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.btn-stage-action:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.18);
}

.btn-action-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.btn-roof-toggle.is-open {
    background: rgba(255, 215, 47, 0.18);
    color: var(--yellow);
    border-color: rgba(255, 215, 47, 0.45);
    box-shadow: 0 0 12px rgba(255, 215, 47, 0.25);
    font-weight: 700;
}

.btn-autofocus-toggle {
    gap: 7px;
}

.autofocus-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #666;
    transition: all 0.25s ease;
    flex-shrink: 0;
}

.btn-autofocus-toggle.is-active {
    background: rgba(43, 217, 168, 0.15);
    color: var(--turq);
    border-color: rgba(43, 217, 168, 0.35);
    font-weight: 700;
}

.btn-autofocus-toggle.is-active .autofocus-dot {
    background: var(--turq);
    box-shadow: 0 0 8px var(--turq);
}

.btn-cam-reset {
    padding: 7px 10px;
}

.btn-cam-reset svg {
    width: 14px;
    height: 14px;
}

/* 3D CANVAS WRAPPER (VIEWPORT) */
.stage-canvas-wrapper {
    position: relative;
    width: 100%;
    height: 440px;
    min-height: 400px;
    background: radial-gradient(ellipse at 50% 35%, #181514 0%, #0a0908 100%);
    overflow: hidden;
}

.stage-canvas-wrapper canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
    outline: none;
}

/* ==================== 3D HOTSPOT SYSTEM (DUA LAPIS: ZERO PENTALAN) ==================== */
/* Lapisan 1: Anchor khusus milik CSS2DObject (Three.js transform kontrol murni) */
.hotspot-anchor {
    position: absolute;
    width: 0;
    height: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    /* DILARANG: transform, transition: transform, atau animation pada anchor! */
}

/* Lapisan 2: Tombol interaktif di dalam anchor */
.hotspot-dot {
    position: absolute;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(18, 16, 14, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.55), 0 0 0 1.5px rgba(255, 255, 255, 0.18);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    color: #fff;
    font-size: 14px;
    transform: translate(-50%, -50%);
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s ease, border-color 0.2s ease;
    pointer-events: auto;
    user-select: none;
}

.hotspot-dot:hover {
    transform: translate(-50%, -50%) scale(1.18);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.7), 0 0 0 2px var(--yellow);
}

.hotspot-dot.is-selected {
    transform: translate(-50%, -50%) scale(1.15);
    box-shadow: 0 0 0 3px var(--yellow), 0 6px 18px rgba(255, 215, 47, 0.45);
}

.hotspot-dot .dot-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    position: relative;
    z-index: 2;
}

.hotspot-dot .dot-pulse {
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 1.5px solid var(--turq);
    opacity: 0.75;
    animation: pinPulseAnim 2.2s infinite ease-out;
    pointer-events: none;
}

@keyframes pinPulseAnim {
    0% { transform: scale(0.9); opacity: 0.85; }
    100% { transform: scale(1.65); opacity: 0; }
}

.hotspot-dot.status-active .dot-pulse {
    border-color: var(--yellow);
}

.hotspot-dot.status-warn .dot-pulse {
    border-color: var(--yellow);
}

.hotspot-dot.status-danger .dot-pulse {
    border-color: var(--flame);
    animation-duration: 1.1s;
}

/* HOTSPOT INSPECTOR CARD (CLICK-TO-INSPECT) */
.hotspot-inspector-card {
    position: absolute;
    bottom: 14px;
    left: 14px;
    max-width: 310px;
    width: calc(100% - 28px);
    background: rgba(18, 16, 14, 0.94);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.06);
    z-index: 25;
    opacity: 0;
    transform: translateY(10px) scale(0.96);
    pointer-events: none;
    transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.hotspot-inspector-card.is-open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.inspector-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.inspector-title-group {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.inspector-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.inspector-badge {
    display: inline-block;
    align-self: flex-start;
    padding: 2px 7px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.inspector-badge.badge-normal {
    background: rgba(43, 217, 168, 0.15);
    color: var(--turq);
    border: 1px solid rgba(43, 217, 168, 0.3);
}

.inspector-badge.badge-active {
    background: rgba(23, 201, 180, 0.2);
    color: var(--turq);
    border: 1px solid rgba(23, 201, 180, 0.4);
}

.inspector-badge.badge-warn {
    background: rgba(255, 215, 47, 0.18);
    color: var(--yellow);
    border: 1px solid rgba(255, 215, 47, 0.4);
}

.inspector-badge.badge-danger {
    background: rgba(255, 97, 63, 0.2);
    color: var(--flame);
    border: 1px solid rgba(255, 97, 63, 0.45);
}

.btn-close-inspector {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.btn-close-inspector:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
}

.btn-close-inspector svg {
    width: 16px;
    height: 16px;
}

.inspector-desc {
    font-size: 11.5px;
    color: var(--text-secondary);
    line-height: 1.45;
    margin: 0 0 8px 0;
}

.inspector-sub {
    display: block;
    font-size: 10px;
    color: var(--text-muted);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding-top: 6px;
}

/* SIMULATION PRESET BAR */
.simulation-bar {
    position: relative;
    z-index: 12;
    background: rgba(26, 23, 21, 0.96);
    border-top: 1px solid rgba(255, 215, 47, 0.25);
    border-bottom: 1px solid rgba(255, 215, 47, 0.25);
    padding: 8px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.sim-bar-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

.sim-badge {
    padding: 3px 8px;
    border-radius: var(--radius-pill);
    background: var(--yellow);
    color: var(--ink);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.sim-presets {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.sim-preset-btn {
    padding: 5px 11px;
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sim-preset-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
}

.sim-preset-btn.is-active {
    background: rgba(23, 201, 180, 0.18);
    border-color: var(--turq);
    color: var(--turq);
    font-weight: 700;
}

/* OFFLINE HELPER PROMPT (SLIM 1-BAR) */
.offline-helper {
    position: relative;
    z-index: 14;
    background: rgba(28, 25, 22, 0.96);
    border-top: 1px solid rgba(255, 176, 32, 0.35);
    border-bottom: 1px solid rgba(255, 176, 32, 0.35);
    padding: 8px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.offline-helper-icon {
    font-size: 20px;
}

.offline-helper-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.offline-helper-info strong {
    font-size: 12px;
    color: var(--color-warning);
}

.offline-helper-info span {
    font-size: 11px;
    color: var(--text-secondary);
}

.btn-activate-sim {
    padding: 5px 13px;
    border-radius: var(--radius-pill);
    background: var(--yellow);
    color: var(--ink);
    border: none;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.btn-activate-sim:hover {
    background: #ffe366;
    box-shadow: 0 0 14px rgba(255, 215, 47, 0.4);
}

/* STAGE FOOTER */
.stage-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 18px;
    background: rgba(18, 16, 15, 0.92);
    border-top: 1px solid var(--border);
    font-size: 11px;
    color: var(--text-muted);
    z-index: 12;
}

/* 4 HUMAN SENSOR METRIC CARDS (2x2 GRID IN LEFT COLUMN) */
.stats-grid-2x2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    width: 100%;
}

.stats-grid-2x2 .stat-card {
    min-height: 126px;
    padding: 13px 15px;
    gap: 5px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}

.stats-grid-2x2 .stat-top {
    margin-bottom: 2px;
}

.stats-grid-2x2 .stat-value {
    font-size: 2.05rem;
    line-height: 1.05;
}

.stats-grid-2x2 .stat-foot {
    font-size: 11px;
    line-height: 1.35;
}
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 18px;
    background: rgba(18, 16, 15, 0.92);
    border-top: 1px solid var(--border);
    font-size: 11px;
    color: var(--text-muted);
    z-index: 12;
}

.stage-hint {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.hint-icon {
    width: 14px;
    height: 14px;
    color: var(--yellow);
}

.twin-tag {
    color: var(--text-secondary);
    font-weight: 600;
}

/* WEBGL FALLBACK */
.webgl-fallback {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 30px;
    text-align: center;
    color: var(--text-secondary);
}

.fallback-icon {
    font-size: 44px;
    margin-bottom: 12px;
}

.webgl-fallback h3 {
    font-size: 18px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.webgl-fallback p {
    max-width: 460px;
    margin-bottom: 12px;
    font-size: 13px;
}

.webgl-fallback span {
    font-size: 12px;
    color: var(--text-muted);
}

/* ==================== RIGHT QUICK PANEL ==================== */
.twin-quick-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.quick-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* CARD 1: SOLAR STATUS STYLE DONUT RING */
.ai-ring-content {
    display: flex;
    align-items: center;
    gap: 16px;
}

.donut-chart-wrap {
    position: relative;
    width: 96px;
    height: 96px;
    flex-shrink: 0;
}

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

.donut-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.07);
    stroke-width: 9;
}

.donut-fg {
    fill: none;
    stroke: var(--color-success);
    stroke-width: 9;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.8s ease, stroke 0.4s ease;
}

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

.donut-number {
    font-family: var(--font-display);
    font-size: 19px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
}

.donut-sublabel {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    margin-top: 3px;
}

.ai-ring-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.ai-human-title {
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
}

.ai-human-sub {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.ai-meta-pills {
    display: flex;
    gap: 6px;
    margin-top: 4px;
    flex-wrap: wrap;
}

.pill-mini {
    padding: 2px 7px;
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.06);
    font-size: 10px;
    font-weight: 600;
    color: var(--text-secondary);
}

.ai-extra-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.extra-metric-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.extra-metric-item span {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.extra-metric-item strong {
    font-size: 12px;
    color: var(--text-primary);
    font-weight: 700;
}

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

/* CARD 2: ACTUATORS QUICK ROWS */
.actuator-rows {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.actuator-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    border: 1px solid var(--border);
    transition: all 0.2s ease;
}

.act-icon {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.act-icon-lamp {
    background: rgba(255, 215, 47, 0.15);
    color: var(--yellow);
}

.act-icon-fan {
    background: rgba(23, 201, 180, 0.15);
    color: var(--turq);
}

.act-icon-buzzer {
    background: rgba(255, 77, 94, 0.15);
    color: var(--danger);
}

.act-details {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.act-details strong {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-primary);
}

.act-human-status {
    font-size: 11px;
    color: var(--text-secondary);
}

.fan-spin-icon {
    transition: transform 0.2s linear;
}

.state-kipas-on .fan-spin-icon {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.mute-button-wrap {
    width: 100%;
    margin-top: 6px;
    box-sizing: border-box;
}

.btn-buzzer-mute {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 8px 14px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
}

.btn-buzzer-mute svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

.btn-buzzer-mute.state-alarm {
    background: var(--flame);
    color: #ffffff;
    border: 1px solid rgba(255, 97, 63, 0.7);
    box-shadow: 0 4px 14px rgba(255, 97, 63, 0.35);
    animation: pulseMuteAlarm 1.2s infinite alternate ease-in-out;
}

.btn-buzzer-mute.state-alarm:hover:not(:disabled) {
    background: #ff7555;
    box-shadow: 0 6px 18px rgba(255, 97, 63, 0.5);
}

.btn-buzzer-mute.state-muted {
    background: rgba(255, 176, 32, 0.16);
    color: var(--yellow);
    border: 1px solid rgba(255, 215, 47, 0.45);
    box-shadow: 0 2px 10px rgba(255, 215, 47, 0.12);
}

.btn-buzzer-mute.state-muted:hover:not(:disabled) {
    background: rgba(255, 176, 32, 0.26);
    color: #ffffff;
    border-color: var(--yellow);
}

.btn-buzzer-mute.state-idle {
    background: var(--surface-2);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-buzzer-mute.state-idle:hover:not(:disabled) {
    background: var(--surface-3);
    color: var(--text-primary);
    border-color: var(--border-hover);
}

/* TYPOGRAPHY FOR HUMAN WORDS ON SENSOR CARDS 3 & 4 */
.stat-card.tone-flame .stat-value,
.stat-card.tone-yellow .stat-value {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

/* CARD 3: 4 MINI SLOTS & PROGRESS */
.mini-slots-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
}

.mini-slot-card {
    padding: 8px 10px;
    border-radius: 9px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.mini-slot-card:hover {
    border-color: var(--border-strong);
}

.mini-slot-card.is-selected-target {
    border-color: var(--yellow);
    background: rgba(255, 215, 47, 0.06);
    box-shadow: 0 0 10px rgba(255, 215, 47, 0.15);
}

.mini-slot-card.is-active-slot {
    border-left: 3px solid var(--color-success);
}

.slot-row-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.mini-slot-card .slot-name {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-primary);
}

.mini-slot-card .slot-hours {
    font-size: 10px;
    color: var(--text-muted);
}

.mini-slot-card .slot-meta {
    font-size: 9px;
    color: var(--text-secondary);
}

.calib-progress-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 2px;
}

.calib-prog-header {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-secondary);
}

.calib-prog-header strong {
    color: var(--text-primary);
}

.calibration-message-text {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.35;
}

.card-mini-meter {
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 8px;
}

/* ==================== RESPONSIVE BREAKPOINTS ==================== */
@media (max-width: 1180px) {
    .twin-hero-grid {
        grid-template-columns: 1fr;
    }

    .stage-canvas-wrapper {
        height: 440px;
        min-height: 400px;
    }
}

@media (max-width: 760px) {
    .stage-canvas-wrapper {
        height: 380px;
        min-height: 340px;
    }

    .mini-slots-grid {
        grid-template-columns: 1fr;
    }

    .simulation-bar {
        padding: 8px 12px;
    }
}

@media (max-width: 640px) {
    .stats-grid-2x2 {
        grid-template-columns: 1fr;
    }
}
