:root {
    --primary: #203D20;
    --primary-light: #2D5A2D;
    --primary-dark: #152A15;
    --bg-body: #f5f5f5;
    --bg-card: #ffffff;
    --bg-sidebar: #203D20;
    --text-primary: #1a1a1a;
    --text-secondary: #6c757d;
    --text-muted: #adb5bd;
    --text-light: #ffffff;
    --border: #e0e0e0;
    --border-light: #f0f0f0;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --green: #203D20;
    --green-light: #28a745;
    --blue: #007bff;
    --purple: #6f42c1;
    --orange: #fd7e14;
    --red: #dc3545;
    --radius: 10px;
    --radius-sm: 6px;
    --radius-lg: 14px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Login */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 40px 32px;
    text-align: center;
}

.login-header { margin-bottom: 32px; }

.logo-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #f8f8f8;
    margin-bottom: 16px;
}

.login-header h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 1px;
}

.login-header .subtitle {
    color: var(--text-secondary);
    font-size: 13px;
    margin-top: 4px;
}

.login-form { text-align: left; }

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fff;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(32,61,32,0.1);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: var(--text-light);
}
.btn-primary:hover { background: var(--primary-light); }

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-primary);
}
.btn-outline:hover { background: #f5f5f5; }

.btn-outline-sm {
    padding: 6px 14px;
    font-size: 12px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    cursor: pointer;
}
.btn-outline-sm:hover { background: #f5f5f5; }

.btn-full { width: 100%; }

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
}
.btn-icon:hover { background: rgba(0,0,0,0.05); }

.btn-icon-sm {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    padding: 4px;
}

.login-footer {
    margin-top: 24px;
    color: var(--text-muted);
    font-size: 12px;
}

.alert {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 18px;
    font-size: 13px;
}
.alert-error { background: #fff5f5; color: var(--red); border: 1px solid #fecaca; }

/* Header */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-sm {
    display: flex;
    align-items: center;
}

.brand-text {
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 0.5px;
}

.admin-badge {
    font-size: 10px;
    font-weight: 600;
    background: var(--primary);
    color: var(--text-light);
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-name {
    font-size: 13px;
    color: var(--text-secondary);
    display: none;
}

.user-menu { position: relative; }

.dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    min-width: 160px;
    z-index: 200;
}

.dropdown-menu.open { display: block; }

.dropdown-menu a {
    display: block;
    padding: 10px 16px;
    font-size: 13px;
    color: var(--text-primary);
    text-decoration: none;
}
.dropdown-menu a:hover { background: #f5f5f5; }

/* Main Content */
.main-content {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px;
    padding-bottom: 100px;
}

.page-header {
    margin-bottom: 20px;
}

.page-header h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
}

.date-display {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.cost-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 18px;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-light);
    margin-bottom: 16px;
}

.cost-bar-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.cost-bar-value {
    font-size: 15px;
    font-weight: 600;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
}

/* Filters */
.filters-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.date-filters {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
}

.filter-btn {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--bg-card);
    font-size: 11px;
    font-family: inherit;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}

.filter-btn:hover { border-color: var(--primary); color: var(--primary); }
.filter-btn.active { background: var(--primary); color: var(--text-light); border-color: var(--primary); }

.btn-apply {
    background: var(--primary);
    color: var(--text-light);
    border-color: var(--primary);
    padding: 6px 10px;
    font-weight: 600;
}

.date-input {
    padding: 5px 6px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-family: inherit;
    min-width: 0;
    width: 110px;
    flex-shrink: 0;
}

.date-sep { color: var(--text-muted); font-size: 11px; flex-shrink: 0; }

.select-input {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-family: inherit;
    background: var(--bg-card);
}

/* KPI Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.kpi-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 14px;
    border: 1px solid var(--border-light);
}

.kpi-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.kpi-icon.green { background: rgba(32,61,32,0.1); color: var(--green); }
.kpi-icon.blue { background: rgba(0,123,255,0.1); color: var(--blue); }
.kpi-icon.purple { background: rgba(111,66,193,0.1); color: var(--purple); }
.kpi-icon.orange { background: rgba(253,126,20,0.1); color: var(--orange); }

.kpi-content { min-width: 0; }

.kpi-label {
    display: block;
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kpi-value {
    display: block;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.kpi-unit {
    font-size: 11px;
    color: var(--text-muted);
}

/* Section Card */
.section-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-light);
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.section-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

/* Month Stats */
.month-stats {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
}

.month-stat-label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.month-stat-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.progress-bar {
    height: 8px;
    background: #eee;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 6px;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transition: width 0.5s ease;
    width: 0%;
}

.progress-text {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
    display: inline-block;
}

/* Chart */
.chart-container {
    position: relative;
    height: 280px;
}

/* Table */
.table-container { overflow-x: auto; }

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.table th {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 2px solid var(--border);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-light);
}

.table tr:hover td { background: #fafafa; }

.table .num { text-align: right; font-variant-numeric: tabular-nums; }

.loading-text {
    text-align: center;
    color: var(--text-muted);
    padding: 30px;
    font-size: 13px;
}

.empty-text {
    text-align: center;
    color: var(--text-muted);
    padding: 30px;
    font-size: 13px;
}

/* FAB */
.fab-refresh {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--text-light);
    border: none;
    box-shadow: 0 4px 16px rgba(32,61,32,0.3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 90;
    transition: transform 0.2s, box-shadow 0.2s;
}

.fab-refresh:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(32,61,32,0.4);
}

.fab-refresh.loading svg {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Bottom Nav */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    background: var(--bg-card);
    border-top: 1px solid var(--border-light);
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 0;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 10px;
    gap: 3px;
    transition: color 0.2s;
}

.nav-item.active { color: var(--primary); }
.nav-item:hover { color: var(--primary); }

/* Admin */
.admin-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    background: var(--bg-card);
    padding: 4px;
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
}

.tab-btn {
    flex: 1;
    padding: 10px;
    border: none;
    background: transparent;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.tab-btn.active {
    background: var(--primary);
    color: var(--text-light);
}

.list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    border-bottom: 1px solid var(--border-light);
    gap: 12px;
}

.list-item:last-child { border-bottom: none; }

.item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.item-name {
    font-size: 14px;
    font-weight: 500;
}

.item-email {
    font-size: 12px;
    color: var(--text-secondary);
}

.item-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.item-detail {
    font-size: 12px;
    color: var(--text-muted);
}

.item-budget {
    font-size: 12px;
    font-weight: 500;
    color: var(--primary);
}

.item-actions { display: flex; gap: 4px; }

.item-badge {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    text-transform: uppercase;
    width: fit-content;
}

.badge-admin { background: rgba(32,61,32,0.1); color: var(--primary); }
.badge-client { background: rgba(0,123,255,0.1); color: var(--blue); }

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 28px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.modal h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
}

.modal-form .form-group { margin-bottom: 14px; }

.modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* Responsive */
@media (max-width: 768px) {
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .month-stats { grid-template-columns: repeat(2, 1fr); }
    .list-item { flex-direction: column; align-items: flex-start; }
    .item-meta { width: 100%; justify-content: space-between; }
}

@media (max-width: 480px) {
    .kpi-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .kpi-card { padding: 14px; }
    .kpi-value { font-size: 16px; }
    .main-content { padding: 12px; }
    .header { padding: 10px 14px; }
}

.panel-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 200;
}

.slide-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
    z-index: 210;
    max-height: 70vh;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.slide-panel.open {
    transform: translateY(0);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
}

.panel-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.panel-body {
    overflow-y: auto;
    padding: 12px 20px 20px;
    flex: 1;
}

.panel-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
}

.panel-item:last-child { border-bottom: none; }

.panel-item:hover { background: #fafafa; margin: 0 -20px; padding: 12px 20px; }

.panel-item-name {
    font-size: 14px;
    font-weight: 500;
}

.panel-item-detail {
    font-size: 12px;
    color: var(--text-secondary);
}

.panel-item-arrow {
    color: var(--text-muted);
    font-size: 18px;
}

.panel-item.active .panel-item-name {
    color: var(--primary);
    font-weight: 600;
}

.panel-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    width: 3px;
    height: 24px;
    background: var(--primary);
    border-radius: 0 2px 2px 0;
}
