@font-face {
    font-family: Barlow;
    src: url("./assets/Barlow-400.woff2") format("woff2");
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: Barlow;
    src: url("./assets/Barlow-600.woff2") format("woff2");
    font-weight: 600;
    font-display: swap;
}
@font-face {
    font-family: Barlow;
    src: url("./assets/Barlow-700.woff2") format("woff2");
    font-weight: 700;
    font-display: swap;
}
@font-face {
    font-family: "Barlow Condensed";
    src: url("./assets/BarlowCondensed-700.woff2") format("woff2");
    font-weight: 700;
    font-display: swap;
}

:root {
    --ink: #192d3d;
    --muted: #516373;
    --rail: #172c3d;
    --canvas: #edf1f3;
    --surface: #fff;
    --line: #dce4e8;
    --accent: #ffa45c;
    --display: "Barlow Condensed", Barlow, "Segoe UI", system-ui, sans-serif;
    color: var(--ink);
    background: var(--canvas);
    font: 16px/1.45 Barlow, "Segoe UI", system-ui, sans-serif;
    font-synthesis: none;
}

*, *::before, *::after { box-sizing: border-box; }
body, h1, h2, h3, p, dl, dd { margin: 0; }
button, input, select { font: inherit; }
button { color: inherit; cursor: pointer; }
button:is(:disabled, [aria-disabled="true"]) { opacity: .65; cursor: wait; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #287bad; outline-offset: 3px; }
.icon { display: block; width: 20px; height: 20px; flex: none; }
.skip { position: fixed; left: 12px; top: 12px; z-index: 2; padding: 10px 12px; border-radius: 7px; color: var(--ink); background: white; }
.skip:not(:focus) { clip-path: inset(50%); }

.wordmark { display: inline-flex; align-items: center; gap: 11px; width: fit-content; color: white; font: 700 2.45rem/1 var(--display); letter-spacing: -.04em; }
.mark { display: grid; place-items: center; width: 32px; height: 32px; border: 1.5px solid #a0b4c1; border-radius: 8px; }
.mark::after { content: ""; width: 11px; height: 11px; border: 2.5px solid var(--accent); border-radius: 50%; }
.brand-dot { color: var(--accent); }

.login { min-height: 100dvh; display: grid; grid-template-columns: minmax(240px, .95fr) minmax(420px, 1fr); }
.login-brand {
    padding: clamp(28px, 5vw, 72px);
    /* Fiktives Werkstor aus der VorOrt-Klickdemo, siehe assets/Bildquellen.txt im Projektstamm. */
    background: linear-gradient(180deg, #162a39d9, #162a3940 60%, #162a3966), var(--rail) 56% center / cover url("./assets/werkstor.webp");
}
.login-workspace { display: grid; place-items: center; padding: 28px; }
.login-card { width: min(100%, 425px); padding: clamp(22px, 4vw, 38px); border: 1px solid var(--line); border-radius: 15px; background: white; }
.login-card h1 { font-size: clamp(2.4rem, 4vw, 3.1rem); }
.login-card > p { color: var(--muted); margin-top: 7px; }
.login-card form { display: grid; gap: 16px; margin-top: 24px; }

.shell { display: grid; grid-template-columns: 218px minmax(0, 1fr); min-height: 100dvh; }
.rail { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; gap: 38px; padding: 25px 17px 17px; color: #f7f9fa; background: var(--rail); }
.rail .wordmark { margin-left: 8px; }
.rail-nav { display: grid; gap: 5px; }
.nav-button { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 13px; text-align: left; border: 0; border-radius: 8px; color: #c7d4dc; background: transparent; font-weight: 600; }
.nav-button:hover { background: #223b4d; color: white; }
.nav-button[aria-current="page"] { background: #284253; color: white; box-shadow: inset 3px 0 var(--accent); }
.nav-button[aria-current="page"] .icon { color: var(--accent); }
.rail-account { display: flex; align-items: center; gap: 11px; margin-top: auto; padding: 14px 7px 2px; border-top: 1px solid #405767; overflow-wrap: anywhere; }
.rail-account small, .context small { display: block; line-height: 1.3; font-size: .87rem; }
.rail-account small { color: #c7d4dc; }
.avatar { display: grid; place-items: center; flex: 0 0 37px; height: 37px; border-radius: 50%; background: #d7e6ed; color: #213d50; font-size: .85rem; font-weight: 700; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 70px; padding: 9px clamp(20px, 4vw, 58px); background: #f9fbfc; border-bottom: 1px solid var(--line); }
.context { min-width: 0; display: flex; align-items: center; gap: 10px; overflow-wrap: anywhere; }
.context small { color: var(--muted); }
.context-icon, .row-icon { display: grid; place-items: center; flex: 0 0 36px; height: 36px; border-radius: 8px; color: #3b5568; background: #e9f0f3; }
.context-icon .icon, .row-icon .icon { width: 18px; height: 18px; }

.content { max-width: 1360px; margin: 0 auto; padding: 36px clamp(20px, 4vw, 58px) 55px; }
.page-header { display: flex; align-items: end; justify-content: space-between; flex-wrap: wrap; gap: 16px; margin-bottom: 24px; }
h1, .dialog-header h2 { font: 700 clamp(2.65rem, 4.8vw, 4.1rem)/1 var(--display); letter-spacing: -.025em; }
.page-header p { margin-top: 7px; color: var(--muted); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 8px 13px; border: 1px solid transparent; border-radius: 8px; background: white; font-weight: 700; line-height: 1.2; }
.btn .icon { width: 17px; height: 17px; }
.primary { background: var(--accent); color: #26303a; border-color: #ef984e; }
.primary:hover:not(:disabled) { background: #ffb47b; }
.secondary { color: #244258; border-color: #c8d6dd; }
.secondary:hover:not(:disabled, [aria-disabled="true"]) { background: #f1f6f8; }
.danger { color: white; background: #92392d; }
.danger:hover:not(:disabled) { background: #792d23; }

.listing, .filters { min-width: 0; background: white; border: 1px solid var(--line); border-radius: 13px; }
.listing-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; padding: 15px 18px; }
.listing-header h2 { font-size: 1.18rem; }
.list-tools { display: flex; align-items: center; justify-content: end; flex-wrap: wrap; gap: 8px 12px; }
.list-tools .btn { font-size: .92rem; }
.count { color: var(--muted); font-size: .93rem; text-align: end; }
table { width: 100%; border-collapse: collapse; text-align: start; table-layout: fixed; }
th, td { padding: 12px; text-align: start; vertical-align: middle; overflow-wrap: anywhere; }
th:first-child, td:first-child { padding-left: 18px; width: 33%; }
th:last-child, td:last-child { padding-right: 18px; text-align: end; width: 150px; }
th { background: #f3f7f9; color: #405667; font-size: .87rem; }
td { border-top: 1px solid var(--line); }
td small { display: block; color: var(--muted); font-size: .9rem; }
.row-main { display: flex; align-items: center; gap: 10px; }
.row-main > div { min-width: 0; }
.row-actions { display: flex; flex-wrap: wrap; justify-content: end; gap: 6px; }
.row-actions .btn { padding-inline: 9px; }
.cell-label { display: none; }
.badge-stack { display: grid; justify-items: start; gap: 4px; }
.badge { display: inline-block; border-radius: 5px; padding: 4px 8px; background: #eaf0f3; color: #34546a; font-size: .84rem; line-height: 1.25; font-weight: 700; }
.badge.ok, .feedback.success { background: #e4f3ec; color: #115c4a; }
.badge.warn { background: #fff3d9; color: #714606; }
.badge.negative { background: #fcebe6; color: #842f25; }
.list-state { display: grid; justify-items: start; gap: 8px; border-top: 1px solid var(--line); padding: 23px 18px; color: var(--muted); }
.list-state .feedback { width: 100%; }

.filters { display: grid; grid-template-columns: minmax(170px, 1.4fr) minmax(165px, 1fr) repeat(2, minmax(128px, .8fr)) auto; align-items: end; gap: 12px; margin-bottom: 17px; padding: 15px 18px; }
.filters .feedback { grid-column: 1 / -1; }
.field { display: grid; align-content: start; gap: 5px; min-width: 0; font-weight: 700; }
.field :is(input, select) { width: 100%; min-width: 0; min-height: 44px; padding: 8px 10px; border: 1px solid #bfcfd8; border-radius: 7px; color: var(--ink); background: white; }
.field input[type="date"], .field input[type="datetime-local"] { display: block; }
.field small { color: var(--muted); font-weight: 400; }

.feedback { padding: 10px 12px; border-radius: 7px; background: #edf4f6; color: #385768; }
.feedback.error { background: #fcebe6; color: #842f25; }
.content > .feedback { margin-bottom: 17px; }

dialog { width: min(610px, calc(100% - 26px)); max-height: min(90dvh, 900px); padding: 0; border: 0; border-radius: 15px; color: var(--ink); background: white; box-shadow: 0 18px 80px #10283950; }
dialog::backdrop { background: #1025339e; }
.dialog-header { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); background: #f9fbfc; }
.dialog-header h2 { font-size: clamp(1.95rem, 5vw, 2.5rem); }
#close-dialog { width: 44px; flex: none; }
.dialog-body { display: grid; gap: 16px; padding: 20px; }
.dialog-body > p { overflow-wrap: anywhere; }
.form-fields { display: grid; gap: 12px; }
.form-actions { display: flex; flex-wrap: wrap; justify-content: end; gap: 8px; }
.receipt-head { display: grid; justify-items: start; gap: 6px; }
.receipt-head h3 { font: 700 2rem/1.05 var(--display); overflow-wrap: anywhere; }
.receipt-head p { color: var(--muted); }
.receipt-section { padding-top: 13px; border-top: 1px solid var(--line); }
.receipt-section h3 { font-size: 1.07rem; margin-bottom: 7px; }
.receipt-section dl { display: grid; grid-template-columns: minmax(120px, .7fr) minmax(0, 1fr); gap: 5px 12px; }
.receipt-section dt { color: var(--muted); overflow-wrap: anywhere; }
.receipt-section dd { overflow-wrap: anywhere; }
.receipt-section summary { cursor: pointer; width: fit-content; font-weight: 700; padding: 5px 0; }
.receipt-photo { display: block; max-width: 100%; max-height: 60vh; object-fit: contain; border-radius: 8px; }
[data-person-photo] :is(.btn, img, .feedback) { margin-top: 8px; }
.reference-account { overflow-wrap: anywhere; }
.reference-account h3 { font-size: 1.25rem; }
.reference-account p { color: var(--muted); }
.reference-review { display: grid; justify-items: start; gap: 12px; }
.reference-image { max-height: min(48dvh, 380px); }
.reference-confirm { display: flex; align-items: start; gap: 9px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; }
.reference-confirm input { flex: none; width: 19px; height: 19px; margin: 2px 0 0; accent-color: #175f50; }
#face-verify-form button:disabled { cursor: not-allowed; }
.reference-actions { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 13px; border-top: 1px solid var(--line); }
.reference-remove { color: #842f25; }

@media (min-width: 761px) {
    table[data-view="users"] :is(th, td):last-child { width: 162px; }
}
@media (max-width: 1220px) {
    .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .filters .btn { justify-self: start; }
}
@media (max-width: 900px) {
    .shell { grid-template-columns: 170px minmax(0, 1fr); }
    th:first-child, td:first-child { width: 32%; }
    th:last-child, td:last-child { width: 128px; }
    th, td { padding-inline: 8px; }
    .row-main .row-icon { display: none; }
}
@media (max-width: 760px) {
    .login { grid-template-columns: 1fr; grid-template-rows: 116px 1fr; }
    .login-brand { padding: 24px 20px; }
    .login-workspace { align-items: start; padding: 22px 16px; }
    .shell { display: flex; flex-direction: column; }
    .rail { position: static; height: auto; padding: 14px 12px 8px; gap: 12px; }
    .rail .wordmark { margin-left: 4px; font-size: 2rem; }
    .rail .mark { width: 28px; height: 28px; }
    .rail-nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .nav-button { justify-content: center; padding: 0 5px; gap: 5px; font-size: .93rem; }
    .nav-button .icon { width: 16px; height: 16px; }
    .nav-button[aria-current="page"] { box-shadow: inset 0 -3px var(--accent); }
    .rail-account { position: absolute; right: 14px; top: 13px; max-width: 53%; margin: 0; padding: 0; text-align: right; border: 0; font-size: .91rem; }
    .rail-account strong { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
    .rail-account > div { min-width: 0; }
    .rail-account .avatar, .context-icon { display: none; }
    .toolbar { min-height: 65px; padding-inline: 14px; }
    .content { padding: 25px 14px 35px; }
    .page-header { align-items: start; margin-bottom: 17px; }
    table, tbody { display: block; }
    thead { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
    tbody tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 10px; padding: 13px; border-top: 1px solid var(--line); }
    tbody td, tbody td:first-child, tbody td:last-child { min-width: 0; width: auto; padding: 0; border: 0; }
    tbody td:first-child, tbody td:last-child { grid-column: 1 / -1; }
    tbody td:empty { display: none; }
    table[data-view="receipts"] td:nth-child(4) { grid-column: 1 / -1; }
    .badge-stack { display: flex; flex-wrap: wrap; }
    .row-main .row-icon { display: grid; }
    .cell-label { display: block; margin-bottom: 2px; color: var(--muted); font-size: .85rem; font-weight: 700; }
    .listing-header { padding: 12px 13px; }
    .filters { padding: 12px; gap: 9px; }
    .filters .search-field, .filters .confirmation-field { grid-column: 1 / -1; }
}

@media (max-width: 400px) {
    .dialog-header { gap: 8px; padding: 12px 14px; }
    .dialog-header h2 { min-width: 0; font-size: 1.75rem; overflow-wrap: anywhere; }
    .dialog-body { padding: 16px; }
}
