@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700&display=swap');

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

:root {
    --font: 'Outfit', 'Inter', -apple-system, sans-serif;
    
    /* Premium Color Palette */
    --primary: #6366f1; /* Indigo */
    --primary-light: rgba(99, 102, 241, 0.08);
    --primary-dark: #4f46e5;
    
    --success: #10b981; /* Emerald */
    --success-light: rgba(16, 185, 129, 0.08);
    
    --warning: #f59e0b; /* Amber */
    --warning-light: rgba(245, 158, 11, 0.08);
    
    --danger: #ef4444; /* Rose */
    --danger-light: rgba(239, 68, 68, 0.08);
    
    /* Backgrounds and Cards */
    --bg: #fafbfd;
    --card: #ffffff;
    --card-glass: rgba(255, 255, 255, 0.75);
    --bg-glass: rgba(248, 250, 252, 0.6);
    
    /* Typography colors */
    --text: #0f172a; /* Slate 900 */
    --text-secondary: #475569; /* Slate 600 */
    --text-muted: #94a3b8; /* Slate 400 */
    
    /* Borders and shadows */
    --border: rgba(226, 232, 240, 0.8);
    --border-light: rgba(241, 245, 249, 0.8);
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.02);
    --shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.02);
    --shadow-md: 0 20px 40px -15px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 30px 60px -20px rgba(0, 0, 0, 0.12), 0 4px 12px rgba(0, 0, 0, 0.04);
    
    /* Radius */
    --radius: 24px;
    --radius-sm: 14px;
    --radius-xs: 8px;
    
    /* Ring and focus */
    --ring: rgba(99, 102, 241, 0.25);
    
    /* Transitions */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

:root[data-theme="dark"] {
    --bg: #090d16;
    --card: #111726;
    --card-glass: rgba(17, 23, 38, 0.7);
    --bg-glass: rgba(9, 13, 22, 0.6);
    
    --text: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #475569;
    
    --border: rgba(51, 65, 85, 0.4);
    --border-light: rgba(51, 65, 85, 0.2);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
    --shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 20px 40px -15px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 30px 60px -20px rgba(0, 0, 0, 0.5);
    --ring: rgba(129, 140, 248, 0.5);
}

/* Global Styles */
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
    transition: background-color 0.4s ease, color 0.4s ease;
}

#app {
    display: flex;
    flex-direction: row;
    min-height: 100vh;
    width: 100%;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Glassmorphism General Style */
.glass {
    background: var(--card-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
}

/* Focus outline */
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* NAVIGATION (Sidebar Desktop) */
#nav-bar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    background: var(--card-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 32px 24px;
    z-index: 100;
    transition: var(--transition);
}

#nav-bar:empty {
    display: none !important;
}

#nav-bar:empty ~ #content {
    margin-left: 0 !important;
    padding: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    margin-bottom: 32px;
}
.brand-logo {
    font-size: 28px;
    background: linear-gradient(135deg, var(--primary), var(--success));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 4px 10px rgba(99, 102, 241, 0.2));
}
.brand-name {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text);
}

.nav-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 20px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    width: 100%;
    position: relative;
}

.nav-btn:hover {
    background: var(--primary-light);
    color: var(--primary);
    transform: translateX(4px);
}

.nav-btn.active {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 8px 20px -6px var(--primary);
}

.nav-btn.active:hover {
    transform: none;
    color: #ffffff;
}

.nav-btn .icon {
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

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

.nav-settings {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    margin-top: 16px;
}

.lang-toggle {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 42px;
    border: 1px solid var(--border);
    background: var(--card-glass);
    color: var(--text-secondary);
    font-size: 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.lang-toggle:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

/* Main Content Area */
#content {
    margin-left: 280px;
    flex-grow: 1;
    padding: 40px 48px;
    max-width: 1300px;
    min-height: 100vh;
    transition: margin 0.3s ease;
}

#content > div {
    animation: fadeInUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 16px;
    animation: fadeInUp 0.4s ease-out;
}

.page-header h2 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text);
}

.month-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}

.month-nav button {
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s ease;
}

.month-nav button:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

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

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 22px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    box-shadow: var(--shadow-sm);
}

.btn:active {
    transform: scale(0.96);
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: 0 10px 24px -8px var(--primary);
}

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

.btn-success:hover {
    background: #059669;
    box-shadow: 0 10px 24px -8px var(--success);
}

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

.btn-danger:hover {
    background: #dc2626;
    box-shadow: 0 10px 24px -8px var(--danger);
}

.btn-warning {
    background: var(--warning);
    color: #ffffff;
}

.btn-warning:hover {
    background: #d97706;
    box-shadow: 0 10px 24px -8px var(--warning);
}

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

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

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
    border-radius: var(--radius-xs);
}

.btn-xs {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: var(--radius-xs);
    box-shadow: none;
}

/* Cards & Grid Containers */
.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-light);
    overflow: hidden;
    transition: var(--transition);
    animation: fadeInUp 0.4s ease-out;
}

.card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border);
}

.card-header {
    padding: 24px 28px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.2px;
}

.card-body {
    padding: 28px;
}

/* Summary Cards (Dashboard) */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.summary-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-light);
    animation: fadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
    position: relative;
    overflow: hidden;
}

.summary-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--text-muted);
}

.summary-card.green::before { background: var(--success); }
.summary-card.red::before { background: var(--danger); }
.summary-card.blue::before { background: var(--primary); }

.summary-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--border);
}

.summary-card .label {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-weight: 600;
    letter-spacing: 0.8px;
}

.summary-card .value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text);
    margin-top: 10px;
    letter-spacing: -0.5px;
}

.summary-card .value.green { color: var(--success); }
.summary-card .value.red { color: var(--danger); }
.summary-card .value.blue { color: var(--primary); }

.summary-card.highlight {
    background: linear-gradient(135deg, var(--primary-light), var(--card));
    border-color: rgba(99, 102, 241, 0.2);
}

/* Animations delay for cards */
.summary-card:nth-child(1) { animation-delay: 0.05s; }
.summary-card:nth-child(2) { animation-delay: 0.1s; }
.summary-card:nth-child(3) { animation-delay: 0.15s; }
.summary-card:nth-child(4) { animation-delay: 0.2s; }

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

/* Filter Controls */
.filters {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
    align-items: center;
    background: var(--bg-glass);
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
}

.filters select, .filters input {
    padding: 9px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    background: var(--card);
    color: var(--text);
    transition: var(--transition);
}

.filters select:focus, .filters input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--ring);
}

.filters .filter-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 600;
}

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

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

th {
    text-align: left;
    padding: 16px 20px;
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-weight: 700;
    letter-spacing: 0.8px;
    background: var(--bg-glass);
    border-bottom: 2px solid var(--border-light);
}

td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    font-size: 14px;
    transition: var(--transition);
}

tr:hover td {
    background: var(--primary-light);
}

.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.font-bold { font-weight: 600; }
.nowrap { white-space: nowrap; }

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.2px;
}

.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-danger { background: var(--danger-light); color: var(--danger); }

/* Expandable Rows (Products) */
.expand-toggle {
    cursor: pointer;
    user-select: none;
    color: var(--primary);
    font-size: 13px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 100px;
    background: var(--primary-light);
    transition: var(--transition);
}

.expand-toggle:hover {
    background: var(--primary);
    color: #ffffff;
}

.products-row td {
    padding: 0;
    background: var(--bg);
}

.products-inner {
    padding: 20px 24px 20px 48px;
    border-left: 3px solid var(--primary);
}

.products-table th {
    padding: 10px 16px;
    font-size: 10px;
    background: var(--border-light);
}

.products-table td {
    padding: 10px 16px;
    font-size: 13px;
    border-bottom: 1px solid var(--border-light);
}

/* Goals and Targets */
.goal-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.goal-item {
    background: var(--card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 20px;
    transition: var(--transition);
}

.goal-item:hover {
    border-color: var(--border);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.goal-info {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 12px;
}

.goal-info .name {
    font-weight: 600;
    font-size: 16px;
    color: var(--text);
}

.goal-info .desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.goal-info .amount {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap;
}

.goal-info .actions {
    display: flex;
    gap: 6px;
}

.goal-bar {
    height: 12px;
    background: var(--border-light);
    border-radius: 100px;
    overflow: hidden;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

.goal-bar-fill {
    height: 100%;
    border-radius: 100px;
    background: linear-gradient(90deg, var(--primary), var(--success));
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.goal-meta {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    margin-top: 8px;
}

/* Payments List */
.payment-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.payment-item {
    background: var(--card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 20px;
    transition: var(--transition);
}

.payment-item:hover {
    border-color: var(--border);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

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

.payment-header .date {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 600;
}

.payment-header .amount {
    font-size: 22px;
    font-weight: 700;
    color: var(--success);
}

.payment-notes {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    line-height: 1.6;
}

.payment-jobs {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

/* Reports List */
.report-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.report-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 18px 24px;
    transition: var(--transition);
}

.report-item:hover {
    border-color: var(--border);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.report-info .name {
    font-weight: 600;
    font-size: 15px;
}

.report-info .meta {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.report-actions {
    display: flex;
    gap: 8px;
}

/* Modal Windows */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: opacity 0.3s;
}

.modal-overlay.hidden { display: none; }

.modal {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 580px;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid var(--border);
    animation: modalIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.94) translateY(24px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 32px;
    border-bottom: 1px solid var(--border-light);
}

.modal-header h3 {
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 32px;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 0.5;
    transition: var(--transition);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: var(--text);
    background: var(--border-light);
}

.modal-body {
    padding: 32px;
}

.modal-footer {
    padding: 20px 32px;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: var(--bg-glass);
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    letter-spacing: 0.2px;
}

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 13px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    background: var(--bg);
    color: var(--text);
    transition: var(--transition);
    font-family: inherit;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--card);
    box-shadow: 0 0 0 4px var(--ring);
}

.form-group textarea {
    resize: vertical;
    min-height: 90px;
}

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

.form-group .error {
    font-size: 12px;
    color: var(--danger);
    margin-top: 6px;
    font-weight: 500;
}

.form-group .hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    cursor: pointer;
    font-weight: 500;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    border-radius: var(--radius-xs);
    accent-color: var(--primary);
    cursor: pointer;
}

/* Toast Messages */
.toast {
    position: fixed;
    bottom: 32px;
    right: 32px;
    padding: 16px 28px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
    z-index: 2000;
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    max-width: 400px;
    display: flex;
    align-items: center;
    gap: 12px;
    backdrop-filter: blur(8px);
}

.toast.hidden { display: none; }
.toast.success { background: rgba(16, 185, 129, 0.95); border: 1px solid rgba(16, 185, 129, 0.2); }
.toast.error { background: rgba(239, 68, 68, 0.95); border: 1px solid rgba(239, 68, 68, 0.2); }
.toast.info { background: rgba(99, 102, 241, 0.95); border: 1px solid rgba(99, 102, 241, 0.2); }

@keyframes toastIn {
    from { opacity: 0; transform: translateY(40px) scale(0.9); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 64px 32px;
    color: var(--text-secondary);
    animation: fadeInUp 0.4s ease-out;
}

.empty-state .icon {
    font-size: 64px;
    margin-bottom: 20px;
    filter: drop-shadow(0 8px 16px rgba(0,0,0,0.06));
}

.empty-state p {
    font-size: 15px;
    max-width: 320px;
    margin: 0 auto 16px;
    line-height: 1.6;
    color: var(--text-secondary);
}

/* Loading Spinners */
.loading {
    text-align: center;
    padding: 64px 20px;
    color: var(--text-muted);
}

.spinner {
    width: 42px;
    height: 42px;
    border: 4px solid var(--border-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 20px;
}

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

/* Goals Global View (Dashboard) */
.goals-global-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.goal-card {
    background: var(--card);
    border-radius: var(--radius-sm);
    padding: 24px;
    text-align: center;
    border: 1px solid var(--border-light);
    transition: var(--transition);
}

.goal-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
    border-color: var(--border);
}

.goal-card .glabel {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-weight: 600;
    letter-spacing: 0.8px;
}

.goal-card .gvalue {
    font-size: 26px;
    font-weight: 700;
    margin-top: 8px;
    letter-spacing: -0.5px;
}

.goal-card.highlight { background: linear-gradient(135deg, var(--primary-light), var(--card)); border-color: rgba(99, 102, 241, 0.2); }
.goal-card.success { background: linear-gradient(135deg, var(--success-light), var(--card)); border-color: rgba(16, 185, 129, 0.2); }
.goal-card.danger { background: linear-gradient(135deg, var(--danger-light), var(--card)); border-color: rgba(239, 68, 68, 0.2); }

.goal-progress-bar {
    height: 16px;
    background: var(--border-light);
    border-radius: 100px;
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.05);
}

.goal-progress-fill {
    height: 100%;
    border-radius: 100px;
    background: linear-gradient(90deg, var(--primary), var(--success));
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.goal-progress-labels {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
}

/* Auth Screens */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 90vh;
    animation: fadeInUp 0.4s ease-out;
    width: 100%;
}

.auth-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 56px 44px;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-light);
    text-align: center;
}

.auth-header {
    margin-bottom: 36px;
}

.auth-icon {
    font-size: 64px;
    margin-bottom: 20px;
    filter: drop-shadow(0 8px 16px rgba(0,0,0,0.08));
}

.auth-header h2 {
    font-size: 26px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.5px;
}

/* MOBILE AND TABLET RESPONSIVE REDESIGN (APP-FIRST) */
@media (max-width: 768px) {
    #app {
        flex-direction: column;
    }
    
    /* Header top bar */
    .nav-brand {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 64px;
        background: var(--card-glass);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-bottom: 1px solid var(--border);
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0 20px;
        margin-bottom: 0;
        z-index: 100;
    }
    .brand-logo { font-size: 24px; }
    .brand-name { font-size: 18px; }
    
    /* Settings in top bar */
    .nav-settings {
        position: fixed;
        top: 11px;
        right: 20px;
        display: flex;
        gap: 6px;
        z-index: 101;
        padding: 0;
        border: none;
        margin: 0;
    }
    
    .lang-toggle {
        width: 38px;
        height: 38px;
        padding: 0;
        border-radius: 50%;
        font-size: 12px;
        background: var(--bg);
    }
    
    /* Bottom Navigation Bar */
    .nav-links {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 72px;
        background: var(--card-glass);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-top: 1px solid var(--border);
        display: flex;
        flex-direction: row;
        justify-content: space-around;
        align-items: center;
        padding: 0 10px;
        z-index: 100;
        gap: 0;
    }
    
    .nav-btn {
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 4px;
        padding: 6px 0;
        font-size: 10px;
        border-radius: var(--radius-sm);
        height: 100%;
        background: transparent;
        color: var(--text-secondary);
        width: auto;
    }
    
    .nav-btn .icon {
        font-size: 22px;
    }
    
    .nav-btn:hover {
        background: transparent;
        transform: none;
    }
    
    .nav-btn.active {
        background: transparent;
        color: var(--primary);
        box-shadow: none;
        font-weight: 600;
    }
    
    .nav-btn.active .icon {
        transform: scale(1.1);
        filter: drop-shadow(0 2px 8px var(--primary-light));
    }
    
    #nav-bar {
        position: static;
        width: auto;
        height: auto;
        background: transparent;
        backdrop-filter: none;
        border: none;
        padding: 0;
        display: block;
    }
    
    /* Content Margin adjustment */
    #content {
        margin-left: 0;
        margin-top: 64px;
        margin-bottom: 84px;
        padding: 24px 20px;
        width: 100%;
    }
    
    /* FLOATING ACTION BUTTON (FAB) FOR ADDING NEW ITEMS */
    .page-header button[data-action^="open"] {
        position: fixed;
        bottom: 96px; /* Floating above bottom navigation */
        right: 24px;
        z-index: 99;
        border-radius: 50% !important;
        width: 60px;
        height: 60px;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
        font-size: 0 !important; /* Hide original text */
        overflow: hidden;
        border: none;
        transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.2s;
    }
    
    .page-header button[data-action^="open"]::before {
        content: '+';
        color: #ffffff;
        font-size: 30px;
        font-weight: 400;
        position: absolute;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        height: 100%;
    }
    
    .page-header button[data-action^="open"]:active {
        transform: scale(0.9) rotate(45deg);
    }
    
    .page-header button[data-action^="open"][data-action="openPaymentForm"] {
        box-shadow: 0 8px 24px rgba(16, 185, 129, 0.4);
    }
    
    /* Hide the duplicated Add Button inside empty states when on mobile (as FAB handles it) */
    .empty-state button[data-action^="open"] {
        display: none;
    }
    
    /* RESPONSIVE TABLE TO CARD CONVERSION */
    .table-wrap table, 
    .table-wrap thead, 
    .table-wrap tbody, 
    .table-wrap th, 
    .table-wrap td, 
    .table-wrap tr { 
        display: block; 
    }
    
    /* Hide column headers visually */
    .table-wrap thead tr { 
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    
    .table-wrap tr {
        background: var(--card);
        border: 1px solid var(--border-light);
        border-radius: var(--radius-sm);
        margin-bottom: 16px;
        padding: 16px;
        position: relative;
        box-shadow: var(--shadow-sm);
    }
    
    .table-wrap tr:hover td {
        background: transparent;
    }
    
    .table-wrap td { 
        border: none;
        border-bottom: 1px solid var(--border-light); 
        position: relative;
        padding: 10px 0 10px 45%; 
        font-size: 13.5px;
        text-align: right;
        min-height: 42px;
    }
    
    .table-wrap td:last-child {
        border-bottom: 0;
        padding-bottom: 0;
        margin-top: 8px;
        text-align: center;
        display: flex;
        justify-content: center;
        gap: 8px;
    }
    
    .table-wrap td::before { 
        position: absolute;
        top: 10px;
        left: 0;
        width: 40%; 
        padding-right: 10px; 
        white-space: nowrap;
        text-align: left;
        font-weight: 600;
        color: var(--text-secondary);
        content: attr(data-label);
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    
    /* Inner Products Table adjustments */
    .products-inner {
        padding: 16px;
        border-left: none;
        border-top: 3px solid var(--primary);
    }
    
    .products-table tr {
        border: 1px solid var(--border);
        background: var(--bg);
        margin-bottom: 10px;
        padding: 10px;
    }
    
    .products-table td {
        padding: 8px 0 8px 45%;
        border-bottom: 1px solid var(--border-light);
    }
    
    .products-table td::before {
        top: 8px;
    }
    
    .products-table td:last-child {
        border-bottom: 0;
    }
}

@media (max-width: 480px) {
    #content {
        padding: 16px;
    }
    
    .summary-grid {
        grid-template-columns: 1fr;
    }
    
    .page-header h2 {
        font-size: 22px;
    }
    
    .auth-card {
        padding: 40px 24px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
}
