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

html, body {
    font-family: 'Segoe UI', Arial, sans-serif;
    font-size: 13px;
    margin: 0;
    background: #f0f0f0;
}

/* ── Fehler-UI ── */
#blazor-error-ui {
    background: #b32121;
    color: white;
    padding: .5rem 1rem;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    display: none;
}
#blazor-error-ui .reload { color: white; text-decoration: underline; margin-left: 1rem; }
#blazor-error-ui .dismiss { float: right; cursor: pointer; }

/* ── Tab-Leiste ── */
.tab-bar {
    display: flex;
    background: #d0d0d0;
    border-bottom: 2px solid #999;
    padding: 4px 4px 0;
    gap: 2px;
}
.tab-btn {
    padding: 5px 18px;
    border: 1px solid #999;
    border-bottom: none;
    border-radius: 4px 4px 0 0;
    background: #e8e8e8;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
}
.tab-btn.active {
    background: white;
    border-color: #666;
    font-weight: 700;
    position: relative;
    top: 1px;
}
.tab-btn:hover:not(.active) { background: #d8d8d8; }

/* ── Tab-Inhalt ── */
.tab-content { background: white; min-height: calc(100vh - 36px); }

/* ── Tab-Panels ── */
.tab-panel { padding: 8px 10px; }
.tab-a { background: #d8f0f0; min-height: 90vh; }
.tab-c { background: #e2f0d9; min-height: 90vh; }
.tab-d { background: #fce9d8; min-height: 90vh; }
.tab-e { background: #e0f4f4; min-height: 90vh; }
.tab-h { background: #ddf0f8; min-height: 90vh; }
.h-controls { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.h-filters { display: flex; gap: 4px; flex-wrap: wrap; }
.h-filter-btn {
    padding: 4px 14px;
    border: 1px solid #aaa;
    border-radius: 14px;
    background: #e8e8e8;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
}
.h-filter-btn.active { background: #4a9; color: white; border-color: #3a8; }
.h-filter-btn:hover:not(.active) { background: #d0e8ff; }
.h-go { width: 60px !important; padding: 5px 0 !important; font-size: 14px !important; }
.h-status {
    display: flex;
    gap: 18px;
    font-size: 12px;
    padding: 5px 10px;
    background: rgba(255,255,255,.55);
    border: 1px solid #ccc;
    border-radius: 4px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}
.tab-o { background: #f2ede4; min-height: 90vh; }
.o-grid { width: auto !important; }

/* ── Tab N ── */
.tab-n { min-height: 90vh; }
.n-layout { display: flex; gap: 6px; height: calc(100vh - 60px); overflow: hidden; }
.n-sidebar { width: 58px; flex: 0 0 58px; display: flex; flex-direction: column; gap: 4px; overflow: hidden; }
.n-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.n-filter {
    display: flex; align-items: center; gap: 5px; padding: 3px 0;
    flex-wrap: wrap; font-size: 12px; margin-bottom: 4px;
}
.n-total { font-size: 12px; color: #444; margin-left: 4px; }
.n-body { display: flex; gap: 6px; flex: 1; overflow: hidden; min-height: 0; }
.n-form { width: 240px; flex-shrink: 0; overflow-y: auto; font-size: 12px; }
.n-grid-wrap { flex: 1; overflow: auto; }
.n-lbl { color: #555; font-size: 11px; white-space: nowrap; text-align: right; }
.n-inp { width: 110px; padding: 1px 3px; font-size: 12px; border: 1px solid #aaa; border-radius: 2px; text-align: left; }
.n-calc { font-weight: 700; font-size: 12px; color: #060; padding: 1px 2px; }
.n-auszahlung { font-weight: 700; color: #060; background: #f0fff0; }
.n-sep { margin: 3px 0; border: none; border-top: 1px solid #ccc; }
.n-buttons { display: flex; gap: 3px; margin-top: 5px; }
.n-btn-sm { flex: 1; margin-top: 0 !important; padding: 5px 3px; font-size: 11px; }

/* ── Header-Zeile ── */
.header-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
    padding: 5px 8px;
    background: rgba(255,255,255,.55);
    border: 1px solid #ccc;
    border-radius: 4px;
    margin-bottom: 8px;
    font-size: 12px;
}
.header-label { color: #555; font-weight: 600; }
.header-val { font-weight: 400; min-width: 80px; }

/* ── Formular ── */
.form-grid {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}
.form-col { display: flex; flex-direction: column; gap: 4px; min-width: 200px; }
.calc-col { min-width: 220px; }

.field-row {
    display: flex;
    align-items: center;
    gap: 6px;
}
.field-row label {
    width: 110px;
    font-weight: 600;
    font-size: 12px;
    flex-shrink: 0;
    color: #333;
}
.field-row input, .field-row span {
    width: 130px;
    padding: 2px 5px;
    border: 1px solid #aaa;
    border-radius: 3px;
    font-size: 12px;
    background: white;
}
.field-row span { border: none; font-weight: 600; }
.inp-ticker { font-size: 13px; font-weight: 700; width: 130px; }

fieldset { border: 1px solid #aaa; border-radius: 4px; padding: 6px 10px; }
fieldset legend { font-size: 11px; font-weight: 700; color: #444; padding: 0 4px; }
.entry-readonly input, .entry-readonly span { background: #f5f5f5; }

/* ── Berechungs-Box ── */
.calc-box {
    background: white;
    border: 1px solid #aaa;
    border-radius: 4px;
    padding: 8px 10px;
    margin-bottom: 8px;
}
.calc-row {
    display: flex;
    justify-content: space-between;
    padding: 2px 0;
    font-size: 12px;
    border-bottom: 1px dotted #ddd;
}
.calc-row:last-child { border-bottom: none; }
.calc-row span { color: #555; }
.calc-row strong { color: #222; }
.risk { color: #c00 !important; }
.profit-pos { color: #060 !important; }
.profit-neg { color: #c00 !important; }
.partial { color: #a60 !important; }

/* ── Buttons ── */
.btn-add, .btn-close {
    width: 100%;
    padding: 6px;
    background: #4a9;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
}
.btn-add:hover, .btn-close:hover { background: #3a8; }
.btn-add:disabled { background: #aaa; cursor: default; }
.btn-split {
    padding: 4px 10px;
    background: #68a;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
}
.btn-split:hover { background: #579; }
.split-panel {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 6px 0 4px;
    font-size: 13px;
}
.btn-cancel {
    width: 100%;
    padding: 5px;
    margin-top: 4px;
    background: #ddd;
    border: 1px solid #aaa;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}
.btn-del {
    background: none;
    border: none;
    color: #c00;
    cursor: pointer;
    font-size: 14px;
    padding: 0 4px;
}

/* ── Tabellen ── */
.grid {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    margin-top: 4px;
}
.grid th {
    background: #555;
    color: white;
    padding: 3px 6px;
    text-align: left;
    white-space: nowrap;
}
.grid td { padding: 2px 6px; border-bottom: 1px solid #ddd; white-space: nowrap; }
.grid-row { cursor: pointer; }
.grid-row:hover { filter: brightness(.93); }
.row-pos { background: #e8f5e8; }
.row-neg { background: #fde8e8; }
.row-selected { background: #c8e8ff !important; outline: 2px solid #38f; }
.totals { background: #e8e8e8; font-weight: 700; }
.totals td { border-top: 2px solid #888; }

/* ── Exit-Panel ── */
.exit-panel {
    background: rgba(255,255,255,.6);
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 10px;
    margin: 8px 0;
}
.exit-panel h4 { margin: 0 0 8px; font-size: 13px; }

/* ── Tab E Layout ── */
.e-layout { display: flex; gap: 8px; height: calc(100vh - 60px); }
.e-sidebar { width: 140px; flex-shrink: 0; display: flex; flex-direction: column; gap: 4px; }
.e-main { flex: 1; overflow-y: auto; }

.filter-btns { display: flex; flex-direction: column; gap: 2px; }
.filter-btn {
    padding: 4px 6px;
    border: 1px solid #aaa;
    border-radius: 3px;
    background: #e8e8e8;
    cursor: pointer;
    font-size: 12px;
    text-align: left;
}
.filter-btn.active { background: #4a9; color: white; border-color: #3a8; font-weight: 700; }
.filter-btn:hover:not(.active) { background: #d8d8d8; }

.ticker-count { font-size: 11px; color: #666; padding: 2px 4px; }
.ticker-list {
    flex: 1;
    overflow-y: auto;
    border: 1px solid #aaa;
    border-radius: 3px;
    background: white;
}
.ticker-item {
    padding: 3px 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    border-bottom: 1px solid #eee;
}
.ticker-item:hover { background: #e8f0ff; }
.ticker-item.selected { background: #4a9; color: white; }

.placeholder { color: #888; font-style: italic; padding: 2rem; }

/* ── Tab B Layout ── */
.b-layout      { display: flex; gap: 16px; padding: 4px; height: calc(100vh - 60px); }
.b-forex       { width: 170px; flex-shrink: 0; display: flex; flex-direction: column; gap: 6px; overflow: auto; }
.b-calc        { flex: 1; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; }
.b-forex-header{ display: flex; align-items: center; gap: 10px; }
.b-section-title{ font-weight: 700; font-size: 14px; }
.b-grid { width: auto !important; white-space: nowrap; }
.b-grid td, .b-grid th { padding: 1px 8px 1px 4px; font-size: 12px; width: 1%; }
.b-grid tbody tr { line-height: 1.2; }
.b-edit-row    { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.b-crrncy-lbl  { font-weight: 700; font-size: 18px; min-width: 50px; }
.b-calc-table  { border-collapse: collapse; }
.b-calc-table th, .b-calc-table td { padding: 4px 10px; border-bottom: 1px solid #eee; }
.b-calc-lbl    { color: #555; white-space: nowrap; padding-right: 14px !important; }
.b-calc-result { font-size: 15px; font-weight: 700; text-align: right; }
.b-inp         { width: 90px; text-align: right; font-size: 13px; padding: 2px 4px; border: 1px solid #ccc; border-radius: 3px; }
.b-section     { display: flex; flex-direction: column; gap: 4px; }
.b-conv-row    { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ── Nachrichten ── */
.message {
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    margin: 6px 0;
}
.msg-ok { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.msg-error { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
