@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --bg: #0b1120;
    --bg-soft: #0f172a;
    --card: #161f34;
    --card-2: #1a2540;
    --border: #263248;
    --border-soft: rgba(255, 255, 255, 0.08);
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --text-faint: #64748b;

    --primary: #f59e0b;
    --primary-strong: #fbbf24;
    --primary-ink: #1c1206;
    --accent: #8b5cf6;
    --accent-soft: rgba(139, 92, 246, 0.15);

    --positive: #22c55e;
    --positive-soft: rgba(34, 197, 94, 0.14);
    --negative: #ef4444;
    --negative-soft: rgba(239, 68, 68, 0.14);

    --radius-sm: 8px;
    --radius: 14px;
    --radius-lg: 20px;

    --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 10px 30px -12px rgba(0, 0, 0, 0.55);
    --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
    margin: 0;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
    position: relative;
    min-height: 100vh;
}

/* Ambient background glow — visible everywhere, sidebar/cards blur it for a "floating glass" feel */
body::before, body::after {
    content: '';
    position: fixed;
    border-radius: 50%;
    filter: blur(130px);
    z-index: -1;
    pointer-events: none;
    opacity: 0.28;
    animation: ambient-drift 22s ease-in-out infinite;
}
body::before { width: 560px; height: 560px; background: var(--accent); top: -180px; right: -140px; }
body::after { width: 520px; height: 520px; background: var(--primary); bottom: -200px; left: -140px; animation-delay: -9s; }

@keyframes ambient-drift {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(-40px, 30px) scale(1.12); }
}

/* Subtle film-grain overlay for a cinematic, premium finish */
.grain-overlay {
    position: fixed;
    inset: 0;
    z-index: 999;
    pointer-events: none;
    opacity: 0.035;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

h1, h2, h3 { font-weight: 700; letter-spacing: -0.01em; }

.gradient-text {
    background: linear-gradient(120deg, var(--text) 20%, var(--primary-strong) 65%, var(--accent) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

a { color: var(--primary-strong); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 4px;
}

.icon { width: 18px; height: 18px; flex-shrink: 0; display: inline-block; vertical-align: -3px; }
.icon-sm { width: 15px; height: 15px; }
.icon-lg { width: 28px; height: 28px; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* ---------- App Shell ---------- */

.app-shell {
    display: flex;
    min-height: 100vh;
    position: relative;
    z-index: 0;
}

.sidebar {
    width: 250px;
    flex-shrink: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    border-right: 1px solid var(--border-soft);
    display: flex;
    flex-direction: column;
    padding: 22px 16px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 6px 22px;
    border-bottom: 1px solid var(--border-soft);
    margin-bottom: 20px;
}

.brand-centered { justify-content: center; border-bottom: none; margin-bottom: 6px; padding-bottom: 0; }

.brand-mark {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    background-size: 200% 200%;
    animation: brand-shimmer 6s ease infinite;
    color: var(--primary-ink);
    font-weight: 800;
    font-size: 15px;
    width: 38px;
    height: 38px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 6px 18px -4px rgba(245, 158, 11, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
}

@keyframes brand-shimmer {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.brand-name { font-weight: 700; line-height: 1.25; font-size: 15px; letter-spacing: -0.01em; }
.brand-name small { color: var(--text-muted); font-weight: 500; font-size: 12px; display: block; }

.nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }

.nav a {
    color: var(--text-muted);
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 11px;
    font-size: 14px;
    font-weight: 500;
    transition: background 150ms ease, color 150ms ease;
}

.nav a { position: relative; }
.nav a:hover { background: rgba(255, 255, 255, 0.06); text-decoration: none; color: var(--text); transform: translateX(2px); }
.nav a.active {
    background: linear-gradient(90deg, var(--accent-soft), rgba(245, 158, 11, 0.08) 70%, transparent);
    color: var(--text);
    box-shadow: 0 4px 14px -6px rgba(245, 158, 11, 0.35);
}
.nav a.active::before {
    content: '';
    position: absolute;
    left: -16px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    border-radius: 3px;
    background: linear-gradient(180deg, var(--primary-strong), var(--accent));
    box-shadow: 0 0 10px 1px rgba(245, 158, 11, 0.7);
}
.nav a.active .icon { color: var(--primary-strong); }

.sidebar-footer {
    border-top: 1px solid var(--border-soft);
    padding-top: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 13px;
}

.sidebar-user { display: flex; align-items: center; gap: 9px; color: var(--text-muted); overflow: hidden; }
.sidebar-user .icon { color: var(--text-faint); }
.username { color: var(--text); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logout-link { color: var(--text-faint); display: flex; align-items: center; padding: 6px; border-radius: var(--radius-sm); transition: color 150ms, background 150ms; }
.logout-link:hover { color: var(--negative); background: var(--negative-soft); text-decoration: none; }

.content {
    flex: 1;
    padding: 30px 40px 50px;
    max-width: 1280px;
    min-width: 0;
}

.content-auth {
    max-width: none;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    position: relative;
    overflow: hidden;
    background: radial-gradient(ellipse 80% 60% at 50% -10%, rgba(139, 92, 246, 0.22), transparent),
                radial-gradient(ellipse 70% 50% at 100% 100%, rgba(245, 158, 11, 0.12), transparent),
                var(--bg);
}

.auth-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    pointer-events: none;
    opacity: 0.55;
    animation: blob-float 12s ease-in-out infinite;
}
.auth-blob-1 { width: 380px; height: 380px; background: rgba(245, 158, 11, 0.25); top: -120px; left: -100px; }
.auth-blob-2 { width: 420px; height: 420px; background: rgba(139, 92, 246, 0.3); bottom: -160px; right: -120px; animation-delay: -6s; }

@keyframes blob-float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(30px, -20px) scale(1.08); }
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 26px;
    gap: 16px;
    flex-wrap: wrap;
}

.page-header h1 { margin: 0; font-size: 26px; }
.page-subtitle { color: var(--text-muted); font-size: 14px; margin: 4px 0 0; }

/* ---------- Cards ---------- */

.card {
    background: var(--card);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 22px;
    box-shadow: var(--shadow-card);
    transition: border-color 200ms ease, transform 200ms ease;
}

/* Soft ambient glow halo for hero/featured surfaces — pure box-shadow, so it
   always renders outside the card with no stacking-order surprises. */
.glow-border {
    border-color: rgba(245, 158, 11, 0.22) !important;
    box-shadow: var(--shadow-card),
                0 0 36px -14px rgba(245, 158, 11, 0.45),
                0 0 64px -20px rgba(139, 92, 246, 0.4);
}

.card-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    gap: 12px;
    flex-wrap: wrap;
}

.card-header-row h2 { margin: 0; font-size: 17px; }

/* ---------- Stat cards ---------- */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}

.stat-card {
    background: var(--card);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: var(--shadow-card);
    transition: border-color 200ms ease, transform 200ms ease, box-shadow 200ms ease;
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    border-color: var(--border);
    transform: translateY(-3px) scale(1.01);
    box-shadow: var(--shadow-card), 0 16px 32px -18px rgba(245, 158, 11, 0.25);
}

.stat-card-featured {
    grid-column: span 2;
    background: linear-gradient(155deg, var(--card-2), var(--card));
}
.stat-card-featured .stat-value { font-size: 32px; }

.stat-card-top { display: flex; align-items: center; justify-content: space-between; }
.stat-label { color: var(--text-muted); font-size: 12.5px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.03em; }

.stat-sparkline {
    position: absolute;
    right: -6px;
    bottom: -6px;
    width: 110px;
    height: 44px;
    opacity: 0.55;
    pointer-events: none;
}

.stat-icon {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-soft);
    color: var(--accent);
    flex-shrink: 0;
}
.stat-icon .icon { width: 16px; height: 16px; }
.stat-icon-positive { background: var(--positive-soft); color: var(--positive); }
.stat-icon-negative { background: var(--negative-soft); color: var(--negative); }

.stat-value { font-size: 24px; font-weight: 800; letter-spacing: -0.01em; }

.text-positive { color: var(--positive); }
.text-negative { color: var(--negative); }

.chart-card h2 { margin-top: 0; }

/* ---------- Forms ---------- */

.form { display: flex; flex-direction: column; gap: 18px; }

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
}

label {
    display: flex;
    flex-direction: column;
    gap: 7px;
    font-size: 13.5px;
    color: var(--text-muted);
    font-weight: 500;
}

input, select, textarea {
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 11px 13px;
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

input::placeholder, textarea::placeholder { color: var(--text-faint); }

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
    background: var(--card-2);
}

input[type="file"] { padding: 9px 13px; cursor: pointer; }

select { cursor: pointer; }

.form-actions { display: flex; gap: 10px; }

/* Icon-inside-input pattern (used on auth forms) */
.input-icon-wrap { position: relative; display: block; }
.input-icon-wrap input { width: 100%; }
.input-icon-wrap > .icon {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-faint);
    pointer-events: none;
}
.input-icon-wrap input { padding-left: 38px; padding-right: 40px; }
.input-icon-wrap .input-toggle {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-faint);
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}
.input-icon-wrap .input-toggle .icon {
    position: static;
    transform: none;
    pointer-events: none;
}
.input-icon-wrap .input-toggle:hover { color: var(--text); }

/* ---------- Buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 11px 18px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--card-2);
    color: var(--text);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: border-color 150ms ease, background 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

.btn:hover { text-decoration: none; border-color: var(--text-faint); }
.btn:active { transform: scale(0.98); }

.btn-primary {
    background: linear-gradient(135deg, var(--primary-strong), var(--primary));
    border-color: transparent;
    color: var(--primary-ink);
    font-weight: 700;
    box-shadow: 0 8px 20px -8px rgba(245, 158, 11, 0.55);
    position: relative;
    overflow: hidden;
    isolation: isolate;
}
.btn-primary:hover { box-shadow: 0 12px 28px -8px rgba(245, 158, 11, 0.75); transform: translateY(-1px); }
.btn-primary::after {
    content: '';
    position: absolute;
    top: 0;
    left: -75%;
    width: 45%;
    height: 100%;
    background: linear-gradient(115deg, transparent, rgba(255, 255, 255, 0.55), transparent);
    transform: skewX(-18deg);
    transition: left 550ms ease;
}
.btn-primary:hover::after { left: 130%; }

.btn-secondary { background: transparent; }
.btn-danger { color: var(--negative); border-color: rgba(239, 68, 68, 0.35); background: rgba(239, 68, 68, 0.08); }
.btn-danger:hover { background: var(--negative-soft); border-color: var(--negative); }
.btn-link { background: transparent; border: none; color: var(--primary-strong); padding: 8px 4px; }
.btn-link:hover { text-decoration: underline; }
.btn-block { width: 100%; }
.btn-small { padding: 7px 11px; font-size: 12.5px; }
.btn-google { background: var(--card-2); }

/* ---------- Auth cards ---------- */

.auth-card {
    background: rgba(15, 21, 36, 0.86);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid rgba(245, 158, 11, 0.25);
    border-radius: var(--radius-lg);
    padding: 38px 34px;
    width: 100%;
    max-width: 400px;
    position: relative;
    z-index: 1;
    box-shadow: 0 30px 60px -25px rgba(0, 0, 0, 0.65),
                0 0 0 1px rgba(255, 255, 255, 0.04) inset,
                0 0 50px -12px rgba(245, 158, 11, 0.35),
                0 0 90px -20px rgba(139, 92, 246, 0.35);
}

.auth-card h1 { text-align: center; font-size: 21px; margin: 4px 0 4px; }
.auth-subtitle { text-align: center; color: var(--text-muted); font-size: 13.5px; margin: 0 0 26px; }
.auth-hint { text-align: center; color: var(--text-muted); font-size: 13px; margin-top: 18px; }
.auth-hint.auth-hint-tight { margin-top: 8px; }

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-faint);
    font-size: 12px;
    margin: 4px 0;
}
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.otp-input {
    text-align: center;
    font-size: 24px;
    letter-spacing: 10px;
    font-weight: 700;
    padding: 12px 0 12px 10px !important;
}

/* ---------- Flash ---------- */

.flash {
    padding: 13px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 18px;
    font-size: 13.5px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.flash-success { background: var(--positive-soft); border: 1px solid rgba(34, 197, 94, 0.35); color: #86efac; }
.flash-error { background: var(--negative-soft); border: 1px solid rgba(239, 68, 68, 0.35); color: #fca5a5; }
.flash ul { margin: 0; padding-left: 18px; }
.flash .icon { margin-top: 1px; }
.flash-auth { position: relative; z-index: 1; max-width: 400px; width: 100%; }

/* ---------- Filters / Tables ---------- */

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: flex-end;
}

.filter-bar label { min-width: 150px; }

.table-wrapper { overflow-x: auto; }

.trades-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

.trades-table th, .trades-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-soft);
    text-align: left;
    white-space: nowrap;
}

.trades-table th { color: var(--text-muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; }
.trades-table tbody tr { transition: background 120ms ease; }
.trades-table tbody tr:hover { background: rgba(255, 255, 255, 0.025); }
.trades-table tbody tr:last-child td { border-bottom: none; }

.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.badge-long { background: var(--positive-soft); color: var(--positive); box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.25) inset, 0 0 12px -4px rgba(34, 197, 94, 0.5); }
.badge-short { background: var(--negative-soft); color: var(--negative); box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.25) inset, 0 0 12px -4px rgba(239, 68, 68, 0.5); }

.table-actions { display: flex; gap: 8px; }
.inline-form { display: inline; }

.flash-inline { display: inline-flex; }
.form-narrow { max-width: 340px; }
.form-mt { margin-top: 10px; }

/* ---------- 2FA / Security ---------- */

.qr-wrapper {
    background: #ffffff;
    display: inline-block;
    padding: 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 14px;
    box-shadow: 0 10px 28px -10px rgba(0, 0, 0, 0.5);
}

.totp-secret {
    font-family: 'Courier New', monospace;
    font-size: 19px;
    letter-spacing: 2px;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    display: inline-block;
    margin: 6px 0 14px;
    word-break: break-all;
}

.security-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    background: var(--positive-soft);
    color: #86efac;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 6px;
}
.security-status .icon { color: var(--positive); }

.trust-status {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    margin: 4px 0 14px;
    font-size: 13.5px;
}
.trust-status strong { display: block; font-size: 14px; margin-bottom: 2px; }
.trust-status p { margin: 0; color: var(--text-muted); }
.trust-status .icon { flex-shrink: 0; margin-top: 2px; }
.trust-status-active { background: var(--positive-soft); color: #86efac; }
.trust-status-active .icon { color: var(--positive); }
.trust-status-idle { background: var(--card-2); color: var(--text-muted); border: 1px solid var(--border-soft); }
.trust-status-idle .icon { color: var(--text-faint); }

.step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 12px;
    font-weight: 700;
    margin-right: 8px;
    flex-shrink: 0;
}

/* ---------- Wirtschaftskalender ---------- */

.chip {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    white-space: nowrap;
}
.chip-high { background: var(--negative-soft); color: var(--negative); box-shadow: 0 0 10px -3px rgba(239, 68, 68, 0.6); }
.chip-medium { background: rgba(245, 158, 11, 0.16); color: var(--primary-strong); }
.chip-low { background: var(--card-2); color: var(--text-muted); border: 1px solid var(--border-soft); }
.chip-holiday { background: var(--accent-soft); color: var(--accent); }
.chip-topic { background: rgba(139, 92, 246, 0.14); color: #c4b5fd; }

.filter-group { display: flex; flex-direction: column; gap: 7px; min-width: 150px; }
.filter-group-label { font-size: 13.5px; color: var(--text-muted); font-weight: 500; }
.filter-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-check { display: inline-flex; align-items: center; cursor: pointer; gap: 0; font-weight: normal; }
.chip-check input { position: absolute; opacity: 0; width: 0; height: 0; }
.chip-check .chip { border: 1px solid transparent; opacity: 0.45; transition: opacity 150ms ease, transform 150ms ease; cursor: pointer; }
.chip-check input:checked + .chip { opacity: 1; transform: translateY(-1px); }
.chip-check input:focus-visible + .chip { outline: 2px solid var(--primary); outline-offset: 2px; }

.calendar-day-card { padding-bottom: 8px; }
.calendar-day-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.calendar-day-header .icon { color: var(--primary-strong); }
.calendar-day-header h2 { margin: 0; font-size: 15px; text-transform: capitalize; flex: 1; }

.calendar-table th:first-child, .calendar-table td:first-child { white-space: nowrap; }
.calendar-time-cell { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.calendar-row-high { background: rgba(239, 68, 68, 0.05); }
.calendar-row-high:hover { background: rgba(239, 68, 68, 0.09) !important; }

.calendar-detail-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    border: none;
    background: none;
    border-radius: var(--radius-sm);
    color: var(--text-faint);
    cursor: pointer;
    transition: color 150ms ease, background 150ms ease, transform 150ms ease;
}
.calendar-detail-toggle:hover, .calendar-detail-toggle.is-open { color: var(--primary-strong); background: var(--accent-soft); }

.calendar-meta-note { color: var(--text-faint); font-size: 12.5px; text-align: center; margin: 10px 0 0; }

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(5, 8, 16, 0.72);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 200;
}
.modal-overlay[hidden] { display: none; }
.modal-card {
    position: relative;
    width: 100%;
    max-width: 440px;
    background: rgba(15, 21, 36, 0.96);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    box-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(245, 158, 11, 0.1);
    padding: 22px 22px 20px;
    animation: modal-pop 160ms ease;
}
@keyframes modal-pop {
    from { opacity: 0; transform: translateY(6px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    border: none;
    background: none;
    color: var(--text-faint);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: color 150ms ease, background 150ms ease;
}
.modal-close:hover { color: var(--text); background: var(--card-2); }
.modal-card h3 {
    margin: 0 26px 4px 0;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.modal-card h3 .icon { color: var(--primary-strong); flex-shrink: 0; }
.modal-card .modal-impact { margin: 0 0 12px; }
.modal-card p {
    margin: 0;
    color: var(--text-muted);
    font-size: 13.5px;
    line-height: 1.6;
    white-space: pre-line;
}

.text-faint { color: var(--text-faint); }

code {
    background: var(--card-2);
    border: 1px solid var(--border-soft);
    border-radius: 4px;
    padding: 1px 5px;
    font-size: 12px;
    color: var(--primary-strong);
}

.favorite-chips { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.favorite-chip-wrap { position: relative; display: inline-flex; }
.favorite-chip {
    text-decoration: none;
    padding-right: 28px;
    border: 1px solid transparent;
    transition: opacity 150ms ease, transform 150ms ease, border-color 150ms ease;
}
.favorite-chip:hover { text-decoration: none; opacity: 0.85; }
.favorite-chip.is-active { border-color: var(--primary); opacity: 1; box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.3); }
.favorite-chip-remove {
    position: absolute;
    right: 3px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: inherit;
    opacity: 0.6;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px;
    border-radius: 50%;
}
.favorite-chip-remove:hover { opacity: 1; background: rgba(0, 0, 0, 0.2); }
.favorite-chip-remove .icon { width: 12px; height: 12px; }

.favorite-add-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.favorite-add-form input[type="text"] { flex: 1 1 200px; }
.favorite-hint { text-align: left; margin-top: 12px; }

.watchlist-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}
.watchlist-tile {
    background: var(--card);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 14px 16px;
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-decoration: none;
    transition: transform 150ms ease, border-color 150ms ease;
}
.watchlist-tile:hover {
    transform: translateY(-2px);
    border-color: rgba(245, 158, 11, 0.4);
    text-decoration: none;
}
.watchlist-tile-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: 0.02em;
}
.watchlist-tile-price {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}
.watchlist-tile-change {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.watchlist-tile-arrow { font-size: 11px; line-height: 1; }
.watchlist-tile-change.is-positive { color: var(--positive); }
.watchlist-tile-change.is-negative { color: var(--negative); }
.watchlist-tile-change.is-flat { color: var(--text-muted); }

.tv-chart-card { padding: 12px; }
/* Die feste Pixel-Höhe muss auf dem äußersten Container stehen (sein Elternelement .card hat
   keine definierte Höhe, daher würde "height: 100%" hier ins Leere laufen und alles zusammenfallen
   lassen). Nur die inneren Ebenen dürfen sich per 100% daran orientieren. */
.tv-chart-container { width: 100%; height: 640px; }
.tv-chart-card .tradingview-widget-container__widget,
.tv-chart-card iframe {
    width: 100% !important;
    height: 100% !important;
}

.stats-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
@media (max-width: 900px) {
    .stats-two-col { grid-template-columns: 1fr; }
}

.news-widget { border: 1px solid rgba(245, 158, 11, 0.18); }
.news-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.news-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 4px;
    border-bottom: 1px solid var(--border-soft);
    font-size: 13.5px;
}
.news-item:last-child { border-bottom: none; }
.news-country { color: var(--text-muted); font-weight: 700; font-size: 12px; width: 34px; flex-shrink: 0; }
.news-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.news-time { color: var(--text-faint); font-size: 12.5px; flex-shrink: 0; white-space: nowrap; }
.news-source-label { color: var(--text-muted); font-weight: 700; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.02em; flex-shrink: 0; }

.risk-calc-grid { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(260px, 1fr); gap: 32px; align-items: start; }
.risk-calc-inputs { display: flex; flex-direction: column; gap: 16px; }
.label-optional { color: var(--text-faint); font-weight: 400; }

.input-suffix-wrap { position: relative; }
.input-suffix-wrap input { width: 100%; padding-right: 38px; }
.input-suffix {
    position: absolute;
    right: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-faint);
    font-size: 13px;
    pointer-events: none;
}

.risk-mode-toggle { display: flex; gap: 8px; }

.risk-calc-results {
    background: var(--card-2);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.risk-result-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    padding: 11px 0;
    border-bottom: 1px solid var(--border-soft);
}
.risk-result-row:last-of-type { border-bottom: none; }
.risk-result-label { color: var(--text-muted); font-size: 13.5px; }
.risk-result-value { font-weight: 700; font-size: 16px; font-variant-numeric: tabular-nums; text-align: right; }
.risk-result-featured { background: var(--accent-soft); margin: 4px -12px; padding: 13px 12px; border-radius: var(--radius-sm); border-bottom: none; }
.risk-result-featured .risk-result-label { color: var(--text); font-weight: 600; }
.risk-result-featured .risk-result-value { color: var(--primary-strong); font-size: 19px; }

.risk-calc-hint {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 14px 0 0;
    color: var(--text-faint);
    font-size: 12.5px;
    line-height: 1.55;
}
.risk-calc-hint .icon { flex-shrink: 0; margin-top: 1px; }

@media (max-width: 760px) {
    .risk-calc-grid { grid-template-columns: 1fr; }
}

.empty-state { color: var(--text-muted); text-align: center; padding: 30px 0 !important; }
.empty-state-inner { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty-state .icon-lg { color: var(--text-faint); }

.current-screenshot { margin-top: -4px; }
.screenshot-preview { max-width: 100%; max-height: 260px; border-radius: var(--radius-sm); border: 1px solid var(--border); margin-top: 6px; }

.video-embed-wrapper {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: #000;
    border: 1px solid var(--border-soft);
}
.video-embed-wrapper iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
}
.live-hint {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 14px 0 0;
    color: var(--text-faint);
    font-size: 13px;
    line-height: 1.55;
}
.live-hint .icon { flex-shrink: 0; margin-top: 1px; }
.live-links-subtitle { margin-top: 0; }
.external-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }

.news-feed-card { padding: 8px 22px; }
.news-feed-list { list-style: none; margin: 0; padding: 0; }
.news-feed-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 0;
    border-bottom: 1px solid var(--border-soft);
    flex-wrap: wrap;
}
.news-feed-item:last-child { border-bottom: none; }
.news-feed-item.is-breaking { background: rgba(239, 68, 68, 0.04); margin: 0 -22px; padding: 13px 22px; border-bottom-color: rgba(239, 68, 68, 0.12); }
.news-feed-badge { display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0; }
.news-feed-source { color: var(--text-faint); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em; flex-shrink: 0; }
.news-feed-title { color: var(--text); font-size: 14px; text-decoration: none; flex: 1 1 320px; min-width: 0; }
.news-feed-title:hover { color: var(--primary-strong); text-decoration: underline; }
.news-feed-time { color: var(--text-faint); font-size: 12.5px; flex-shrink: 0; white-space: nowrap; margin-left: auto; }

@media (max-width: 900px) {
    .sidebar { width: 210px; }
    .content { padding: 24px; }
}

@media (max-width: 720px) {
    .app-shell { flex-direction: column; }
    .sidebar { width: 100%; flex-direction: row; align-items: center; justify-content: space-between; height: auto; position: static; padding: 14px 16px; }
    .brand { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
    .brand-name { display: none; }
    .nav { flex-direction: row; }
    .nav a span { display: none; }
    .sidebar-footer { border-top: none; padding-top: 0; }
    .sidebar-user .username { display: none; }
    .content { padding: 20px; }
    .auth-card { padding: 30px 24px; }
}
