/* ========================================
   Finance Manager - Modern UI Stylesheet
   ======================================== */

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --primary-glow: rgba(99, 102, 241, 0.35);
    --success: #22c55e;
    --success-bg: #dcfce7;
    --danger: #ef4444;
    --danger-bg: #fee2e2;
    --warning: #f59e0b;
    --warning-bg: #fef3c7;
    --info: #3b82f6;
    --info-bg: #dbeafe;

    --bg: #f0f2f7;
    --bg-card: rgba(255, 255, 255, 0.82);
    --bg-card-solid: #ffffff;
    --bg-sidebar: #12103d;
    --text: #1e293b;
    --text-light: #64748b;
    --text-sidebar: #c7c4f0;
    --border: rgba(226, 232, 240, 0.8);

    --radius: 16px;
    --radius-sm: 10px;
    --radius-xs: 6px;
    --shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.03);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.06), 0 1px 4px rgba(0,0,0,0.04);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.04);
    --shadow-xl: 0 20px 60px rgba(0,0,0,0.12), 0 8px 20px rgba(0,0,0,0.06);
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-spring: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);

    --sidebar-width: 270px;

    --gradient-primary: linear-gradient(135deg, #6366f1, #8b5cf6);
    --gradient-success: linear-gradient(135deg, #22c55e, #16a34a);
    --gradient-danger: linear-gradient(135deg, #ef4444, #dc2626);
    --gradient-warning: linear-gradient(135deg, #f59e0b, #d97706);
    --gradient-info: linear-gradient(135deg, #3b82f6, #2563eb);
    --gradient-bg: linear-gradient(135deg, #eff1f7 0%, #e8e4f3 50%, #eef0fa 100%);
}

[data-theme="dark"] {
    --bg: #0c0e1a;
    --bg-card: rgba(22, 28, 50, 0.75);
    --bg-card-solid: #161c32;
    --bg-sidebar: #0a0c1a;
    --text: #e8eaf0;
    --text-light: #a0a9c4;
    --text-sidebar: #a0a3c0;
    --border: rgba(55, 65, 90, 0.6);
    --shadow: 0 1px 3px rgba(0,0,0,0.3), 0 4px 12px rgba(0,0,0,0.2);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.3), 0 1px 4px rgba(0,0,0,0.2);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.4), 0 4px 12px rgba(0,0,0,0.3);
    --shadow-xl: 0 20px 60px rgba(0,0,0,0.5);
    --gradient-bg: linear-gradient(135deg, #0c0e1a 0%, #12102a 50%, #0e101e 100%);
    --primary-glow: rgba(99, 102, 241, 0.25);
    --success-bg: rgba(34, 197, 94, 0.15);
    --danger-bg: rgba(239, 68, 68, 0.15);
    --warning-bg: rgba(245, 158, 11, 0.15);
    --info-bg: rgba(59, 130, 246, 0.15);
}

/* ========== Reset & Base ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--gradient-bg);
    color: var(--text);
    display: flex;
    min-height: 100vh;
    line-height: 1.6;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--primary); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: var(--primary-dark); text-decoration: none; }

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

/* ========== Animations ========== */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes slideInDown {
    from { opacity: 0; transform: translateY(-12px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes progressFill {
    from { width: 0; }
}

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

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 8px var(--primary-glow); }
    50% { box-shadow: 0 0 20px var(--primary-glow); }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

.shake { animation: shake 0.4s ease; }

/* Page load animation */
.page-content {
    animation: fadeIn 0.4s ease;
    flex: 1;
}

/* Staggered card animation */
.page-content .card,
.page-content .stat-card {
    animation: fadeInUp 0.5s ease backwards;
}
.page-content > :nth-child(1) { animation-delay: 0.05s; }
.page-content > :nth-child(2) { animation-delay: 0.1s; }
.page-content > :nth-child(3) { animation-delay: 0.15s; }
.page-content > :nth-child(4) { animation-delay: 0.2s; }
.page-content > :nth-child(5) { animation-delay: 0.25s; }
.page-content > :nth-child(6) { animation-delay: 0.3s; }

.stats-grid .stat-card:nth-child(1) { animation-delay: 0.05s; }
.stats-grid .stat-card:nth-child(2) { animation-delay: 0.1s; }
.stats-grid .stat-card:nth-child(3) { animation-delay: 0.15s; }
.stats-grid .stat-card:nth-child(4) { animation-delay: 0.2s; }

/* ========== Sidebar ========== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    color: var(--text-sidebar);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    transition: transform var(--transition);
    border-right: 1px solid rgba(255,255,255,0.05);
    overflow: hidden;
}

.sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(ellipse at top left, rgba(99, 102, 241, 0.15), transparent 60%),
        radial-gradient(ellipse at bottom right, rgba(139, 92, 246, 0.1), transparent 60%);
    pointer-events: none;
    z-index: 0;
}

.sidebar > * { position: relative; z-index: 1; }

.sidebar-header {
    padding: 1.5rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,0.07);
}

.sidebar-header .logo-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-header .logo-icon {
    width: 38px;
    height: 38px;
    background: var(--gradient-primary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
    transition: transform var(--transition-spring), box-shadow var(--transition);
}

.sidebar-header .logo-icon:hover {
    transform: rotate(-8deg) scale(1.05);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.sidebar-header .logo-icon svg { width: 20px; height: 20px; }

.sidebar-header h2 {
    font-size: 1.15rem;
    font-weight: 700;
    background: linear-gradient(135deg, #c7c4f0, #a78bfa, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.02em;
}

.sidebar-toggle { display: none; background: none; border: none; color: var(--text-sidebar); cursor: pointer; padding: 0.5rem; border-radius: var(--radius-xs); transition: background var(--transition-fast); }
.sidebar-toggle:hover { background: rgba(255,255,255,0.08); }

.nav-links {
    list-style: none;
    padding: 0.75rem 0.75rem;
    flex: 1;
    overflow-y: auto;
}

.nav-links li {
    margin-bottom: 2px;
}

.nav-links li a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 1rem;
    color: var(--text-sidebar);
    text-decoration: none;
    transition: all var(--transition);
    font-size: 0.9rem;
    border-radius: var(--radius-sm);
    position: relative;
    font-weight: 450;
}

.nav-links li a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%) scaleY(0);
    width: 3px;
    height: 60%;
    background: var(--gradient-primary);
    border-radius: 0 4px 4px 0;
    transition: transform var(--transition-spring);
}

.nav-links li a:hover {
    background: rgba(255,255,255,0.07);
    color: #fff;
    text-decoration: none;
    transform: translateX(2px);
}

.nav-links li a:hover::before {
    transform: translateY(-50%) scaleY(1);
}

.nav-links li.active a {
    background: rgba(99, 102, 241, 0.15);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.15);
}

.nav-links li.active a::before {
    transform: translateY(-50%) scaleY(1);
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.6);
}

.nav-links li a svg { width: 19px; height: 19px; flex-shrink: 0; opacity: 0.75; transition: opacity var(--transition-fast); }
.nav-links li a:hover svg, .nav-links li.active a svg { opacity: 1; }

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255,255,255,0.07);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.6rem;
    font-size: 0.85rem;
    color: rgba(255,255,255,0.7);
}

.user-info .user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.75rem;
    color: #fff;
    flex-shrink: 0;
}

.user-info svg { width: 16px; height: 16px; }

.btn-logout {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-sidebar);
    opacity: 0.6;
    font-size: 0.82rem;
    text-decoration: none;
    padding: 0.4rem 0.5rem;
    border-radius: var(--radius-xs);
    transition: all var(--transition-fast);
}

.btn-logout:hover { opacity: 1; text-decoration: none; background: rgba(239, 68, 68, 0.12); color: #fca5a5; }
.btn-logout svg { width: 15px; height: 15px; }

/* ========== Content ========== */
.content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.content-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.content-header h1 {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
}

.mobile-menu-btn { display: none; background: none; border: none; color: var(--text); cursor: pointer; padding: 0.5rem; border-radius: var(--radius-xs); transition: background var(--transition-fast); }
.mobile-menu-btn:hover { background: rgba(0,0,0,0.05); }

.header-actions { display: flex; gap: 0.5rem; align-items: center; }

.page-content { padding: 1.75rem 2rem 3rem; }

/* ========== Cards (Glassmorphism) ========== */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: transform var(--transition), box-shadow var(--transition);
}

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

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

.card-header h3 {
    font-size: 1.05rem;
    font-weight: 650;
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-header h3 svg { width: 18px; height: 18px; color: var(--primary); }

/* ========== Stat Cards (Dashboard) ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    opacity: 0;
    transition: opacity var(--transition);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform var(--transition-spring);
}

.stat-card:hover .stat-icon {
    transform: scale(1.08);
}

.stat-icon svg { width: 24px; height: 24px; }

.stat-icon.income { background: linear-gradient(135deg, rgba(34,197,94,0.15), rgba(34,197,94,0.05)); color: var(--success); }
.stat-icon.expense { background: linear-gradient(135deg, rgba(239,68,68,0.15), rgba(239,68,68,0.05)); color: var(--danger); }
.stat-icon.balance { background: linear-gradient(135deg, rgba(59,130,246,0.15), rgba(59,130,246,0.05)); color: var(--info); }
.stat-icon.savings { background: linear-gradient(135deg, rgba(245,158,11,0.15), rgba(245,158,11,0.05)); color: var(--warning); }

.stat-card:has(.stat-icon.income)::before { background: var(--gradient-success); }
.stat-card:has(.stat-icon.expense)::before { background: var(--gradient-danger); }
.stat-card:has(.stat-icon.balance)::before { background: var(--gradient-info); }
.stat-card:has(.stat-icon.savings)::before { background: var(--gradient-warning); }

.stat-info h4 { font-size: 0.78rem; color: var(--text-light); font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 0.15rem; }
.stat-info .stat-value { font-size: 1.5rem; font-weight: 750; letter-spacing: -0.02em; }
.stat-info .stat-change { font-size: 0.78rem; margin-top: 0.2rem; font-weight: 500; display: inline-flex; align-items: center; gap: 0.2rem; padding: 0.1rem 0.4rem; border-radius: 999px; }
.stat-change.positive { color: var(--success); background: var(--success-bg); }
.stat-change.negative { color: var(--danger); background: var(--danger-bg); }

/* ========== Charts Grid ========== */
.charts-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.chart-container { position: relative; height: 300px; }

/* ========== Buttons ========== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 550;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    line-height: 1.5;
    position: relative;
    overflow: hidden;
    letter-spacing: 0.01em;
}

.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(0.98); }
.btn svg { width: 17px; height: 17px; }

.btn-primary {
    background: var(--gradient-primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}
.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
    color: #fff;
}

.btn-success {
    background: var(--gradient-success);
    color: #fff;
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.3);
}
.btn-success:hover {
    box-shadow: 0 6px 20px rgba(34, 197, 94, 0.4);
    color: #fff;
}

.btn-danger {
    background: var(--gradient-danger);
    color: #fff;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.25);
}
.btn-danger:hover {
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.35);
    color: #fff;
}

.btn-outline {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    box-shadow: var(--shadow);
}
.btn-outline:hover { background: var(--bg-card-solid); box-shadow: var(--shadow-md); border-color: var(--primary); color: var(--primary); }

.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; border-radius: var(--radius-xs); }
.btn-sm svg { width: 14px; height: 14px; }

.btn-icon {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    position: relative;
}
.btn-icon:hover { background: var(--bg-card); color: var(--primary); transform: rotate(15deg); }
.btn-icon svg { width: 20px; height: 20px; }

/* Button tooltip */
.btn[title], .btn-icon[title], .btn-sm[title] {
    position: relative;
}

/* ========== Forms ========== */
.form-group {
    margin-bottom: 1.15rem;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.form-control {
    width: 100%;
    padding: 0.65rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.92rem;
    background: var(--bg-card-solid);
    color: var(--text);
    transition: all var(--transition);
    font-family: inherit;
}

.form-control:hover {
    border-color: var(--text-light);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-glow);
    background: var(--bg-card-solid);
}

.form-control::placeholder {
    color: var(--text-light);
    opacity: 0.6;
}

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M4.646 5.646a.5.5 0 0 1 .708 0L8 8.293l2.646-2.647a.5.5 0 0 1 .708.708l-3 3a.5.5 0 0 1-.708 0l-3-3a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
    gap: 1rem;
}

.form-inline {
    display: flex;
    gap: 0.75rem;
    align-items: end;
    flex-wrap: wrap;
}

.form-inline .form-group { flex: 1; min-width: 140px; margin-bottom: 0; }
.form-row .form-group { margin-bottom: 0; }

/* ========== Tables ========== */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-sm);
}

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

thead th {
    padding: 0.85rem 1rem;
    text-align: left;
    font-size: 0.72rem;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-light);
    border-bottom: 2px solid var(--border);
    background: var(--bg-card-solid);
    position: sticky;
    top: 0;
    z-index: 5;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.04);
}

tbody td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.88rem;
    transition: background var(--transition-fast);
}

tbody tr {
    transition: all var(--transition-fast);
}

tbody tr:nth-child(even) {
    background: rgba(99, 102, 241, 0.02);
}

[data-theme="dark"] tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

tbody tr:hover {
    background: rgba(99, 102, 241, 0.06);
}

[data-theme="dark"] tbody tr:hover {
    background: rgba(99, 102, 241, 0.08);
}

tbody tr:last-child td {
    border-bottom: none;
}

.amount-in { color: var(--success); font-weight: 650; }
.amount-out { color: var(--danger); font-weight: 650; }

/* Text Truncation Utilities */
.text-truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

td.td-note {
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 768px) {
    td.td-note { max-width: 120px; }
}

.budget-header .budget-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

/* ========== Category Badge ========== */
.category-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.7rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 550;
    transition: transform var(--transition-fast);
}

.category-badge:hover {
    transform: scale(1.05);
}

/* ========== Alerts ========== */
.alert {
    padding: 0.85rem 1.25rem;
    border-radius: var(--radius-sm);
    margin: 0 2rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.88rem;
    font-weight: 500;
    animation: slideInDown 0.4s ease backwards;
    border-left: 4px solid transparent;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.alert-success { background: var(--success-bg); color: #166534; border-left-color: var(--success); }
.alert-danger { background: var(--danger-bg); color: #991b1b; border-left-color: var(--danger); }
.alert-warning { background: var(--warning-bg); color: #92400e; border-left-color: var(--warning); }
.alert-info { background: var(--info-bg); color: #1e40af; border-left-color: var(--info); }

[data-theme="dark"] .alert-success { color: #86efac; }
[data-theme="dark"] .alert-danger { color: #fca5a5; }
[data-theme="dark"] .alert-warning { color: #fcd34d; }
[data-theme="dark"] .alert-info { color: #93c5fd; }

.alert-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: inherit;
    opacity: 0.6;
    transition: opacity var(--transition-fast);
    padding: 0.25rem;
    border-radius: 50%;
    line-height: 1;
}
.alert-close:hover { opacity: 1; }

/* ========== Modal ========== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 200;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active { display: flex; }

.modal {
    background: var(--bg-card-solid);
    border-radius: var(--radius);
    padding: 2rem;
    width: 90%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: scaleIn 0.3s ease;
    border: 1px solid var(--border);
}

.modal h2 {
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 1.75rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

/* ========== Budget Progress ========== */
.budget-item {
    margin-bottom: 1.25rem;
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}

.budget-item:hover {
    background: rgba(99, 102, 241, 0.03);
}

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

.budget-header .budget-name { font-weight: 600; font-size: 0.9rem; }
.budget-header .budget-amount { font-size: 0.82rem; color: var(--text-light); font-weight: 500; }

.progress-bar {
    height: 10px;
    background: var(--border);
    border-radius: 999px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    animation: progressFill 1s ease backwards;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    background-size: 200% 100%;
    animation: shimmer 2s ease-in-out infinite;
}

.progress-fill.ok { background: var(--gradient-success); }
.progress-fill.warning { background: var(--gradient-warning); }
.progress-fill.danger { background: var(--gradient-danger); }

/* ========== Quick Add ========== */
.quick-add {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.quick-add input {
    flex: 1;
    padding: 0.85rem 1.25rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--text);
    transition: all var(--transition);
    font-family: inherit;
}

.quick-add input:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 4px var(--primary-glow);
}

.quick-add-hint {
    font-size: 0.78rem;
    color: var(--text-light);
    margin-top: 0;
    margin-bottom: 2rem;
    opacity: 0.7;
}

/* ========== Pagination ========== */
.pagination {
    display: flex;
    gap: 0.3rem;
    justify-content: center;
    margin-top: 1.5rem;
}

.pagination a, .pagination span {
    padding: 0.5rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: var(--text);
    text-decoration: none;
    transition: all var(--transition-fast);
    font-weight: 500;
}

.pagination a:hover {
    background: var(--bg-card);
    text-decoration: none;
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-1px);
}

.pagination .active {
    background: var(--gradient-primary);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

/* ========== Empty State ========== */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-light);
}

.empty-state svg { width: 52px; height: 52px; margin-bottom: 1rem; opacity: 0.35; }
.empty-state p { margin-bottom: 1.25rem; font-size: 0.95rem; }

/* ========== Auth Pages ========== */
.auth-page {
    min-height: 100vh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-bg);
    padding: 1rem;
    position: relative;
    overflow: hidden;
}

.auth-page::before {
    content: '';
    position: absolute;
    top: -40%;
    left: -20%;
    width: 80%;
    height: 80%;
    background: radial-gradient(ellipse, rgba(99, 102, 241, 0.12), transparent 70%);
    pointer-events: none;
}

.auth-page::after {
    content: '';
    position: absolute;
    bottom: -30%;
    right: -20%;
    width: 70%;
    height: 70%;
    background: radial-gradient(ellipse, rgba(139, 92, 246, 0.1), transparent 70%);
    pointer-events: none;
}

.auth-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 4px);
    box-shadow: var(--shadow-xl);
    padding: 2.75rem;
    width: 100%;
    max-width: 440px;
    position: relative;
    z-index: 1;
    animation: fadeInUp 0.6s ease;
}

.auth-card .auth-logo {
    width: 56px;
    height: 56px;
    background: var(--gradient-primary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.25rem;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.35);
    animation: float 3s ease-in-out infinite;
}

.auth-card .auth-logo svg { width: 28px; height: 28px; color: #fff; }

.auth-card h1 {
    text-align: center;
    margin-bottom: 0.4rem;
    font-size: 1.75rem;
    font-weight: 750;
    background: linear-gradient(135deg, var(--primary), #a78bfa, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.03em;
}

.auth-card .subtitle {
    text-align: center;
    color: var(--text-light);
    margin-bottom: 2rem;
    font-size: 0.9rem;
    line-height: 1.5;
}

.auth-card .btn-primary {
    width: 100%;
    justify-content: center;
    padding: 0.8rem;
    font-size: 0.95rem;
    font-weight: 600;
}

.auth-card .auth-link {
    text-align: center;
    margin-top: 1.75rem;
    font-size: 0.88rem;
    color: var(--text-light);
}

.auth-error {
    background: var(--danger-bg);
    color: #991b1b;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.25rem;
    font-size: 0.85rem;
    font-weight: 500;
    border-left: 3px solid var(--danger);
    animation: shake 0.4s ease;
}

[data-theme="dark"] .auth-error { color: #fca5a5; }

/* ========== Settings Grid ========== */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
    gap: 1.5rem;
}

/* ========== Budget Grid ========== */
.budget-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
    gap: 1.5rem;
}

/* ========== Export Grid ========== */
.export-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
    gap: 1.5rem;
}

/* ========== Budget Percentage Display ========== */
.budget-percentage {
    font-size: 2.25rem;
    font-weight: 750;
    letter-spacing: -0.03em;
    text-align: center;
    margin: 1rem 0;
}

.budget-percentage.status-ok { color: var(--text); }
.budget-percentage.status-warning { color: var(--warning); }
.budget-percentage.status-danger { color: var(--danger); }

.budget-detail {
    color: var(--text-light);
    font-size: 0.85rem;
    text-align: center;
}

.budget-meta {
    margin-top: 0.75rem;
    display: flex;
    justify-content: space-between;
    font-size: 0.82rem;
    color: var(--text-light);
}

/* ========== Action Bar ========== */
.action-bar {
    margin-bottom: 1.5rem;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.action-bar .summary {
    color: var(--text-light);
    font-size: 0.88rem;
    font-weight: 500;
}

/* ========== Inline Alert (for cards) ========== */
.alert-inline {
    margin: 0.75rem 0 0;
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    border-radius: var(--radius-xs);
}

/* ========== Color Dot ========== */
.color-dot {
    display: inline-block;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid var(--border);
    transition: transform var(--transition-fast);
}

.color-dot:hover { transform: scale(1.2); }

/* ========== Responsive ========== */

/* Tablet */
@media (max-width: 1024px) and (min-width: 769px) {
    .charts-grid { grid-template-columns: 1fr; }
    .settings-grid { grid-template-columns: 1fr; }
    .page-content { padding: 1.25rem 1.5rem 2rem; }
}

/* Mobile */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open { transform: translateX(0); }

    .sidebar-toggle { display: block; }
    .mobile-menu-btn { display: flex; }

    .content { margin-left: 0; }
    .content-header { padding: 0.85rem 1rem; }
    .page-content { padding: 1rem; }

    .charts-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-icon { width: 42px; height: 42px; }
    .stat-info .stat-value { font-size: 1.2rem; }

    .form-row { grid-template-columns: 1fr; }
    .form-inline { flex-direction: column; align-items: stretch; }
    .form-inline .form-group { min-width: auto; }
    .alert { margin: 0 1rem 1rem; }

    .settings-grid,
    .export-grid { grid-template-columns: 1fr; }

    .budget-grid { grid-template-columns: 1fr; }

    /* Mobile Bottom Nav */
    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--bg-card-solid);
        border-top: 1px solid var(--border);
        z-index: 100;
        padding: 0.35rem 0.25rem;
        padding-bottom: calc(0.35rem + env(safe-area-inset-bottom, 0px));
        box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
        justify-content: space-around;
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
    }

    .mobile-bottom-nav a {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.15rem;
        padding: 0.5rem 0.75rem;
        color: var(--text-light);
        text-decoration: none;
        font-size: 0.65rem;
        font-weight: 500;
        border-radius: var(--radius-sm);
        transition: all var(--transition-fast);
        min-width: 56px;
    }

    .mobile-bottom-nav a svg { width: 22px; height: 22px; }

    .mobile-bottom-nav a.active {
        color: var(--primary);
    }

    .mobile-bottom-nav a.active svg {
        filter: drop-shadow(0 2px 4px rgba(99, 102, 241, 0.3));
    }

    /* Ensure page content has enough bottom padding for bottom nav */
    .content {
        padding-bottom: calc(3.5rem + env(safe-area-inset-bottom, 0px));
    }

    /* Larger touch targets on mobile */
    .btn { min-height: 44px; }
    .btn-sm { min-height: 36px; }
    .form-control { min-height: 44px; font-size: 16px; /* prevents iOS zoom */ }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; gap: 0.75rem; }
    .auth-card { padding: 2rem 1.5rem; }

    /* Kompaktere Abstände */
    .content-header { padding: 0.75rem 1rem; }
    .content-header h1 { font-size: 1.15rem; }
    .page-content { padding: 0.75rem 0.75rem 2rem; }

    /* Kompaktere Cards */
    .card { padding: 1.15rem; margin-bottom: 1rem; }
    .card-header { margin-bottom: 1rem; padding-bottom: 0.6rem; }
    .card-header h3 { font-size: 0.95rem; }

    /* Kompaktere Stat-Cards */
    .stat-card { padding: 1rem; gap: 0.75rem; }
    .stat-icon { width: 42px; height: 42px; }
    .stat-info .stat-value { font-size: 1.15rem; }

    /* Tabellen kompakter */
    thead th { padding: 0.6rem 0.5rem; font-size: 0.65rem; }
    tbody td { padding: 0.6rem 0.5rem; font-size: 0.8rem; }

    /* Touch-freundliche Pagination */
    .pagination a, .pagination span {
        padding: 0.6rem 0.9rem;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }

    /* Alerts anpassen */
    .alert {
        margin: 0 0.5rem 0.75rem;
        padding: 0.7rem 1rem;
        font-size: 0.82rem;
    }

    /* Modals für kleine Screens */
    .modal { padding: 1.25rem; width: 95%; }
    .modal h2 { font-size: 1.1rem; }

    /* Quick-Add stapeln */
    .quick-add { flex-direction: column; }
    .quick-add input { width: 100%; }

    /* Grids erzwingen */
    .settings-grid,
    .export-grid,
    .budget-grid { grid-template-columns: 1fr; }

    /* Charts */
    .charts-grid { grid-template-columns: 1fr; }
    .chart-container { height: 220px; }

    /* Action-Bar stapeln */
    .action-bar { flex-direction: column; align-items: stretch; gap: 0.5rem; }
}

@media (min-width: 769px) {
    .mobile-bottom-nav {
        display: none;
    }
}

/* ========== Install Page Overrides ========== */
.installer {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 4px);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 620px;
    padding: 2.75rem;
    animation: fadeInUp 0.6s ease;
}


.widget-item {
    min-width: 0;
    transition: opacity 0.2s, transform 0.2s;
}

.widget-item[draggable="true"] {
    cursor: grab;
    border: 2px dashed transparent;
    border-radius: var(--radius);
    padding: 2px;
}

.widget-item[draggable="true"]:hover {
    border-color: var(--primary);
}

.widget-item[draggable="true"]:active {
    cursor: grabbing;
}


/* ========== Fixed Footer ========== */
.site-footer {
    text-align: center;
    padding: 1.25rem 2rem;
    font-size: 0.8rem;
    color: var(--text-light);
    border-top: 1px solid var(--border);
    margin-top: auto;
    background: var(--bg-card);
    z-index: 10;
}

.site-footer a {
    color: var(--text-light);
    text-decoration: none;
    transition: color 0.2s;
}

.site-footer a:hover {
    color: var(--primary);
    text-decoration: none;
}

.site-footer .footer-links {
    display: flex;
    justify-content: center;
    gap: 0.35rem;
    margin-bottom: 0.35rem;
}

.site-footer .footer-brand {
    font-size: 0.75rem;
    opacity: 0.7;
}

@media (max-width: 768px) {
    .site-footer {
        padding-bottom: calc(3.5rem + env(safe-area-inset-bottom, 0px));
    }
}

/* ========== Legal Pages (Datenschutz, AGB, Impressum) ========== */
.legal-page {
    max-width: 750px;
}

.legal-page .legal-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.legal-page .legal-header {
    background: linear-gradient(135deg, var(--primary), #a78bfa);
    color: #fff;
    padding: 2rem;
    text-align: center;
}

.legal-page .legal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
}

.legal-page .legal-header p {
    margin: 0.5rem 0 0;
    opacity: 0.85;
    font-size: 0.9rem;
}

.legal-page .legal-body {
    padding: 2rem;
}

.legal-page .legal-section {
    margin-bottom: 1.75rem;
    padding-bottom: 1.75rem;
    border-bottom: 1px solid var(--border);
}

.legal-page .legal-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.legal-page .legal-section h4 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.legal-page .legal-section h4::before {
    content: '';
    width: 4px;
    height: 1.1em;
    background: var(--primary);
    border-radius: 2px;
    flex-shrink: 0;
}

.legal-page .legal-section p {
    color: var(--text-light);
    line-height: 1.8;
    white-space: pre-line;
    margin: 0;
}

.legal-page .legal-footer {
    padding: 1.25rem 2rem;
    background: var(--bg);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.85rem;
}

/* ========== Sidebar Nav Groups ========== */
.nav-group-title {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: rgba(199, 196, 240, 0.45);
    padding: 1.25rem 1.5rem 0.3rem;
    font-weight: 700;
    list-style: none;
    user-select: none;
}
.nav-group-title:first-child { padding-top: 0.5rem; }

/* ========== Admin Sidebar Layout ========== */
.admin-layout {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}
.admin-sidebar {
    width: 210px;
    min-width: 210px;
    background: var(--bg-card-solid);
    border-radius: 12px;
    padding: 0.5rem;
    position: sticky;
    top: 1rem;
    height: fit-content;
    box-shadow: var(--shadow);
}
.admin-sidebar a {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.85rem;
    border-radius: 8px;
    color: var(--text);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.15s;
}
.admin-sidebar a:hover {
    background: var(--bg);
    color: var(--primary);
}
.admin-sidebar a.active {
    background: var(--primary);
    color: #fff;
}
.admin-sidebar a.active svg { stroke: #fff; }
.admin-sidebar a svg { width: 16px; height: 16px; flex-shrink: 0; }
.admin-nav-divider {
    border-top: 1px solid var(--border);
    margin: 0.4rem 0.5rem;
}
.admin-content {
    flex: 1;
    min-width: 0;
}
@media (max-width: 768px) {
    .admin-layout { flex-direction: column; }
    .admin-sidebar {
        width: 100%;
        min-width: 0;
        position: static;
        display: flex;
        overflow-x: auto;
        gap: 0.25rem;
        padding: 0.4rem;
        -webkit-overflow-scrolling: touch;
    }
    .admin-sidebar a {
        white-space: nowrap;
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }
    .admin-nav-divider { display: none; }
}

/* ========== Breadcrumbs ========== */
.breadcrumbs {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.breadcrumbs a {
    color: var(--primary);
    text-decoration: none;
}
.breadcrumbs a:hover { text-decoration: underline; }
.breadcrumbs .separator { opacity: 0.4; }

/* ========== Global Search Overlay ========== */
.search-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 9999;
    align-items: flex-start;
    justify-content: center;
    padding-top: 15vh;
    animation: fadeIn 0.15s;
}
.search-overlay.active {
    display: flex;
}
.search-modal {
    background: var(--bg-card-solid);
    border-radius: 16px;
    width: 95%;
    max-width: 560px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}
.search-modal input[type="text"] {
    width: 100%;
    padding: 1rem 1.25rem;
    border: none;
    outline: none;
    font-size: 1.1rem;
    background: transparent;
    color: var(--text);
    border-bottom: 1px solid var(--border);
}
.search-results {
    max-height: 350px;
    overflow-y: auto;
}
.search-results .search-group-title {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-light);
    padding: 0.75rem 1.25rem 0.25rem;
    font-weight: 700;
}
.search-results a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1.25rem;
    color: var(--text);
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.1s;
}
.search-results a:hover,
.search-results a.active {
    background: var(--primary);
    color: #fff;
}
.search-results a svg { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.6; }
.search-results a:hover svg,
.search-results a.active svg { opacity: 1; stroke: #fff; }
.search-hint {
    padding: 0.6rem 1.25rem;
    font-size: 0.7rem;
    color: var(--text-light);
    border-top: 1px solid var(--border);
    text-align: center;
}
.search-hint kbd {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.1rem 0.4rem;
    font-size: 0.65rem;
    font-family: monospace;
}

/* ========== Improved Empty States ========== */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-light);
}
.empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: 1rem;
    opacity: 0.25;
    stroke-width: 1.2;
}
.empty-state .empty-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.4rem;
}
.empty-state .empty-desc {
    font-size: 0.88rem;
    margin-bottom: 1.25rem;
    max-width: 360px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
}

/* ========== Shortcut Help Modal ========== */
.shortcut-table {
    width: 100%;
    font-size: 0.85rem;
}
.shortcut-table td {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}
.shortcut-table td:first-child {
    width: 140px;
    font-weight: 600;
}
.shortcut-table kbd {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.15rem 0.5rem;
    font-size: 0.75rem;
    font-family: monospace;
}

/* ========== Professional Polish ========== */

/* Focus States (Accessibility) */
.btn:focus-visible,
.btn-icon:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
a:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 4px;
}
select:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
}

/* Muted Icon Buttons (Header) */
.btn-icon-muted {
    opacity: 0.6;
    transition: opacity 0.2s;
}
.btn-icon-muted:hover {
    opacity: 1;
}

/* ========== Notification System ========== */
.notif-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--danger);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    display: grid;
    place-items: center;
}
.notif-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    width: 380px;
    max-height: 440px;
    background: var(--bg-card-solid);
    border-radius: 14px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.18);
    z-index: 200;
    overflow: hidden;
    border: 1px solid var(--border);
    animation: fadeIn 0.15s;
}
.notif-dropdown.open { display: block; }
.notif-dropdown-header {
    padding: 0.85rem 1.15rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.notif-dropdown-header strong { font-size: 0.9rem; }
.notif-dropdown-header a {
    font-size: 0.75rem;
    color: var(--primary);
    text-decoration: none;
}
.notif-dropdown-header a:hover { text-decoration: underline; }
.notif-dropdown-list {
    max-height: 360px;
    overflow-y: auto;
}
.notif-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem 1.15rem;
    text-decoration: none;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}
.notif-item:hover { background: var(--bg); }
.notif-item.unread { background: rgba(99, 102, 241, 0.04); border-left: 3px solid var(--primary); }
.notif-icon {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.notif-content { flex: 1; min-width: 0; }
.notif-title {
    font-size: 0.82rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.notif-item.unread .notif-title { font-weight: 600; }
.notif-msg {
    font-size: 0.72rem;
    color: var(--text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}
.notif-time {
    font-size: 0.65rem;
    color: var(--text-light);
    flex-shrink: 0;
    padding-top: 2px;
}
.notif-empty {
    padding: 2.5rem 1rem;
    text-align: center;
    color: var(--text-light);
    font-size: 0.88rem;
}

/* ========== Support Banner ========== */
.support-banner {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #000;
    border-radius: 10px;
    padding: 0.85rem 1.25rem;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.25);
}
.support-banner-inner { display: flex; align-items: center; gap: 0.5rem; }
.support-banner-btn {
    background: #000;
    color: #fbbf24;
    font-weight: 600;
    border: none;
    padding: 0.4rem 0.85rem;
    border-radius: 6px;
    cursor: pointer;
    transition: opacity 0.15s;
}
.support-banner-btn:hover { opacity: 0.85; }

/* ========== Widget System (Proper CSS) ========== */
.widget-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 1.5rem;
}
.widget-size-1 { grid-column: span 2; }
.widget-size-2 { grid-column: span 3; }
.widget-size-3 { grid-column: span 6; }
@media (max-width: 1024px) {
    .widget-size-1 { grid-column: span 3; }
    .widget-size-2 { grid-column: span 3; }
}
@media (max-width: 768px) {
    .widget-grid { grid-template-columns: 1fr; }
    .widget-size-1,
    .widget-size-2,
    .widget-size-3 { grid-column: span 1; }
}
.widget-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
    gap: 0.75rem;
}
.widget-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
}
.widget-checkbox-label:hover { background: var(--bg); }
.widget-checkbox-label.active {
    background: var(--success-bg);
    border-color: var(--success);
}

/* ========== Modal Variants ========== */
.modal-narrow { max-width: 420px; }

/* ========== Responsive Card Grid (Goals, Challenges, etc.) ========== */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
    gap: 1.5rem;
}

/* ========== Card Accent Borders ========== */
.card-accent { border-left: 4px solid var(--primary); }
.card-accent.accent-success { border-left-color: var(--success); }
.card-accent.accent-danger { border-left-color: var(--danger); }
.card-accent.accent-warning { border-left-color: var(--warning); }
.card-accent.accent-info { border-left-color: var(--info); }
.card-accent.accent-teal { border-left-color: #14b8a6; }
.card-accent.accent-pink { border-left-color: #ec4899; }
.card-accent.accent-purple { border-left-color: #8b5cf6; }

/* ========== Support PIN Box ========== */
.pin-box {
    display: inline-block;
    background: var(--bg);
    border: 2px dashed var(--primary);
    border-radius: 12px;
    padding: 1rem 2rem;
    cursor: pointer;
    position: relative;
    transition: all var(--transition);
}
.pin-box:hover {
    border-color: var(--success);
    background: var(--success-bg);
}

/* ========== Card Hover Polish ========== */

/* ========== Dark Mode Additions ========== */
[data-theme="dark"] .support-banner {
    background: linear-gradient(135deg, #92400e, #78350f);
    color: #fcd34d;
}
[data-theme="dark"] .support-banner-btn {
    background: #fcd34d;
    color: #78350f;
}
[data-theme="dark"] .notif-dropdown {
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5);
    border-color: rgba(255, 255, 255, 0.08);
}
[data-theme="dark"] .notif-item:hover { background: rgba(255, 255, 255, 0.04); }
[data-theme="dark"] .notif-item.unread { background: rgba(99, 102, 241, 0.1); }
[data-theme="dark"] .btn-icon-muted { opacity: 0.7; }
[data-theme="dark"] .widget-checkbox-label:hover { background: rgba(255, 255, 255, 0.04); }
[data-theme="dark"] .search-overlay { background: rgba(0, 0, 0, 0.7); }

/* ========== Reduced Motion (Accessibility) ========== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ========== Better Focus Visibility ========== */
.nav-links li a:focus-visible {
    outline: 2px solid var(--primary-light);
    outline-offset: -2px;
}
.mobile-bottom-nav a:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
}

/* ========== Notification Dropdown Mobile ========== */
@media (max-width: 480px) {
    .notif-dropdown {
        position: fixed;
        left: 0.5rem;
        right: 0.5rem;
        top: auto;
        bottom: 70px;
        width: auto;
        max-height: 60vh;
    }
}

/* ========== Dark Mode: Admin Sidebar ========== */
[data-theme="dark"] .admin-sidebar {
    background: var(--bg-card-solid);
    border: 1px solid var(--border);
}
[data-theme="dark"] .admin-sidebar a:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* ========== Print Styles ========== */
@media print {
    .sidebar, .mobile-bottom-nav, .content-header, .site-footer,
    .support-banner, .notif-dropdown, .btn { display: none !important; }
    .content { margin-left: 0 !important; }
    .page-content { padding: 0 !important; }
    .card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
}
