/* ============================================
   KVC-Manager - K.V. Capital GmbH
   Haupt-Stylesheet
   ============================================ */

/* ---- CSS Custom Properties ---- */
:root {
    /* Akzentfarbe */
    --primary: #FFB300;
    --primary-hover: #FFA000;
    --primary-light: rgba(255, 179, 0, 0.12);
    --primary-border: rgba(255, 179, 0, 0.25);
    --primary-foreground: #1a1a2e;
    
    /* Dark Theme Farben */
    --bg-body: #0f1117;
    --bg-sidebar: #13151d;
    --bg-card: #1a1c28;
    --bg-card-hover: #22243a;
    --bg-header: #13151d;
    --bg-input: #1e2030;
    --bg-input-focus: #252840;
    
    /* Text */
    --text-primary: #e8e8ed;
    --text-secondary: #9398a7;
    --text-muted: #636878;
    --text-heading: #f0f0f5;
    
    /* Borders */
    --border-color: #2a2d3e;
    --border-light: #353849;
    
    /* Status */
    --success: #22c55e;
    --success-bg: rgba(34, 197, 94, 0.12);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.12);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.12);
    --info: #3b82f6;
    --info-bg: rgba(59, 130, 246, 0.12);
    
    /* Layout */
    --sidebar-width: 260px;
    --sidebar-collapsed: 70px;
    --header-height: 64px;
    --radius: 8px;
    --radius-sm: 6px;
    --radius-lg: 12px;
    
    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
    
    /* Transitions */
    --transition: all 0.2s ease;
    --transition-slow: all 0.3s ease;
}

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

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

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

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

a:hover {
    color: var(--primary-hover);
}

img {
    max-width: 100%;
    height: auto;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-body);
}

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

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

/* ============================================
   LAYOUT
   ============================================ */

/* ---- App Container ---- */
.app-container {
    display: flex;
    min-height: 100vh;
}

.main-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: var(--transition-slow);
}

.main-wrapper.sidebar-collapsed {
    margin-left: var(--sidebar-collapsed);
}

.main-content {
    flex: 1;
    padding: 24px;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 50;
    transition: var(--transition-slow);
    overflow: hidden;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

/* Logo Area */
.sidebar-logo {
    display: flex;
    align-items: center;
    height: var(--header-height);
    padding: 0 16px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    gap: 12px;
    overflow: hidden;
}

.sidebar-logo img {
    height: 36px;
    width: auto;
    flex-shrink: 0;
}

.sidebar-logo .logo-text {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-heading);
    white-space: nowrap;
    transition: opacity 0.2s;
}

.sidebar-logo .logo-text span {
    color: var(--primary);
}

.sidebar.collapsed .logo-text {
    opacity: 0;
    width: 0;
}

.sidebar.collapsed .sidebar-logo {
    justify-content: center;
    padding: 0;
}

.sidebar.collapsed .sidebar-logo img {
    height: 30px;
}

/* Navigation */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 16px 12px;
}

.nav-section-title {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 8px 12px 6px;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar.collapsed .nav-section-title {
    text-align: center;
    font-size: 0;
    padding: 8px 0;
}

.sidebar.collapsed .nav-section-title::after {
    content: '•••';
    font-size: 0.6rem;
    color: var(--text-muted);
}

.nav-items {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 450;
    transition: var(--transition);
    position: relative;
    white-space: nowrap;
    overflow: hidden;
}

.nav-item a:hover {
    background: var(--primary-light);
    color: var(--primary);
    box-shadow: inset 0 0 0 1px var(--primary-border);
}

.nav-item a.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 500;
    box-shadow: inset 0 0 0 1px var(--primary-border);
}

.nav-item a.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--primary);
    border-radius: 0 3px 3px 0;
}

.nav-item a i,
.nav-item a svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    stroke-width: 1.75;
}

.nav-item a .nav-text {
    transition: opacity 0.2s;
}

/* Collapsed Sidebar */
.sidebar.collapsed .nav-item a {
    justify-content: center;
    padding: 10px;
}

.sidebar.collapsed .nav-item a .nav-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.sidebar.collapsed .nav-item a::before {
    display: none;
}

/* Sidebar User Profile */
.sidebar-user {
    border-top: 1px solid var(--border-color);
    padding: 12px;
    flex-shrink: 0;
}

.sidebar-user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
    flex-shrink: 0;
    border: 2px solid var(--primary-border);
}

.sidebar-user-details {
    flex: 1;
    min-width: 0;
    transition: opacity 0.2s;
}

.sidebar-user-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-logout {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-user-logout:hover {
    background: var(--danger-bg);
    color: var(--danger);
}

.sidebar.collapsed .sidebar-user-details,
.sidebar.collapsed .sidebar-user-logout {
    display: none;
}

.sidebar.collapsed .sidebar-user-info {
    justify-content: center;
}

/* ---- Sidebar Tooltip (collapsed) ---- */
.nav-item {
    position: relative;
}

.nav-tooltip {
    display: none;
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    white-space: nowrap;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    z-index: 100;
    pointer-events: none;
}

.sidebar.collapsed .nav-item:hover .nav-tooltip {
    display: block;
}

/* ============================================
   HEADER
   ============================================ */
.header {
    position: sticky;
    top: 0;
    z-index: 40;
    height: var(--header-height);
    background: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    backdrop-filter: blur(8px);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Sidebar Toggle */
.sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-toggle:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

/* Search */
.header-search {
    position: relative;
    width: 280px;
}

.header-search input {
    width: 100%;
    padding: 8px 12px 8px 36px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.85rem;
    transition: var(--transition);
    font-family: inherit;
}

.header-search input::placeholder {
    color: var(--text-muted);
}

.header-search input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg-input-focus);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.header-search .search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    width: 18px;
    height: 18px;
}

/* Header Buttons */
.header-btn {
    position: relative;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-btn:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.header-btn .badge {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid var(--bg-header);
}

.notif-badge {
    position: absolute;
    top: 0;
    right: 0;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    font-size: 0.6rem;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    color: #fff;
    background: var(--danger);
    border-radius: 8px;
    border: 2px solid var(--bg-header);
}

.notif-dropdown-item {
    display: flex;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none;
    color: inherit;
}
.notif-dropdown-item:hover {
    background: var(--bg-hover);
}
.notif-dropdown-item.unread {
    background: rgba(255, 179, 0, 0.04);
}
.notif-dropdown-item .notif-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.notif-icon.severity-info { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.notif-icon.severity-warning { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.notif-icon.severity-danger { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.notif-icon.severity-success { background: rgba(34, 197, 94, 0.15); color: #22c55e; }
.notif-dropdown-item .notif-text {
    flex: 1;
    min-width: 0;
}
.notif-dropdown-item .notif-title {
    font-size: 0.78rem;
    font-weight: 500;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.notif-dropdown-item .notif-time {
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Profile Dropdown */
.profile-dropdown {
    position: relative;
}

.profile-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius);
    transition: var(--transition);
}

.profile-trigger:hover {
    background: var(--bg-card);
}

.profile-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.75rem;
    border: 2px solid var(--primary-border);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 220px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 4px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: var(--transition);
    z-index: 100;
}

.dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-header {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 4px;
}

.dropdown-header .name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
}

.dropdown-header .email {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.85rem;
    transition: var(--transition);
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
}

.dropdown-item:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.dropdown-item.danger:hover {
    background: var(--danger-bg);
    color: var(--danger);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 0;
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
    border-top: 1px solid var(--border-color);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-sidebar);
}

.footer-text {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.card-header {
    padding: 20px 24px 0;
}

.card-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-heading);
    margin-bottom: 4px;
}

.card-description {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.card-body {
    padding: 20px 24px;
}

.card-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 18px;
    font-size: 0.85rem;
    font-weight: 500;
    font-family: inherit;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    line-height: 1.4;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary);
    color: var(--primary-foreground);
    border-color: var(--primary);
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
}

.btn-outline {
    background: transparent;
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-outline:hover:not(:disabled) {
    background: var(--bg-card-hover);
    border-color: var(--border-light);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: none;
}

.btn-ghost:hover:not(:disabled) {
    background: var(--bg-card);
    color: var(--text-primary);
}

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

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
    border-color: #dc2626;
}

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

.btn-sm {
    padding: 6px 12px;
    font-size: 0.78rem;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 0.95rem;
}

.btn-block {
    width: 100%;
}

.btn-icon {
    padding: 8px;
    width: 36px;
    height: 36px;
}

/* ============================================
   FORMS
   ============================================ */
.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 9px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: inherit;
    transition: var(--transition);
    line-height: 1.5;
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg-input-focus);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-control.is-invalid {
    border-color: var(--danger);
}

.form-control.is-invalid:focus {
    box-shadow: 0 0 0 3px var(--danger-bg);
}

.form-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.form-error {
    font-size: 0.75rem;
    color: var(--danger);
    margin-top: 4px;
}

.input-icon-wrapper {
    position: relative;
}

.input-icon-wrapper .input-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    width: 18px;
    height: 18px;
    pointer-events: none;
}

.input-icon-wrapper .form-control {
    padding-left: 38px;
}

/* Checkbox */
.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}

.form-check label {
    font-size: 0.82rem;
    color: var(--text-secondary);
    cursor: pointer;
}

/* Select */
select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%239398a7' viewBox='0 0 16 16'%3E%3Cpath d='M4.646 6.646a.5.5 0 0 1 .708 0L8 9.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 12px center;
    padding-right: 36px;
}

/* ============================================
   TABLES
   ============================================ */
.table-responsive {
    overflow-x: auto;
}

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

.table th,
.table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.85rem;
}

.table th.text-right,
.table td.text-right,
.text-right {
    text-align: right !important;
}

/* Kompakt-Variante (Commission-Report etc.) */
.table-compact th,
.table-compact td {
    padding: 6px 10px;
    font-size: 0.8rem;
}

.table th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--bg-card);
    position: relative;
}

/* Sortierbare + Verschiebbare Spalten */
.table th.sortable {
    cursor: pointer;
    user-select: none;
    padding-right: 28px;
    transition: color 0.15s, background 0.15s;
}

.table th.sortable:hover {
    color: var(--primary);
    background: var(--primary-light);
}

/* Sort-Indikator-Pfeil */
.table th.sortable::after {
    content: '';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    opacity: 0;
    transition: opacity 0.15s, border-color 0.15s;
}

.table th.sortable:hover::after {
    border-bottom: 5px solid var(--text-muted);
    opacity: 0.3;
}

.table th.sort-asc::after {
    border-bottom: 5px solid var(--primary);
    border-top: none;
    opacity: 1 !important;
}

.table th.sort-desc::after {
    border-top: 5px solid var(--primary);
    border-bottom: none;
    opacity: 1 !important;
}

.table th.sort-asc,
.table th.sort-desc {
    color: var(--primary);
}

/* Drag & Drop Spaltenverschiebung */
.table th[draggable="true"] {
    cursor: grab;
}

.table th[draggable="true"]:active {
    cursor: grabbing;
}

.table th.col-dragging {
    opacity: 0.4;
    background: var(--primary-light);
}

.table th.col-drag-over {
    box-shadow: inset -3px 0 0 var(--primary);
}

.table td.col-drag-highlight {
    background: rgba(255,179,0,0.03);
}

/* Strategien-Übersicht: ausgeblendete Spalten (Checkbox-Dropdown) */
#strategiesTable .strategy-col-hidden {
    display: none !important;
}

.table tbody tr:hover {
    background: var(--bg-card-hover);
}

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

/* ============================================
   BADGES
   ============================================ */
.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 500;
}

.badge-success {
    background: var(--success-bg);
    color: var(--success);
}

.badge-danger {
    background: var(--danger-bg);
    color: var(--danger);
}

.badge-warning {
    background: var(--warning-bg);
    color: var(--warning);
}

.badge-info {
    background: var(--info-bg);
    color: var(--info);
}

.badge-primary {
    background: var(--primary-light);
    color: var(--primary);
}

/* Tradecopier Agent-LED */
.tc-led {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 6px currentColor;
    vertical-align: middle;
    cursor: help;
}

/* Tag-Badges (dynamische Farben via --tag-color) */
.tag-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 500;
    background: color-mix(in srgb, var(--tag-color, #64748b) 18%, transparent);
    color: var(--tag-color, #64748b);
    white-space: nowrap;
    line-height: 1.4;
}

.tag-badge-sm {
    padding: 1px 8px;
    font-size: 0.65rem;
}

.tag-remove {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 0;
    margin-left: 2px;
    font-size: 0.9rem;
    line-height: 1;
    opacity: 0.6;
    transition: opacity 0.15s;
}

.tag-remove:hover {
    opacity: 1;
}

/* Tag-Farbpunkt im Filter-Dropdown */
.tag-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 4px;
    vertical-align: middle;
}

/* ============================================
   ALERTS
   ============================================ */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 0.85rem;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 16px;
    border: 1px solid;
}

.alert-success {
    background: var(--success-bg);
    color: var(--success);
    border-color: rgba(34, 197, 94, 0.2);
}

.alert-danger {
    background: var(--danger-bg);
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.2);
}

.alert-warning {
    background: var(--warning-bg);
    color: var(--warning);
    border-color: rgba(245, 158, 11, 0.2);
}

.alert-info {
    background: var(--info-bg);
    color: var(--info);
    border-color: rgba(59, 130, 246, 0.2);
}

/* ============================================
   MODAL
   ============================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.95) translateY(10px);
    transition: var(--transition);
}

.modal-overlay.show .modal {
    transform: scale(1) translateY(0);
}

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

.modal-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-heading);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    display: flex;
    align-items: center;
}

.modal-close:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
}

/* Modal Sizes */
.modal-lg {
    max-width: 720px;
}

.modal-sm {
    max-width: 400px;
}

.modal-fullscreen {
    max-width: 95vw;
    max-height: 95vh;
    width: 95vw;
    height: 95vh;
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
}

.modal-fullscreen .modal-header {
    flex-shrink: 0;
}

.modal-fullscreen .modal-body {
    flex: 1;
    padding: 0;
    overflow: hidden;
}

.modal-fullscreen .modal-body iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: #fff;
}

/* ============================================
   TABS
   ============================================ */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    gap: 0;
    margin-bottom: 20px;
    overflow-x: auto;
}

.tab-btn {
    padding: 10px 18px;
    font-size: 0.85rem;
    font-weight: 450;
    color: var(--text-muted);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    font-family: inherit;
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ============================================
   MULTISELECT DROPDOWN
   ============================================ */
.multiselect-dropdown {
    position: relative;
    min-width: 170px;
}

.multiselect-trigger {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    cursor: pointer;
    width: auto;
    min-width: 170px;
    text-align: left;
    white-space: nowrap;
}

.multiselect-trigger:hover {
    border-color: var(--primary);
}

.multiselect-label {
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.multiselect-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 100%;
    max-width: 300px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 60;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: var(--transition);
}

.multiselect-dropdown.open .multiselect-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.multiselect-dropdown.open .multiselect-trigger {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.multiselect-actions {
    display: flex;
    gap: 4px;
    padding: 8px 10px 4px;
    border-bottom: 1px solid var(--border-color);
}

.multiselect-action-btn {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.72rem;
    font-family: inherit;
    padding: 2px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

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

.multiselect-options {
    max-height: 240px;
    overflow-y: auto;
    padding: 4px;
}

.multiselect-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.82rem;
    color: var(--text-secondary);
    transition: var(--transition);
}

.multiselect-option:hover {
    background: var(--primary-light);
    color: var(--text-primary);
}

.multiselect-option input[type="checkbox"] {
    width: 15px;
    height: 15px;
    accent-color: var(--primary);
    cursor: pointer;
    flex-shrink: 0;
}

.multiselect-option span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.multiselect-badge {
    background: var(--primary);
    color: var(--primary-foreground);
    font-size: 0.68rem;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 10px;
    margin-left: 4px;
}

/* ============================================
   PAGINATION
   ============================================ */
.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
    list-style: none;
}

.pagination a,
.pagination span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 8px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    color: var(--text-secondary);
    transition: var(--transition);
}

.pagination a:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.pagination .active span {
    background: var(--primary);
    color: var(--primary-foreground);
    font-weight: 500;
}

/* ============================================
   LOGIN PAGE
   ============================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--bg-body);
}

.login-container {
    width: 100%;
    max-width: 420px;
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo img {
    height: 48px;
    margin-bottom: 16px;
}

.login-logo h2 {
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--text-heading);
    margin-bottom: 6px;
}

.login-logo p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

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

.login-card .card-header {
    padding: 24px 24px 0;
}

.login-card .card-body {
    padding: 24px;
}

.login-card .card-footer {
    padding: 16px 24px;
    text-align: center;
    background: var(--bg-sidebar);
}

.login-card .card-footer p {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.login-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

/* ============================================
   PAGE HEADER
   ============================================ */
.page-header {
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-heading);
    margin-bottom: 4px;
}

.page-header p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.page-header-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

/* ============================================
   UTILITIES
   ============================================ */
.text-primary { color: var(--primary) !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-info { color: var(--info) !important; }
.text-muted { color: var(--text-muted) !important; }

.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }

.d-flex { display: flex; }
.align-items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.flex-wrap { flex-wrap: wrap; }

.grid {
    display: grid;
    gap: 16px;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ============================================
   LOADING / SPINNER
   ============================================ */
.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

.btn .spinner {
    width: 16px;
    height: 16px;
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 14px 18px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-width: 300px;
    max-width: 420px;
    animation: toastIn 0.3s ease;
    font-size: 0.85rem;
}

.toast.toast-out {
    animation: toastOut 0.3s ease forwards;
}

.toast-success { border-left: 3px solid var(--success); }
.toast-danger { border-left: 3px solid var(--danger); }
.toast-warning { border-left: 3px solid var(--warning); }
.toast-info { border-left: 3px solid var(--info); }

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

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

/* ============================================
   RESPONSIVE
   ============================================ */
.mobile-menu-toggle {
    display: none;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 45;
}

@media (max-width: 1200px) {
    .dashboard-grid.grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    
    .sidebar-overlay.show {
        display: block;
    }
    
    .main-wrapper,
    .main-wrapper.sidebar-collapsed {
        margin-left: 0;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
    
    .header-search {
        width: 200px;
    }
}

/* Mobile: Minimieren-Button ausblenden, aber Toggle-Funktion behalten */
@media (max-width: 768px) {
    /* Reduzierungsbutton (Desktop Toggle - Minimieren) ausblenden */
    .sidebar-toggle:not(.mobile-menu-toggle) {
        display: none !important;
    }
    
    /* Mobile Menu Toggle Button bleibt sichtbar */
    .mobile-menu-toggle {
        display: flex !important;
    }
    
    /* Main Wrapper - kein Margin, da Sidebar über dem Content liegt */
    .main-wrapper {
        margin-left: 0 !important;
    }
    
    .main-content {
        padding: 16px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    /* Page Header - volle Breite */
    .page-header {
        width: 100%;
        max-width: 100%;
    }
    
    .header {
        padding: 0 16px;
    }
    
    .header-search {
        display: none;
    }
    
    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }
    
    .page-header-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .footer {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }

    .modal {
        margin: 16px;
        max-width: calc(100% - 32px);
    }
}

/* ============================================
   PERMISSION BADGES (Rechtemanagement)
   ============================================ */
.permission-grid {
    display: grid;
    gap: 16px;
}

.permission-category {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 16px;
}

.permission-category-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.permission-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.permission-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.permission-item label {
    font-size: 0.82rem;
    color: var(--text-secondary);
    cursor: pointer;
}

/* Switch Toggle */
.switch {
    position: relative;
    width: 40px;
    height: 22px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    inset: 0;
    background: var(--border-light);
    border-radius: 11px;
    cursor: pointer;
    transition: var(--transition);
}

.switch-slider::before {
    content: '';
    position: absolute;
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: var(--transition);
}

.switch input:checked + .switch-slider {
    background: var(--primary);
}

.switch input:checked + .switch-slider::before {
    transform: translateX(18px);
}

/* ============================================
   STATS CARDS (Dashboard)
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

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

.stat-icon.primary {
    background: var(--primary-light);
    color: var(--primary);
}

.stat-icon.success {
    background: var(--success-bg);
    color: var(--success);
}

.stat-icon.info {
    background: var(--info-bg);
    color: var(--info);
}

.stat-icon.warning {
    background: var(--warning-bg);
    color: var(--warning);
}

.stat-info h3 {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.stat-value {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-heading);
}

/* ============================================
   EMPTY STATES
   ============================================ */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.empty-state svg {
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 0.85rem;
    max-width: 360px;
    margin: 0 auto;
}

/* ============================================
   PORTFOLIO ANALYTICS
   ============================================ */

/* 5-Column Stats Grid */
.stats-grid-5 {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    margin-bottom: 0;
}

/* Compact stat cards for statistics section */
.stat-card-compact {
    padding: 16px;
}

.stat-card-compact .stat-value {
    font-size: 1.25rem;
}

.stat-card-compact .stat-info h3 {
    font-size: 0.72rem;
}

/* Analytics grid layout (left: flex 3, right: flex 1) */
.grid-analytics {
    display: flex;
    gap: 16px;
}

/* Clickable card hover */
.card-clickable {
    transition: border-color 0.2s, transform 0.15s;
}

.card-clickable:hover {
    border-color: var(--primary-border);
    transform: translateY(-2px);
}

/* Portfolio tab content */
.portfolio-tab {
    display: none;
}

.portfolio-tab.active {
    display: block;
}

/* Table small variant */
.table-sm th,
.table-sm td {
    padding: 8px 12px;
    font-size: 0.82rem;
}

@media (max-width: 1200px) {
    .stats-grid-5 {
        grid-template-columns: repeat(3, 1fr);
    }
    .grid-analytics {
        flex-direction: column;
    }
}

@media (max-width: 768px) {
    .stats-grid-5 {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   HealthCheck Styles
   ============================================ */
.hc-check-item {
    border-bottom: 1px solid var(--border-color);
    transition: background 0.15s;
}
.hc-check-item:last-child {
    border-bottom: none;
}
.hc-check-item:hover {
    background: var(--bg-hover);
}
.hc-check-item.hc-active {
    background: var(--primary-light);
    border-left: 3px solid var(--accent);
}
.hc-check-config {
    border-top: 1px solid var(--border-color);
    background: var(--bg-card);
}
.hc-status-badge {
    margin-left: auto;
}

/* Chart Mode Toggle */
.chart-mode-toggle {
    display: inline-flex;
    background: var(--bg-color);
    border-radius: 6px;
    padding: 3px;
    gap: 2px;
    border: 1px solid var(--border-color);
}
.chart-mode-toggle .chart-mode-btn {
    background: transparent !important;
    color: var(--text-muted) !important;
    border: none !important;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
    font-size: 0.72rem;
    padding: 5px 14px;
    border-radius: 4px;
    line-height: 1.3;
}
.chart-mode-toggle .chart-mode-btn:hover {
    color: var(--text-primary) !important;
    background: rgba(255,255,255,0.06) !important;
}
.chart-mode-toggle .chart-mode-btn.active {
    background: var(--primary) !important;
    color: var(--primary-foreground) !important;
    font-weight: 600;
}

/* Export CSV Button (mini) */
.btn-export-csv {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 0.68rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    font-family: inherit;
    line-height: 1.3;
}
.btn-export-csv:hover {
    color: var(--text-primary);
    border-color: var(--primary-border);
    background: var(--primary-light);
}
.btn-export-csv:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}
.btn-export-csv:disabled:hover {
    color: var(--text-muted);
    border-color: var(--border-color);
    background: transparent;
}

/* Strategy Legend Items */
.strategy-legend-item .strategy-legend-label {
    text-decoration: none;
    transition: text-decoration 0.15s;
}
.strategy-legend-item:hover .strategy-legend-label {
    text-decoration: underline;
}

/* ============================================
   Settings Two-Column Layout
   ============================================ */
.settings-grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
}

.settings-col-left,
.settings-col-right {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

@media (max-width: 992px) {
    .settings-grid-2col {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   Backtest Gallery
   ============================================ */
.backtest-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}

.backtest-gallery-item {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
    aspect-ratio: 16/10;
    background: var(--bg-page);
}

.backtest-gallery-item:hover {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(var(--primary-rgb, 59, 130, 246), 0.15);
    transform: translateY(-1px);
}

.backtest-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.backtest-date-badge {
    position: absolute;
    bottom: 4px;
    left: 4px;
    background: rgba(0,0,0,0.65);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 500;
    padding: 1px 5px;
    border-radius: 3px;
    line-height: 1.5;
    pointer-events: none;
    z-index: 1;
}

.backtest-gallery-item .backtest-delete-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s;
    padding: 0;
}

.backtest-gallery-item:hover .backtest-delete-btn {
    opacity: 1;
}

.backtest-gallery-item .backtest-delete-btn:hover {
    background: var(--danger);
}

/* ============================================
   Backtest Dropzone
   ============================================ */
.backtest-dropzone {
    position: relative;
    min-height: 80px;
    border-radius: var(--radius);
    outline: none;
    transition: border-color 0.15s;
}

.backtest-dropzone.dragover {
    border: 2px dashed var(--primary);
    background: rgba(var(--primary-rgb, 59, 130, 246), 0.04);
}

.backtest-dropzone-overlay {
    position: absolute;
    inset: 0;
    background: rgba(var(--primary-rgb, 59, 130, 246), 0.08);
    border: 2px dashed var(--primary);
    border-radius: var(--radius);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--primary);
    font-weight: 600;
    font-size: 0.9rem;
    z-index: 10;
    pointer-events: none;
}

.backtest-dropzone.dragover .backtest-dropzone-overlay {
    display: flex;
}

/* ============================================
   Lightbox
   ============================================ */
.backtest-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s, visibility 0.25s;
}

.backtest-lightbox.show {
    opacity: 1;
    visibility: visible;
}

.backtest-lightbox img {
    max-width: 92vw;
    max-height: 88vh;
    border-radius: var(--radius);
    box-shadow: 0 8px 40px rgba(0,0,0,0.5);
    object-fit: contain;
    transition: transform 0.2s;
}

.backtest-lightbox-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(255,255,255,0.12);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    z-index: 2;
}

.backtest-lightbox-close:hover {
    background: rgba(255,255,255,0.25);
}

.backtest-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.1);
    color: #fff;
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    z-index: 2;
}

.backtest-lightbox-nav:hover {
    background: rgba(255,255,255,0.25);
}

.backtest-lightbox-prev {
    left: 16px;
}

.backtest-lightbox-next {
    right: 16px;
}

/* ============================================
   Backtest CSV List
   ============================================ */
.backtest-csv-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    margin-bottom: 8px;
    transition: var(--transition);
    gap: 12px;
}

.backtest-csv-item:hover {
    border-color: var(--primary);
    background: var(--bg-card-hover);
}

.backtest-csv-info {
    flex: 1;
    min-width: 0;
}

.backtest-csv-label {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-heading);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.backtest-csv-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.backtest-csv-date {
    white-space: nowrap;
}

.backtest-csv-filename {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--primary);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.backtest-csv-filename:hover {
    text-decoration: underline;
}

.backtest-csv-delete {
    flex-shrink: 0;
}

.backtest-lightbox-caption {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255,255,255,0.7);
    font-size: 0.82rem;
    text-align: center;
    max-width: 80vw;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================
   DASHBOARD DEPOT WIDGET (MyWallets-Style)
   ============================================ */
.depot-widget-card {
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 10px;
}
.depot-widget-card:last-child {
    margin-bottom: 0;
}
.depot-widget-card:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

/* Gradient headers by depot type */
.depot-widget-header {
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.depot-gradient-trading {
    background: linear-gradient(135deg, #10b981, #059669);
}
.depot-gradient-demo {
    background: linear-gradient(135deg, #3b82f6, #6366f1);
}
.depot-gradient-fee {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.depot-widget-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.depot-widget-title {
    min-width: 0;
    flex: 1;
}

.depot-widget-name {
    font-weight: 600;
    font-size: 0.88rem;
    color: #fff;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.depot-widget-broker {
    font-size: 0.68rem;
    color: rgba(255,255,255,0.8);
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.depot-widget-body {
    padding: 12px 14px;
}

.depot-widget-balance {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 10px;
}

.depot-widget-balance-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.depot-widget-balance-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-heading);
}

.depot-widget-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 10px;
}

.depot-widget-stat {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.depot-widget-stat-label {
    font-size: 0.62rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.depot-widget-stat-value {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-heading);
}

.depot-widget-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
}

.depot-widget-updated {
    font-size: 0.65rem;
    color: var(--text-muted);
}

.depot-widget-portfolio {
    font-size: 0.62rem;
    background: rgba(var(--accent-rgb, 255,179,0), 0.15);
    color: var(--accent);
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

/* Depot config items in modal */
.depot-config-item {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: background 0.15s;
}
.depot-config-item:hover {
    background: var(--bg-card-hover);
}
.depot-config-item:last-child {
    border-bottom: none !important;
}

/* ============================================
   BACKTEST UPLOAD
   ============================================ */
.backtest-upload-zone {
    border: 2px dashed var(--border-light);
    border-radius: var(--radius);
    padding: 28px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.backtest-upload-zone:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.backtest-upload-zone.drag-over {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: inset 0 0 20px rgba(255, 179, 0, 0.06);
}

.backtest-upload-zone .backtest-upload-content p {
    line-height: 1.4;
}

/* Kleiner Spinner für Inline-Loading */
.spinner-sm {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    flex-shrink: 0;
}

/* Backtest-Notiz Inline-Edit */
.backtest-note-input:hover {
    border-color: var(--border-color) !important;
}

.backtest-note-input:focus {
    outline: none;
    border-color: var(--primary) !important;
    background: var(--bg-input) !important;
}

/* ============================================
   EA UPLOAD (2-Datei Upload-Zone)
   ============================================ */
.ea-upload-zone {
    border: 2px dashed var(--border-light);
    border-radius: var(--radius);
    padding: 20px;
    transition: all 0.2s ease;
}

.ea-upload-zone:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.ea-upload-zone.is-dragover {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: inset 0 0 20px rgba(255, 179, 0, 0.06);
}

.ea-upload-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
}

.ea-upload-slot {
    border: 2px dashed var(--border-light);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
    transition: border-color 0.2s, background 0.2s;
    min-height: 110px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ea-upload-slot-content {
    cursor: pointer;
    width: 100%;
}

.ea-upload-slot:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.ea-upload-slot.has-file {
    border-color: var(--success);
    border-style: solid;
    background: rgba(34, 197, 94, 0.04);
}

.ea-upload-slot-selected {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    width: 100%;
}

.ea-upload-slot-filename {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 150px;
}

/* EA-Versions-Input in Tabelle */
.ea-version-input {
    width: 60px;
    text-align: center;
    font-weight: 600;
    font-size: 0.82rem;
    padding: 3px 6px;
    border: 1px solid transparent;
    background: transparent;
    border-radius: 4px;
    color: var(--text-primary);
    transition: border-color 0.15s, background 0.15s;
}

.ea-version-input:hover {
    border-color: var(--border-color);
}

.ea-version-input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg-input);
}

/* EA Download-Links */
.ea-file-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    color: var(--primary);
    text-decoration: none;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background 0.15s;
}

.ea-file-link:hover {
    background: rgba(255, 179, 0, 0.08);
    text-decoration: underline;
}

/* ============================================
   AI-Analytics Console
   ============================================ */
.ai-console {
    min-height: 80px;
    max-height: 500px;
    overflow-y: auto;
    font-size: 0.82rem;
    line-height: 1.6;
}

.ai-console-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 32px 16px;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.ai-console-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 32px 16px;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.ai-loader {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: ai-spin 0.8s linear infinite;
}

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

.ai-console-error {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px;
    color: var(--danger);
    background: rgba(239, 68, 68, 0.06);
    border-radius: var(--radius);
    margin: 8px;
}

.ai-console-content {
    padding: 16px;
    color: var(--text);
}

.ai-console-content h1,
.ai-console-content h2,
.ai-console-content h3,
.ai-console-content h4,
.ai-console-content h5 {
    color: var(--text-heading);
    margin-top: 16px;
    margin-bottom: 8px;
}

.ai-console-content h1 { font-size: 1.1rem; }
.ai-console-content h2 { font-size: 1rem; }
.ai-console-content h3 { font-size: 0.92rem; }
.ai-console-content h4 { font-size: 0.88rem; }
.ai-console-content h5 { font-size: 0.84rem; }

.ai-console-content p {
    margin-bottom: 8px;
}

.ai-console-content ul,
.ai-console-content ol {
    padding-left: 20px;
    margin-bottom: 8px;
}

.ai-console-content li {
    margin-bottom: 4px;
}

.ai-console-content strong {
    color: var(--text-heading);
    font-weight: 600;
}

.ai-console-content em {
    font-style: italic;
}

.ai-console-content code {
    background: var(--bg-input);
    padding: 1px 5px;
    border-radius: 3px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.8rem;
}

.ai-console-content pre.ai-code {
    background: var(--bg-dark, #1a1a2e);
    color: #e0e0e0;
    padding: 12px;
    border-radius: var(--radius);
    overflow-x: auto;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.78rem;
    margin: 8px 0;
}

.ai-console-content hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 12px 0;
}

.ai-console-meta {
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
    font-size: 0.72rem;
    color: var(--text-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

/* =============================================
   Depot View Modal
   ============================================= */
.depot-view-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.depot-view-stat-card {
    background: var(--bg-input, #1a1a2e);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
}

.depot-view-stat-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.depot-view-stat-value {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.depot-view-stat-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.depot-view-footer-info {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    font-size: 0.78rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
}

@media (max-width: 600px) {
    .depot-view-stats {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   TRADECOPIER SIMULATION
   ============================================ */
.sim-stats-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 14px;
    margin-bottom: 20px;
}

.sim-stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 16px 18px;
    transition: transform 0.15s, box-shadow 0.15s;
}

.sim-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-light);
}

.sim-stat-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-color);
}

.sim-stat-value {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-heading);
}

.sim-stat-value.positive {
    color: var(--success);
}

.sim-stat-value.negative {
    color: var(--danger);
}

@media (max-width: 1200px) {
    .sim-stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .sim-stats-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   MOBILE DASHBOARD OPTIMIERUNGEN
   ============================================ */

/* Mobile-spezifische Optimierungen für Dashboard (max-width: 768px) */
@media (max-width: 768px) {
    /* Stats Grid - auf mobilen Geräten ausblenden */
    .stats-grid {
        display: none;
    }
    
    /* Kompaktere Stat Cards für mobile */
    .stat-card {
        padding: 16px;
        gap: 12px;
    }
    
    .stat-icon {
        width: 40px;
        height: 40px;
    }
    
    .stat-icon i,
    .stat-icon svg {
        width: 20px;
        height: 20px;
    }
    
    .stat-info h3 {
        font-size: 0.72rem;
        margin-bottom: 2px;
    }
    
    .stat-value {
        font-size: 1.2rem;
    }
    
    /* Dashboard Grid - 1 Spalte auf mobilen Geräten, volle Breite */
    .dashboard-grid {
        gap: 16px !important;
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        max-width: 100% !important;
        align-items: stretch !important;
    }
    
    /* Dashboard Grid Container - volle Breite */
    .dashboard-grid > div {
        width: 100% !important;
        max-width: 100% !important;
        flex: 1 1 100%;
    }
    
    /* Mobile Reihenfolge: Portfolios, Depots, Benachrichtigungen, Strategien */
    .dashboard-grid > div:nth-child(1) {
        order: 1; /* Portfolios */
    }
    
    .dashboard-grid > div:nth-child(2) {
        order: 4; /* Strategien - nach unten */
    }
    
    .dashboard-grid > div:nth-child(3) {
        order: 2; /* Depots - nach oben */
    }
    
    .dashboard-grid > div:nth-child(4) {
        order: 3; /* Notifications */
    }
    
    /* Page Header - kompakter */
    .page-header {
        margin-bottom: 16px;
    }
    
    .page-header h1 {
        font-size: 1.5rem;
    }
    
    .page-header p {
        font-size: 0.85rem;
    }
    
    /* Portfolio Cards - mobile optimiert, volle Breite */
    .dashboard-grid .card {
        border-radius: var(--radius);
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box;
    }
    
    /* Alle Dashboard-Container - volle Breite */
    .dashboard-grid > div[style*="display:flex"] {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .dashboard-grid .card-header {
        padding: 12px 16px;
    }
    
    .dashboard-grid .card-title {
        font-size: 0.95rem;
    }
    
    .dashboard-grid .card-body {
        padding: 12px 16px;
    }
    
    /* Portfolio Mini-Charts - kleiner auf mobile */
    .dashboard-grid canvas {
        max-height: 60px;
    }
    
    /* Strategien-Tabelle - mobile optimiert */
    .dashboard-grid .table-sm {
        font-size: 0.75rem;
    }
    
    .dashboard-grid .table-sm th,
    .dashboard-grid .table-sm td {
        padding: 8px;
        font-size: 0.75rem;
    }
    
    /* Badges kleiner auf mobile */
    .dashboard-grid .badge-status {
        font-size: 0.55rem;
        padding: 2px 6px;
    }
    
    /* Section Headers - kompakter */
    .dashboard-grid h3 {
        font-size: 0.75rem;
        margin-bottom: 8px;
    }
    
    /* Touch-optimierte Buttons */
    .dashboard-grid .btn {
        min-height: 36px;
        padding: 8px 12px;
    }
    
    /* Depot/Notification Cards - kompakter */
    #dashDepotList .card,
    #dashNotifList .card {
        margin-bottom: 12px;
    }
}

/* Kleine mobile Geräte (max-width: 480px) */
@media (max-width: 480px) {
    /* Stats Grid bleibt ausgeblendet */
    
    /* Page Header - noch kompakter */
    .page-header h1 {
        font-size: 1.3rem;
    }
    
    .page-header p {
        font-size: 0.8rem;
    }
    
    /* Dashboard Grid - noch weniger Abstand, volle Breite */
    .dashboard-grid {
        gap: 12px !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    /* Dashboard Grid Container - volle Breite */
    .dashboard-grid > div {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    /* Cards - volle Breite */
    .dashboard-grid .card {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    /* Cards - noch kompakter */
    .dashboard-grid .card-header {
        padding: 10px 12px;
    }
    
    .dashboard-grid .card-body {
        padding: 10px 12px;
    }
    
    /* Portfolio Metrics - kompakter */
    .dashboard-grid .card-body > div {
        gap: 8px;
    }
    
    /* Strategien-Tabelle - noch kompakter */
    .dashboard-grid .table-sm th,
    .dashboard-grid .table-sm td {
        padding: 6px;
        font-size: 0.7rem;
    }
    
    /* Mini-Charts - noch kleiner */
    .dashboard-grid canvas {
        max-height: 50px;
    }
    
    /* Portfolio Card Metriken - kompakter */
    .dashboard-grid .card-body > div[style*="display:flex"] {
        gap: 8px !important;
    }
    
    .dashboard-grid .card-body > div[style*="min-width:90px"] {
        min-width: 70px !important;
    }
    
    /* Metriken-Text kleiner */
    .dashboard-grid .text-muted[style*="font-size:0.58rem"] {
        font-size: 0.5rem !important;
    }
    
    .dashboard-grid div[style*="font-size:0.8rem"][id*="dash-metric"] {
        font-size: 0.7rem !important;
    }
    
    /* Total Profit größer auf mobile */
    .dashboard-grid div[id*="dash-metric-tpp"] {
        font-size: 0.9rem !important;
    }
}

/* Touch-optimierte Interaktionen für mobile Geräte */
@media (max-width: 768px) {
    /* Größere Touch-Targets */
    .card-clickable {
        min-height: 44px; /* Mindesthöhe für Touch-Targets */
    }
    
    /* Tabelle-Zeilen größer für Touch */
    .dashboard-grid .table-sm tbody tr {
        min-height: 44px;
    }
    
    /* Buttons größer für Touch */
    .dashboard-grid .btn-sm {
        min-height: 36px;
        padding: 8px 12px;
    }
    
    /* Scroll-Verhalten für Dashboard-Grid */
    .dashboard-grid {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Portfolio Card Layout - Metriken bleiben rechts neben dem Graphen */
    .dashboard-grid .card-body > div[style*="display:flex"][style*="align-items:stretch"] {
        gap: 12px !important;
    }
    
    .dashboard-grid .card-body > div[style*="min-height:80px"] {
        min-height: 60px !important;
    }
    
    /* Metriken rechts bleiben - nur kompakter */
    .dashboard-grid .card-body > div[style*="min-width:90px"][style*="text-align:right"] {
        min-width: 80px !important;
    }
    
    /* Strategien-Tabelle - horizontales Scrollen auf sehr kleinen Geräten */
    .dashboard-grid .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Modal-Anpassungen für mobile */
    .modal {
        width: calc(100% - 32px);
        max-width: 100%;
        margin: 16px;
    }
    
    .modal-header {
        padding: 16px;
    }
    
    .modal-body {
        padding: 16px;
    }
    
    .modal-footer {
        padding: 12px 16px;
        flex-direction: column-reverse;
        gap: 8px;
    }
    
    .modal-footer .btn {
        width: 100%;
    }
}

/* ---- DEV Environment Bar ---- */
.dev-env-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10000;
    height: 26px;
    background: #c0392b;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    justify-content: center;
}

body:has(.dev-env-bar) .app-container {
    padding-top: 26px;
}