/* Dark mode for app.einlasspilot.de (Cockpit, Gate, Tower, Schalter, Buchhaltung, login/portal start).
   Active when <html data-theme="dark">, set by js/theme.js (saved choice, otherwise the system setting).
   Depth comes from surface steps and hairlines, not from shadows. */

/* ---- toggle button (all pages) ---- */
.ep-theme, .gate .ep-theme { position: fixed; top: 16px; right: 16px; z-index: 70; width: 40px; height: 40px; padding: 0; border-radius: 8px; cursor: pointer;
  display: grid; place-items: center; border: 1px solid rgba(17, 24, 39, .16); background: #fff; color: #4b5565;
  transition: background-color .15s cubic-bezier(.22, 1, .36, 1), color .15s cubic-bezier(.22, 1, .36, 1); }
.ep-theme:hover, .gate .ep-theme:hover { background: #eceff4; color: #111827; }
.ep-theme:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
.ep-theme svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.ep-theme .sun { display: none; }
html[data-theme="dark"] .ep-theme, html[data-theme="dark"] .gate .ep-theme { background: #11141c; border-color: rgba(238, 240, 245, .12); color: #a3a9b8; }
html[data-theme="dark"] .ep-theme:hover { background: #1a1e28; color: #eef0f5; }
html[data-theme="dark"] .ep-theme .sun { display: block; }
html[data-theme="dark"] .ep-theme .moon { display: none; }
body.portal .t-main { padding-top: 64px; }          /* room for the button above the page header */
body.auth .auth-nav { right: 76px; }
@media (max-width: 860px) { body.portal .t-main { padding-top: 28px; } .ep-theme { top: 8px; right: 8px; } }
@media print { .ep-theme { display: none !important; } }

/* ---- colours ---- */
html[data-theme="dark"] { color-scheme: dark; }
html[data-theme="dark"] body.portal {
  --t-bg: #0b0d14; --t-card: #11141c; --t-raised: #1a1e28; --t-line: rgba(238, 240, 245, .08); --t-field-line: rgba(238, 240, 245, .14);
  --t-ink: #eef0f5; --t-mut: #a3a9b8; --t-soft: #7a8296; --t-bar: #2c3240;
  --t-side: #07080d; --t-side-raised: #1a1e28; --t-side-line: rgba(238, 240, 245, .08);
  --t-ac: #2563eb; --t-ac-hover: #3b82f6; --t-ac-text: #6ea4f8; --t-ac-soft: rgba(59, 130, 246, .14);
  --t-ok: #4cc38a; --t-ok-text: #6fd3a2; --t-ok-soft: rgba(76, 195, 138, .12);
  --t-warn: #f0b35a; --t-warn-soft: rgba(240, 179, 90, .12);
  --t-bad: #e5484d; --t-bad-text: #ff9592; --t-bad-soft: rgba(229, 72, 77, .12);
}
html[data-theme="dark"] body.auth { --ink: #eef0f5; --mut: #a3a9b8; --line: rgba(238, 240, 245, .1); background: #0b0d14; }

/* surfaces that were plain white */
html[data-theme="dark"] .t-btn.ghost, html[data-theme="dark"] .t-filters input, html[data-theme="dark"] .t-filters select,
html[data-theme="dark"] .t-form input, html[data-theme="dark"] .t-form select, html[data-theme="dark"] .t-form textarea,
html[data-theme="dark"] .t-form input[type=file], html[data-theme="dark"] .t-table input, html[data-theme="dark"] .t-table select,
html[data-theme="dark"] .t-inline input, html[data-theme="dark"] .t-events-check label, html[data-theme="dark"] .holder-row input,
html[data-theme="dark"] .holder-me, html[data-theme="dark"] .t-device .link input, html[data-theme="dark"] .g-bar input,
html[data-theme="dark"] .gate .row, html[data-theme="dark"] .gate .hit, html[data-theme="dark"] .gate .dev,
html[data-theme="dark"] .gate button:not(.t-btn):not(.ep-theme), html[data-theme="dark"] .bo-kpis div, html[data-theme="dark"] .bo-dialog,
html[data-theme="dark"] .bo-notes button, html[data-theme="dark"] .bo-given input, html[data-theme="dark"] .bo-btn.no,
html[data-theme="dark"] .auth-card, html[data-theme="dark"] .t-card input, html[data-theme="dark"] .t-card select,
html[data-theme="dark"] .t-card textarea {
  background: #11141c; color: var(--t-ink, #eef0f5); border-color: rgba(238, 240, 245, .14);
}
html[data-theme="dark"] .t-btn.ghost:hover { background: #1a1e28; }
html[data-theme="dark"] .t-btn.danger, html[data-theme="dark"] .t-btn.ok, html[data-theme="dark"] .t-btn.warn { background: transparent; }
html[data-theme="dark"] .t-btn.danger:hover { background: var(--t-bad-soft); }
html[data-theme="dark"] .t-btn.ok:hover { background: var(--t-ok-soft); }
html[data-theme="dark"] .t-btn.warn:hover { background: var(--t-warn-soft); }
html[data-theme="dark"] .t-table tbody tr:hover td { background: rgba(238, 240, 245, .02); }
html[data-theme="dark"] .t-card.is-disabled input { background: #1a1e28; }

/* QR codes stay black on white so phones can scan them */
html[data-theme="dark"] .t-device .qr, html[data-theme="dark"] .g-qr { background: #fff; }
/* MFA setup: the authenticator QR code (black on transparent) needs a white quiet zone to be scannable */
html[data-theme="dark"] .auth-card img[src^="data:image/svg"] { background: #fff; padding: 12px; border-radius: 12px; }

/* tinted notices and messages: same roles, darker text colours */
html[data-theme="dark"] .t-msgs li, html[data-theme="dark"] .t-live-bar { color: #a7e8c5; }
html[data-theme="dark"] .t-msgs li.error, html[data-theme="dark"] .t-notice, html[data-theme="dark"] .t-live-bar.stopped,
html[data-theme="dark"] .gate .conflict, html[data-theme="dark"] .bo-error, html[data-theme="dark"] .bo-change.bad {
  background: var(--t-bad-soft, rgba(229, 72, 77, .12)); color: #ffc2c0; border-color: rgba(229, 72, 77, .3); }
html[data-theme="dark"] .t-notice.info { background: var(--t-ac-soft); color: #c3d8fb; border-color: rgba(59, 130, 246, .3); }
html[data-theme="dark"] .t-info .t-tip { background: #eef0f5; color: #111827; }
html[data-theme="dark"] .t-info .t-tip::after { border-top-color: #eef0f5; }
html[data-theme="dark"] .t-info.below .t-tip::after { border-top-color: transparent; border-bottom-color: #eef0f5; }
html[data-theme="dark"] .t-info:hover, html[data-theme="dark"] .t-info:focus, html[data-theme="dark"] .t-info.open { background: #eef0f5; color: #111827; }
html[data-theme="dark"] .g-expired { color: var(--t-mut); border-color: var(--t-line); background: var(--t-raised); }
html[data-theme="dark"] .t-todo { color: #f5d9a8; }

/* Gate */
html[data-theme="dark"] .gate button:not(.t-btn):not(.ep-theme):hover { background: #1a1e28; }
html[data-theme="dark"] .gate .hit .tk { background: var(--t-ac); color: #fff; }
html[data-theme="dark"] .gate .hit span.tk { background: #1a1e28; color: var(--t-mut); }
html[data-theme="dark"] .gate .hit span.tk.here { background: var(--t-ok-soft); color: var(--t-ok-text); }
html[data-theme="dark"] .gate b.vip { background: #1a1e28; color: var(--t-ink); border-color: var(--t-field-line); }

/* Schalter: uses the portal tokens, only the old white surfaces need the dark card */
html[data-theme="dark"] .bo-qty button, html[data-theme="dark"] .bo-btn.card, html[data-theme="dark"] .bo-btn.no { background: #11141c; }
html[data-theme="dark"] .bo-qty button:hover:not(:disabled), html[data-theme="dark"] .bo-btn.card:hover:not(:disabled) { background: #1a1e28; }
html[data-theme="dark"] .bo-btn.cash, html[data-theme="dark"] .bo-btn.yes { background: #2563eb; color: #fff; }
html[data-theme="dark"] .bo-btn.free { background: #eef0f5; color: #111827; }
html[data-theme="dark"] .bo-due { background: #1a1e28; }

/* login / portal start */
html[data-theme="dark"] .auth-card { box-shadow: none; }
html[data-theme="dark"] .auth-card input[type=email], html[data-theme="dark"] .auth-card input[type=password],
html[data-theme="dark"] .auth-card input[type=text], html[data-theme="dark"] .auth-card input[type=number],
html[data-theme="dark"] .auth-card input:not([type]) { background: #0b0d14; border-color: rgba(238, 240, 245, .14); color: #eef0f5; }
html[data-theme="dark"] .auth-card input:focus { background: #0b0d14; }
html[data-theme="dark"] .area-links a { background: #0b0d14; border-color: rgba(238, 240, 245, .1); }
html[data-theme="dark"] .area-links a:hover { border-color: rgba(238, 240, 245, .24); background: #11141c; }
html[data-theme="dark"] .area-links .ai { background: #1a1e28; color: #a3a9b8; }
html[data-theme="dark"] .area-links a:hover .ai { color: #eef0f5; }
html[data-theme="dark"] .auth-card .auth-btn.ghost { color: #eef0f5; border-color: rgba(238, 240, 245, .14); }
html[data-theme="dark"] .auth-card ul.messages li { background: rgba(59, 130, 246, .14); color: #c3d8fb; }
html[data-theme="dark"] .auth-card ul.messages li { background: rgba(59, 130, 246, .14); color: #c3d8fb; }
html[data-theme="dark"] .auth-card ul.messages li.error, html[data-theme="dark"] .auth-card .errorlist.nonfield,
html[data-theme="dark"] .auth-card form > ul.errorlist { background: rgba(229, 72, 77, .12); color: #ffc2c0; border-color: rgba(229, 72, 77, .3); }
html[data-theme="dark"] .auth-card code, html[data-theme="dark"] .auth-card pre { background: #1a1e28; }
html[data-theme="dark"] a { color: inherit; }
html[data-theme="dark"] body.auth a { color: #6ea4f8; }
html[data-theme="dark"] body.auth .auth-nav a { color: var(--mut); }
html[data-theme="dark"] body.auth .area-links a { color: var(--ink); }
