:root {
    --canvas: #faf8f5;
    --surface-0: #ffffff;
    --surface-1: #f5f3f0;
    --surface-2: #eceae6;
    --text-primary: #1e1e2e;
    --text-secondary: #6c6b7b;
    --text-tertiary: #a3a2b2;
    --text-muted: #d1d0d8;
    --border: rgba(30, 30, 46, 0.08);
    --border-subtle: rgba(30, 30, 46, 0.04);
    --border-strong: rgba(30, 30, 46, 0.15);
    --accent: #7c3aed;
    --accent-hover: #6d28d9;
    --accent-light: rgba(124, 58, 237, 0.08);
    --accent-gradient: linear-gradient(135deg, #7c3aed 0%, #f59e0b 100%);
    --positive: #10b981;
    --positive-light: rgba(16, 185, 129, 0.08);
    --negative: #ef4444;
    --negative-light: rgba(239, 68, 68, 0.08);
    --ctrl-bg: #faf8f5;
    --ctrl-border: rgba(30, 30, 46, 0.15);
    --ctrl-focus: rgba(124, 58, 237, 0.2);
    --shadow-sm: 0 1px 2px rgba(30, 30, 46, 0.04);
    --shadow-md: 0 4px 12px rgba(30, 30, 46, 0.06);
    --eur-accent: #6366f1;
    --eur-light: rgba(99, 102, 241, 0.08);
    --usd-accent: #8b5cf6;
    --usd-light: rgba(139, 92, 246, 0.08);
}

.dark {
    --canvas: #0f0e17;
    --surface-0: #1a1929;
    --surface-1: #252438;
    --surface-2: #0f0e17;
    --text-primary: #fffffe;
    --text-secondary: #94a1b2;
    --text-tertiary: #5f6c80;
    --text-muted: #3d4455;
    --border: rgba(255, 255, 254, 0.06);
    --border-subtle: rgba(255, 255, 254, 0.03);
    --border-strong: rgba(255, 255, 254, 0.12);
    --accent: #a78bfa;
    --accent-hover: #8b5cf6;
    --accent-light: rgba(167, 139, 250, 0.1);
    --accent-gradient: linear-gradient(135deg, #a78bfa 0%, #fbbf24 100%);
    --positive: #34d399;
    --positive-light: rgba(52, 211, 153, 0.1);
    --negative: #fb7185;
    --negative-light: rgba(251, 113, 133, 0.1);
    --ctrl-bg: #252438;
    --ctrl-border: rgba(255, 255, 254, 0.1);
    --ctrl-focus: rgba(167, 139, 250, 0.2);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
    --eur-accent: #818cf8;
    --eur-light: rgba(129, 140, 248, 0.1);
    --usd-accent: #a78bfa;
    --usd-light: rgba(167, 139, 250, 0.1);
}

*, *::before, *::after {
    box-sizing: border-box;
}

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    background-color: var(--canvas);
    color: var(--text-primary);
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.5;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.brand-gradient-text {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.brand-gradient-bg {
    background: var(--accent-gradient);
}

.brand-gradient-border {
    border-image: var(--accent-gradient) 1;
}

.btn-brand {
    background: var(--accent-gradient);
    color: #fff;
    border: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.btn-brand:hover {
    opacity: 0.92;
    transform: translateY(-1px);
}

.btn-outline {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 0.75rem;
    border: 1px solid var(--accent);
    color: var(--accent);
    background: transparent;
    transition: background-color 0.15s ease;
    text-decoration: none;
}

.btn-outline:hover {
    background: var(--accent-light);
}

.btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
    color: var(--text-secondary);
    background: transparent;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.btn-ghost:hover {
    background: var(--surface-1);
    color: var(--text-primary);
}

.btn-ghost-danger:hover {
    background: var(--negative-light);
    color: var(--negative);
}

.sidebar-active {
    position: relative;
    background: var(--accent-light);
}

.sidebar-active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--accent-gradient);
}

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

.skeleton {
    background: linear-gradient(90deg, var(--surface-1) 25%, var(--surface-2) 50%, var(--surface-1) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: 6px;
    min-height: 1em;
    min-width: 3em;
}

@keyframes breathe-positive {
    0%, 100% { border-color: var(--positive); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
    50% { border-color: var(--positive); box-shadow: 0 0 16px 0 rgba(16, 185, 129, 0.12); }
}

@keyframes breathe-negative {
    0%, 100% { border-color: var(--negative); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
    50% { border-color: var(--negative); box-shadow: 0 0 16px 0 rgba(239, 68, 68, 0.12); }
}

.breathe-positive {
    animation: breathe-positive 3s ease-in-out infinite;
}

.breathe-negative {
    animation: breathe-negative 3s ease-in-out infinite;
}

@keyframes toast-in {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes toast-out {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

.toast-enter {
    animation: toast-in 0.25s ease-out forwards;
}

.toast-exit {
    animation: toast-out 0.2s ease-in forwards;
}

@keyframes fade-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fade-in 0.2s ease-out;
}

@keyframes modal-in {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-content-animate {
    animation: modal-in 0.2s ease-out;
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

.sidebar-scroll::-webkit-scrollbar-thumb {
    background: var(--border-strong);
}

@media print {
    .no-print { display: none !important; }
}

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

#dashboardChart {
    width: 100%;
    height: max(50vh, 400px);
    min-height: 350px;
}

g[opacity^="0."] {
    display: none;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1050;
    overflow-x: hidden;
    overflow-y: auto;
    outline: 0;
}

.modal.show .modal-dialog { transform: none; }

.modal-dialog {
    position: relative;
    width: auto;
    margin: 1.75rem auto;
    max-width: 500px;
    pointer-events: none;
    transform: translateY(-50px);
    transition: transform 0.2s ease-out;
}

.modal-dialog-centered {
    display: flex;
    align-items: center;
    min-height: calc(100% - 3.5rem);
}

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1040;
    width: 100vw;
    height: 100vh;
    background-color: #000;
}

.modal-backdrop.fade { opacity: 0; }
.modal-backdrop.show { opacity: 0.5; }
.modal.fade .modal-dialog { transition: transform 0.2s ease-out; }
.modal.show .modal-dialog { transform: none; }

@media (max-width: 576px) {
    .modal-dialog { margin: 1rem; max-width: calc(100% - 2rem); }
    .modal-dialog-centered { min-height: calc(100% - 2rem); }
}

table.dataTable { border-collapse: collapse !important; }

table.dataTable thead th {
    background: var(--surface-1) !important;
    color: var(--text-tertiary) !important;
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    padding: 0.75rem 1rem !important;
    border-bottom: 2px solid var(--border) !important;
}

.dark table.dataTable thead th {
    background: var(--surface-1) !important;
    color: var(--text-tertiary) !important;
    border-bottom-color: var(--border) !important;
}

table.dataTable tbody td {
    padding: 0.875rem 1rem !important;
    border-bottom: 1px solid var(--border-subtle) !important;
    color: var(--text-primary) !important;
}

.dark table.dataTable tbody td {
    border-bottom-color: var(--border-subtle) !important;
    color: var(--text-primary) !important;
}

table.dataTable tbody tr {
    background: transparent !important;
    transition: background-color 0.1s ease;
}

table.dataTable tbody tr:hover {
    background: var(--accent-light) !important;
}

.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
    border: 1px solid var(--ctrl-border) !important;
    border-radius: 8px !important;
    padding: 0.375rem 0.75rem !important;
    background: var(--ctrl-bg) !important;
    color: var(--text-primary) !important;
    font-size: 0.875rem !important;
    outline: none !important;
}

.dark .dataTables_wrapper .dataTables_length select,
.dark .dataTables_wrapper .dataTables_filter input {
    background: var(--ctrl-bg) !important;
    color: var(--text-primary) !important;
    border-color: var(--ctrl-border) !important;
}

.dataTables_wrapper .dataTables_length select:focus,
.dataTables_wrapper .dataTables_filter input:focus {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 3px var(--ctrl-focus) !important;
}

.dataTables_wrapper .dataTables_info {
    color: var(--text-tertiary) !important;
    font-size: 0.875rem !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    color: var(--text-secondary) !important;
    border: 1px solid var(--border) !important;
    border-radius: 8px !important;
    padding: 0.375rem 0.75rem !important;
    margin: 0 2px !important;
    background: var(--surface-0) !important;
    transition: all 0.15s ease !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: var(--accent-light) !important;
    color: var(--accent) !important;
    border-color: var(--accent) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--accent) !important;
    color: #ffffff !important;
    border-color: var(--accent) !important;
    font-weight: 600 !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled { opacity: 0.4 !important; }

.dataTables_wrapper .dataTables_filter label,
.dataTables_wrapper .dataTables_length label {
    color: var(--text-secondary) !important;
    font-size: 0.875rem !important;
}

.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
    padding: 0.75rem 0;
    font-size: 0.875rem;
}
.dataTables_wrapper .dataTables_filter { float: right; margin-bottom: 0.75rem; }
.dataTables_wrapper .dataTables_length { float: left; margin-bottom: 0.75rem; }
.dataTables_wrapper .dataTables_info { clear: both; float: left; padding-top: 1rem; }
.dataTables_wrapper .dataTables_paginate { clear: both; float: right; padding-top: 1rem; }
.dataTables_wrapper .dataTables_paginate .paginate_button { cursor: pointer; display: inline-block; }
.dataTables_wrapper .dataTables_filter input { margin-left: 0.5em; }
.dataTables_wrapper .dataTables_length select { margin: 0 0.25em; }
.dataTables_wrapper:after { content: ''; display: table; clear: both; }
table.dataTable thead .sorting::after,
table.dataTable thead .sorting_asc::after,
table.dataTable thead .sorting_desc::after { content: ''; }
