:root {
    --bg: #0d1117; --card-bg: #161b22; --border: #30363d;
    --text-dim: #8b949e; --cyan: #58a6ff; --green: #3fb950;
    --orange: #d29922; --purple: #bc8cff;
}

body { background: var(--bg); color: white; font-family: 'Segoe UI', sans-serif; margin: 0; overflow-x: hidden; overflow-y: auto; padding-bottom: 100px; }
#main-content { padding: 0 15px; }

.top-header { padding: 15px 20px; display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; background: var(--bg); z-index: 1000; }
#connectBtn { background: var(--cyan); border: none; color: white; padding: 8px 16px; border-radius: 8px; font-weight: bold; cursor: pointer; position: relative; z-index: 1001; }

/* Dashboard Gauge */
.main-speed { text-align: center; padding: 15px 0; display: flex; flex-direction: column; align-items: center; }
.speed-circle {
    width: 210px; height: 210px; border-radius: 50%;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    background: radial-gradient(var(--card-bg) 64%, transparent 66%), conic-gradient(from 180deg, var(--cyan) var(--deg, 0deg), #21262d 0deg);
    position: relative; transition: --deg 0.3s ease-out; 
}
.glow-ball { position: absolute; width: 12px; height: 12px; background: #fff; border-radius: 50%; box-shadow: 0 0 15px 5px var(--cyan); z-index: 10; top: 50%; left: 50%; display: none; }

/* Font Spedometer (Optimal untuk 3 Digit) */
.speed-circle h2 { font-size: 85px; margin: 0; line-height: 1; font-weight: bold; }
.speed-circle .unit-label { font-size: 11px; color: var(--text-dim); letter-spacing: 1px; }
.rpm-display { font-size: 18px; font-weight: bold; margin-top: 2px; color: white; }

.mode-badge { display: inline-block; background: #238636; padding: 6px 22px; border-radius: 20px; margin: 15px 0; font-weight: bold; text-transform: uppercase; font-size: 14px; }

/* Layout Mendatar untuk Kartu */
.info-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin-bottom: 12px; }
.mini { display: flex; flex-direction: column; align-items: center; text-align: center; }
.label { font-size: 10px; color: var(--text-dim); text-transform: uppercase; margin-bottom: 5px; }

/* Perbaikan Data Tidak Nempel & Mendatar */
.stats-row { display: flex; justify-content: space-around; align-items: center; gap: 5px; width: 100%; }
.stat-box { flex: 1; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 5px; }
.stat-box small { font-size: 9px; color: var(--text-dim); text-transform: uppercase; }
.stat-box b { font-size: 13px; color: #fff; display: block; }

.temp-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 5px; border-top: 1px solid var(--border); padding-top: 12px; }

/* Battery Progress */
.soc-bar-container { background: #21262d; height: 10px; border-radius: 5px; margin-bottom: 15px; overflow: hidden; width: 100%; }
.soc-fill { height: 100%; background: var(--green); width: 0%; transition: 0.5s; }

/* Cells Grid */
.cell-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 10px; }
.cell-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px 5px; text-align: center; }
.cell-id { font-size: 9px; color: var(--text-dim); margin-bottom: 3px; display: block; }

.bottom-nav { position: fixed; bottom: 0; width: 100%; height: 75px; background: #161b22; display: flex; justify-content: space-around; align-items: center; border-top: 1px solid var(--border); z-index: 2000; }
.nav-item { color: var(--text-dim); cursor: pointer; transition: 0.3s; padding: 10px; }
.nav-item.active { color: var(--cyan); transform: scale(1.1); }

/* --- Tambahkan Bagian Ini di style.css --- */

.history-card {
    overflow: hidden; /* Mencegah elemen di dalam keluar dari batas kartu */
}

.chart-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    height: 120px;
    margin-top: 15px;
    width: 100%; /* Memastikan baris grafik tidak lebih lebar dari kartu */
}

.chart-wrapper {
    flex: 1;
    position: relative;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 5px;
    min-width: 0; /* Penting agar flexbox tidak melebar tanpa batas */
}

.chart-tag {
    position: absolute;
    top: 2px;
    left: 5px;
    font-size: 8px;
    font-weight: bold;
    z-index: 5;
    pointer-events: none;
}

canvas {
    width: 100% !important;
    height: 100% !important;
}

/* Update atau Tambahkan Bagian Ini di style.css */

.cell-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* Tampilan 2 kolom untuk HP agar lega */
    gap: 8px;
}

.cell-card {
    background: var(--card-bg);
    border: 1px solid #30363d;
    padding: 8px 10px;
    border-radius: 8px;
}

/* Styling Bar Per Cell */
.cell-bar-bg {
    width: 100%;
    height: 6px;
    background: #21262d;
    border-radius: 3px;
    margin-top: 5px;
    overflow: hidden;
}

.cell-bar-fill {
    height: 100%;
    width: 0%;
    background: #3fb950;
    transition: width 0.5s ease, background-color 0.3s ease;
}

.cell-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2px;
}

hr {
    border: 0;
    border-top: 1px solid #30363d;
    margin: 10px 0;
}