:root {
    /* Updated Pastel Green Palette */
    --primary: #86efac;      /* Soft Pastel Green */
    --primary-dark: #4ade80; /* Slightly darker for active states/text */
    --primary-light: #bbf7d0;
    --accent: #0891b2;
    --accent-light: #06b6d4;
    --secondary: #8b5cf6;
    --success: #4ade80;      /* Matches pastel theme */
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #0891b2;
    --bg-main: #f8fafc;
    --bg-secondary: #f1f5f9;
    --white: #ffffff;
    --text-main: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
    --bg-main: #0f172a;
    --bg-secondary: #1e293b;
    --white: #1e293b;
    --text-main: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --border: #334155;
    --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Inter', sans-serif; transition: background-color 0.3s, color 0.3s, border-color 0.3s; }
body { display: flex; background: var(--bg-main); color: var(--text-main); height: 100vh; overflow: hidden; }

.main-wrapper { flex: 1; display: flex; flex-direction: column; width: 100%; height: 100%; overflow: hidden; }

/* --- NEW TOP HEADER LAYOUT --- */
.header { 
    min-height: 70px; 
    background: var(--white); 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    padding: 0.5rem 2.5rem; 
    border-bottom: 1px solid var(--border); 
    width: 100%; 
    gap: 1rem;
    flex-wrap: wrap;
}
.header-left { display: flex; align-items: center; gap: 2rem; }
.header-tools { display: flex; align-items: center; gap: 1.2rem; }

/* Brand & Navigation */
.brand-container { display: flex; align-items: center; }
.brand-main { font-weight: 900; font-size: 1.3rem; line-height: 1.2; letter-spacing: -0.02em; color: var(--text-main); text-transform: uppercase; }

.nav-group { display: flex; flex-direction: row; gap: 0.5rem; align-items: center; }
.nav-link { 
    padding: 0.5rem 0.8rem; 
    border-radius: 8px; 
    cursor: pointer; 
    color: var(--text-muted); 
    font-weight: 600; 
    font-size: 0.85rem; 
    display: flex; 
    align-items: center; 
    gap: 8px; 
    transition: all 0.2s ease; 
}
.nav-link:hover { background: var(--bg-secondary); color: var(--primary-dark); }
.nav-link.active { background: rgba(134, 239, 172, 0.2); color: var(--primary-dark); }

.header-pill { display: flex; align-items: center; gap: 8px; background: var(--bg-secondary); padding: 7px 14px; border-radius: 10px; border: none; font-size: 0.8rem; font-weight: 600; color: var(--text-main); white-space: nowrap; }
.header-pill i { color: var(--primary-dark); }
.theme-toggle { background: var(--bg-secondary); border: none; width: 40px; height: 40px; border-radius: 10px; cursor: pointer; color: var(--primary-dark); display: flex; align-items: center; justify-content: center; transition: all 0.2s ease; }
.theme-toggle:hover { background: var(--border); }

.search-container { position: relative; width: 320px; }
.search-input { width: 100%; padding: 0.65rem 1rem 0.65rem 2.3rem; border-radius: 10px; border: 1px solid var(--border); background: var(--bg-secondary); color: var(--text-main); outline: none; transition: all 0.2s ease; font-size: 0.9rem; }
.search-input:focus { border-color: var(--primary-dark); background: var(--white); }

.content { flex: 1; padding: 2rem 2.5rem; overflow-y: auto; width: 100%; }
.section { display: none; animation: fadeIn 0.3s ease-out; width: 100%; }
.section.active { display: block; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.5rem; margin-bottom: 2rem; width: 100%; }
.card { background: var(--white); border-radius: 14px; padding: 1.5rem; border: 1px solid var(--border); box-shadow: var(--card-shadow); transition: all 0.2s ease; position: relative; overflow: hidden; }
.card::before { content: ''; position: absolute; top: -1px; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, var(--primary) 0%, var(--primary-dark) 100%); opacity: 0; transition: opacity 0.2s; }
.card:hover { border-color: var(--primary-dark); transform: translateY(-2px); }
.card:hover::before { opacity: 1; }

.filter-bar { display: flex; gap: 8px; margin-bottom: 1.5rem; padding: 6px; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 10px; width: fit-content; }
.filter-btn { padding: 0.55rem 1rem; border-radius: 8px; border: none; cursor: pointer; font-size: 0.8rem; font-weight: 600; transition: all 0.2s ease; background: transparent; color: var(--text-muted); }
.filter-btn:hover { background: rgba(134, 239, 172, 0.1); color: var(--primary-dark); }
.filter-btn.active { background: var(--primary-dark); color: white; }

.table-container { border-radius: 14px; overflow: hidden; border: 1px solid var(--border); background: var(--white); width: 100%; margin-bottom: 20px; }
table { width: 100%; border-collapse: collapse; }
th { background: var(--bg-secondary); padding: 1rem; color: var(--primary-dark); font-size: 0.75rem; text-transform: uppercase; border-bottom: 1px solid var(--border); text-align: left; font-weight: 700; letter-spacing: 0.05em; }
td { padding: 1.1rem 1rem; border-bottom: 1px solid var(--border); font-size: 0.9rem; color: var(--text-main); }
tr:hover { background: var(--bg-secondary); }

.badge { padding: 4px 10px; border-radius: 8px; font-weight: 600; font-size: 0.75rem; }
.badge-success { background: rgba(74, 222, 128, 0.15); color: var(--success); }
.badge-danger { background: rgba(239, 68, 68, 0.15); color: var(--danger); }

.action-group { display: flex; gap: 10px; justify-content: flex-end; }
.action-btn { background: none; border: none; cursor: pointer; transition: all 0.2s ease; padding: 6px; border-radius: 8px; display: flex; align-items: center; justify-content: center; }
.action-btn:hover { transform: scale(1.15); }
.action-btn i { width: 18px; height: 18px; }
.action-btn.release { color: var(--primary-dark); }
.action-btn.edit { color: var(--accent); }
.action-btn.delete { color: var(--danger); }

.modal { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.5); backdrop-filter: blur(4px); display: none; align-items: center; justify-content: center; z-index: 100; }
.modal-card { background: var(--white); width: 420px; padding: 2rem; border-radius: 16px; border: 1px solid var(--border); animation: slideIn 0.3s ease-out; }
.modal-card h3 { color: var(--text-main); margin-bottom: 1.5rem; }
.form-input { width: 100%; padding: 0.8rem; margin-bottom: 1rem; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-secondary); color: var(--text-main); outline: none; transition: all 0.2s ease; }
.form-input:focus { border-color: var(--primary-dark); background: var(--white); }

#toast-container { position: fixed; top: 20px; right: 20px; z-index: 9999; }
.toast { background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%); color: var(--text-main); padding: 14px 18px; border-radius: 10px; display: flex; align-items: center; gap: 12px; margin-bottom: 10px; animation: slideIn 0.3s ease-out; border-left: 3px solid #16a34a; min-width: 320px; justify-content: space-between; font-weight: 500;}
.toast.error { background: linear-gradient(135deg, #7f1d1d 0%, #b91c1c 100%); color: white; border-left-color: var(--danger); }
.undo-btn { background: rgba(0,0,0,0.1); border: none; color: inherit; padding: 4px 10px; border-radius: 6px; font-size: 0.7rem; cursor: pointer; font-weight: 700; text-transform: uppercase; transition: all 0.2s ease; }
.undo-btn:hover { background: rgba(0,0,0,0.2); }

.fab-container { position: fixed; bottom: 2rem; right: 2rem; display: flex; flex-direction: column; gap: 1rem; z-index: 90; }
.fab { width: 56px; height: 56px; border-radius: 14px; color: white; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s ease; position: relative; overflow: hidden; font-weight: 700; font-size: 1.3rem; }
.fab:hover { transform: scale(1.1); }
.fab-add { background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%); color: var(--text-main); }
.fab-rel { background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%); }

@keyframes slideIn { from { transform: translateX(100%) translateY(20px); opacity: 0; } to { transform: translateX(0) translateY(0); opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.delete-icon-box { width: 56px; height: 56px; background: rgba(239, 68, 68, 0.15); color: var(--danger); border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 1.5rem auto; }
.delete-title { font-size: 1.25rem; font-weight: 700; text-align: center; margin-bottom: 0.5rem; color: var(--text-main); }
.delete-text { text-align: center; color: var(--text-muted); font-size: 0.9rem; margin-bottom: 2rem; line-height: 1.5; }
.delete-actions { display: flex; gap: 12px; }
.btn-confirm-delete { flex: 1; padding: 0.8rem; background: var(--danger); color: white; border: none; border-radius: 10px; font-weight: 600; cursor: pointer; transition: all 0.2s ease; }
.btn-confirm-delete:hover { opacity: 0.9; }
.btn-cancel-delete { flex: 1; padding: 0.8rem; background: var(--bg-secondary); color: var(--text-main); border: 1px solid var(--border); border-radius: 10px; font-weight: 600; cursor: pointer; transition: all 0.2s ease; }
.btn-cancel-delete:hover { background: var(--border); }

.analysis-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
@media (max-width: 1024px) { .analysis-grid { grid-template-columns: 1fr; } }
.bar-bg { width: 100%; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; margin-top: 6px; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--primary) 0%, var(--primary-dark) 100%); border-radius: 3px; transition: width 0.4s ease-out; }

.text-prev { color: var(--text-muted); font-weight: 500; }
.text-curr { color: var(--primary-dark); font-weight: 600; }
.text-total { font-weight: 700; color: var(--text-main); }

h2 { color: var(--text-main); font-size: 1.5rem; margin-bottom: 0.5rem; }
h3 { color: var(--text-main); font-size: 1rem; }
p { color: var(--text-muted); }