:root {
    --primary: #0984E3;
    --primary-hover: #076BBB;
    --secondary: #F39C12;
    --accent: #2ECC71;
    --danger: #FF7675;

    --bg-main: #0F0F1A;
    --bg-panel: #1A1A2E;
    --bg-hover: #24243D;

    --text-main: #E2E8F0;
    --text-muted: #94A3B8;
    --border: #2D2D4A;

    --radius: 12px;
    --font: 'Inter', system-ui, sans-serif;
}

[data-theme="light"] {
    --bg-main: #F8F9FA;
    --bg-panel: #FFFFFF;
    --bg-hover: #E9ECEF;

    --text-main: #2D3436;
    --text-muted: #636E72;
    --border: #DFE6E9;
}

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

body {
    font-family: var(--font);
    background: var(--bg-main);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    transition: background-color 0.3s, color 0.3s;
}

.text-primary {
    color: var(--primary);
}

.text-danger {
    color: var(--danger);
}

.text-success {
    color: var(--accent);
}

.text-accent {
    color: var(--secondary);
}

/* Buttons */
.btn {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: none;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--primary);
    color: #FFF;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-hover);
    color: var(--text-main);
    border: 1px solid var(--border);
}

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

.btn-icon {
    background: transparent;
    color: var(--text-muted);
    border: none;
    padding: 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.2s;
}

.btn-icon:hover {
    color: var(--primary);
    background: var(--bg-hover);
}

/* Navbar */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.icon-pln {
    width: 28px;
    height: 28px;
    color: var(--secondary);
}

.logo h1 {
    font-size: 1.25rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Layout */
.app-container {
    display: flex;
    flex: 1;
    overflow: hidden;
    padding: 1.5rem;
    gap: 1.5rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

@media (max-width: 900px) {
    .app-container {
        flex-direction: column;
        overflow-y: auto;
    }

    aside.sidebar {
        max-width: 100%;
        flex: none;
    }

    main.main-content {
        overflow-y: visible;
    }
}

/* Sidebar */
.sidebar {
    width: 350px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

/* Cards & Forms */
.card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
}

.card h2 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--text-main);
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.flex-between h2 {
    margin: 0;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

input,
select {
    background: var(--bg-main);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.75rem;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: 0.2s;
}

input:focus,
select:focus {
    border-color: var(--primary);
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Equipment List */
.equipment-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.appliance-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
}

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

.app-name {
    font-weight: 600;
}

.app-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.app-kwh {
    font-weight: 700;
    color: var(--accent);
    white-space: nowrap;
}

.btn-del {
    color: var(--danger);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    font-size: 1rem;
    opacity: 0.7;
}

.btn-del:hover {
    opacity: 1;
}

.summary-box {
    background: var(--bg-hover);
    padding: 1rem;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    border-left: 3px solid var(--secondary);
}

.summary-box span {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.summary-box strong {
    font-size: 1.4rem;
    margin: 0.25rem 0;
}

.sub-text {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Main Content */
.main-content {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding-right: 0.5rem;
}

.main-content::-webkit-scrollbar {
    width: 6px;
}

.main-content::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

/* Calculator Hero */
.calculator-hero {
    text-align: center;
}

.nominal-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.pill {
    background: var(--bg-main);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

.pill:hover {
    border-color: var(--primary);
}

.pill.active {
    background: var(--primary);
    color: #FFF;
    border-color: var(--primary);
}

.inline-nominal {
    max-width: 300px;
    margin: 0 auto 2rem auto;
    text-align: left;
}

.result-display {
    display: flex;
    gap: 2rem;
    align-items: stretch;
    justify-content: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.result-circle {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    border: 4px solid var(--primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-main);
    box-shadow: 0 0 20px rgba(9, 132, 227, 0.1);
}

.result-circle .label {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.result-circle .kwh-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.1;
    margin: 0.25rem 0;
}

.result-circle .unit {
    font-size: 1rem;
    color: var(--primary);
    font-weight: 600;
}

.breakdown {
    flex: 1;
    min-width: 250px;
    background: var(--bg-hover);
    padding: 1.5rem;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.75rem;
    text-align: left;
}

.b-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.95rem;
    font-weight: 500;
}

.b-row span:last-child {
    font-family: monospace;
    font-size: 1rem;
}

.b-divider {
    height: 1px;
    background: var(--border);
    margin: 0.5rem 0;
}

.b-row.info {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.projection-banner {
    background: rgba(9, 132, 227, 0.1);
    border: 1px solid rgba(9, 132, 227, 0.2);
    padding: 1.5rem;
    border-radius: 8px;
    font-size: 0.95rem;
}

.days-left {
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 0.5rem;
}

.mt-1 {
    margin-top: 1rem;
}

.mb-1 {
    margin-bottom: 1rem;
}

.full-width {
    width: 100%;
}

/* History */
.history-section {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.chart-container {
    height: 250px;
    width: 100%;
    margin-bottom: 1.5rem;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-main);
}

.h-date {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.h-amount {
    font-weight: 600;
}

.h-kwh {
    color: var(--primary);
    font-weight: 700;
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 100%;
    max-width: 450px;
    padding: 2rem;
}

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

.btn-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
}

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

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}