/* Kartenverwaltung – Design angelehnt an www.jahuena.de: Primärfarbe #ff5200, Schrift Georgia */
:root {
    --primary: #ff5200;
    --primary-dark: #d94600;
    --primary-soft: #fff0e8;
    --primary-mid: #ffc4a6;
    --ink: #2b2b2b;
    --muted: #6d655f;
    --bg: #f7f3ef;
    --card: #ffffff;
    --line: #e7ded6;
    --ok: #2e7d32;
    --warn: #b26a00;
    --err: #c62828;
    --seat: 26px;
    --table-w: 84px;
    --stage-w: 64px;
    --aisle-w: 22px;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,.06), 0 4px 14px rgba(0,0,0,.04);
    color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
    font-family: Georgia, "Times New Roman", Times, serif;
    color: var(--ink);
    background: var(--bg);
    font-size: 16px;
    line-height: 1.45;
    -webkit-text-size-adjust: 100%;
}
a { color: var(--primary-dark); }
h1, h2, h3 { font-weight: bold; line-height: 1.2; }
h1 { font-size: 1.6rem; margin: 0; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
code { font-family: ui-monospace, Consolas, monospace; font-size: .9em; background: var(--primary-soft); padding: 0 .25em; border-radius: 3px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.spacer { flex: 1; }

/* ---------- Kopfzeile ---------- */
.topbar { background: var(--primary); color: #fff; position: sticky; top: 0; z-index: 50; box-shadow: 0 2px 6px rgba(0,0,0,.15); }
.topbar-inner { max-width: 1400px; margin: 0 auto; display: flex; align-items: center; gap: 1rem; padding: .5rem 1rem; }
.brand { display: flex; align-items: center; gap: .6rem; color: #fff; text-decoration: none; min-width: 0; }
.brand-logo { height: 44px; width: 44px; object-fit: contain; background: #fff; border-radius: 50%; padding: 2px; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-app { font-weight: bold; font-size: 1.15rem; }
.brand-club { font-size: .78rem; opacity: .92; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mainnav { margin-left: auto; display: flex; align-items: center; gap: .15rem; flex-wrap: wrap; }
.mainnav a, .nav-logout button {
    color: #fff; text-decoration: none; padding: .45rem .7rem; border-radius: 6px; font: inherit; font-size: .95rem;
    background: none; border: 0; cursor: pointer;
}
.mainnav a:hover, .nav-logout button:hover { background: rgba(255,255,255,.16); }
.mainnav a.active { background: rgba(0,0,0,.16); }
.mainnav a.nav-cta { background: #fff; color: var(--primary-dark); font-weight: bold; margin: 0 .3rem; }
.nav-sep { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; opacity: .8; padding: 0 .4rem 0 .8rem; border-left: 1px solid rgba(255,255,255,.4); }
.nav-logout { margin: 0; }
.nav-toggle { display: none; }
.nav-burger { display: none; }

@media (max-width: 1100px) {
    .nav-burger { display: flex; flex-direction: column; gap: 5px; margin-left: auto; cursor: pointer; padding: .6rem; }
    .nav-burger span { display: block; width: 24px; height: 3px; background: #fff; border-radius: 2px; }
    .mainnav {
        display: none; position: absolute; left: 0; right: 0; top: 100%; background: var(--primary);
        flex-direction: column; align-items: stretch; padding: .5rem 1rem 1rem; box-shadow: 0 8px 16px rgba(0,0,0,.2);
    }
    .nav-toggle:checked ~ .mainnav { display: flex; }
    .mainnav a, .nav-logout button { padding: .75rem .5rem; width: 100%; text-align: left; }
    .mainnav a.nav-cta { margin: .3rem 0; text-align: center; }
    .nav-sep { border: 0; border-top: 1px solid rgba(255,255,255,.35); padding: .7rem 0 .2rem; margin-top: .3rem; }
}

/* ---------- Seite ---------- */
.page { max-width: 1400px; margin: 0 auto; padding: 1.25rem 1rem 5rem; }
.footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 1.5rem 1rem 2rem; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.1rem; margin-bottom: 1rem; border-top: 3px solid var(--primary); }
.card-plan { padding: .75rem; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-top: .75rem; }
td.actions { margin: 0; justify-content: flex-end; }
.page-head .actions { margin: 0; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
    font: inherit; font-size: .95rem; padding: .55rem .95rem; min-height: 40px; border-radius: 6px;
    border: 1px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--primary); color: var(--primary-dark); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: bold; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.btn-danger { background: var(--err); border-color: var(--err); color: #fff; }
.btn-danger:hover { color: #fff; filter: brightness(.92); }
.btn-link { border: 0; background: none; color: var(--primary-dark); text-decoration: underline; padding: .4rem; min-height: 0; }
.btn-danger-link { color: var(--err); }
.btn-block { width: 100%; }
.btn-sq { width: 40px; padding: 0; }

/* ---------- Formulare ---------- */
.form label { display: flex; flex-direction: column; gap: .25rem; font-size: .9rem; color: var(--muted); margin-bottom: .75rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1rem; }
.form-grid .span-2 { grid-column: span 2; }
label.check { flex-direction: row !important; align-items: center; gap: .5rem !important; color: var(--ink) !important; cursor: pointer; }
label.check input { width: 20px; height: 20px; accent-color: var(--primary); }
label.inline { display: inline-flex; align-items: center; gap: .3rem; font-size: .9rem; }
input, select, textarea {
    font: inherit; font-size: 1rem; color: var(--ink); padding: .55rem .65rem; border: 1px solid #d5cbc2; border-radius: 6px; background: #fff; min-height: 42px; width: 100%;
}
input[type=checkbox] { width: auto; min-height: 0; }
textarea { resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary-mid); border-color: var(--primary); }
.validation-message { color: var(--err); font-size: .85rem; }
.narrow { max-width: 480px; }
.w-xs { width: 70px; } .w-s { width: 130px; } .w-num { width: 90px; }

/* ---------- Hinweise ---------- */
.alert { display: flex; gap: .75rem; justify-content: space-between; align-items: flex-start; padding: .7rem .9rem; border-radius: 6px; margin-bottom: 1rem; border-left: 4px solid; }
.alert-success { background: #e8f5e9; border-color: var(--ok); }
.alert-error { background: #fdecea; border-color: var(--err); }
.alert-info { background: #eef4fb; border-color: #3a6ea5; }
.alert-warn { background: #fff4e0; border-color: var(--warn); }
.alert-close { background: none; border: 0; font-size: 1rem; cursor: pointer; color: inherit; padding: 0 .2rem; }
.badge { display: inline-block; font-size: .75rem; padding: .1rem .5rem; border-radius: 99px; background: #eee6df; color: var(--ink); margin: .1rem .2rem .1rem 0; white-space: nowrap; }
.badge-ok { background: #e3f2e4; color: var(--ok); }
.badge-warn { background: #fff0d9; color: var(--warn); }

/* ---------- Übersicht ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.kpi { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: .8rem 1rem; }
.kpi a { text-decoration: none; color: inherit; }
.kpi-value, .kpi a .kpi-value { display: block; font-size: 1.5rem; font-weight: bold; color: var(--primary-dark); }
.kpi-label { font-size: .85rem; color: var(--muted); }
.day-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1rem; }
.day-card header { margin-bottom: .75rem; }
.day-card h2 { margin: 0; }
.day-closed { opacity: .75; border-top-color: var(--muted); }
.util { height: 12px; border-radius: 6px; background: #efe7e0; overflow: hidden; margin: .5rem 0; }
.util-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--primary-dark)); }
.day-numbers { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; text-align: center; margin: .5rem 0; }
.day-numbers strong { display: block; font-size: 1.2rem; }
.day-numbers span { font-size: .8rem; color: var(--muted); }
.day-numbers .free strong { color: var(--ok); }
table.mini { width: 100%; border-collapse: collapse; font-size: .88rem; margin: .4rem 0; }
table.mini th, table.mini td { padding: .25rem .3rem; border-bottom: 1px solid var(--line); text-align: left; }
table.mini th.num, table.mini td.num { text-align: right; }

/* ---------- Listen ---------- */
.filters { display: grid; grid-template-columns: auto 2fr 1.4fr 1fr 1fr auto; gap: .6rem; align-items: center; }
.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.segmented button { font: inherit; font-size: .92rem; border: 0; background: #fff; padding: .55rem .85rem; cursor: pointer; min-height: 42px; border-right: 1px solid var(--line); }
.segmented button:last-child { border-right: 0; }
.segmented .seg-active { background: var(--primary); color: #fff; font-weight: bold; }
.badge-btn { border: 0; font: inherit; font-size: .75rem; cursor: pointer; }
.badge-open { background: #fdecea; color: var(--err); }
@media (max-width: 1200px) { .filters { grid-template-columns: 1fr 1fr 1fr; } .filters input[type=search] { grid-column: span 2; } }
table.list { width: 100%; border-collapse: collapse; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
table.list th { background: #3a3330; color: #fff; text-align: left; padding: .6rem .7rem; font-weight: normal; font-size: .9rem; }
table.list td { padding: .6rem .7rem; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list tbody tr:hover { background: var(--primary-soft); }
table.list th.num { text-align: right; }

@media (max-width: 760px) {
    .filters { grid-template-columns: 1fr; }
    .filters input[type=search] { grid-column: auto; }
    .segmented { display: flex; } .segmented button { flex: 1; }
    table.list, table.list tbody, table.list tr, table.list td { display: block; width: 100%; }
    table.list thead { display: none; }
    table.list { background: none; box-shadow: none; }
    table.list tr { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: .75rem; padding: .4rem .2rem; border-top: 3px solid var(--primary); }
    table.list td { border: 0; padding: .3rem .8rem; display: grid; grid-template-columns: 7rem 1fr; gap: .5rem; text-align: left; }
    table.list td::before { content: attr(data-label); color: var(--muted); font-size: .85rem; }
    table.list td.actions { display: flex; }
    table.list td.actions::before { content: none; }
    .form-grid { grid-template-columns: 1fr; }
    .form-grid .span-2 { grid-column: auto; }
    h1 { font-size: 1.35rem; }
}

/* ---------- Bestellung ---------- */
.order-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 1rem; align-items: start; }
.order-side { position: sticky; top: 80px; }
@media (max-width: 1000px) {
    .order-layout { grid-template-columns: minmax(0, 1fr); }
    .order-side { position: static; }
}
.tabs { display: flex; gap: .4rem; overflow-x: auto; padding: 10px 8px .4rem 0; margin-bottom: .75rem; }
.tab { position: relative; display: flex; flex-direction: column; align-items: flex-start; font: inherit; padding: .5rem .9rem; border: 1px solid var(--line); background: #fff; border-radius: 6px; cursor: pointer; min-width: 140px; }
.tab small { color: var(--muted); }
.tab-active { border-color: var(--primary); background: var(--primary-soft); box-shadow: inset 0 -3px 0 var(--primary); }
.tab-count { position: absolute; top: -8px; right: -6px; background: var(--primary); color: #fff; border-radius: 99px; font-size: .75rem; padding: 0 .45rem; font-weight: bold; }
.suggest { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-bottom: .75rem; }
.suggest select { width: auto; }
.stepper { display: inline-flex; align-items: center; gap: .3rem; }
.stepper span { margin-right: .3rem; }
.stepper input { width: 64px; text-align: center; }
.proposals { display: flex; flex-direction: column; gap: .5rem; margin-bottom: .75rem; }
.proposal { display: flex; justify-content: space-between; align-items: center; gap: .75rem; border: 1px dashed var(--primary-mid); border-radius: 6px; padding: .6rem .8rem; cursor: pointer; }
.proposal-active { border-style: solid; border-color: var(--primary); background: var(--primary-soft); }
.summary .sum-day { border-bottom: 1px solid var(--line); padding: .4rem 0; }
.sum-day-title { font-weight: bold; font-size: .92rem; }
.sum-line { display: flex; justify-content: space-between; gap: .5rem; font-size: .9rem; padding: .1rem 0; }
.sum-total { display: flex; justify-content: space-between; font-weight: bold; padding: .5rem 0 .2rem; }
.sum-due { font-size: 1.15rem; color: var(--primary-dark); border-top: 2px solid var(--ink); margin-top: .3rem; }
.summary-actions { display: flex; flex-direction: column; gap: .5rem; margin-top: .75rem; }
.danger-zone { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; background: #fdecea; padding: .6rem; border-radius: 6px; }

/* ---------- Admin ---------- */
.toolbar { display: flex; flex-direction: column; gap: .6rem; margin-bottom: .75rem; }
.toolgroup { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; padding: .6rem; background: #faf7f4; border-radius: 6px; }
.toolgroup select { width: auto; max-width: 100%; }
.table-scroll { overflow-x: auto; }
.edit-table { border-collapse: collapse; width: 100%; }
.edit-table th { text-align: left; font-weight: normal; color: var(--muted); font-size: .85rem; padding: .3rem; }
.edit-table td { padding: .2rem .3rem; }
.edit-table input { min-height: 36px; padding: .35rem .45rem; }
.sticky-actions { position: sticky; bottom: 0; background: linear-gradient(to top, var(--bg) 70%, transparent); padding: 1rem 0; display: flex; justify-content: flex-end; }

/* ---------- Saalplan (Tische eines Bereichs ohne Abstand, wie samstag1.pdf) ---------- */
.plan-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; padding: .25rem 0 .5rem; }
.plan { --seat-w: calc(var(--table-w) / 3); display: grid; column-gap: 0; row-gap: 16px; width: max-content; align-items: start; }
.stage-item { display: flex; align-items: center; justify-content: center; text-align: center; font-size: .78rem; color: #fff; background: #4a403b; border-radius: 6px; padding: .3rem; align-self: stretch; margin-right: 8px; }
.stage-buehne { flex-direction: column; writing-mode: vertical-rl; transform: rotate(180deg); font-size: 1rem; letter-spacing: .25em; background: var(--primary); font-weight: bold; }
.stage-buehne small { font-size: .7rem; letter-spacing: .1em; font-weight: normal; opacity: .85; }
.stage-kapelle { background: #7a6a61; }
.stage-loge { background: #9a7b2f; }
.stage-bottom { width: 100%; min-width: max-content; text-align: center; background: #4a403b; color: #fff; border-radius: 6px; margin-top: 12px; padding: .35rem; font-size: .85rem; letter-spacing: .08em; }
/* Tisch = Raster aus Stuhlspalten. Jede Zelle zeichnet nur ihre rechte und untere Linie,
   der Tisch die obere (und links, wenn kein Nachbartisch anschließt) -> alle Linien liegen exakt übereinander. */
.ptable { --line: 1.5px solid #8c817a; display: grid; grid-auto-rows: auto; border-top: var(--line); }
.ptable > .seat, .ptable > .ptable-label { box-sizing: border-box; border: 0; border-right: var(--line); border-bottom: var(--line); margin: 0; border-radius: 0; }
.ptable:not(.ptable-joined) > .c1 { border-left: var(--line); }
.ptable-active .ptable-label { background: var(--primary-soft); }
.ptable-ghost { visibility: hidden; height: 1px; border: 0; }
.ptable-hidden { align-self: stretch; border: 1.5px dashed #b6aaa0; border-radius: 4px; color: var(--muted); font-size: .68rem; display: flex; align-items: center; justify-content: center; text-align: center; min-height: 70px; background: repeating-linear-gradient(45deg, #faf7f4, #faf7f4 6px, #f0e9e2 6px, #f0e9e2 12px); }
.seat {
    width: var(--seat-w); height: var(--seat); padding: 0; font: inherit; font-size: .72rem; line-height: 1;
    background: #fff; color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
    touch-action: manipulation; position: relative;
}
.seat-empty { background: transparent; cursor: default; }
.seat:disabled { cursor: default; }
i.seat { display: inline-block; width: 16px; height: 16px; border: 1.5px solid #8c817a; vertical-align: -3px; }
.seat-free:not(:disabled):hover { background: var(--primary-soft); box-shadow: inset 0 0 0 2px var(--primary); }
.seat-taken { background: #8c817a; color: #fff; }
.seat-locked { background: repeating-linear-gradient(45deg, #b6aaa0, #b6aaa0 4px, #9a8f88 4px, #9a8f88 8px); color: #fff; }
.seat-locked:not(:disabled):hover { box-shadow: inset 0 0 0 2px var(--primary); }
.seat-selected { background: var(--primary); color: #fff; font-weight: bold; }
.seat-proposal { background: var(--primary-mid); color: var(--ink); box-shadow: inset 0 0 0 2px var(--primary-dark); }
.ptable-label {
    grid-column: 1 / -1; min-height: 32px; background: #f2ebe5;
    font: inherit; font-size: .75rem; line-height: 1.1; display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; padding: 2px;
}
.ptable-label:disabled { cursor: default; color: var(--ink); }
.ptable-label:not(:disabled):hover { background: var(--primary-soft); }
.ptable-name { font-weight: bold; }
.ptable-free { font-size: .68rem; color: var(--muted); }
.ptable-full .ptable-label { background: #ddd4cd; }
.ptable-locked .ptable-label { background: #d8cfc8; color: var(--muted); }
.ptable-names { grid-column: 1 / -1; list-style: none; margin: 4px 0 0; padding: 0 2px; font-size: .66rem; line-height: 1.15; text-align: center; color: var(--ink); }
.legend { display: flex; flex-wrap: wrap; gap: .4rem 1rem; align-items: center; font-size: .85rem; margin-top: .4rem; }
.legend-price { background: var(--primary-soft); border-radius: 99px; padding: .05rem .6rem; }
@media (max-width: 760px) {
    :root { --seat: 24px; --table-w: 78px; --stage-w: 40px; --aisle-w: 16px; }
    .stage-kapelle, .stage-loge { font-size: .62rem; }
}

/* ---------- Dialog ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 90; }
.modal { position: fixed; z-index: 100; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(760px, calc(100vw - 1.5rem)); max-height: calc(100dvh - 1.5rem);
         display: flex; flex-direction: column; background: #fff; border-radius: 10px; box-shadow: 0 20px 50px rgba(0,0,0,.3); border-top: 4px solid var(--primary); }
.modal-head, .modal-foot { display: flex; align-items: center; gap: .5rem; padding: .8rem 1rem; }
.modal-head { border-bottom: 1px solid var(--line); justify-content: space-between; }
.modal-head h2 { margin: 0; }
.modal-body { padding: 1rem; overflow-y: auto; }
.modal-foot { border-top: 1px solid var(--line); flex-wrap: wrap; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 1rem; background: linear-gradient(160deg, var(--primary) 0%, var(--primary-dark) 55%, #8a2e00 100%); }
.login-card { background: #fff; width: min(420px, 100%); border-radius: 12px; padding: 1.5rem; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.login-head { display: flex; align-items: center; gap: .9rem; margin-bottom: 1.2rem; }
.login-head img { width: 64px; height: 64px; object-fit: contain; }
.login-head h1 { color: var(--primary-dark); }
.login-head p { margin: .2rem 0 0; color: var(--muted); font-size: .9rem; }

/* ---------- Druck ---------- */
.print-page { padding: 1rem; background: #fff; min-height: 100vh; }
.print-toolbar { display: flex; gap: .5rem; margin-bottom: 1rem; }
.print-head { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 3px solid var(--primary); padding-bottom: .5rem; margin-bottom: .75rem; }
.print-club { color: var(--primary-dark); font-weight: bold; }
.print-meta { text-align: right; font-size: .85rem; }
@media print {
    @page { size: A4 landscape; margin: 8mm; }
    .no-print { display: none !important; }
    body { background: #fff; }
    .plan-scroll { overflow: visible; }
    .seat, .stage-item, .stage-bottom, .ptable-label, .legend-price { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------- Blazor-Fehleranzeige ---------- */
#blazor-error-ui { display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 1000; background: #fff4e0; padding: .7rem 1rem; box-shadow: 0 -2px 8px rgba(0,0,0,.2); }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .6rem; }
.blazor-error-boundary { background: #fdecea; padding: 1rem; color: var(--err); }
.blazor-error-boundary::after { content: "Ein Fehler ist aufgetreten."; }

/* Tisch-Editor */
.edit-table td.center { text-align: center; }
.edit-table input.cb { width: 20px; height: 20px; min-height: 0; accent-color: var(--primary); }
.edit-table tr.row-locked td { background: #f3ede8; }
.edit-table tr.row-hidden td { background: #f6f6f6; opacity: .7; }

/* sortierbare Spaltenköpfe */
.th-sort { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; text-decoration: underline dotted; }
.th-sort.th-active { color: var(--primary-dark); font-weight: bold; text-decoration: none; }
.th-sort.th-active::after { content: " ▲"; font-size: .75em; }
.btn-disabled { pointer-events: none; opacity: .5; }
