/* ========== VARIABEL WARNA ========== */
:root {
    --bg: #0f172a;
    --bg-card: #1e293b;
    --bg-input: #0f172a;
    --border: #334155;
    --text: #e2e8f0;
    --text-secondary: #94a3b8;
    --primary: #38bdf8;
    --header-bg: #1e293b;
    --shadow: rgba(0,0,0,0.5);
}

.light {
    --bg: #f1f5f9;
    --bg-card: #ffffff;
    --bg-input: #e2e8f0;
    --border: #cbd5e1;
    --text: #1e293b;
    --text-secondary: #475569;
    --primary: #0ea5e9;
    --header-bg: #ffffff;
    --shadow: rgba(0,0,0,0.1);
}

/* ========== RESET ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

/* ========== LOGIN PAGE ========== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg) 0%, var(--bg-card) 100%);
    min-height: 100vh;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 400px;
}

.login-card {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 30px 20px;
    box-shadow: 0 20px 40px var(--shadow);
    border: 1px solid var(--border);
    text-align: center;
}

.logo {
    margin-bottom: 25px;
}

.logo-icon {
    font-size: 40px;
    display: block;
    margin-bottom: 8px;
}

.logo h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -1px;
}

.logo p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 5px;
}

.alert {
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-size: 13px;
}

.alert-error {
    background: #7f1d1d;
    color: #fca5a5;
    border: 1px solid #b91c1c;
}

.alert-success {
    background: #14532d;
    color: #86efac;
    border: 1px solid #22c55e;
}

.form-group {
    margin-bottom: 18px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-secondary);
}

.form-group input {
    width: 100%;
    padding: 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-size: 15px;
    outline: none;
    transition: border 0.3s;
}

.form-group input:focus {
    border-color: var(--primary);
}

/* ========== BUTTON ========== */
.btn {
    display: inline-block;
    padding: 10px 18px;
    border-radius: 10px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: none;
    font-size: 14px;
    transition: all 0.3s;
    font-family: 'Poppins', sans-serif;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: #0f172a;
}

.btn-primary:hover {
    opacity: 0.9;
}

.btn-block {
    width: 100%;
    padding: 14px;
    font-size: 15px;
    margin-top: 10px;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-outline:hover {
    background: var(--border);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* ========== HEADER ========== */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: var(--header-bg);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    flex-wrap: wrap;
    gap: 10px;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-brand h1 {
    font-size: 18px;
    color: var(--primary);
    white-space: nowrap;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* ========== CONTAINER ========== */
.container {
    max-width: 900px;
    margin: 20px auto;
    padding: 0 15px;
}

/* ========== INPUT TRANSAKSI ========== */
.chat-input-section {
    background: var(--bg-card);
    padding: 20px 15px;
    border-radius: 20px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
    box-shadow: 0 4px 12px var(--shadow);
}

.chat-form {
    display: flex;
    gap: 10px;
}

.chat-form input {
    flex: 1;
    padding: 14px 16px;
    background: var(--bg-input);
    border: 2px solid var(--border);
    border-radius: 14px;
    color: var(--text);
    font-size: 16px;
    outline: none;
    font-family: 'Poppins', sans-serif;
    transition: border 0.3s;
}

.chat-form input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

.btn-send {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    background: var(--primary);
    color: #0f172a;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.btn-send:hover {
    transform: scale(1.05);
}

.hint {
    margin-top: 10px;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.hint code {
    background: var(--border);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 12px;
    color: #facc15;
}

/* ========== FILTER BAR ========== */
.filter-bar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 16px;
}

.filter-bar input[type="month"] {
    padding: 8px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-size: 14px;
    font-family: 'Poppins', sans-serif;
    outline: none;
    max-width: 160px;
}

/* ========== CARDS ========== */
.cards {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.card {
    flex: 1;
    background: var(--bg-card);
    border-radius: 18px;
    padding: 18px 14px;
    border: 1px solid var(--border);
    transition: transform 0.2s;
    min-width: 0;
}

.card:hover {
    transform: translateY(-2px);
}

.card-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    white-space: nowrap;
}

.card-value {
    font-size: 18px;
    font-weight: 700;
    word-break: break-all;
}

.card-income .card-value { color: #4ade80; }
.card-expense .card-value { color: #f87171; }
.card-balance .card-value { color: var(--primary); }

/* ========== PROGRESS ========== */
.progress-section {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 14px 16px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
}

.progress-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.progress-bar {
    width: 100%;
    height: 10px;
    background: var(--border);
    border-radius: 5px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #818cf8);
    border-radius: 5px;
    transition: width 0.5s ease;
}

/* ========== TABEL & WRAPPER ========== */
.table-section h2 {
    margin-bottom: 12px;
    font-size: 18px;
    font-weight: 600;
}

.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 16px;
    border: 1px solid var(--border);
}

table {
    width: 100%;
    min-width: 750px;
    border-collapse: collapse;
    background: var(--bg-card);
}

th {
    background: var(--border);
    padding: 12px 10px;
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.3px;
    color: var(--text-secondary);
    text-align: center;
    white-space: nowrap;
}

td {
    padding: 12px 10px;
    text-align: center;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: rgba(0,0,0,0.05);
}

.text-income {
    color: #4ade80;
    font-weight: 600;
}

.text-expense {
    color: #f87171;
    font-weight: 600;
}

.empty {
    color: var(--text-secondary);
    padding: 25px;
    font-size: 14px;
}

.action-cell {
    display: flex;
    gap: 6px;
    justify-content: center;
    align-items: center;
}

.btn-edit,
.btn-delete {
    background: var(--border);
    color: var(--text);
    border-radius: 6px;
    text-decoration: none;
    padding: 6px 10px;
    font-size: 13px;
}

.btn-edit:hover {
    opacity: 0.8;
}

.btn-delete:hover {
    background: #7f1d1d;
    color: #fca5a5;
}

.btn-batal {
    background: var(--border);
    color: var(--text);
    margin-left: 8px;
}

/* ========== FORM EDIT & SETTINGS ========== */
.small-container {
    max-width: 600px;
    margin: 30px auto;
    background: var(--bg-card);
    padding: 20px 15px;
    border-radius: 16px;
    border: 1px solid var(--border);
}

.small-container h1 {
    margin-bottom: 18px;
    font-size: 22px;
}

.form-edit label,
.small-container label {
    display: block;
    margin: 10px 0 4px;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-secondary);
}

.form-edit input,
.form-edit select,
.small-container input,
.small-container select {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
    outline: none;
    font-family: 'Poppins', sans-serif;
}

.form-edit select,
.small-container select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.form-actions {
    margin-top: 18px;
    display: flex;
    align-items: center;
}

/* Settings Grid */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.preview-logo {
    width: 70px;
    height: 70px;
    border-radius: 16px;
    object-fit: cover;
    border: 2px solid var(--border);
    margin: 8px 0;
}

/* ========== CHARTS ========== */
.chart-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 15px;
    margin-bottom: 20px;
    height: 300px;
}

h2 {
    margin: 18px 0 8px;
    font-size: 16px;
}

/* ========== MOBILE RESPONSIVE ========== */
@media (max-width: 600px) {
    .main-header {
        flex-direction: column;
        align-items: flex-start;
        padding: 10px 15px;
    }

    .header-actions {
        width: 100%;
        justify-content: space-between;
    }

    .cards {
        flex-direction: column;
    }

    .card {
        padding: 14px;
    }

    .card-value {
        font-size: 20px;
    }

    .chat-input-section {
        padding: 15px 12px;
    }

    .chat-form input {
        font-size: 15px;
        padding: 12px 14px;
    }

    .btn-send {
        width: 44px;
        height: 44px;
        border-radius: 12px;
        font-size: 18px;
    }

    .filter-bar {
        justify-content: flex-start;
    }

    /* Tabel: sembunyikan kolom Jumlah, Kategori, Sumber, Deskripsi, Aksi */
    .table-wrapper {
        border-radius: 12px;
    }

    table {
        min-width: 750px;
    }

    th:nth-child(3),
    th:nth-child(4),
    th:nth-child(5),
    th:nth-child(6),
    th:nth-child(7) {
        display: none;
    }

    td {
        padding: 10px 8px;
        font-size: 13px;
    }

    .action-cell {
        display: flex;
        gap: 6px;
        align-items: center;
    }

    .btn-edit,
    .btn-delete {
        padding: 6px 10px;
        font-size: 12px;
        white-space: nowrap;
    }

    .settings-grid {
        grid-template-columns: 1fr;
    }

    .small-container {
        margin: 15px;
        padding: 15px;
    }

    .btn-sm {
        padding: 5px 10px;
        font-size: 11px;
    }

    .header-brand h1 {
        font-size: 16px;
    }
}

@media (max-width: 380px) {
    .chat-form input {
        font-size: 14px;
    }

    .card-value {
        font-size: 16px;
    }

    .btn {
        font-size: 12px;
        padding: 8px 14px;
    }
}