/* === THEME === */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
@import url('../shared-theme.css');

/* Global box-sizing to avoid unexpected overflow from children */
html { box-sizing: border-box; }
*, *::before, *::after { box-sizing: inherit; }

body { 
    margin: 0; 
    padding: 0; 
    background-color: #181b24;
    color: #ffffff; 
    font-family: 'Inter', system-ui, -apple-system, sans-serif; 
    
    /* VERY IMPORTANT for Android fix: */
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0; /* Zwingt den Body bis ganz nach unten */
    height: 100% !important; /* Fallback */
    
    overflow: hidden; 
    touch-action: none; 
    display: flex; 
    flex-direction: column; 

    /* Verhindert das versehentliche Markieren von Text */
    user-select: none;
    -webkit-user-select: none; 
    /* Verhindert den "Pull-to-Refresh" (Nach-unten-ziehen zum Neuladen) von Browsern */
    overscroll-behavior-y: none; 
    /* Prevents the typical grey flash when tapping on mobile devices */
    -webkit-tap-highlight-color: transparent;
}

/* TradingView-Style Top-Bar */
#top-bar {
        padding: 14px 28px;
        background: rgba(32, 38, 54, 0.85);
        box-shadow: 0 4px 24px 0 rgba(0,0,0,0.12);
        border-bottom: 1.5px solid #232634;
        display: flex;
        gap: 16px;
        align-items: center;
        flex-wrap: wrap;
        z-index: 30;
        position: relative;
        border-radius: 0 0 18px 18px;
        backdrop-filter: blur(8px);
        /* allow the bar to grow and wrap instead of clipping content */
        max-height: none;
        overflow: visible;
}

select, button {
    padding: 8px 18px;
    background: rgba(44, 51, 73, 0.95);
    color: #eaeef5;
    border: 1.5px solid #2a2e3d;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    outline: none;
    box-shadow: 0 2px 8px 0 rgba(0,0,0,0.12);
}
button:hover, select:hover {
    background: rgba(60, 70, 100, 1);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px 0 rgba(0,0,0,0.18);
}
button:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px 0 rgba(0,0,0,0.10);
}

.back-home-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    margin-right: auto;
    background: rgba(71, 85, 105, 0.9);
    color: #ffffff;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: background 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}
.back-home-btn:hover {
    background: rgba(100, 116, 139, 0.95);
    color: #fff;
    border-color: rgba(148, 163, 184, 0.28);
    transform: translateY(-1px);
}

.app-installed .back-home-btn {
    display: none !important;
}

@media (display-mode: standalone) {
    .back-home-btn {
        display: none !important;
    }
}

.active-btn {
    background-color: #2962ff !important;
    border-color: #2962ff !important;
    color: #fff !important;
    font-weight: bold;
    box-shadow: 0 2px 8px 0 rgba(41,98,255,0.15);
}
#live-price {
    font-size: 12px;
    font-weight: bold;
    color: #4ade80;
    margin-left: 0;
    background: rgba(34, 40, 54, 0.7);
    padding: 6px 18px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    box-shadow: 0 1px 4px 0 rgba(8,153,129,0.10);
}
.closed { color: #f23645 !important; }

.tool-group {
    display: flex;
    gap: 6px;
    border-right: 1.5px solid #232634;
    padding-right: 14px;
}

.history-group {
    padding-right: 0;
}

#btn-undo,
#btn-redo {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

#btn-undo:disabled,
#btn-redo:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Make top-bar children flexible so they wrap cleanly on resize */
#top-bar > * { flex: 0 1 auto; min-width: 0; }
#price-container {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    z-index: 31;
}

/* Erlaubt dem Chart, exakt den flexiblen Restplatz einzunehmen */
#chart-area {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: row;
    overflow: hidden;
}

#chart-column {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#tvchart { 
    width: 100%; 
    max-width: 100%; 
    position: relative; 
    flex: 1 1 auto; 
    min-height: 0; /* Extrem wichtig, damit Flexbox das Chart bei Platzmangel stauchen darf */
    overflow: hidden; 
    box-sizing: border-box; 
}

#chart-brand-badge {
    position: absolute;
    left: 6px;
    bottom: 35px;
    z-index: 15;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 12px;
    background: transparent;
    box-shadow: none;
    pointer-events: none;
}

.chart-brand-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 12px;
}

#hint {
    font-size: 12px;
    color: #b0b6c3;
    margin-left: 10px;
    letter-spacing: 0.02em;
}

/* consolidated #tvchart rules are above */
#svg-layer { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 9; }

#chart-zitat {
    position: absolute;
    bottom: 38px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 14;
    pointer-events: none;
    max-width: 70%;
    text-align: center;
    font-size: 10.5px;
    font-style: italic;
    color: rgba(200, 210, 230, 0.38);
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity 1s ease;
}
#svg-layer, #svg-layer line, #svg-layer g, .chart-rect, .chart-text, .ls-tool {
    will-change: transform, left, top, width, height;
    backface-visibility: hidden;
}
.trading-install-cta {
    position: fixed;
    right: 14px;
    bottom: 16px;
    z-index: 1001;
    display: none;
}
.trading-install-btn {
    border: 1px solid rgba(74, 222, 128, 0.38);
    background: linear-gradient(135deg, #20e3b2 0%, #0ea5e9 100%);
    color: #05131f;
    font-weight: 800;
    font-size: 13px;
    letter-spacing: 0.01em;
    padding: 10px 14px;
    border-radius: 999px;
    box-shadow: 0 10px 22px rgba(14, 165, 233, 0.35);
}
.trading-install-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 26px rgba(14, 165, 233, 0.42);
}
.trading-install-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}
.app-installed .trading-install-cta {
    display: none !important;
}
@media (display-mode: standalone) {
    .trading-install-cta {
        display: none !important;
    }
}

@media (max-width: 900px) {
    .trading-install-cta {
        display: block;
        left: 12px;
        right: 12px;
        bottom: calc(64px + env(safe-area-inset-bottom, 0px));
    }

    .trading-install-btn {
        width: 100%;
        text-align: center;
        padding: 12px 14px;
    }
}

/* Pre-Trade Checklist Gate */
#checklist-gate {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px;
    background: rgba(7, 17, 31, 0.82);
    backdrop-filter: blur(8px);
}

#checklist-gate .gate-card {
    background: rgba(30, 41, 59, 0.96);
    border: 1px solid rgba(239, 68, 68, 0.35);
    border-radius: 20px;
    padding: 36px 32px;
    max-width: 520px;
    width: 100%;
    text-align: center;
    box-shadow: 0 24px 60px rgba(0,0,0,0.45);
}

#checklist-gate .gate-icon {
    font-size: 48px;
    margin-bottom: 16px;
    line-height: 1;
}

#checklist-gate .gate-title {
    font-size: 20px;
    font-weight: 700;
    color: #e2e8f0;
    margin: 0 0 14px;
}

#checklist-gate .gate-body {
    font-size: 14px;
    line-height: 1.7;
    color: #94a3b8;
    margin: 0 0 24px;
}

#checklist-gate .gate-btn {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 999px;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    font-size: 14px;
    transition: transform 0.2s ease, opacity 0.2s ease;
    margin-bottom: 16px;
}

#checklist-gate .gate-btn:hover {
    transform: translateY(-1px);
    opacity: 0.9;
}

#checklist-gate .gate-dismiss-btn {
    display: block;
    width: 100%;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 999px;
    padding: 10px 20px;
    color: #94a3b8;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

#checklist-gate .gate-dismiss-btn:hover {
    background: rgba(255,255,255,0.07);
    color: #e2e8f0;
}

/* === FLOATING TOOLBAR === */
#floating-toolbar {
    display: none; position: absolute;
    background: #1e222d;
    border: 1px solid #2a2e3d;
    border-radius: 10px;
    box-shadow: 0 8px 28px rgba(0,0,0,0.40);
    padding: 5px 4px;
    backdrop-filter: blur(10px);
    z-index: 20; pointer-events: auto; transform: translate(-50%, -100%); margin-top: -12px;
    align-items: center; gap: 2px;
}
.float-btn {
    background: transparent;
    border: none;
    color: #a0a8bc;
    cursor: pointer;
    padding: 7px 9px;
    border-radius: 7px;
    transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
}
.float-btn:hover { background: rgba(255,255,255,0.08); color: #eaeef5; transform: translateY(-1px); }
.float-btn:active { transform: translateY(0); }
.float-btn.delete { color: #e05f6b; }
.float-btn.delete:hover { background: rgba(242,54,69,0.15); color: #f23645; }

/* === FORMEN === */
.chart-rect { position: absolute; border: 1px solid transparent; pointer-events: none; z-index: 10; transition: border 0.1s, background-color 0.1s; }
.chart-rect.blue { background-color: #2962ff3d; }
.chart-rect.red { background-color: #b2283448; }
.chart-rect.selected-shape.blue { background-color: #2962ff3d; border-color: #2962ff3d; }
.chart-rect.selected-shape.red { background-color: #b2283448; border-color: #b2283448; }

.chart-rect.alarm-on { outline: 3px solid rgba(245,162,35,0.18); }
.chart-rect.alarm-sent { box-shadow: 0 0 18px 4px rgba(242,100,23,0.18); }

/* Alert line: active alarm = orange, triggered = gray */
#btn-alert-line { color: #f59e0b; }
#btn-alert-line.active-btn { background: rgba(245,158,11,0.15); border-color: #f59e0b; }

/* Alarm badge inside rectangle */
.rect-alarm-badge { display: none; position: absolute; top: 2px; right: 2px; background: rgba(255,255,255,0.9); color: #f5a623; padding: 1px 2px; border-radius: 12px; font-size: 12px; line-height: 1; box-shadow: 0 2px 6px rgba(0,0,0,0.08); pointer-events: none; }
.chart-rect.alarm-on .rect-alarm-badge { display: block; }
.chart-rect.alarm-sent .rect-alarm-badge { background: rgba(242,54,69,0.95); color: #fff; }

/* Pending trade small icon */
.chart-rect .pending-icon { display: none; position: absolute; bottom: 6px; right: 6px; font-size: 14px; pointer-events: none; z-index: 20; }
.chart-rect.pending-on .pending-icon { display: block; }

/* SVG line group pending icon */
#svg-layer g .pending-icon { display: none; fill: #ff9900; }
#svg-layer g.pending-on .pending-icon { display: block; }

.rect-label { position: absolute; left: 50%; transform: translateX(-50%); background: #1e2535; color: #d1d4dc; padding: 2px 6px; font-size: 11px; border: 1px solid #2B2B43; border-radius: 4px; opacity: 0; transition: 0.2s; }
.chart-rect.selected-shape .rect-label { opacity: 1; }
.rect-label.top { top: -24px; } .rect-label.bottom { bottom: -24px; }

.handle { position: absolute; width: 16px; height: 16px; background: rgba(255,255,255,0.9); border: 2px solid #2962ff; transform: translate(-50%, -50%); cursor: crosshair; opacity: 0; pointer-events: none; z-index: 12; border-radius: 50%; touch-action: none; }
.handle.visible-handle { opacity: 1; pointer-events: auto; }

.chart-text { position: absolute; font-size: 11.2px; font-weight: bold; line-height: 1.2; white-space: pre-wrap; transform: translate(-50%, -50%); pointer-events: none; z-index: 11; padding: 4px; border: 1px solid transparent; border-radius: 4px; }
.chart-text-content { white-space: pre-wrap; }
.chart-text.green { color: #089981; } .chart-text.red { color: #f23645; } .chart-text.gray { color: #787b86; }
.chart-text.selected-shape { border-color: #d1d4dc; background: rgba(0,0,0,0.05); }

.text-editor-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 14, 23, 0.65);
    padding: 16px;
}
.text-editor-modal {
    width: min(420px, 100%);
    background: #1e222d;
    border: 1px solid #2a2e3d;
    border-radius: 12px;
    box-shadow: 0 12px 36px rgba(0,0,0,0.35);
    padding: 14px;
}
.text-editor-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
    color: #eaeef5;
}
.text-editor-input {
    width: 100%;
    min-height: 110px;
    resize: vertical;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #394055;
    background: #151924;
    color: #eaeef5;
    font: inherit;
}
.text-editor-hint {
    margin-top: 8px;
    font-size: 12px;
    color: #a0a8bc;
}
.text-editor-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 12px;
}

/* === LONG / SHORT TOOL === */
.ls-tool { position: absolute; pointer-events: none; z-index: 8; opacity: 0.85; }
.ls-tool.selected-shape { opacity: 1; outline: none; box-shadow: none; }

.ls-box { position: absolute; width: 100%; left: 0; display: flex; align-items: center; justify-content: center; flex-direction: column; font-size: 10px; font-weight: bold; color: rgba(19, 23, 34, 0.34); text-align: center; line-height: 1.2; }
.ls-tool.selected-shape .ls-box { color: rgba(19, 23, 34, 0.5); }
.ls-profit { background: rgba(8, 153, 129, 0.10); } 
.ls-loss { background: rgba(242, 54, 69, 0.10); }

/* Pending trades bottom bar */
#pending-trades-bar { position: relative; left: 0; right: 0; height: 40px; background: rgba(0,0,0,0.65); color: #fff; display: none; align-items: center; gap: 12px; padding: 6px 12px; z-index: 30; font-size: 13px; }
#pending-trades-bar .pending-left { font-weight: bold; margin-right: 8px; }
#pending-trades-bar .pending-mid { opacity: 0.9; }
#pending-trades-bar .pending-right { margin-left: auto; opacity: 0.8; font-size: 12px; }
/* pending bar delete button */
.pending-delete-btn { margin-left: 12px; background: rgba(242,54,69,0.15); color: #f23645; border: 1px solid rgba(242,54,69,0.35); padding: 5px 12px; border-radius: 7px; cursor: pointer; font-weight: 600; font-size: 13px; transition: background 0.15s, border-color 0.15s, transform 0.1s; font-family: inherit; }
.pending-delete-btn:hover { background: rgba(242,54,69,0.28); border-color: #f23645; transform: translateY(-1px); }

/* small alarm badge appended to symbol buttons */
.symbol-alarm-badge { display: inline-block; margin-left: 6px; background: transparent; color: #f5a623; font-size: 0.95em; line-height: 1; }

/* small pending badge appended to symbol buttons */
.symbol-pending-badge { display: inline-block; margin-left: 6px; background: transparent; color: #ff9900; font-size: 0.95em; line-height: 1; }

/* Bottom symbol bar (mobile) */
#symbol-bar-bottom { 
    display: none; 
    position: relative; 
    background:
        linear-gradient(180deg, rgba(12, 18, 31, 0.86), rgba(7, 12, 22, 0.96)),
        radial-gradient(90% 140% at 50% -45%, rgba(56, 189, 248, 0.18), rgba(15, 23, 42, 0));
    z-index: 60; 
    box-sizing: border-box; 
    border-top: 1px solid rgba(120, 146, 196, 0.26);
    box-shadow: 0 -12px 28px rgba(0,0,0,0.34); 
    width: 100%;
    margin-bottom: 0; /* Garantiert keinen Abstand nach unten */
    backdrop-filter: blur(10px);
    
    /* Keep bottom bar stable (no post-load safe-area jump) */
    padding: 2px 4px 2px;
    
}
#symbol-bar-bottom .symbol-scroll {
    display: flex;
    gap: 7px;
    overflow-x: auto;
    padding: 2px 4px 1px;
    justify-content: center;
    scrollbar-width: none;
}
#symbol-bar-bottom .symbol-scroll::-webkit-scrollbar { display: none; }
#symbol-bar-bottom .symbol-btn {
    flex: 0 0 auto;
    min-width: 88px;
    min-height: 34px;
    padding: 5px 11px;
    border-radius: 10px;
    background: linear-gradient(180deg, rgba(45, 57, 85, 0.95), rgba(30, 40, 63, 0.95));
    color: #eaf0ff;
    border: 1px solid rgba(118, 141, 186, 0.34);
    font-weight: 700;
    font-size: 12.5px;
    letter-spacing: 0.02em;
    box-shadow: 0 6px 14px rgba(4, 8, 16, 0.34), inset 0 1px 0 rgba(255,255,255,0.05);
    transition: transform 0.14s ease, box-shadow 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}
#symbol-bar-bottom .symbol-btn:hover {
    transform: translateY(-1px);
    border-color: rgba(138, 163, 211, 0.52);
    box-shadow: 0 8px 18px rgba(4, 8, 16, 0.42), inset 0 1px 0 rgba(255,255,255,0.08);
}
#symbol-bar-bottom .symbol-btn.active-btn {
    background: linear-gradient(180deg, #3b82f6 0%, #1d4ed8 100%);
    border-color: #7fb2ff;
    color: #fff;
    box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.25), 0 10px 22px rgba(37, 99, 235, 0.42);
}


/* Drawings panel styles */
#drawings-panel table tbody tr { border-top: 1px solid #eef2fb; }
#drawings-panel table tbody td { padding: 6px 6px; vertical-align: middle; }
#drawings-panel table tbody tr.selected-row { background: rgba(41,98,255,0.06); }
#drawings-panel input[type="checkbox"].draw-vis { width: 18px; height: 18px; }
#btn-toggle-drawings { cursor: pointer; }

/* Moved from inline/index.html */
:root { --text-muted: #b0b6c3; }

#trading-banner{display:none;width:100%;text-align:center;background:linear-gradient(135deg,rgba(242,54,69,0.12),rgba(20,24,36,0.95));border-bottom:1px solid rgba(242,54,69,0.25);color:#f5a0a0;padding:9px 12px;z-index:999;letter-spacing:0.01em}
#trading-banner.weekend-warning{background:linear-gradient(135deg,rgba(245,158,11,0.15),rgba(20,24,36,0.95));border-bottom-color:rgba(245,158,11,0.3);color:#fbbf24}
#trading-banner .trading-message{font-size:14px;line-height:1.3;font-weight:500}
@media (max-width:480px){#trading-banner .trading-message{font-size:14px;padding:8px 10px}}

@media (max-width: 480px) {
    #symbol-bar-bottom .symbol-scroll {
        gap: 6px;
        padding: 2px 3px 1px;
    }

    #symbol-bar-bottom .symbol-btn {
        min-width: 80px;
        min-height: 32px;
        padding: 4px 9px;
        border-radius: 9px;
        font-size: 11.5px;
    }
}

#symbol-selector{display:none}

#btn-long{color:#009688}
#btn-short{color:#f44336}

#candle-countdown{font-family:monospace;color:#4ade80;font-weight:bold;background:rgba(0,0,0,0.2);padding:2px 6px;border-radius:4px;font-size:16px;display:inline-flex;align-items:center;justify-content:center;min-width:58px;text-align:center;}

#execution-status{margin-left:16px;color:var(--text-muted);font-size:12px}

#btn-screenshot{margin-left:12px;padding:0;border-radius:8px;background:rgba(43,158,247,0.15);color:#2b9ef7;border:1px solid rgba(43,158,247,0.3);cursor:pointer;display:inline-flex;align-items:center;justify-content:center;width:36px;height:36px;transition:background 0.15s,border-color 0.15s,transform 0.1s,box-shadow 0.15s}
#btn-screenshot:hover{background:rgba(43,158,247,0.28);border-color:#2b9ef7;box-shadow:0 0 0 3px rgba(43,158,247,0.12);transform:translateY(-1px)}

#btn-show-drawings{margin-left:8px;padding:0;border-radius:8px;background:rgba(160,168,188,0.08);color:#a0a8bc;border:1px solid rgba(160,168,188,0.2);cursor:pointer;display:inline-flex;align-items:center;justify-content:center;width:36px;height:36px;transition:background 0.15s,border-color 0.15s,transform 0.1s}
#btn-show-drawings:hover{background:rgba(160,168,188,0.18);color:#eaeef5;transform:translateY(-1px)}

#drawings-panel{position:fixed;right:12px;top:86px;width:320px;max-height:60vh;overflow:auto;background:rgba(255,255,255,0.96);border:1px solid #e6e9f2;border-radius:8px;box-shadow:0 6px 20px rgba(0,0,0,0.12);z-index:9999;padding:8px;display:none}
#drawings-panel > div:first-child{display:flex;align-items:center;gap:8px;margin-bottom:8px}
#btn-toggle-drawings{margin-left:auto;padding:4px 8px;font-size:12px}

#drawings-table{width:100%;border-collapse:collapse;font-size:13px;color:#000}
#drawings-table thead th:first-child, #drawings-table thead th:nth-child(2){text-align:left}
/* Week group header */
#drawings-table tr.week-group-header td{background:#e8ecf5;padding:5px 6px;font-weight:600;color:#30374f;border-top:2px solid #c8cfe8;user-select:none}
#drawings-table tr.week-group-header .week-vis{width:15px;height:15px;margin-right:6px;vertical-align:middle;cursor:pointer}
#drawings-table tr.week-group-header .week-caret{font-size:9px;margin-right:5px;vertical-align:middle;cursor:pointer;color:#555;user-select:none}
#drawings-table tr.week-group-header .week-group-label{vertical-align:middle;font-size:12px}
#drawings-table tr.week-group-header .week-group-count{vertical-align:middle;font-size:11px;color:#787b86;font-weight:400}
/* Drawing rows inside week group */
#drawings-table tr.week-group-row td{padding:5px 8px;border-top:1px solid #eef2fb}
#drawings-table tr.week-group-row:hover{background:rgba(41,98,255,0.04)}

/* Show bottom symbol bar when viewport is portrait (width < height) */
@media (orientation: portrait) 
{
    #sidebar { display: none !important; }
    #symbol-bar-bottom {
        display: block !important;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        flex: 0 0 auto;
    }
    #chart-area { padding-bottom: 0; }
    #symbol-bar-top { display: none !important; }
    /* hide the select on portrait as well (keeps behavior consistent) */
    #top-bar select#symbol-selector { display: none !important; }
}

@media (max-width: 680px) {
    #top-bar select#symbol-selector { display: none !important; }
    
    #tvchart {
        flex: 1 1 0%; /* Nimmt sich den Platz, den er braucht */
        height: auto !important;
        max-height: none !important; /* Removes old constraints */
        padding-bottom: 0 !important;
        margin-bottom: 0 !important;
    }

    #symbol-bar-bottom { 
        display: block !important; 
        flex: 0 0 auto;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        /* No more margin-bottom or padding-bottom hacks needed */
        margin-bottom: 0 !important; 
    }
    #chart-area { padding-bottom: 0; }
    #symbol-bar-top { display: none; }
}

@media (max-width: 700px) {
    #top-bar {
        padding: 8px 6px 10px;
        gap: 8px;
        max-height: none;
        flex-wrap: wrap;
        row-gap: 4px;
        align-items: center;
        justify-content: center;
    }
    #top-bar > * {
        font-size: 13px !important;
        padding: 4px 8px !important;
        min-width: 0;
    }
    #price-container {
        position: static;
        left: auto;
        transform: none;
        margin-left: 0 !important;
        width: auto;
        flex: 0 0 auto;
        justify-content: center;
        gap: 8px;
    }
    .back-home-btn { margin-right: 0; }
    .tool-group {
        padding-right: 6px;
        gap: 2px;
    }
    #live-price {
        padding: 4px 8px;
        font-size: 10px;
        margin-left: 0;
    }
    #btn-undo,
    #btn-redo,
    #btn-screenshot,
    #btn-show-drawings {
        width: 32px;
        height: 32px;
    }
    #execution-status{
        display: none !important;
    }
    #journal-logout-link{
        display: none !important;
    }

}



/* ===== SIDEBAR (landscape only) ===== */
#sidebar {
    display: none;
    flex-direction: column;
    width: 120px;
    flex-shrink: 0;
    background: #13161f;
    border-right: 1px solid #1e2233;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px 7px;
    gap: 4px;
    z-index: 50;
}

.sidebar-symbols {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-sym-btn {
    width: 100% !important;
    padding: 9px 4px !important;
    font-size: 15px !important;
    font-weight: 600;
    text-align: center;
    border-radius: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(44, 51, 73, 0.7);
    border: 1.5px solid #2a2e3d;
    color: #c5cde0;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}
.sidebar-sym-btn:hover { transform: translateY(-1px); background: rgba(60,70,100,1); color: #fff; }
.sidebar-sym-btn:active { transform: translateY(0); }

.sidebar-sym-btn .sym-main { font-size: 15px; line-height: 1; }
.sidebar-sym-btn .sym-sub { font-size: 11px; color: var(--text-muted); margin-top: 4px; line-height: 1; }

.sidebar-divider {
    height: 1px;
    background: rgba(255,255,255,0.07);
    margin: 8px 2px;
}

.sidebar-tools {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-tool-btn {
    width: 100% !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 10px 4px !important;
    border-radius: 8px;
    background: rgba(44, 51, 73, 0.7);
    border: 1.5px solid #2a2e3d;
    color: #a0a8bc;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}

.sidebar-tool-btn:hover { background: rgba(60, 70, 100, 1); color: #eaeef5; transform: translateY(-1px); box-shadow: 0 3px 10px rgba(0,0,0,0.18); }
.sidebar-tool-btn:active { transform: translateY(0); }
.sidebar-tool-btn.active-btn { background: rgba(41,98,255,0.2) !important; border-color: #2962ff !important; color: #7ea8ff !important; box-shadow: 0 0 0 2px rgba(41,98,255,0.18); }

.sidebar-tool-label {
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.03em;
    color: inherit;
    line-height: 1;
}
.sidebar-tool-btn.active-btn .sidebar-tool-label { color: #7ea8ff; }

/* ===== LANDSCAPE: sidebar layout ===== */
/* Landscape: show a full left sidebar with symbols and tools when width > height */
@media (orientation: landscape) 
{
    #sidebar { display: flex; }

    /* Hide bottom symbol bar and tool-group from top-bar (they live in sidebar now) */
    #symbol-bar-bottom { display: none !important; }
    .tool-group { display: none !important; }

    /* Top bar stays horizontal but slimmer — just price, status, screenshot */
    #top-bar {
        position: static;
        flex-direction: row;
        flex-wrap: nowrap;
        padding: 8px 16px;
        gap: 12px;
        border-radius: 0;
    }
}