/* d:\Work & Projects\Programming\Git Repo's\pfa-tax\static\css\modern.css */

:root {
  --bg-base: #09090b;
  --bg-surface: rgba(24, 24, 27, 0.65);
  --bg-surface-hover: rgba(39, 39, 42, 0.85);
  --bg-modal: rgba(24, 24, 27, 0.85);
  --border-color: rgba(255, 255, 255, 0.08);
  
  --text-primary: #f4f4f5;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  
  --accent: #6366f1; /* CAS */
  --accent-hover: #4f46e5;
  --accent-alpha: rgba(99, 102, 241, 0.15);
  
  --red: #ef4444; /* Plăți depășite / Acțiuni Danger */
  --red-alpha: rgba(239, 68, 68, 0.15);
  
  --green: #10b981; /* CASS / Confirmat */
  --green-alpha: rgba(16, 185, 129, 0.15);
  
  --yellow: #f59e0b; /* IMPOZIT / Atenționări */
  --yellow-alpha: rgba(245, 158, 11, 0.15);
  
  --imp-color: #f97316; /* Secondary imp color / extra bracket */
  
  --font-main: 'Inter', sans-serif;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
  
  --trans-fast: 0.15s ease;
  --trans-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  background-image: 
    radial-gradient(circle at 15% 50%, rgba(99, 102, 241, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 85% 30%, rgba(239, 68, 68, 0.03) 0%, transparent 40%);
  background-attachment: fixed;
}

[hidden] { display: none !important; }

/* ================= Layout ================= */
.app-view {
  display: flex; height: 100vh; overflow: hidden;
}

.sidebar {
  width: 260px;
  background: var(--bg-surface);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border-right: 1px solid var(--border-color);
  display: flex; flex-direction: column;
  transition: width var(--trans-smooth), transform var(--trans-smooth);
  z-index: 40;
}

.sidebar-header {
  padding: 1.5rem; display: flex; align-items: center; gap: 1rem; border-bottom: 1px solid var(--border-color);
}
.sidebar-logo { width: 32px; height: 32px; border-radius: 8px; }
.logo { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.025em; }
.sidebar-toggle { display: block; background: none; border: none; color: var(--text-secondary); font-size: 1.25rem; cursor: pointer; margin-left: auto; transition: color var(--trans-fast); }
.sidebar-toggle:hover { color: var(--text-primary); }

.sidebar-nav {
  flex: 1; padding: 1.5rem 1rem; display: flex; flex-direction: column; gap: 0.5rem; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: var(--border-color) transparent;
}
.nav-link {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem;
  color: var(--text-secondary); text-decoration: none; border-radius: var(--radius-sm);
  transition: all var(--trans-fast); font-weight: 500; font-size: 0.875rem;
}
.nav-link:hover { background: var(--bg-surface-hover); color: var(--text-primary); }
.nav-link.active { background: var(--accent-alpha); color: var(--accent); }
.nav-icon { font-size: 1.1rem; }

.sidebar.collapsed { width: 80px; }
.sidebar.collapsed .logo, .sidebar.collapsed .sidebar-logo, .sidebar.collapsed .nav-label,
.sidebar.collapsed .sidebar-year, .sidebar.collapsed .account-copy, .sidebar.collapsed .account-logout { display: none; }
.sidebar.collapsed .sidebar-header { padding: 1.5rem 0; justify-content: center; }
.sidebar.collapsed .sidebar-toggle { margin: 0 auto; }
.sidebar.collapsed .sidebar-nav { padding: 1.5rem 0.5rem; }
.sidebar.collapsed .nav-link { justify-content: center; padding: 0.75rem 0; }
.sidebar.collapsed .nav-icon { font-size: 1.25rem; margin: 0; }
.sidebar.collapsed .sidebar-account { padding: 1.5rem 0; justify-content: center; }
.sidebar.collapsed .account-profile-button {
  flex: 0 0 auto;
  margin: 0;
  padding: 0.5rem;
  justify-content: center;
}
.impersonation-banner { position: fixed; top: 0; left: 0; right: 0; z-index: 1100; min-height: 52px; padding: 0.5rem 1rem; display: flex; align-items: center; justify-content: center; gap: 1rem; background: #78350f; color: #fef3c7; border-bottom: 1px solid #d97706; box-shadow: var(--shadow-md); }
.impersonation-banner[hidden] { display: none; }
.app-view.impersonating .sidebar { top: 52px; height: calc(100vh - 52px); }
.app-view.impersonating .main-content { padding-top: calc(2rem + 52px); }

.sidebar-account { padding: 1rem; border-top: 1px solid var(--border-color); display: flex; align-items: center; gap: 0.5rem; overflow: hidden; }
.account-profile-button { flex: 1; min-width: 0; padding: 0.5rem; margin: -0.5rem; display: flex; align-items: center; gap: 0.75rem; color: inherit; background: none; border: 0; border-radius: var(--radius-sm); cursor: pointer; text-align: left; font: inherit; transition: background var(--trans-fast); }
.account-profile-button:hover { background: var(--bg-surface-hover); }
.sidebar-year { padding: 1.5rem; border-top: 1px solid var(--border-color); display: flex; flex-direction: column; gap: 0.5rem; }
.account-avatar {
  width: 36px; height: 36px; border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 0.875rem; text-transform: uppercase;
  flex-shrink: 0;
}
.account-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.account-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 0.875rem; }
.account-copy strong, .account-copy span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account-copy strong { color: var(--text-primary); }
.account-copy span { color: var(--text-secondary); font-size: 0.75rem; }
.account-logout { flex-shrink: 0; margin-right: -0.5rem; background: none; border: none; color: var(--red); font-size: 0.875rem; font-weight: 500; cursor: pointer; padding: 0.5rem; border-radius: var(--radius-sm); transition: background var(--trans-fast); }
.account-logout:hover { background: var(--red-alpha); }

.sidebar-year { display: flex; flex-direction: column; gap: 0.5rem; }
.sidebar-year label { font-size: 0.75rem; text-transform: uppercase; color: var(--text-secondary); font-weight: 600; letter-spacing: 0.05em; }
.year-dropdown { position: relative; }
.year-dropdown-btn {
  width: 100%; display: flex; justify-content: space-between; align-items: center;
  background: var(--bg-surface-hover); border: 1px solid var(--border-color);
  color: var(--text-primary); padding: 0.75rem 1rem; border-radius: var(--radius-sm);
  cursor: pointer; font-family: var(--font-main); font-weight: 500; font-size: 0.875rem; transition: all var(--trans-fast);
}
.year-dropdown-btn:hover { border-color: rgba(255,255,255,0.2); }
.year-dropdown-list {
  position: absolute; bottom: calc(100% + 0.5rem); left: 0; right: 0;
  background: var(--bg-modal); border: 1px solid var(--border-color); border-radius: var(--radius-md);
  overflow: hidden; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none; transform: translateY(10px); transition: all var(--trans-fast);
}
.year-dropdown.open .year-dropdown-list { opacity: 1; pointer-events: auto; transform: translateY(0); }
.year-dropdown-item { padding: 0.75rem 1rem; cursor: pointer; color: var(--text-secondary); font-size: 0.875rem; transition: var(--trans-fast); }
.year-dropdown-item:hover, .year-dropdown-item.selected { background: var(--bg-surface-hover); color: var(--text-primary); }

.main {
  flex: 1; display: flex; flex-direction: column; overflow-y: auto; position: relative;
  scrollbar-width: thin; scrollbar-color: var(--border-color) transparent;
}
.main::-webkit-scrollbar { width: 6px; }
.main::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }

.topbar {
  padding: 1.5rem 2rem; display: flex; align-items: center; gap: 1rem; position: sticky; top: 0;
  background: linear-gradient(to bottom, var(--bg-base) 40%, transparent);
  z-index: 20;
}
.topbar-title { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.025em; }
.topbar-toggle { display: none; background: none; border: none; color: var(--text-primary); font-size: 1.5rem; cursor: pointer; }

/* ================= Sections & Cards ================= */
.section { display: none; padding: 0 2rem 2rem; animation: fadeIn var(--trans-smooth); }
.section.active { display: block; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}

.section-actions { display: flex; gap: 1rem; margin-bottom: 2rem; flex-wrap: wrap; }

.cards-row { display: grid; grid-template-columns: 1fr 320px; gap: 1.5rem; }

.card {
  background: var(--bg-surface); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color); border-radius: var(--radius-lg); padding: 1.5rem;
  box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 1.5rem;
  transition: transform var(--trans-fast), box-shadow var(--trans-fast), border-color var(--trans-fast);
  margin-bottom: 1.5rem;
}
.card:hover { border-color: rgba(255,255,255,0.12); box-shadow: var(--shadow-md); }

.card-header { display: flex; justify-content: space-between; align-items: center; }
.card-header h2 { font-size: 1.125rem; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
.card-sub { font-size: 0.875rem; color: var(--text-secondary); }

.badge { background: var(--accent-alpha); color: var(--accent); padding: 0.25rem 0.75rem; border-radius: var(--radius-full); font-size: 0.75rem; font-weight: 600; }
.badge-warn { background: var(--red-alpha); color: var(--red); }

/* ================= Proiecție & Overview ================= */
.overview-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
.overview-item {
  display: flex; flex-direction: column; gap: 0.5rem; padding: 1.25rem;
  background: rgba(0,0,0,0.25); border-radius: var(--radius-md); border: 1px solid transparent;
}
.ov-item-net {
  border-color: var(--accent-alpha);
  background: linear-gradient(180deg, rgba(99,102,241,0.06) 0%, transparent 100%);
}
.ov-label { font-size: 0.875rem; color: var(--text-secondary); font-weight: 500; }
.ov-value { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.025em; }
.ov-value.deduct { color: var(--text-muted); }
.ov-value.highlight { color: var(--accent); text-shadow: 0 0 15px rgba(99,102,241,0.4); }

.bracket-bar-wrap { position: relative; margin-top: 0.5rem; }
.bracket-bar-track { height: 6px; background: rgba(255,255,255,0.08); border-radius: 3px; position: relative; overflow: hidden; }
.bracket-bar-fill { height: 100%; position: absolute; left: 0; top: 0; transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1); border-radius: 3px; }
.bracket-marker { width: 2px; height: 12px; background: #fff; position: absolute; top: -3px; transform: translateX(-50%); box-shadow: 0 0 4px rgba(0,0,0,0.5); }
.bracket-ends { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--text-muted); margin-top: 0.35rem; }
.bracket-detail { font-size: 0.75rem; margin-top: 0.25rem; color: var(--text-secondary); }
.bd-next { color: var(--text-muted); }
.bd-prev { color: var(--green); }

.tax-breakdown { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 0.5rem; }
.tax-pill {
  background: rgba(0,0,0,0.25); border: 1px solid var(--border-color);
  padding: 0.5rem 1rem; border-radius: var(--radius-full);
  display: flex; gap: 0.75rem; align-items: center; font-size: 0.875rem;
}
.tax-name { color: var(--text-secondary); font-weight: 500; }
.tax-val { font-weight: 600; }
.cas-notice { padding: 1rem; background: var(--yellow-alpha); color: var(--yellow); border-radius: var(--radius-md); font-size: 0.875rem; font-weight: 500; border-left: 3px solid var(--yellow); }

.income-progress { margin-top: 10px; display: flex; flex-direction: column; gap: 0.875rem; }
.progress-card { display: flex; flex-direction: column; gap: 1.5rem; justify-content: center;}
.progress-section-expenses {
  border-top: 1px solid var(--border-color);
  padding-top: 1.5rem;
}
.prog-row { display: flex; justify-content: space-between; font-size: 0.875rem; }
.prog-row span:first-child { color: var(--text-secondary); }
.prog-row span:last-child { font-weight: 600; }
.prog-bar-wrap { height: 8px; background: rgba(255,255,255,0.08); border-radius: 4px; overflow: hidden; margin-top: 0.25rem; }
.prog-bar { height: 100%; background: var(--green); border-radius: 4px; transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1); }
.prog-bar-expense { background: var(--red); }
.prog-bar-cas { background: var(--accent); }
.prog-bar-cass { background: var(--green); }
.prog-bar-imp { background: var(--yellow); }
.prog-legend { font-size: 0.75rem; color: var(--text-secondary); text-align: right; margin-top: -0.25rem; }

/* ================= Tax savings accounts ================= */
.tax-savings-accounts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.5rem; }
.tax-savings-account {
  background: rgba(0,0,0,0.25); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 1.25rem;
  display: flex; flex-direction: column; gap: 1rem; transition: transform var(--trans-fast);
}
.tax-savings-account:hover { transform: translateY(-2px); border-color: rgba(255,255,255,0.15); }
.tax-savings-account-header { display: flex; justify-content: space-between; align-items: center; }
.tax-savings-account-name { font-size: 1.125rem; font-weight: 700; letter-spacing: -0.025em; }
.tax-savings-account-amounts { display: flex; flex-direction: column; gap: 0.65rem; font-size: 0.875rem; }
.tax-savings-account-amounts > div { display: flex; justify-content: space-between; align-items: center; }
.p-label { color: var(--text-secondary); }
.p-val { font-weight: 600; }
.p-should { color: var(--accent); }
.p-paid { color: var(--green); }

/* ================= UI Elements & Forms ================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.625rem 1.125rem; font-size: 0.875rem; font-weight: 600; font-family: var(--font-main);
  border-radius: var(--radius-sm); cursor: pointer; transition: all var(--trans-fast);
  border: 1px solid transparent; outline: none; white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 4px 12px rgba(99,102,241,0.25); }
.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 6px 16px rgba(99,102,241,0.4); }
.btn-secondary { background: rgba(255,255,255,0.05); color: var(--text-primary); border-color: var(--border-color); }
.btn-secondary:hover { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.15); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: rgba(255,255,255,0.08); color: var(--text-primary); }
.btn-danger { background: rgba(239,68,68,0.05); color: var(--red); border: 1px solid var(--red-alpha); padding: 0.4rem 0.65rem; border-radius: var(--radius-sm); font-size: 0.75rem; font-weight: 600; cursor: pointer; transition: all var(--trans-fast); display: inline-flex; align-items: center; justify-content: center; line-height: 1; }
.btn-danger:hover { background: rgba(239,68,68,0.15); border-color: rgba(239,68,68,0.25); }
.btn-danger-solid { background: var(--red); color: white; box-shadow: 0 4px 12px rgba(239,68,68,0.25); }
.btn-danger-solid:hover { background: #dc2626; box-shadow: 0 6px 16px rgba(239,68,68,0.4); }
.btn-confirm { background: var(--green-alpha); color: var(--green); padding: 0.4rem 0.75rem; border-radius: var(--radius-sm); border: none; font-size: 0.75rem; font-weight: 600; cursor: pointer; transition: background var(--trans-fast); }
.btn-confirm:hover { background: rgba(16,185,129,0.25); }
.btn-edit { background: rgba(255,255,255,0.08); color: var(--text-primary); padding: 0.4rem 0.75rem; border-radius: var(--radius-sm); border: none; font-size: 0.75rem; font-weight: 500; cursor: pointer; transition: background var(--trans-fast); }
.btn-edit:hover { background: rgba(255,255,255,0.15); }
.btn-icon { background: rgba(255,255,255,0.05); border: 1px solid var(--border-color); color: var(--text-primary); width: 32px; height: 32px; border-radius: var(--radius-sm); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all var(--trans-fast); }
.btn-icon:hover { background: rgba(255,255,255,0.15); border-color: rgba(255,255,255,0.2); }

.input {
  width: 100%; background: rgba(0,0,0,0.3); border: 1px solid var(--border-color); color: var(--text-primary);
  padding: 0.75rem 1rem; border-radius: var(--radius-sm); font-family: var(--font-main); font-size: 0.875rem;
  transition: all var(--trans-fast); outline: none;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-alpha); }
.input:-webkit-autofill, .input:-webkit-autofill:hover, .input:-webkit-autofill:focus, .input:-webkit-autofill:active{
  -webkit-box-shadow: 0 0 0 30px #18181b inset !important; -webkit-text-fill-color: white !important;
}
.input-sm { padding: 0.5rem; width: auto; }
.input[type="number"]::-webkit-outer-spin-button, .input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none; margin: 0;
}
.input[type="number"] { -moz-appearance: textfield; }

.input-row { display: flex; gap: 0.75rem; }

.form-group { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1.25rem; }
.form-group label { font-size: 0.875rem; font-weight: 500; color: var(--text-secondary); }
.form-row { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.field-hint { font-size: 0.75rem; color: var(--text-muted); }
.field-hint-inline { font-weight: 400; color: var(--text-muted); margin-left: 0.5rem; }
.checkbox-label { display: flex; align-items: center; gap: 0.75rem; cursor: pointer; user-select: none; font-size: 0.875rem; }
.checkbox-label input[type="checkbox"] { width: 1.125rem; height: 1.125rem; accent-color: var(--accent); cursor: pointer; }
.informative-value { background: rgba(0,0,0,0.2); border-radius: var(--radius-sm); padding: 1rem; margin-bottom: 1rem; font-size: 0.875rem; border: 1px solid var(--border-color); }

/* ================= Custom Inputs ================= */
.custom-select { position: relative; width: 100%; }
.custom-select-btn { display: flex; justify-content: space-between; align-items: center; cursor: pointer; text-align: left; padding: 0.75rem; }
.custom-select-chevron { font-size: 0.5rem; margin-left: 10px; }
.custom-select-list {
  position: fixed; top: 0; left: 0;
  background: var(--bg-modal); border: 1px solid var(--border-color); border-radius: var(--radius-md);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none; transform: translateY(10px); transition: opacity var(--trans-fast), transform var(--trans-fast); z-index: 9999;
  max-height: 250px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--border-color) transparent;
}
.custom-select-list::-webkit-scrollbar { width: 6px; }
.custom-select-list::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }
.custom-select-list.open { opacity: 1; pointer-events: auto; transform: translateY(0); }
.custom-select-item { padding: 0.75rem 1rem; cursor: pointer; color: var(--text-secondary); font-size: 0.875rem; transition: var(--trans-fast); }
.custom-select-item:hover, .custom-select-item.selected { background: var(--bg-surface-hover); color: var(--text-primary); }

.custom-datepicker-wrapper { position: relative; width: 100%; }
.custom-datepicker-input { cursor: pointer !important; padding-right: 2.5rem !important; background: rgba(0,0,0,0.3) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'%3E%3C/rect%3E%3Cline x1='16' y1='2' x2='16' y2='6'%3E%3C/line%3E%3Cline x1='8' y1='2' x2='8' y2='6'%3E%3C/line%3E%3Cline x1='3' y1='10' x2='21' y2='10'%3E%3C/line%3E%3C/svg%3E") no-repeat right 0.75rem center / 1rem !important; }
.custom-datepicker-popup {
  position: fixed; top: 0; left: 0; background: var(--bg-modal); border: 1px solid var(--border-color); border-radius: var(--radius-md);
  padding: 1.25rem; backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none; transform: translateY(10px); transition: opacity var(--trans-fast), transform var(--trans-fast); z-index: 9999; width: 280px;
}
.custom-datepicker-popup.open { opacity: 1; pointer-events: auto; transform: translateY(0); }
.cdp-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.cdp-header button { background: rgba(255,255,255,0.05); border: 1px solid var(--border-color); color: var(--text-primary); cursor: pointer; width: 28px; height: 28px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; transition: all var(--trans-fast); }
.cdp-header button:hover { background: rgba(255,255,255,0.15); border-color: rgba(255,255,255,0.2); }
.cdp-title { font-weight: 600; font-size: 0.875rem; letter-spacing: -0.01em; }
.cdp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 0.25rem; text-align: center; }
.cdp-day-name { font-size: 0.7rem; color: var(--text-muted); font-weight: 600; padding-bottom: 0.5rem; text-transform: uppercase; }
.cdp-day { font-size: 0.875rem; padding: 0.4rem 0; cursor: pointer; border-radius: var(--radius-sm); transition: var(--trans-fast); font-weight: 500; }
.cdp-day:not(.empty):hover { background: rgba(255,255,255,0.1); color: var(--text-primary); }
.cdp-day.selected { background: var(--accent); color: #fff; box-shadow: 0 4px 12px rgba(99,102,241,0.25); }

.input-with-suffix { position: relative; display: flex; align-items: center; width: 100%; }
.input-with-suffix::after { content: attr(data-suffix); position: absolute; right: 1rem; color: var(--text-muted); pointer-events: none; font-size: 0.875rem; font-weight: 600; }
.input-with-suffix .input { padding-right: 2.5rem; }

.input.input-invalid { border-color: var(--red) !important; color: var(--red) !important; box-shadow: 0 0 0 3px var(--red-alpha) !important; }

/* ================= Lists & Rows ================= */
.item-list, .slot-list { display: flex; flex-direction: column; gap: 0.75rem; }
.item-row, .slot-item {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1rem 1.25rem; background: rgba(255,255,255,0.03); border: 1px solid transparent; border-radius: var(--radius-md);
  transition: background var(--trans-fast), border-color var(--trans-fast);
}
.item-row:hover, .slot-item:hover { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.1); }
.item-row.inactive { opacity: 0.5; }

.item-info, .slot-info { display: flex; flex-direction: column; gap: 0.35rem; flex: 1; }
.item-name, .slot-name { font-weight: 600; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.item-detail, .slot-detail { font-size: 0.75rem; color: var(--text-secondary); }
.item-aside { font-size: 0.75rem; color: var(--accent); margin-top: 0.25rem; }

.item-amount, .slot-amount { text-align: right; display: flex; flex-direction: column; font-weight: 600; font-size: 1.125rem; letter-spacing: -0.01em; }
.sub-amt, .ron-amt { font-size: 0.75rem; color: var(--text-secondary); font-weight: 400; margin-top: 0.15rem; }
.main-amt { font-weight: 600; font-size: 1rem; }

.item-actions, .slot-actions { display: flex; gap: 0.5rem; align-items: center; }
.item-actions { flex-wrap: wrap; justify-content: flex-end; }

.tag { padding: 0.15rem 0.6rem; border-radius: var(--radius-full); font-size: 0.65rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.tag-inactive { background: rgba(255,255,255,0.1); color: var(--text-secondary); }
.tag-personal { background: var(--red-alpha); color: var(--red); }
.tag-future { background: rgba(255,255,255,0.1); color: var(--text-secondary); }
.tag-confirmed { background: var(--green-alpha); color: var(--green); }
.tag-pending { background: var(--red-alpha); color: var(--red); }
.tag-income { background: var(--green-alpha); color: var(--green); }
.tag-expense { background: var(--red-alpha); color: var(--red); }
.tag-tva-excluded { background: var(--accent-alpha); color: #a5b4fc; }
.tag-medical { background: rgba(56, 189, 248, 0.12); color: #7dd3fc; }
.custom-select-btn:disabled { opacity: 0.55; cursor: not-allowed; }

.slot-item.confirmed { border-left: 3px solid var(--green); }
.slot-item.overdue { border-left: 3px solid var(--red); }
.slot-item.slot-income {
  border-left-color: var(--green);
}
.slot-item.slot-expense {
  border-left-color: var(--red);
}
.slot-month { font-size: 0.75rem; font-weight: 700; color: var(--text-secondary); width: 45px; text-transform: uppercase; letter-spacing: 0.025em; }

/* ================= Timeline & Tables ================= */
.timeline { display: flex; gap: 0.5rem; overflow-x: auto; padding: 0.25rem 0 0.75rem 0; scrollbar-width: none; }
.timeline::-webkit-scrollbar { display: none; }
.timeline { display: flex; gap: 0.5rem; overflow-x: auto; padding: 0.25rem 0 0.75rem 0; scrollbar-width: thin; scrollbar-color: var(--border-color) transparent; }
.timeline::-webkit-scrollbar { height: 6px; }
.timeline::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }
.tm-month { flex: 1; min-width: 60px; padding: 0.75rem; background: rgba(0,0,0,0.25); border-radius: var(--radius-md); text-align: center; display: flex; flex-direction: column; gap: 0.35rem; transition: transform var(--trans-fast); }
.tm-month:hover { transform: translateY(-2px); }
.tm-current { background: var(--accent-alpha); border: 1px solid rgba(99,102,241,0.3); }
.tm-label { font-size: 0.75rem; font-weight: 600; color: var(--text-primary); text-transform: uppercase; }
.tm-status { font-size: 0.7rem; font-weight: 500; }

.text-accent { color: var(--accent); }
.text-red { color: var(--red); }
.text-green { color: var(--green); }
.text-yellow { color: var(--yellow); }
.text-muted { color: var(--text-muted); }

#realIncomeTable { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.875rem; overflow-x: auto; padding-bottom: 0.5rem; scrollbar-width: thin; scrollbar-color: var(--border-color) transparent; }
#realIncomeTable::-webkit-scrollbar { height: 6px; }
#realIncomeTable::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }
.ri-header { display: flex; min-width: 560px; padding: 0.75rem 1rem; color: var(--text-secondary); font-weight: 600; font-size: 0.75rem; text-transform: uppercase; border-bottom: 1px solid var(--border-color); letter-spacing: 0.025em; }
.ri-row { display: flex; min-width: 560px; padding: 0.875rem 1rem; background: rgba(255,255,255,0.02); border-radius: var(--radius-sm); transition: background var(--trans-fast); }
.ri-row:hover { background: rgba(255,255,255,0.04); }
.ri-header span, .ri-row span { flex: 1; text-align: right; }
.ri-header span:first-child, .ri-row span:first-child { text-align: left; }
.ri-month { font-weight: 500; color: var(--text-primary); }
.ri-income { font-weight: 600; }
.ri-expense { color: var(--text-muted); }
.ri-taxes { color: var(--red); opacity: 0.8; }
.ri-net { font-weight: 700; }

.empty-state { padding: 2.5rem 1.5rem; text-align: center; color: var(--text-muted); font-size: 0.875rem; background: rgba(0,0,0,0.15); border-radius: var(--radius-md); border: 1px dashed var(--border-color); }

/* ================= Modals ================= */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; opacity: 0; pointer-events: none; transition: opacity var(--trans-smooth);
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--bg-modal); border: 1px solid var(--border-color); box-shadow: var(--shadow-lg);
  border-radius: var(--radius-lg); width: 100%; max-width: 500px; max-height: 90vh;
  display: flex; flex-direction: column;
  transform: scale(0.95) translateY(15px); opacity: 0; transition: all var(--trans-smooth);
}
.modal-sm { max-width: 550px; }
.modal-overlay.open .modal { transform: scale(1) translateY(0); opacity: 1; }
.modal-header { padding: 1.5rem 1.5rem 1.25rem; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { font-size: 1.25rem; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
.modal-close { background: none; border: none; color: var(--text-secondary); font-size: 1.5rem; line-height: 1; cursor: pointer; transition: color var(--trans-fast); }
.modal-close:hover { color: var(--text-primary); }
.modal-body { padding: 1.5rem; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--border-color) transparent; }
.modal-footer { padding: 1.25rem 1.5rem; border-top: 1px solid var(--border-color); display: flex; justify-content: flex-end; gap: 1rem; background: rgba(0,0,0,0.2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

.recurrence-tabs {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.35rem;
  margin-bottom: 1.5rem; padding: 0.35rem; border-radius: var(--radius-md);
  background: rgba(0,0,0,0.3); border: 1px solid var(--border-color);
}
.recurrence-tab {
  min-width: 0; padding: 0.65rem 0.35rem; border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--text-secondary); font: inherit;
  font-size: 0.78rem; font-weight: 600; cursor: pointer; transition: all var(--trans-fast);
}
.recurrence-tab:hover { color: var(--text-primary); background: rgba(255,255,255,0.05); }
.recurrence-tab.active {
  color: white; background: var(--accent); box-shadow: 0 4px 12px rgba(99,102,241,0.25);
}

.set-aside-intro { font-size: 0.875rem; color: var(--text-secondary); margin-bottom: 1.5rem; }
.set-aside-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
.sa-item { background: rgba(0,0,0,0.3); border: 1px solid var(--border-color); padding: 1.25rem 0.5rem; border-radius: var(--radius-md); text-align: center; display: flex; flex-direction: column; gap: 0.5rem; }
.sa-item span { font-size: 0.75rem; color: var(--text-secondary); text-transform: uppercase; font-weight: 600; letter-spacing: 0.05em; }
.sa-item strong { font-size: 1.25rem; font-weight: 700; color: var(--text-primary); }
.sa-cas strong { color: var(--accent); }
.sa-cass strong { color: var(--green); }
.sa-imp strong { color: var(--yellow); }
.sa-total { text-align: center; font-size: 1.125rem; margin-bottom: 1.5rem; }
.sa-total strong { color: var(--text-primary); font-weight: 700; }
.sa-before-after { background: rgba(255,255,255,0.03); padding: 1.25rem; border-radius: var(--radius-md); font-size: 0.875rem; display: flex; flex-direction: column; gap: 0.75rem; margin-bottom: 1.5rem; }
.sa-ba-row { display: flex; justify-content: space-between; }
.sa-ba-label { color: var(--text-secondary); }
.sa-ba-old { color: var(--text-muted); text-decoration: line-through; }
.sa-ba-arrow { color: var(--text-secondary); margin: 0 0.5rem; }
.sa-ba-new { font-weight: 600; color: var(--green); }
.sa-cas-warning { background: var(--red-alpha); border-left: 4px solid var(--red); padding: 1rem 1.25rem; border-radius: 0 var(--radius-md) var(--radius-md) 0; font-size: 0.875rem; margin-bottom: 1.5rem; }
.warning-risk { color: var(--yellow); margin-top: 0.75rem; }
.sa-opt-row { display: flex; align-items: flex-start; gap: 0.75rem; font-size: 0.875rem; padding: 1.25rem; background: rgba(0,0,0,0.25); border-radius: var(--radius-md); cursor: pointer; border: 1px solid var(--border-color); transition: background var(--trans-fast); }
.sa-opt-row:hover { background: rgba(255,255,255,0.05); }
.tax-adjustment-disclaimer {
  margin-top: 1.25rem; padding: 1rem 1.1rem; border-left: 3px solid var(--yellow);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0; background: var(--yellow-alpha);
  color: var(--text-secondary); font-size: 0.78rem; line-height: 1.55;
}
.tax-adjustment-disclaimer strong { color: var(--yellow); }

/* ================= Authentication ================= */
.auth-view {
  display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 2rem;
  background: radial-gradient(circle at top center, rgba(99,102,241,0.12) 0%, transparent 60%), var(--bg-base);
}
.auth-panel {
  background: rgba(24, 24, 27, 0.6); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border-color); border-radius: var(--radius-lg); padding: 2.5rem;
  width: 100%; max-width: 420px; box-shadow: var(--shadow-lg);
}
.auth-brand { display: flex; align-items: center; gap: 1rem; margin-bottom: 2rem; }
.auth-logo { width: 48px; height: 48px; border-radius: 12px; }
.auth-brand h1 { font-size: 1.5rem; font-weight: 700; margin: 0; letter-spacing: -0.025em; }
.auth-brand p { color: var(--text-secondary); font-size: 0.875rem; margin: 0; }
.auth-tabs { display: flex; gap: 0.5rem; background: rgba(0,0,0,0.3); padding: 0.375rem; border-radius: var(--radius-md); margin-bottom: 2rem; }
.auth-tab { flex: 1; padding: 0.625rem; border: none; background: transparent; color: var(--text-secondary); font-weight: 600; font-size: 0.875rem; border-radius: var(--radius-sm); cursor: pointer; transition: all var(--trans-fast); }
.auth-tab.active { background: var(--bg-surface-hover); color: var(--text-primary); box-shadow: var(--shadow-sm); }
.auth-form { display: none; animation: fadeIn var(--trans-smooth); }
.auth-form.active { display: block; }
.auth-submit { width: 100%; margin-top: 1rem; padding: 0.875rem; font-size: 1rem; }
.auth-error { color: var(--red); font-size: 0.875rem; text-align: center; min-height: 1.25rem; margin-top: 1.25rem; font-weight: 500; }
.auth-text-button { width: 100%; margin-top: 0.85rem; border: 0; background: none; color: var(--accent); cursor: pointer; font: inherit; font-size: 0.875rem; }
.auth-text-button:hover { color: var(--text-primary); }
.google-auth-button { width: 100%; justify-content: center; background: #fff; color: #27272a; border: 1px solid #d4d4d8; text-decoration: none; }
.google-auth-button:hover { background: #f4f4f5; }
.google-mark { color: #4285f4; font-size: 1.05rem; font-weight: 700; }
.auth-divider { display: flex; align-items: center; gap: 0.75rem; margin: 1rem 0; color: var(--text-secondary); font-size: 0.75rem; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--border-color); }
.file-input { padding: 0.55rem; }
.file-input::file-selector-button { margin-right: 0.75rem; padding: 0.5rem 0.75rem; border: 0; border-radius: var(--radius-sm); background: var(--bg-surface-hover); color: var(--text-primary); cursor: pointer; }
.signup-picture-preview { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.75rem; }
.signup-picture-preview[hidden] { display: none; }
.signup-picture-preview img { width: 52px; height: 52px; border-radius: var(--radius-full); object-fit: cover; }

.account-card { max-width: 760px; }
.profile-editor { display: flex; align-items: center; gap: 1.5rem; margin-bottom: 1.5rem; }
.profile-preview { width: 88px; height: 88px; flex: 0 0 88px; border-radius: var(--radius-full); display: flex; align-items: center; justify-content: center; overflow: hidden; background: linear-gradient(135deg, var(--accent), var(--accent-hover)); font-size: 1.5rem; font-weight: 700; text-transform: uppercase; }
.profile-preview img { width: 100%; height: 100%; object-fit: cover; }
.profile-photo-actions { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.profile-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.profile-readonly { display: grid; grid-template-columns: auto 1fr; gap: 0.35rem 1rem; margin: 0.5rem 0 1.5rem; color: var(--text-secondary); font-size: 0.875rem; }
.profile-readonly strong { color: var(--text-primary); }
.account-security-button { align-self: flex-start; }
.account-password-actions { display: flex; align-items: center; gap: 0.75rem; margin-top: 1rem; flex-wrap: wrap; }
.account-inline-form { display: flex; align-items: flex-end; gap: 0.75rem; margin-top: 1rem; flex-wrap: wrap; }
.account-inline-form .form-group { flex: 1 1 280px; margin: 0; }
.two-factor-intro { margin-bottom: 1rem; line-height: 1.6; }
.two-factor-qr { display: block; width: 220px; height: 220px; margin: 0 auto 1rem; padding: 10px; border-radius: var(--radius-md); background: #fff; }
.two-factor-secret { display: block; margin: 0.5rem 0 1.25rem; padding: 0.75rem; border: 1px solid var(--border-color); border-radius: var(--radius-sm); color: #a5b4fc; background: rgba(0,0,0,0.25); text-align: center; overflow-wrap: anywhere; user-select: all; }
.otp-input { letter-spacing: 0.22em; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.recovery-code-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.65rem; margin: 1rem 0 1.5rem; }
.recovery-code-grid code { padding: 0.65rem; border-radius: var(--radius-sm); background: rgba(0,0,0,0.25); color: #a5b4fc; text-align: center; font-size: 0.9rem; user-select: all; }

@media (max-width: 600px) {
  .profile-editor { align-items: flex-start; flex-direction: column; }
  .profile-fields { grid-template-columns: 1fr; }
  .recovery-code-grid { grid-template-columns: 1fr; }
}

/* ================= Toast & Loaders ================= */
.toast-container { position: fixed; bottom: 2rem; right: 2rem; display: flex; flex-direction: column; gap: 0.75rem; z-index: 200; pointer-events: none; }
.toast {
  background: var(--bg-surface-hover); backdrop-filter: blur(16px); border: 1px solid var(--border-color);
  padding: 1rem 1.25rem; border-radius: var(--radius-sm); color: var(--text-primary); box-shadow: var(--shadow-lg);
  font-size: 0.875rem; font-weight: 500; display: flex; align-items: center; gap: 0.75rem;
  animation: slideInUp 0.3s cubic-bezier(0.16, 1, 0.3, 1), fadeOut 0.5s ease 3s forwards; pointer-events: auto;
}
.toast-success { border-left: 4px solid var(--green); }
.toast-error { border-left: 4px solid var(--red); }
.toast-info { border-left: 4px solid var(--accent); }
@keyframes slideInUp { from { opacity: 0; transform: translateY(20px) scale(0.95); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes fadeOut { to { opacity: 0; transform: translateY(10px); } }

.loading-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center;
  z-index: 1000; opacity: 0; pointer-events: none; transition: opacity var(--trans-smooth);
}
.loading-overlay.active { opacity: 1; pointer-events: auto; }
.spinner { width: 40px; height: 40px; border: 3px solid rgba(255,255,255,0.1); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ================= Mobile Responsiveness ================= */

@media (max-width: 1220px) {
  .overview-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar { position: fixed; top: 0; bottom: 0; left: 0; transform: translateX(-100%); width: 280px !important; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: translateX(0); }
  .topbar-toggle { display: block; }
  .main { padding: 0; }
  .section { padding: 0 1rem 1.5rem; }
  .topbar { padding: 1.25rem 1rem; }
  .cards-row { grid-template-columns: 1fr; }
  .item-row, .slot-item { flex-direction: column; align-items: flex-start; gap: 0.875rem; }
  .item-amount, .slot-amount { text-align: left; }
  .item-actions, .slot-actions { width: 100%; justify-content: flex-end; border-top: 1px solid rgba(255,255,255,0.05); padding-top: 0.875rem; margin-top: 0.25rem; }
  .modal { max-height: calc(100vh - 2rem); margin: 1rem; }
  .set-aside-grid { grid-template-columns: 1fr; }
}
