:root {
  --red: #e60005; --red-dark: #b8000a; --bg: #f4f5f7; --fg: #1d1d1d; --muted: #5f6368;
  --line: #e3e5e8; --link: #0b5cad; --radius: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
}
* { box-sizing: border-box; }
body { margin: 0; font: 16px/1.5 system-ui, sans-serif; background: var(--bg); color: var(--fg); }
a { color: var(--link); text-underline-offset: 2px; }
a:hover { color: #08457f; }
:focus-visible { outline: 3px solid rgba(11, 92, 173, .45); outline-offset: 2px; }
/* White header: the DRK logo must sit on white with a clear space of at least one cross bar
   (bar = 1/3 of the cross; at 44px logo height that is about 15px, so 1rem all around). */
.topbar { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between;
  padding: 1rem; background: #fff; color: var(--fg); border-bottom: 4px solid var(--red); }
.topbar a { color: var(--fg); }
.brand { display: flex; align-items: center; text-decoration: none; }
.brand img { display: block; height: 44px; width: auto; }
.sender { display: flex; flex-direction: column; justify-content: center; margin-left: 1rem;
  padding-left: 1rem; border-left: 1px solid #333; line-height: 1.25; min-height: 44px; }
.sender-org { font-weight: 600; }
.sender-app { color: var(--muted); font-size: .9rem; }
nav.account { position: relative; }
nav.account .account-items { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; }
.account-toggle { display: none; }
nav.account .who { color: var(--muted); }
nav.account form { margin: 0; }
nav.account button, nav.account button[type=submit] { background: transparent; color: var(--fg); border: 1px solid #999; border-radius: 4px; padding: .25rem .6rem; font: inherit; cursor: pointer; }
@media (max-width: 40rem) {
  /* 36px logo -> bar about 12px; .75rem keeps the clear space */
  .topbar { padding: .75rem; }
  .brand img { height: 36px; }
  .sender { margin-left: .75rem; padding-left: .75rem; min-height: 36px; font-size: .9rem; }
  /* account menu: one button next to the logo, the entries open below it */
  .topbar:has(.account.js-menu) { flex-wrap: nowrap; }
  .topbar:has(.account.js-menu) .brand { min-width: 0; }
  nav.account.js-menu { flex: none; }
  nav.account.js-menu .account-toggle { display: inline-flex; align-items: center; gap: .35rem; padding: .4rem .7rem; font: inherit; font-weight: 600; color: var(--fg); background: #fff; border: 1px solid #c4c7cc; border-radius: 4px; cursor: pointer; }
  nav.account.js-menu .account-toggle[aria-expanded="true"] { background: #f1f3f5; }
  nav.account.js-menu .account-items { display: none; }
  nav.account.js-menu.open .account-items { display: flex; flex-direction: column; align-items: stretch; gap: 0; position: absolute; right: 0; top: calc(100% + .5rem); z-index: 20; min-width: 15rem; background: #fff; border-radius: var(--radius); box-shadow: 0 6px 24px rgba(16, 24, 40, .18); padding: .4rem 0; }
  nav.account.js-menu.open .account-items > * { padding: .6rem 1rem; }
  nav.account.js-menu.open .who { font-size: .9rem; border-bottom: 1px solid var(--line); }
  nav.account.js-menu.open a { text-decoration: none; }
  nav.account.js-menu.open a:hover { background: #f1f3f5; }
  nav.account.js-menu.open form { border-top: 1px solid var(--line); margin-top: .3rem; }
  nav.account.js-menu.open form button { width: 100%; }
}
main { max-width: 56rem; margin: 1.5rem auto; padding: 0 1rem; }
.card, form { max-width: 28rem; }
input, select, textarea { width: 100%; padding: .5rem; font: inherit; border: 1px solid #bbb; border-radius: 4px; background: #fff; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--link); box-shadow: 0 0 0 3px rgba(11, 92, 173, .2); }
input[type=radio]:focus, input[type=checkbox]:focus { box-shadow: none; }
/* Buttons: primary (red), secondary (white with grey border), danger (white with red border).
   All have a 1px border so that they line up at the same height. */
button[type=submit], .btn { background: var(--red); color: #fff; border: 1px solid var(--red); border-radius: 4px; padding: .5rem 1rem; font: inherit; font-weight: 600; line-height: 1.4; cursor: pointer; transition: background-color .15s; }
button[type=submit]:hover:not(:disabled), .btn:hover { background: var(--red-dark); border-color: var(--red-dark); color: #fff; }
.btn.btn-secondary, button.secondary, button[type=submit].secondary { background: #fff; color: var(--fg); border: 1px solid #c4c7cc; }
.btn.btn-secondary:hover, button.secondary:hover:not(:disabled) { background: #f1f3f5; border-color: #9aa0a6; color: var(--fg); }
button.danger:hover:not(:disabled) { background: #fdecea; border-color: #b00020; color: #b00020; }
.form-actions { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.messages { list-style: none; padding: .5rem 1rem; background: #fff3cd; border-radius: 4px; }
.errorlist { color: #b00020; padding-left: 1rem; }
.btn-group, .alert { margin: .5rem 0; }
.head { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between; }
.head h1 { margin: .5rem 0; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.actions form { margin: 0; }
.btn { text-decoration: none; display: inline-block; }
button.danger, button[type=submit].danger { background: #fff; color: #b00020; border: 1px solid #b00020; border-radius: 4px; padding: .5rem 1rem; font: inherit; font-weight: 600; cursor: pointer; }
.tabs { display: flex; flex-wrap: wrap; gap: .25rem; margin: 1rem 0; }
.tabs a { padding: .4rem .8rem; border-radius: 4px; background: #e6e6e6; color: var(--fg); text-decoration: none; }
.tabs a.active { background: var(--fg); color: #fff; }
table { width: 100%; border-collapse: separate; border-spacing: 0; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
th, td { text-align: left; padding: .6rem .7rem; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
th { font-size: .85rem; color: var(--muted); }
.empty { color: var(--muted); }
.status { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .85rem; background: #e6e6e6; white-space: nowrap; }
.status-requested { background: #fff3cd; }
.status-accepted, .status-completed { background: #d1e7dd; }
.status-change_requested { background: #ffe5b4; }
.status-en_route { background: #cfe2ff; }
.status-rejected, .status-cancelled { background: #f8d7da; }
.notice { background: #fff; border-left: 4px solid var(--red); border-radius: 0 var(--radius) var(--radius) 0; box-shadow: var(--shadow); padding: .6rem 1rem; }
.refresh-warning { background: #fdecea; font-weight: 600; }
.required { color: var(--red); font-weight: 700; }
.field.radio > div { display: flex; gap: 1.5rem; }
.field.radio label { font-weight: 400; display: flex; gap: .35rem; align-items: center; }
.field.radio > label { display: block; font-weight: 600; }
.field.radio input[type=radio] { width: auto; }
.exclusion-hint { color: #b00020; font-weight: 600; margin: .4rem 0 0; }
.ride-form button[type=submit]:disabled { opacity: .5; cursor: not-allowed; }
.ready { color: #1b5e20; }
table.pre-booked tr.today td { background: #fffbea; }
.ready-actions { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: flex-end; margin-top: .6rem; }
.ready-actions form { margin: 0; max-width: none; }
.ready-time { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-end; }
.ready-time label { display: flex; flex-direction: column; font-size: .85rem; color: var(--muted); }
.ready-time input[type=time] { width: auto; }
.ready-actions small { flex-basis: 100%; }
.refresh-warning[hidden] { display: none; }
.ride-form { max-width: 36rem; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.5rem 1.5rem; }
@media (max-width: 40rem) { .ride-form { padding: .75rem 1rem 1.25rem; } }
/* sign-in and other short forms: a white card */
.form-card { max-width: 26rem; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem 1.5rem 1.5rem; }
.form-card .form-actions { margin-top: 1.25rem; padding-top: 0; border-top: 0; }
.field .helptext, .field .helptext ul { color: var(--muted); font-size: .85rem; margin: .25rem 0 0; }
.field .helptext ul { padding-left: 1.1rem; }
.auth { max-width: 26rem; margin: 2rem auto; }
.auth h1 { margin-top: 0; }
.field { margin-bottom: 1rem; }
.field label { display: block; font-weight: 600; margin-bottom: .25rem; }
.field small { display: block; color: var(--muted); }
.field input[type=checkbox] { width: auto; }
.has-error input, .has-error select { border-color: #b00020; }
dl { display: grid; grid-template-columns: max-content 1fr; gap: .5rem 1.5rem; background: #fff; padding: 1rem 1.25rem; border-radius: var(--radius); box-shadow: var(--shadow); }
dt { color: var(--muted); }
dd { margin: 0; }
@media (max-width: 40rem) { dl { grid-template-columns: 1fr; } table { font-size: .9rem; } }
.badge { display: inline-block; vertical-align: middle; font-size: .85rem; font-weight: 600; padding: .15rem .6rem; border-radius: 999px; background: var(--red); color: #fff; }
.badge[hidden] { display: none; }
.badge.flash { animation: flash 1s ease-in-out 3; }
@keyframes flash { 50% { background: #ffb400; color: #000; } }
tr.open td { background: #fffbea; }
.warn { color: #b00020; }
.filterbar { display: flex; flex-wrap: wrap; gap: 1rem; max-width: none; margin-bottom: 1rem; }
.filterbar label { display: flex; flex-direction: column; font-size: .85rem; color: var(--muted); }
.filterbar select { width: auto; min-width: 12rem; }
.panel { background: #fff; border-left: 4px solid var(--fg); border-radius: 0 var(--radius) var(--radius) 0; box-shadow: var(--shadow); padding: .5rem 1.25rem 1rem; margin: 1rem 0; }
/* dispatcher actions on the ride page: accept / reject / status, each in its own row */
.panel .inline-form + .inline-form, .panel .inline-form + .actions, .panel .ready-actions + .inline-form { border-top: 1px solid var(--line); padding-top: .9rem; margin-top: .9rem; }
.panel h2 { margin: .5rem 0; font-size: 1.1rem; }
.inline-form { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; max-width: none; margin-bottom: .75rem; }
.inline-form label { display: flex; flex-direction: column; font-size: .85rem; color: var(--muted); }
.inline-form input { width: auto; min-width: 12rem; }
.qr { background: #fff; display: inline-block; padding: .75rem; border: 1px solid #ddd; border-radius: 4px; }
.qr svg { display: block; width: 14rem; height: 14rem; }
.secret { font-size: 1.1rem; letter-spacing: .05em; background: #fff; padding: .25rem .5rem; border-radius: 4px; }
.steps { padding-left: 1.2rem; }
.muted { color: var(--muted); }
button.secondary, button[type=submit].secondary { background: #fff; color: var(--fg); border: 1px solid #999; border-radius: 4px; padding: .5rem 1rem; font: inherit; cursor: pointer; }
nav.account button.secondary { background: transparent; }
.legal { max-width: 56rem; margin: 2rem auto; padding: 0 1rem; display: flex; gap: 1rem; font-size: .9rem; }
.legal a { color: var(--muted); }
.mainnav { display: flex; flex-wrap: wrap; gap: .25rem; padding: 0 1rem; background: #fff; border-bottom: 1px solid #e6e6e6; }
.mainnav a { padding: .7rem .9rem; color: var(--fg); text-decoration: none; border-bottom: 3px solid transparent; }
.mainnav a:hover { border-bottom-color: #ccc; }
.mainnav a.active { border-bottom-color: var(--red); font-weight: 600; }
@media (max-width: 40rem) { .mainnav { padding: 0 .5rem; } .mainnav a { padding: .6rem .6rem; } }
/* Phone number of the dispatch center, always at the right end of the menu bar */
.mainnav a.nav-phone { margin-left: auto; display: flex; align-items: center; gap: .5rem; padding: .35rem 0 .35rem .9rem; }
.mainnav a.nav-phone:hover { border-bottom-color: transparent; }
.nav-phone svg { flex: none; color: var(--red); }
.nav-phone-text { display: flex; flex-direction: column; line-height: 1.2; }
.nav-phone-label { font-size: .75rem; color: var(--muted); }
.nav-phone strong { white-space: nowrap; }
@media (max-width: 40rem) {
  .mainnav a.nav-phone { flex-basis: 100%; margin-left: 0; padding: .5rem .6rem; border-top: 1px solid #eee; }
  .nav-phone-text { flex-direction: row; flex-wrap: wrap; align-items: baseline; column-gap: .4rem; }
  .nav-phone-label { font-size: .9rem; }
}
/* --- dispatch board --- */
main.wide { max-width: 90rem; }
.sound { font-size: .9rem; color: var(--muted); display: flex; gap: .35rem; align-items: center; }
.sound input { width: auto; }
.board-message { padding: .5rem 1rem; border-radius: 4px; }
.board-message.ok { background: #d1e7dd; }
.board-message.error { background: #f8d7da; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem; margin: 1rem 0 1.5rem; }
.kpi { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: .75rem 1rem; display: flex; flex-direction: column; }
.kpi-value { font-size: 1.8rem; font-weight: 700; line-height: 1.1; }
.kpi-label { color: var(--muted); font-size: .9rem; }
.kpi-alert { border-left: 4px solid var(--red); }
.board-section { margin-bottom: 2rem; }
.board-section h2 { font-size: 1.2rem; margin: 0 0 .5rem; }
table.inbox td { vertical-align: top; }
table.inbox tr.urgent td { background: #fdecea; }
table.inbox tr.urgent td:first-child { box-shadow: inset 4px 0 0 var(--red); }
table.inbox tr.fresh td { animation: fresh 2s ease-out 2; }
@keyframes fresh { 0% { background: #ffe58f; } 100% { background: inherit; } }
.inline-actions form { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin: 0; max-width: none; }
.inline-actions input[type=datetime-local] { width: auto; }
.inline-actions input[type=text] { width: 9rem; }
.inline-actions details { margin-top: .4rem; }
.inline-actions summary { cursor: pointer; color: #b00020; font-size: .9rem; }
.inline-actions details form { margin-top: .4rem; }
.inline-actions details input[type=text] { width: 16rem; }
.flow { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; }
.flow-column { background: #e9ebee; border-radius: var(--radius); padding: .5rem; min-height: 6rem; }
.flow-column h3 { font-size: 1rem; margin: .25rem .25rem .5rem; }
.count { display: inline-block; min-width: 1.5rem; text-align: center; font-size: .8rem; background: #fff; border-radius: 999px; padding: 0 .4rem; color: var(--muted); }
.card { background: #fff; border-radius: 6px; box-shadow: var(--shadow); padding: .5rem .6rem; margin-bottom: .5rem; font-size: .92rem; }
.card a { color: var(--fg); text-decoration: none; }
.card.overdue { border-left: 4px solid #ffb400; }
.card form { margin: .4rem 0 0; max-width: none; }
.card button.step { width: 100%; padding: .35rem .5rem; font-size: .9rem; }
.card button.step-back { width: 100%; padding: .2rem .5rem; font-size: .8rem; background: transparent; color: var(--muted); border: 1px solid #ccc; }
.preview-day { background: #fff; border-radius: 6px; box-shadow: var(--shadow); padding: .4rem .75rem; margin-bottom: .4rem; }
.preview-day summary { cursor: pointer; }
.preview-day ul { margin: .4rem 0; padding-left: 1.2rem; }
.search-number input { width: 7rem; }
.archive-search input[type=date], .archive-search input[type=search] { width: auto; }
.archive-search { align-items: flex-end; }
@media (max-width: 60rem) { .flow { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 40rem) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .flow { grid-template-columns: 1fr; }
  table.inbox thead { display: none; }
  table.inbox tr { display: block; border-bottom: 1px solid #e6e6e6; padding: .5rem 0; }
  table.inbox td { display: block; border: 0; padding: .2rem .7rem; }
}
/* --- customer view (Meine Fahrten) --- */
.btn-large { font-size: 1.05rem; padding: .7rem 1.2rem; }
.day-section { margin: 1.25rem 0; }
.day-section h2 { font-size: 1.15rem; margin: 0 0 .5rem; display: inline-flex; gap: .5rem; align-items: center; }
.ride-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: .75rem 1rem; margin-bottom: .6rem; }
.ride-card.needs-attention { border-left: 4px solid #ffb400; }
.ride-card p { margin: .25rem 0; }
.ride-card-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem; align-items: baseline; }
.ride-card-time { font-weight: 700; color: var(--fg); text-decoration: none; }
.pickup { background: #d1e7dd; border-radius: 4px; padding: .1rem .5rem; }
.pickup-big { font-size: 1.15rem; background: #d1e7dd; border-radius: 6px; padding: .6rem 1rem; }
.attention { color: #8a5a00; font-weight: 600; }
.progress { display: flex; list-style: none; padding: 0; margin: .6rem 0 .2rem; counter-reset: step; }
.progress li { flex: 1; position: relative; text-align: center; font-size: .78rem; color: var(--muted); padding-top: 1.1rem; }
.progress li::before { content: ""; position: absolute; top: .3rem; left: 50%; transform: translateX(-50%); width: .7rem; height: .7rem; border-radius: 50%; background: #ccc; z-index: 1; }
.progress li::after { content: ""; position: absolute; top: .6rem; left: -50%; width: 100%; height: 2px; background: #ccc; }
.progress li:first-child::after { display: none; }
.progress li.step-done::before, .progress li.step-current::before { background: #2e7d32; }
.progress li.step-done::after, .progress li.step-current::after { background: #2e7d32; }
.progress li.step-current { color: var(--fg); font-weight: 600; }
.progress li.step-current::before { box-shadow: 0 0 0 3px #c8e6c9; }
.progress-ended { display: inline-block; margin: .5rem 0 .2rem; padding: .15rem .6rem; border-radius: 999px; font-size: .85rem; }
.progress-ended.status-rejected, .progress-ended.status-cancelled { background: #f8d7da; }
.detail-footer { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1rem; }
fieldset { border: 0; border-top: 1px solid #ddd; margin: 1.25rem 0 0; padding: .75rem 0 0; }
legend { font-weight: 700; padding-right: .5rem; }
/* PLZ and Ort share one line */
.ride-form fieldset { display: grid; grid-template-columns: 6rem minmax(0, 1fr); column-gap: .75rem; }
.ride-form .field { grid-column: 1 / -1; }
.ride-form .field[data-field$="_postal_code"] { grid-column: 1; }
.ride-form .field[data-field$="_city"] { grid-column: 2; }
label.checkbox { display: flex; gap: .5rem; align-items: center; font-weight: 600; }
@media (max-width: 40rem) { .progress li span { display: none; } .progress li.step-current span { display: inline; position: absolute; top: 1.2rem; left: 50%; transform: translateX(-50%); white-space: nowrap; } .progress { padding-bottom: 1rem; } }
.reason { background: #fdecea; border-radius: 4px; padding: .3rem .6rem; }
/* --- administration --- */
.subnav { margin-bottom: 1.25rem; }
.subnav .tech { margin-left: auto; background: transparent; color: var(--muted); }
.admin-table td, .admin-table th { font-size: .92rem; }
.admin-table tr.inactive td { color: var(--muted); }
.row-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.row-actions form { margin: 0; max-width: none; }
.row-actions button { padding: .2rem .55rem; font-size: .85rem; }
.hints { list-style: none; padding: 0; }
.hints li { background: #fff; border-left: 4px solid #999; padding: .5rem .8rem; margin-bottom: .4rem; }
.hints .hint-bad { border-left-color: var(--red); }
.hints .hint-warn { border-left-color: #ffb400; }
.hints .hint-info { border-left-color: #6c8ebf; }
.ok-note { background: #d1e7dd; padding: .5rem .8rem; border-radius: 4px; }
.org-block { margin-bottom: 1.5rem; }
.org-block h2 { font-size: 1.1rem; display: flex; gap: .75rem; align-items: baseline; flex-wrap: wrap; }
.edit-link { font-size: .85rem; font-weight: 400; }
dl.system dd.good::before { content: "● "; color: #2e7d32; }
dl.system dd.bad::before { content: "● "; color: var(--red); }
code.details { font-size: .8rem; white-space: normal; }
.pager { display: flex; gap: 1rem; align-items: center; margin: 1rem 0; }
.stats-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 1.5rem; }
.stats-grid h2 { font-size: 1.05rem; }
@media (max-width: 60rem) { .stats-grid { grid-template-columns: 1fr; } .admin-table { display: block; overflow-x: auto; } }
.ride-no { font-weight: 600; color: var(--muted); }
