* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --primary-color: #00d4ff;
    --brand-purple: #a855f7;
    --brand-gradient: linear-gradient(135deg, #a855f7 0%, #3b82f6 52%, #00d4ff 100%);
    --secondary-color: #ff6b6b;
    --success-color: #4ade80;
    --warning-color: #fbbf24;
    --dark-bg: #0f172a;
    --darker-bg: #0a0e27;
    --card-bg: rgba(20, 24, 46, 0.88);
    --card-solid: #14182e;
    --text-primary: #ffffff;
    --text-secondary: #cbd5e1;
    --border-color: rgba(168, 85, 247, 0.42);
    --glow: 0 8px 32px rgba(168, 85, 247, 0.22), 0 0 24px rgba(0, 212, 255, 0.16);
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.brand-logo-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 12px;
}

.brand-logo-login {
    width: min(260px, 82%);
    height: auto;
    display: block;
}

.brand-logo-loading {
    width: min(250px, 76vw);
    height: auto;
    display: block;
    margin: 0 auto 20px;
}

html,
body {
    width: 100%;
    height: 100%;
    height: 100dvh;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: transparent;
    color: var(--text-primary);
    overflow: hidden;
    position: fixed;
    inset: 0;
}

/* Escena AR a pantalla completa (dejar que MindAR alinee el canvas con el video) */
a-scene {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    z-index: 0 !important;
    overflow: hidden;
    display: block;
}

/* Logo de la empresa en la vista AR */
.ar-company-brand {
    position: fixed;
    top: calc(12px + var(--safe-top));
    left: calc(12px + var(--safe-left));
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(15, 20, 40, 0.78);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 100;
    max-width: calc(100vw - 150px);
}

.ar-machine-switcher {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--primary-color);
    font-size: 12px;
    font-weight: 700;
    padding: 4px 8px;
    max-width: 155px;
    cursor: pointer;
}

.ar-machine-switcher option {
    background: #14182e;
    color: #ffffff;
}

.ar-machine-switcher.hidden {
    display: none !important;
}

.ar-company-brand.hidden,
.ar-top-actions.hidden,
.ar-login-overlay.hidden,
.admin-fab.hidden,
.ar-login-error.hidden,
#ar-company-logo.hidden {
    display: none !important;
}

#ar-company-logo {
    max-height: 36px;
    max-width: 140px;
    object-fit: contain;
    display: block;
}

#ar-company-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Accesos discretos en la esquina superior derecha */
.ar-top-actions {
    position: fixed;
    top: calc(12px + var(--safe-top));
    right: calc(12px + var(--safe-right));
    display: flex;
    gap: 8px;
    z-index: 100;
}

.admin-fab {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(20, 24, 46, 0.72);
    border: 1px solid var(--border-color);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    text-decoration: none;
    cursor: pointer;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0.8;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.admin-fab:hover {
    opacity: 1;
    transform: scale(1.06);
}

/* Overlay de Login en vista AR */
.ar-login-overlay {
    position: fixed;
    inset: 0;
    background: #060916;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 1500;
    overflow: hidden;
}

.iot-bg-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.ar-login-card {
    position: relative;
    z-index: 2;
    background: rgba(16, 22, 44, 0.86);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1.5px solid var(--border-color);
    border-radius: 16px;
    padding: 28px 24px;
    width: min(380px, 100%);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65), var(--glow);
}

.ar-login-card h2 {
    color: var(--primary-color);
    font-size: 20px;
    margin-bottom: 6px;
}

.ar-login-sub {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 18px;
}

.ar-login-card .form-group {
    margin-bottom: 12px;
}

.ar-login-error {
    color: #fca5a5;
    font-size: 13px;
    margin-bottom: 10px;
}

.ar-face-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.ar-face-frame {
    position: relative;
    width: 210px;
    height: 210px;
    border-radius: 50%;
    overflow: hidden;
    background: #000;
    border: 3px solid var(--primary-color);
    box-shadow: 0 0 24px rgba(0, 212, 255, 0.3);
}

.ar-face-frame.hidden,
#ar-login-form.hidden,
.ar-face-section.hidden {
    display: none !important;
}

.ar-face-frame video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
}

.ar-face-ring {
    position: absolute;
    inset: 6px;
    border-radius: 50%;
    border: 2px dashed rgba(168, 85, 247, 0.8);
    pointer-events: none;
    animation: spin 10s linear infinite;
}

.ar-face-status {
    font-size: 13px;
    color: var(--text-secondary);
    text-align: center;
    min-height: 20px;
}

.ar-link-btn {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 13px;
    cursor: pointer;
    margin-top: 8px;
    display: block;
    width: 100%;
    text-align: center;
}

.ar-link-btn:hover {
    text-decoration: underline;
}

/* Modo Google Cardboard (Side-by-Side AR) */
.cardboard-canvas {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: #000000;
    z-index: 400;
    display: block;
}

.cardboard-canvas.hidden,
.cardboard-exit-btn.hidden {
    display: none !important;
}

.cardboard-exit-btn {
    position: fixed;
    top: calc(10px + var(--safe-top));
    left: 50%;
    transform: translateX(-50%);
    z-index: 450;
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: rgba(15, 20, 40, 0.78);
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    backdrop-filter: blur(8px);
}

body.cardboard-active .ar-company-brand,
body.cardboard-active .ar-top-actions {
    display: none !important;
}

/* En modo Cardboard ocultamos el modal 2D plano (se renderiza duplicado en ambos ojos) */
body.cardboard-active #chart-canvas {
    opacity: 0;
    pointer-events: none;
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, var(--darker-bg) 0%, var(--dark-bg) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity 0.35s ease;
}

.loading-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-content {
    text-align: center;
    padding: 20px;
}

.spinner {
    width: 56px;
    height: 56px;
    border: 4px solid rgba(0, 212, 255, 0.2);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

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

.loading-content p {
    color: var(--text-secondary);
    font-size: 15px;
    letter-spacing: 0.8px;
}

/* HUD Superior */
.ar-controls {
    position: fixed;
    top: calc(12px + var(--safe-top));
    left: calc(12px + var(--safe-left));
    width: min(340px, calc(100vw - 24px - var(--safe-left) - var(--safe-right)));
    background: var(--card-bg);
    border: 1.5px solid var(--border-color);
    border-radius: 14px;
    padding: 12px 14px;
    z-index: 100;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: var(--glow);
}

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

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

.controls-header h2 {
    font-size: 15px;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin: 0;
    white-space: nowrap;
}

.badge {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 3px 7px;
    border-radius: 999px;
    white-space: nowrap;
}

.badge-online {
    background: rgba(74, 222, 128, 0.18);
    color: var(--success-color);
    border: 1px solid rgba(74, 222, 128, 0.45);
}

.badge-offline {
    background: rgba(251, 191, 36, 0.18);
    color: var(--warning-color);
    border: 1px solid rgba(251, 191, 36, 0.45);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-icon {
    background: rgba(0, 212, 255, 0.08);
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--primary-color);
    font-size: 18px;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
}

.machine-selector-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.machine-select {
    flex: 1;
    min-width: 0;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    padding: 6px 10px;
    font-size: 13px;
    font-weight: 600;
}

.machine-select option {
    background: #14182e;
    color: #ffffff;
}

.range-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

.range-buttons {
    display: flex;
    gap: 4px;
}

.range-btn {
    padding: 4px 9px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
}

.range-btn.active,
.range-btn:hover {
    background: rgba(0, 212, 255, 0.22);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.stats-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 11px;
    color: var(--text-secondary);
}

.stats-strip strong {
    color: var(--primary-color);
}

.periph-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
    gap: 10px;
    padding: 4px 0;
}

.periph-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.periph-card.ok { border-left: 4px solid var(--success-color); }
.periph-card.bad { border-left: 4px solid var(--secondary-color); }
.periph-name { font-size: 12px; color: var(--text-secondary); text-transform: uppercase; }
.periph-state { font-size: 14px; font-weight: 700; }
.periph-card.ok .periph-state { color: var(--success-color); }
.periph-card.bad .periph-state { color: var(--secondary-color); }

.info-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 8px;
}

.info-row {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 10px;
}

.info-key { font-size: 11px; color: var(--text-secondary); text-transform: uppercase; }
.info-val { font-size: 14px; color: var(--primary-color); font-weight: 700; margin-top: 3px; word-break: break-all; }

.conn-indicator {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 999px;
}

.conn-indicator.connected {
    color: var(--success-color);
    background: rgba(74, 222, 128, 0.14);
    border: 1px solid rgba(74, 222, 128, 0.45);
}

.conn-indicator.disconnected {
    color: var(--secondary-color);
    background: rgba(255, 107, 107, 0.14);
    border: 1px solid rgba(255, 107, 107, 0.45);
}

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

.conn-indicator.connected .conn-dot {
    background: var(--success-color);
    box-shadow: 0 0 8px var(--success-color);
}

.conn-indicator.disconnected .conn-dot {
    background: var(--secondary-color);
    box-shadow: 0 0 8px var(--secondary-color);
}

.btn-icon:hover {
    background: rgba(0, 212, 255, 0.2);
    border-color: var(--border-color);
    transform: scale(1.06);
}

/* Metrics Panel */
.metrics-panel {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 10px;
}

.metrics-panel.hidden {
    display: none;
}

.metric-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    padding: 8px 10px;
    background: rgba(0, 212, 255, 0.07);
    border: 1px solid rgba(0, 212, 255, 0.16);
    border-left: 3px solid var(--primary-color);
    border-radius: 8px;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease, border-color 0.2s ease;
}

.metric-item:hover,
.metric-item:focus-visible {
    background: rgba(0, 212, 255, 0.16);
    border-color: var(--primary-color);
    transform: translateY(-1px);
    outline: none;
}

.metric-label {
    font-size: 10px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.metric-value {
    font-size: 15px;
    color: var(--primary-color);
    font-weight: 700;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* Barra inferior interactiva de gráficos */
.chart-dock {
    position: fixed;
    left: 50%;
    bottom: calc(14px + var(--safe-bottom));
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px;
    max-width: calc(100vw - 24px - var(--safe-left) - var(--safe-right));
    background: var(--card-bg);
    border: 1.5px solid var(--border-color);
    border-radius: 14px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: var(--glow);
    z-index: 120;
    overflow-x: auto;
    scrollbar-width: none;
}

.chart-dock::-webkit-scrollbar {
    display: none;
}

.dock-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 40px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid transparent;
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dock-btn:hover,
.dock-btn.active {
    background: rgba(0, 212, 255, 0.22);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* Status Info */
.status-info {
    position: fixed;
    top: calc(12px + var(--safe-top));
    right: calc(12px + var(--safe-right));
    padding: 8px 12px;
    background: var(--card-bg);
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: 12px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 100;
    max-width: 240px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Panel interactivo de gráficos Chart.js */
#chart-canvas {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(15, 20, 40, 0.94);
    border: 1.5px solid var(--primary-color);
    border-radius: 16px;
    padding: 16px;
    width: min(94vw, 680px);
    max-height: 80dvh;
    display: none;
    flex-direction: column;
    gap: 12px;
    z-index: 500;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.65), var(--glow);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    animation: scaleIn 0.22s ease;
}

#chart-canvas.visible {
    display: flex;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.chart-title-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.chart-title-wrap h3 {
    color: var(--primary-color);
    font-size: 16px;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chart-live-value {
    font-size: 13px;
    font-weight: 700;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    color: var(--success-color);
    background: rgba(74, 222, 128, 0.12);
    border: 1px solid rgba(74, 222, 128, 0.35);
    padding: 2px 8px;
    border-radius: 999px;
    white-space: nowrap;
}

.chart-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.chart-action-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 8px;
    color: var(--text-primary);
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chart-action-btn:hover,
.chart-action-btn.active {
    background: rgba(0, 212, 255, 0.2);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

#chart-canvas-close {
    background: rgba(255, 107, 107, 0.14);
    border: 1px solid rgba(255, 107, 107, 0.4);
    border-radius: 8px;
    color: #ff8585;
    width: 32px;
    height: 32px;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

#chart-canvas-close:hover {
    background: rgba(255, 107, 107, 0.3);
    color: #ffffff;
}

.chart-tabs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 2px;
}

.chart-tabs::-webkit-scrollbar {
    display: none;
}

.chart-tab {
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.chart-tab:hover,
.chart-tab.active {
    background: rgba(0, 212, 255, 0.2);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.chart-body {
    position: relative;
    width: 100%;
    height: clamp(210px, 38dvh, 360px);
}

/* Modal de configuración */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 2000;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--card-solid);
    border: 1.5px solid var(--primary-color);
    border-radius: 14px;
    padding: 22px;
    width: min(420px, 100%);
    max-height: 90dvh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 212, 255, 0.22);
    animation: slideUp 0.25s ease;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes scaleIn {
    from { opacity: 0; transform: translate(-50%, -48%) scale(0.95); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

.modal-header h3 {
    font-size: 18px;
    color: var(--primary-color);
    margin: 0;
}

.btn-close {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 26px;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
}

.btn-close:hover {
    color: var(--primary-color);
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.form-input {
    padding: 11px 12px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--primary-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 15px;
    width: 100%;
}

.form-input:focus {
    outline: none;
    background: rgba(0, 212, 255, 0.1);
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.3);
}

.btn {
    padding: 12px 18px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 700;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--brand-gradient);
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 26px rgba(168, 85, 247, 0.35), 0 0 18px rgba(0, 212, 255, 0.25);
}

/* Responsive: Móviles */
@media (max-width: 640px) {
    .ar-controls {
        padding: 10px 12px;
    }

    .controls-header h2 {
        font-size: 14px;
    }

    .status-info {
        top: auto;
        right: auto;
        left: 50%;
        bottom: calc(68px + var(--safe-bottom));
        transform: translateX(-50%);
        font-size: 11px;
        padding: 6px 12px;
        max-width: calc(100vw - 24px);
    }

    .dock-btn {
        padding: 8px 10px;
        font-size: 12px;
    }

    #chart-canvas {
        padding: 14px;
        max-height: 76dvh;
    }

    .chart-body {
        height: clamp(190px, 34dvh, 280px);
    }
}

/* Responsive: Móviles muy angostos */
@media (max-width: 390px) {
    .dock-btn span {
        display: none;
    }

    .dock-btn {
        min-width: 44px;
        font-size: 16px;
    }
}

/* Responsive: Horizontal en móviles (landscape) */
@media (max-height: 500px) and (orientation: landscape) {
    .ar-controls {
        width: min(280px, 44vw);
        padding: 8px 10px;
    }

    .metrics-panel {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
        margin-top: 6px;
    }

    .metric-item {
        padding: 5px 8px;
    }

    .metric-value {
        font-size: 13px;
    }

    .status-info {
        top: calc(10px + var(--safe-top));
        right: calc(10px + var(--safe-right));
        bottom: auto;
        left: auto;
        transform: none;
    }

    #chart-canvas {
        max-height: 86dvh;
        padding: 12px;
    }

    .chart-body {
        height: 44dvh;
    }
}
