:root {
    --bg: #1a1a1a;
    --surface: #242424;
    --surface-hover: #2a2a2a;
    --border: #333;
    --text: #e0e0e0;
    --text-muted: #888;
    --primary: #4a9eff;
    --success: #4caf50;
    --warning: #ff9800;
    --danger: #f44336;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 1.5rem;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

nav {
    display: flex;
    gap: 1rem;
}

nav a {
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: all 0.2s;
}

nav a:hover, nav a.active {
    color: var(--text);
    background: var(--surface);
}

.card {
    background: var(--surface);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

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

.card-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
}

.period-dates {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.summary-row {
    display: flex;
    gap: 2rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.summary-item {
    text-align: center;
}

.summary-item .value {
    font-size: 1.5rem;
    font-weight: 600;
}

.summary-item .label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.summary-item.paid .value { color: var(--success); }
.summary-item.due .value { color: var(--warning); }
.summary-item.overdue .value { color: var(--danger); }

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

.expense-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    background: var(--bg);
    border-radius: 6px;
    gap: 1rem;
}

.expense-item .status {
    width: 24px;
    text-align: center;
}

.expense-item .name {
    flex: 1;
}

.expense-item .amount {
    font-weight: 500;
    min-width: 80px;
    text-align: right;
}

.expense-item .due-date {
    color: var(--text-muted);
    font-size: 0.85rem;
    min-width: 100px;
}

.expense-item .badge {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    text-transform: uppercase;
}

.badge-installment {
    background: var(--primary);
    color: white;
}

.badge-overdue {
    background: var(--danger);
    color: white;
}

.badge-due-soon {
    background: var(--warning);
    color: black;
}

.progress-bar {
    width: 80px;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar .fill {
    height: 100%;
    background: var(--success);
    transition: width 0.3s;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

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

.btn-primary:hover {
    opacity: 0.9;
}

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

.btn-secondary:hover {
    background: var(--surface-hover);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-sm {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
}

.actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.3rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.6rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 0.95rem;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

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

.form-row.three {
    grid-template-columns: 1fr 1fr 1fr;
}

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

.checkbox-group input {
    width: auto;
}

.radio-group {
    display: flex;
    gap: 1rem;
}

.radio-group label {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    cursor: pointer;
}

.radio-group input {
    width: auto;
}

.hidden {
    display: none !important;
}

.suggestion-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    background: var(--bg);
    border-radius: 6px;
    margin-bottom: 0.5rem;
    gap: 1rem;
}

.suggestion-item .details {
    flex: 1;
}

.suggestion-item .transaction-desc {
    font-weight: 500;
}

.suggestion-item .transaction-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.confidence {
    font-size: 0.85rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    background: var(--surface-hover);
}

.confidence.high {
    background: var(--success);
    color: white;
}

.confidence.medium {
    background: var(--warning);
    color: black;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

.toast {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    padding: 1rem 1.5rem;
    background: var(--surface);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 1000;
    animation: slideIn 0.3s ease;
}

.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

table {
    width: 100%;
    border-collapse: collapse;
}

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

th {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.85rem;
}

tr:hover {
    background: var(--surface-hover);
}

.sync-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.sync-status .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
}

.sync-status .dot.syncing {
    background: var(--warning);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
