:root {
    --bsn: #20228a;
    --bsn-light: #3b3db5;
    --bsn-soft: #eef0ff;
    --bg: #f6f7fb;
    --card: #ffffff;
    --text: #1a1a2e;
    --muted: #6b7280;
    --border: #e5e7eb;
    --border-strong: #d1d5db;
    --green: #10b981;
    --red: #ef4444;
    --yellow: #f59e0b;
    --radius: 14px;
    --shadow: 0 1px 3px rgba(16,17,40,.06), 0 4px 14px rgba(16,17,40,.05);
    --focus-ring: 0 0 0 3px rgba(59, 61, 181, .14);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { overflow-x: hidden; }
body {
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}
nav {
    background: linear-gradient(90deg, var(--bsn), var(--bsn-light));
    color: #fff;
    padding: .7rem 1.25rem;
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(20, 22, 90, .25);
}
nav a {
    color: #fff;
    text-decoration: none;
    font-weight: 500;
    font-size: .9rem;
    padding: .45rem .9rem;
    border-radius: 9px;
    transition: background .2s;
}
nav a:hover, nav a.active { background: rgba(255,255,255,.16); }
nav .brand { font-weight: 700; font-size: 1.05rem; margin-right: auto; letter-spacing: .01em; }
main { max-width: 1280px; margin: 0 auto; padding: 1.75rem 1.25rem 3rem; }
h2 { font-size: 1.45rem; letter-spacing: -.01em; }
.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid rgba(16,17,40,.04);
    padding: 1.5rem;
    margin-bottom: 1.25rem;
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    padding: .65rem 1.25rem;
    border-radius: 10px;
    border: 1.5px solid transparent;
    font-size: .92rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    min-height: 44px;
    text-decoration: none;
    transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--bsn); color: #fff; box-shadow: 0 2px 8px rgba(32,34,138,.28); }
.btn-primary:hover { background: var(--bsn-light); }
.btn-outline { background: #fff; border-color: var(--bsn); color: var(--bsn); }
.btn-outline:hover { background: var(--bsn); color: #fff; }
.btn-ghost { background: #fff; border-color: var(--border-strong); color: var(--text); box-shadow: 0 1px 2px rgba(16,17,40,.05); }
.btn-ghost:hover:not(:disabled) { border-color: var(--bsn-light); color: var(--bsn); background: var(--bsn-soft); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-sm { padding: .42rem .9rem; font-size: .83rem; min-height: 38px; border-radius: 9px; }

/* ── Toolbar (Suche + Filter + Aktionen) ─────────────────── */
.toolbar {
    display: flex;
    gap: .75rem;
    align-items: center;
    flex-wrap: wrap;
    padding: .85rem 1rem;
}
.search-wrap { position: relative; flex: 1 1 260px; }
.search-wrap .search-icon {
    position: absolute; left: .85rem; top: 50%; transform: translateY(-50%);
    opacity: .45; pointer-events: none; font-size: .9rem;
}
.search-wrap input {
    width: 100%;
    padding: .55rem 1rem .55rem 2.5rem;
    border: 1.5px solid var(--border-strong);
    border-radius: 10px;
    background: #fbfbfd;
    font-size: .92rem;
    font-family: inherit;
    min-height: 42px;
    transition: border-color .15s, box-shadow .15s, background .15s;
}
.search-wrap input:focus { border-color: var(--bsn-light); background: #fff; box-shadow: var(--focus-ring); outline: none; }
.toolbar-select { flex: 0 0 auto; }
.toolbar-actions { display: flex; gap: .5rem; margin-left: auto; flex-wrap: wrap; }

/* ── Formular-Elemente ───────────────────────────────────── */
select, input[type="text"] {
    padding: .5rem .8rem;
    border: 1.5px solid var(--border-strong);
    border-radius: 10px;
    font-size: .9rem;
    font-family: inherit;
    min-height: 42px;
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
}
select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 2rem;
    background: #fff url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236b7280' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right .7rem center / 10px 6px;
}
select:focus, input[type="text"]:focus { border-color: var(--bsn-light); box-shadow: var(--focus-ring); outline: none; }
input[type="date"] {
    padding: .32rem .45rem;
    border: 1.5px solid transparent;
    border-radius: 8px;
    background: #f1f2f7;
    font-size: .83rem;
    font-family: inherit;
    color: var(--text);
    min-height: 36px;
    width: 138px;
    transition: background .15s, border-color .15s, box-shadow .15s;
}
input[type="date"]:hover { background: #e7e9f2; }
input[type="date"]:focus { border-color: var(--bsn-light); background: #fff; box-shadow: var(--focus-ring); outline: none; }

/* ── Tabelle ─────────────────────────────────────────────── */
.table-card { padding: 0; overflow: hidden; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table {
    width: 100%;
    min-width: 1150px;
    border-collapse: collapse;
    font-size: .9rem;
}
th, td { padding: .62rem .7rem; text-align: left; vertical-align: middle; }
th {
    background: var(--bsn);
    color: #fff;
    font-weight: 600;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    white-space: nowrap;
}
tbody tr { border-bottom: 1px solid var(--border); transition: background .12s; }
tbody tr:nth-child(even) { background: #fafbfe; }
tbody tr:hover { background: var(--bsn-soft); }
td.date-cell { font-variant-numeric: tabular-nums; color: var(--muted); font-size: .83rem; white-space: nowrap; }
td.editable { cursor: pointer; border-radius: 6px; }
td.editable:hover { background: #e4e7ff; box-shadow: inset 0 0 0 1px var(--bsn-light); }
td.editable:hover::after { content: "✎"; margin-left: .45rem; font-size: .72rem; color: var(--bsn-light); }
.col-spiel { min-width: 170px; }
.col-verlag { min-width: 120px; }
.col-recipient { min-width: 165px; }
.col-check { width: 40px; }
.col-del { width: 50px; }
.row-del { border-radius: 8px; min-height: 34px; padding: .3rem .55rem; }

/* ── Badges & Sonstiges ──────────────────────────────────── */
.badge {
    display: inline-block;
    padding: .2em .65em;
    border-radius: 100px;
    font-size: .75rem;
    font-weight: 600;
}
.badge-green { background: #d1fae5; color: #065f46; }
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-gray { background: #e5e7eb; color: #374151; }
.upload-zone {
    border: 2.5px dashed var(--border-strong);
    border-radius: var(--radius);
    padding: 3rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all .2s;
    background: #fafbfc;
}
.upload-zone:hover, .upload-zone.drag-over { border-color: var(--bsn-light); background: var(--bsn-soft); }
.upload-zone .icon { font-size: 3rem; margin-bottom: .5rem; }
.upload-zone p { color: var(--muted); margin: .3rem 0; }
.preview-img { max-width: 100%; max-height: 300px; border-radius: 10px; margin: 1rem 0; display: none; }
.loading { display: none; text-align: center; padding: 2rem; }
.spinner {
    width: 40px; height: 40px;
    border: 4px solid var(--border);
    border-top-color: var(--bsn);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}
@keyframes spin { to { transform: rotate(360deg); } }
.toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    padding: .9rem 1.4rem;
    border-radius: 10px;
    color: #fff;
    font-weight: 600;
    z-index: 999;
    animation: slideUp .3s ease;
    max-width: 350px;
    box-shadow: 0 6px 20px rgba(16,17,40,.25);
}
.toast-success { background: var(--green); }
.toast-error { background: var(--red); }
@keyframes slideUp { from { transform: translateY(100px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.filters { display: flex; gap: .75rem; flex-wrap: wrap; margin-bottom: 1.25rem; align-items: center; }
.filters label { font-weight: 600; font-size: .85rem; }
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty-state .icon { font-size: 3rem; margin-bottom: 1rem; }
.actions { display: flex; gap: .5rem; margin: 1rem 0; flex-wrap: wrap; }
.confidence-bar { height: 6px; border-radius: 3px; background: var(--border); margin-top: 4px; overflow: hidden; }
.confidence-fill { height: 100%; border-radius: 3px; background: var(--green); }
.file-input-hidden { display: none; }
.hint { font-size: .85rem; color: var(--muted); margin: .35rem 0 .9rem; }

@media (max-width: 700px) {
    main { padding: 1rem .75rem 2rem; }
    nav { gap: .3rem; padding: .6rem .75rem; }
    nav a { font-size: .8rem; padding: .3rem .5rem; }
    .actions { flex-direction: column; }
    .actions .btn { width: 100%; }
    .toolbar { padding: .75rem; }
    .search-wrap { flex: 1 1 100%; }
    .toolbar-select { flex: 1 1 100%; }
    .toolbar-actions { margin-left: 0; width: 100%; }
    .toolbar-actions .btn { flex: 1; }
}
