:root {
    --guinda: #6B1020;
    --guinda-mid: #7d1326;
    --gold: #C8A951;
    --bg-light: #fafafa;
    --border: #e0e0e0;
    --text: #111;
    --text-dim: #666;
    --font-mono: 'IBM Plex Mono', monospace;
    --font-body: 'Inter', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
html, body {
    height: 100%;
    font-family: var(--font-body);
    background: var(--bg-light);
    color: var(--text);
    overflow: hidden;
}
#app {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* ===== TOPBAR ===== */
.topbar {
    background: white;
    border-bottom: 1px solid var(--border);
    padding: 8px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    flex-shrink: 0;
}
.brand-proj {
    font-weight: 600;
    font-size: 1rem;
}
.status-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #f0f0f0;
    padding: 4px 12px;
    border-radius: 40px;
    font-size: 0.7rem;
}
.sdot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
}

/* ===== WORKSPACE ===== */
.workspace {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: 220px;
    background: white;
    border-right: 1px solid var(--border);
    overflow-y: auto;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}
.nav-section {
    padding: 12px 16px 6px;
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-dim);
    letter-spacing: 1px;
}
.nav-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 16px;
    background: none;
    border: none;
    font-size: 0.85rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-dim);
    border-left: 3px solid transparent;
}
.nav-btn.active {
    background: var(--guinda);
    color: white;
    border-left-color: var(--gold);
}
.nav-btn .nav-icon {
    font-size: 1.1rem;
}
.progress-list {
    padding: 0 16px 16px;
}
.progress-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 6px 0;
    font-size: 0.8rem;
}
.progress-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ccc;
    flex-shrink: 0;
}
.progress-dot.done { background: #22c55e; }
.progress-dot.active { background: var(--guinda); box-shadow: 0 0 0 2px var(--gold); }

/* ===== MAIN PANEL ===== */
.main-panel {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
}
.sec-heading {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}
.sec-bar {
    width: 4px;
    height: 28px;
    background: var(--guinda);
    border-radius: 2px;
    flex-shrink: 0;
}
.sec-title {
    font-size: 1.3rem;
    font-weight: 600;
}
.sec-sub {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-left: auto;
    white-space: nowrap;
}

/* ===== ENSAMBLAJE ===== */
.paso-card {
    background: white;
    border-radius: 12px;
    border: 1px solid var(--border);
    margin-bottom: 24px;
    overflow: hidden;
}
.paso-header {
    background: #f9f9f9;
    padding: 12px 16px;
    font-weight: 600;
    border-bottom: 1px solid var(--border);
    font-size: 1rem;
}
.paso-video {
    width: 100%;
    max-width: 100%;
    display: block;
    background: #000;
}
.paso-controls {
    padding: 12px 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}
.btn-verify {
    background: var(--guinda);
    color: white;
    border: none;
    padding: 8px 18px;
    border-radius: 30px;
    cursor: pointer;
    font-weight: 500;
    transition: 0.2s;
    font-size: 0.9rem;
}
.btn-verify:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.verify-result {
    font-size: 0.85rem;
    margin-left: auto;
    font-weight: 500;
}

/* ===== CÓDIGO ARDUINO ===== */
.info-card {
    background: white;
    border-radius: 12px;
    padding: 16px 20px;
    border: 1px solid var(--border);
    margin-bottom: 16px;
}
.info-card p {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-dim);
}
.btn-download {
    background: var(--gold);
    border: none;
    padding: 8px 20px;
    border-radius: 30px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.9rem;
    margin-top: 8px;
}
.code-block {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 12px;
    border-radius: 12px;
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    margin: 16px 0;
    max-height: 300px;
    overflow-y: auto;
}
.code-block pre {
    white-space: pre-wrap;
    word-break: break-all;
}

/* ===== CONTROL REMOTO ===== */
.remote-url-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    background: white;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid var(--border);
    margin-bottom: 20px;
}
.remote-url-group label {
    font-weight: 500;
    font-size: 0.9rem;
}
.remote-input {
    flex: 1;
    min-width: 180px;
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 30px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
}
.btn-primary {
    background: var(--guinda);
    color: white;
    border: none;
    padding: 8px 18px;
    border-radius: 30px;
    cursor: pointer;
    font-weight: 500;
}
.btn-secondary {
    background: #ccc;
    border: none;
    padding: 8px 18px;
    border-radius: 30px;
    cursor: pointer;
    font-weight: 500;
}

.model3d-container {
    height: 260px;
    background: #f5f5f5;
    border-radius: 16px;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border);
}
model-viewer {
    width: 100%;
    height: 100%;
}
.model-tip {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: rgba(0,0,0,0.6);
    color: white;
    font-size: 0.7rem;
    padding: 4px 12px;
    border-radius: 20px;
    pointer-events: none;
}
.sliders-panel {
    background: white;
    border-radius: 16px;
    padding: 16px;
    border: 1px solid var(--border);
}
.sliders-panel h3 {
    font-size: 1.1rem;
    margin-bottom: 12px;
}
.slider-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}
.slider-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.slider-item label {
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    justify-content: space-between;
}
.slider-item input[type="range"] {
    width: 100%;
    margin: 4px 0;
}
.telem-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
}
.telem-chip {
    background: white;
    border-radius: 12px;
    padding: 10px 14px;
    flex: 1;
    min-width: 100px;
    border: 1px solid var(--border);
}
.tc-label {
    font-size: 0.7rem;
    color: var(--text-dim);
}
.tc-val {
    font-weight: 600;
    font-size: 1rem;
}

/* ===== FOOTER ===== */
.footer {
    border-top: 1px solid var(--border);
    padding: 6px 16px;
    background: white;
    font-size: 0.65rem;
    display: flex;
    justify-content: space-between;
    flex-shrink: 0;
}
.log-txt {
    color: var(--text-dim);
}
.log-txt.ok { color: #16a34a; }
.log-txt.err { color: #dc2626; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .topbar { padding: 6px 12px; }
    .brand-proj { font-size: 0.85rem; }
    .status-pill { font-size: 0.6rem; padding: 2px 10px; }
    .sidebar {
        width: 180px;
        transform: translateX(0);
    }
    .main-panel { padding: 12px; }
    .sec-title { font-size: 1.1rem; }
    .sec-sub { font-size: 0.7rem; }
    .paso-header { font-size: 0.9rem; }
    .paso-controls { flex-direction: column; align-items: stretch; }
    .btn-verify, .btn-download { width: 100%; text-align: center; }
    .remote-url-group { flex-direction: column; align-items: stretch; }
    .remote-input { min-width: unset; }
    .model3d-container { height: 200px; }
    .slider-grid { grid-template-columns: 1fr; }
    .telem-chip { min-width: 80px; padding: 8px 10px; }
}

@media (max-width: 480px) {
    .sidebar {
        width: 150px;
    }
    .nav-btn {
        padding: 8px 12px;
        font-size: 0.75rem;
    }
    .nav-icon { font-size: 0.9rem; }
    .sec-title { font-size: 1rem; }
    .main-panel { padding: 8px; }
    .paso-video { max-height: 200px; object-fit: cover; }
    .model3d-container { height: 160px; }
}