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

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: #0a0e17;
    color: #e0e0e0;
    padding: 20px;
}

.container { max-width: 1400px; margin: 0 auto; }

.mode-banner {
    padding: 8px 16px;
    border-radius: 8px;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 15px;
    display: none;
}
.mode-banner.demo { background: linear-gradient(90deg, #f59e0b, #f97316); color: white; display: block; }
.mode-banner.live { background: linear-gradient(90deg, #22c55e, #10b981); color: white; display: block; }

.header {
    display: flex; justify-content: space-between; align-items: center;
    flex-wrap: wrap; gap: 15px; margin-bottom: 20px;
    padding-bottom: 15px; border-bottom: 1px solid #2a2e3d;
}
.logo h1 {
    font-size: 24px;
    background: linear-gradient(135deg, #4facfe, #00f2fe);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.logo p { font-size: 12px; color: #6a6f7a; margin-top: 4px; }

.connection-status {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 15px; background: #1a1e2a;
    border-radius: 8px; margin-bottom: 20px; flex-wrap: wrap;
}
.status-led { width: 10px; height: 10px; border-radius: 50%; background: #6a6f7a; flex-shrink: 0; }
.status-led.connected { background: #22c55e; box-shadow: 0 0 5px #22c55e; }

.btn {
    padding: 8px 16px; border-radius: 8px; border: none;
    cursor: pointer; font-size: 13px; font-weight: 500;
    transition: all 0.2s; background: #2c3e66; color: white;
}
.btn-primary { background: #4facfe; color: white; }
.btn-primary:hover:not(:disabled) { background: #3a8ed9; }
.btn-danger { background: #dc2626; color: white; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }
.btn-outline { background: transparent; border: 1px solid #2a2e3d; color: #e0e0e0; }
.btn-outline:hover:not(:disabled) { background: #1a1e2a; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

.tabs {
    display: flex; gap: 5px; margin-bottom: 20px;
    border-bottom: 1px solid #1e2532; overflow-x: auto; flex-wrap: nowrap;
}
.tab {
    padding: 10px 16px; cursor: pointer; background: none;
    border: none; color: #6a6f7a; font-size: 13px;
    white-space: nowrap; transition: color 0.2s;
}
.tab:hover { color: #e0e0e0; }
.tab.active { color: #4facfe; border-bottom: 2px solid #4facfe; }
.tab-content { display: none; }
.tab-content.active { display: block; }

.card {
    background: #11161f; border-radius: 16px;
    border: 1px solid #1e2532; overflow: hidden; margin-bottom: 20px;
}
.card-header {
    padding: 15px 20px; background: #0d121b;
    border-bottom: 1px solid #1e2532; font-weight: 600;
    display: flex; justify-content: space-between; align-items: center;
    flex-wrap: wrap; gap: 10px;
}
.card-body { padding: 20px; }

/* Live params grid v2 */
.params-grid-v2 {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}
.param-card-v2 {
    background: #1a1e2a; border-radius: 10px; padding: 14px;
    border-left: 3px solid #4facfe; transition: all 0.2s;
}
.param-header {
    display: flex; align-items: center; gap: 6px; margin-bottom: 8px;
}
.param-icon { font-size: 14px; }
.param-name-v2 { font-size: 12px; color: #9ca3af; }
.param-value-v2 { font-family: monospace; font-size: 22px; font-weight: bold; }
.param-unit-v2 { font-size: 12px; color: #6a6f7a; font-weight: normal; }

/* Chart */
.chart-wrapper {
    background: #0a0e17; border-radius: 8px; padding: 15px;
    height: 400px; position: relative;
}
.chart-select {
    width: 100%; max-width: 400px; padding: 10px;
    background: #1a1e2a; border: 1px solid #2a2e3d;
    border-radius: 8px; color: #e0e0e0; font-size: 14px; margin-bottom: 15px;
}

/* DTC items */
.dtc-item {
    background: #1a1e2a; border-left: 3px solid #ef4444;
    padding: 12px; margin-bottom: 10px; border-radius: 8px;
}
.dtc-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 6px;
}
.dtc-code { font-family: monospace; font-weight: bold; font-size: 16px; }
.dtc-system {
    font-size: 10px; padding: 3px 8px; background: #2a2e3d;
    border-radius: 4px; text-transform: uppercase; color: #9ca3af;
}
.dtc-desc { font-size: 13px; color: #d1d5db; }

/* Freeze Frame */
.ff-trigger {
    background: linear-gradient(90deg, #1e293b, #0f172a);
    padding: 12px; border-radius: 8px; margin-bottom: 15px;
    border-left: 3px solid #4facfe;
}
.ff-table { width: 100%; border-collapse: collapse; }
.ff-table td {
    padding: 10px; border-bottom: 1px solid #1e2532;
}
.ff-table td:first-child { color: #9ca3af; font-size: 13px; }
.ff-val { font-family: monospace; font-weight: bold; text-align: right; color: #4facfe; }

/* Readiness */
.readiness-header {
    display: flex; gap: 30px; padding: 15px;
    background: #1a1e2a; border-radius: 8px; margin-bottom: 15px;
    flex-wrap: wrap;
}
.monitors-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
}
.monitor-item {
    background: #1a1e2a; padding: 10px 12px; border-radius: 8px;
    border-left: 3px solid #6a6f7a; font-size: 13px;
}
.monitor-item > div:first-child { margin-bottom: 4px; color: #d1d5db; }

/* Info tables */
.info-table { width: 100%; border-collapse: collapse; }
.info-table td {
    padding: 10px; border-bottom: 1px solid #1e2532; font-size: 14px;
}
.info-table td:first-child { color: #9ca3af; width: 40%; }

.vin-input {
    padding: 10px 12px; background: #1a1e2a; border: 1px solid #2a2e3d;
    border-radius: 8px; color: #e0e0e0; font-family: monospace;
    flex: 1; min-width: 200px;
}

/* PID list v2 */
.category-tabs {
    display: flex; gap: 6px; margin-bottom: 15px;
    flex-wrap: wrap; padding-bottom: 12px; border-bottom: 1px solid #1e2532;
}
.cat-btn {
    padding: 6px 12px; background: #1a1e2a; border: 1px solid #2a2e3d;
    border-radius: 16px; color: #9ca3af; font-size: 12px;
    cursor: pointer; transition: all 0.2s;
}
.cat-btn:hover { background: #22283a; color: #e0e0e0; }
.cat-btn.active { background: #4facfe; color: white; border-color: #4facfe; }

.pid-list-v2 {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 8px; max-height: 500px; overflow-y: auto;
}
.pid-item {
    display: flex; align-items: center; gap: 10px; padding: 10px;
    background: #1a1e2a; border-radius: 8px; cursor: pointer;
    transition: all 0.2s;
}
.pid-item:hover { background: #22283a; }
.pid-item input { cursor: pointer; }

/* Logs */
.log-container {
    background: #0a0e17; border-radius: 8px; padding: 10px;
    font-family: monospace; font-size: 11px; height: 300px; overflow-y: auto;
}
.log-entry { padding: 4px 0; border-bottom: 1px solid #1e2532; color: #6a6f7a; }

/* Toast */
.alert-toast {
    position: fixed; bottom: 20px; right: 20px;
    color: white; padding: 12px 18px; border-radius: 8px;
    z-index: 1000; animation: slideIn 0.3s ease;
    max-width: 320px; font-size: 13px; font-weight: 500;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.alert-toast.success { background: #22c55e; }
.alert-toast.warning { background: #f59e0b; }
.alert-toast.info { background: #4facfe; }
@keyframes slideIn { from { transform: translateX(400px); } to { transform: translateX(0); } }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #0a0e17; }
::-webkit-scrollbar-thumb { background: #2a2e3d; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #3a4052; }

/* Mobile */
@media (max-width: 768px) {
    body { padding: 10px; }
    .header { flex-direction: column; align-items: stretch; }
    .params-grid-v2 { grid-template-columns: 1fr 1fr; }
    .btn { padding: 6px 12px; font-size: 12px; }
    .btn-group { flex-wrap: wrap; }
    .chart-wrapper { height: 280px; }
    .vin-input { min-width: 0; }
}
@media (max-width: 480px) {
    .params-grid-v2 { grid-template-columns: 1fr; }
    .pid-list-v2 { grid-template-columns: 1fr; }
}
