:root {
    --bg-color: #0f172a;
    --sidebar-bg: rgba(30, 41, 59, 0.7);
    --card-bg: rgba(30, 41, 59, 0.6);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --positive: #10b981;
    --negative: #ef4444;
    --warning: #f59e0b;
    --border: rgba(255, 255, 255, 0.1);
    --glass-blur: blur(12px);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    background-image: radial-gradient(circle at 15% 50%, rgba(59, 130, 246, 0.15), transparent 25%),
                      radial-gradient(circle at 85% 30%, rgba(16, 185, 129, 0.15), transparent 25%);
}

.app-container {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    backdrop-filter: var(--glass-blur);
    border-right: 1px solid var(--border);
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
}

.brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 3rem;
    padding: 0 1rem;
}

.logo {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    text-align: left;
    padding: 0.8rem 1rem;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    text-decoration: none;
}

.nav-btn::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(90deg, rgba(255,255,255,0.03), transparent);
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 0;
}

.nav-icon {
    width: 24px;
    height: 24px;
    transition: transform 0.3s;
    z-index: 1;
    flex-shrink: 0;
}

.nav-text {
    z-index: 1;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.nav-btn:hover::before {
    opacity: 1;
}

.nav-btn:hover .nav-icon {
    transform: scale(1.15);
}

.nav-btn.active {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(139, 92, 246, 0.15));
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: var(--text-primary);
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.15);
}

.nav-btn.active::after {
    content: '';
    position: absolute;
    left: 0;
    top: 20%;
    height: 60%;
    width: 3px;
    background: linear-gradient(to bottom, var(--accent), #8b5cf6);
    border-radius: 0 4px 4px 0;
    box-shadow: 0 0 10px var(--accent);
}

.logout-btn {
    margin-top: auto;
    color: rgba(239, 68, 68, 0.8) !important;
}

.logout-btn:hover {
    background: rgba(239, 68, 68, 0.05);
    border-color: rgba(239, 68, 68, 0.1);
    color: var(--negative) !important;
}

/* Main Content */
.content-area {
    flex: 1;
    padding: 2.5rem;
    overflow-y: auto;
}

.module {
    display: none;
    animation: fadeIn 0.4s ease forwards;
}

.module.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.module-header {
    margin-bottom: 2rem;
}

.module-header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    line-height: 1.3;
    padding-bottom: 5px;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.module-header p {
    color: var(--text-secondary);
}

/* Components */
.card {
    background: var(--card-bg);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.mt-2 { margin-top: 1.5rem; }

.btn {
    display: inline-block;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
    white-space: nowrap;
}

.btn.primary {
    background: var(--accent);
    color: white;
}
.btn.primary:hover { background: var(--accent-hover); }

/* Kanban Board */
.kanban-board {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    overflow-x: auto;
    padding-bottom: 1rem;
}

.kanban-column {
    background: rgba(15, 23, 42, 0.5);
    border-radius: 12px;
    padding: 1rem;
    min-width: 250px;
    flex: 1;
    border: 1px solid var(--border);
}

.kanban-column h3 {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.kanban-items {
    min-height: 150px;
}

.kanban-card {
    background: var(--card-bg);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 0.75rem;
    cursor: grab;
    border: 1px solid var(--border);
    font-size: 0.9rem;
    transition: transform 0.2s, border-color 0.2s;
}

.kanban-card:active { cursor: grabbing; }
.kanban-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.kanban-card.dragging { opacity: 0.5; }

/* GDD */
.gdd-section { margin-bottom: 2rem; }
.gdd-editor {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
    min-height: 100px;
    border: 1px solid var(--border);
    outline: none;
    line-height: 1.6;
}
.gdd-editor:focus { border-color: var(--accent); }
.gdd-editor ul { margin-left: 1.5rem; margin-top: 0.5rem; }
.gdd-editor li { margin-bottom: 0.5rem; }

/* Chat App */
.chat-app {
    display: flex;
    height: 500px;
    background: var(--card-bg);
    border-radius: 16px;
    border: 1px solid var(--border);
    overflow: hidden;
}

.chat-sidebar {
    width: 200px;
    background: rgba(0,0,0,0.2);
    border-right: 1px solid var(--border);
    padding: 1rem 0;
}

.channel {
    padding: 0.75rem 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.95rem;
    transition: background 0.2s;
}

.channel:hover { background: rgba(255,255,255,0.05); color: var(--text-primary); }
.channel.active { background: rgba(59, 130, 246, 0.2); color: var(--accent); border-left: 3px solid var(--accent); }

.chat-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.chat-messages {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.message {
    background: rgba(255,255,255,0.05);
    padding: 1rem;
    border-radius: 8px;
    align-self: flex-start;
    max-width: 80%;
    line-height: 1.5;
}

.message.self {
    background: rgba(59, 130, 246, 0.2);
    align-self: flex-end;
}

.chat-input-area {
    padding: 1rem;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    background: rgba(0,0,0,0.1);
}

.chat-input-area input {
    flex: 1;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: rgba(0,0,0,0.2);
    color: white;
    outline: none;
    transition: border-color 0.2s;
}

.chat-input-area input:focus { border-color: var(--accent); }

/* Finance */
.finance-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.finance-table th, .finance-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.finance-table th {
    color: var(--text-secondary);
    font-weight: 500;
}

.journal-entry-group {
    border-bottom: 2px solid rgba(255,255,255,0.05);
}
.journal-entry-group:last-child {
    border-bottom: none;
}

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 99px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge.positive { background: rgba(16, 185, 129, 0.2); color: var(--positive); }
.badge.negative { background: rgba(239, 68, 68, 0.2); color: var(--negative); }

.stat-card h2 { margin-top: 0.5rem; font-size: 2rem; }
.warning-card { border-color: rgba(245, 158, 11, 0.3); background: rgba(245, 158, 11, 0.05); }
.progress-bar {
    height: 8px;
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
    margin-top: 1rem;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: var(--warning);
    border-radius: 4px;
}
.hidden { display: none; }

/* Timeline */
.timeline-item {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}
.timeline-item:last-child { border-bottom: none; }
.timeline-item .day {
    font-weight: 600;
    color: var(--accent);
    min-width: 60px;
}
.timeline-item .task {
    line-height: 1.5;
}

/* Login Screen */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--bg-color);
    background-image: radial-gradient(circle at 50% 50%, rgba(59, 130, 246, 0.2), transparent 50%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s;
}

.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 3rem;
    width: 100%;
    max-width: 450px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
    position: relative;
    overflow: hidden;
}

.modal-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
    text-align: left;
}

.login-logo {
    margin: 0 auto 1.5rem;
    width: 48px;
    height: 48px;
}

.login-card h2 { margin-bottom: 0.5rem; }
.login-card p { color: var(--text-secondary); margin-bottom: 2rem; font-size: 0.9rem; }

.input-group { margin-bottom: 1rem; }
.input-group input {
    width: 100%;
    padding: 1rem;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: white;
    outline: none;
    font-size: 1rem;
}
.input-group input:focus { border-color: var(--accent); }

#login-btn { width: 100%; padding: 1rem; font-size: 1rem; margin-top: 1rem; }
.login-error { color: var(--negative) !important; margin-top: 1rem; margin-bottom: 0 !important; }

/* Mobile Header */
.mobile-header {
    display: none;
    padding: 1rem;
    background: var(--sidebar-bg);
    border-bottom: 1px solid var(--border);
    align-items: center;
    justify-content: space-between;
}

.mobile-header .brand {
    margin-bottom: 0;
    padding: 0;
}

.hamburger-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
}

/* Responsive Media Queries */
/* Base Report/Page Layouts */
.page-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.report-filter-form {
    background: rgba(0,0,0,0.2);
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    margin-bottom: 1.5rem;
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .app-container { flex-direction: column; }
    
    .modal-card {
        padding: 1.5rem;
        width: 95%;
    }
    
    .mobile-header { display: flex; }
    
    .sidebar {
        position: fixed;
        left: -100%;
        top: 60px; /* Below mobile header */
        height: calc(100vh - 60px);
        width: 100%;
        z-index: 999;
        transition: left 0.3s ease;
        padding-top: 1rem;
    }
    
    .sidebar.show { left: 0; }
    .sidebar .brand { display: none; /* Hidden in mobile sidebar since it's in header */ }
    
    .content-area { padding: 1rem; }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    .page-header h1 {
        font-size: 1.3rem;
    }
    
    .report-filter-form {
        flex-direction: column;
        align-items: stretch;
        padding: 1rem;
    }
    .report-filter-form .input-group {
        width: 100%;
        margin-bottom: 0.5rem !important;
    }
    .report-filter-form .btn {
        width: 100%;
        margin-top: 0.5rem;
    }
    
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    
    .chat-app { flex-direction: column; height: auto; }
    .chat-sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--border); display: flex; overflow-x: auto; }
    .channel { white-space: nowrap; }
    .chat-messages { height: 300px; }
    
    /* Mobile Tables as Cards */
    .finance-table { display: block; border: none; }
    .finance-table thead { display: none; }
    .finance-table tbody { display: block; width: 100%; }
    
    /* Default row as card */
    .finance-table tr {
        display: flex;
        flex-direction: column;
        margin-bottom: 1rem;
        background: rgba(255, 255, 255, 0.03);
        border: 1px solid var(--border);
        border-radius: 12px;
        padding: 0.5rem;
    }
    
    /* For Journal Table, the tbody is the card to group entry and details */
    .table-jurnal tbody.journal-entry-group {
        display: flex;
        flex-direction: column;
        margin-bottom: 1rem;
        background: rgba(255, 255, 255, 0.03);
        border: 1px solid var(--border);
        border-radius: 12px;
        padding: 0.5rem;
    }
    .table-jurnal tbody.journal-entry-group tr {
        margin-bottom: 0;
        background: transparent;
        border: none;
        border-radius: 0;
        padding: 0;
    }
    .finance-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: right;
        padding: 0.75rem 0.5rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
        font-size: 0.95rem;
        border-left: none !important;
        border-right: none !important;
        border-top: none !important;
    }
    .finance-table td:last-child { border-bottom: none !important; }
    
    .finance-table td::before {
        font-weight: 600;
        color: var(--text-secondary);
        text-align: left;
        margin-right: 1rem;
        font-size: 0.85rem;
    }

    /* Labels for Jurnal Table */
    .table-jurnal td:nth-child(1)::before { content: "Tanggal & Ref"; }
    .table-jurnal td:nth-child(2)::before { content: "Keterangan"; }
    .table-jurnal td:nth-child(3)::before { content: "Debet"; }
    .table-jurnal td:nth-child(4)::before { content: "Kredit"; }
    .table-jurnal td:nth-child(5) { justify-content: center; padding-top: 1rem; }
    .table-jurnal td:nth-child(5)::before { display: none; }

    /* Labels for COA Table */
    .table-coa td:nth-child(1)::before { content: "Kode"; }
    .table-coa td:nth-child(2)::before { content: "Nama"; }
    .table-coa td:nth-child(3)::before { content: "Tipe"; }
    .table-coa td:nth-child(4)::before { content: "Induk"; }
    .table-coa td:nth-child(5)::before { content: "Status"; }
    .table-coa td:nth-child(6) { justify-content: center; padding-top: 1rem; }
    .table-coa td:nth-child(6)::before { display: none; }

    /* Labels for Ledger Table */
    .table-ledger td:nth-child(1)::before { content: "Tanggal/Ref"; }
    .table-ledger td:nth-child(2)::before { content: "Keterangan"; }
    .table-ledger td:nth-child(3)::before { content: "Debet"; }
    .table-ledger td:nth-child(4)::before { content: "Kredit"; }
    .table-ledger td:nth-child(5)::before { content: "Saldo"; }
    
    /* Labels for Trial Balance */
    .table-trial td:nth-child(1)::before { content: "Kode"; }
    .table-trial td:nth-child(2)::before { content: "Nama Akun"; }
    .table-trial td:nth-child(3)::before { content: "Debet"; }
    .table-trial td:nth-child(4)::before { content: "Kredit"; }
    
    /* Hide some styling when colspan is used (loading, empty states) */
    .finance-table td[colspan] {
        justify-content: center !important;
        text-align: center !important;
    }
    .finance-table td[colspan]::before { display: none !important; }
    
    /* Ledger Summary Rows (Saldo Awal & Akhir) */
    .finance-table tr.ledger-summary-row td {
        justify-content: space-between !important;
        border: none !important;
    }
    .finance-table tr.ledger-summary-row td:nth-child(1) {
        text-align: left !important;
        justify-content: flex-start !important;
        color: var(--text-secondary);
        padding-bottom: 0.25rem;
    }
    .finance-table tr.ledger-summary-row td:nth-child(2) {
        text-align: left !important;
        justify-content: flex-start !important;
        font-size: 1.1rem;
        padding-top: 0;
    }
    .finance-table tr.ledger-summary-row td::before {
        display: none !important;
    }
}

select option {
    background-color: #0f172a; /* Warna dark solid */
    color: #ffffff; /* Text putih */
}

/* Task Items Premium Style */
.task-item-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.task-item-card:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    border-color: rgba(255,255,255,0.2);
}

.task-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.task-item-title-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.task-item-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(139, 92, 246, 0.2));
    border-radius: 8px;
    font-size: 1.2rem;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.1);
}

.task-item-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
}

.task-item-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    padding-left: 3rem; /* Aligns with text next to icon */
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
.spinner-icon {
    animation: spin 1s linear infinite;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(59, 130, 246, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(59, 130, 246, 0.6);
}

/* Mobile adjustments for Finance Tabs */
@media (max-width: 768px) {
    .fin-tab-text {
        display: none;
    }
    .fin-tab-icon {
        font-size: 1.5rem;
    }
}
