:root {
  --bg: #f6f6f6;
  --paper: #ffffff;
  --ink: #161616;
  --muted: #575756;
  --line: #dadada;
  --accent: #e40422;
  --accent-dark: #b50019;
  --accent-2: #004f9f;
  --accent-2-dark: #002856;
  --success: #d7eee0;
  --error: #f8d5dc;
  --info: #dce9f5;
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Berlin Type Office", Arial, sans-serif;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(0, 79, 159, 0.025) 1px, transparent 1px),
    linear-gradient(180deg, #ffffff 0, var(--bg) 350px);
  background-size: 28px 28px, auto;
  border-top: 7px solid var(--accent);
}

.topbar,
.page {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.topbar {
  padding: 28px 0 12px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
}

.page {
  padding-bottom: 40px;
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.75rem;
  color: var(--accent-2);
}

h1,
h2,
p {
  margin-top: 0;
}

.card {
  background: var(--paper);
  border: 1px solid rgba(217, 201, 174, 0.8);
  border-radius: 18px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.hero,
.split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}

.stack {
  display: grid;
  gap: 10px;
}

.compact {
  gap: 6px;
}

.inline-form,
.userbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.userbar a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

input,
select,
button {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--line);
  padding: 10px 12px;
  font: inherit;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkbox input {
  width: auto;
}

button {
  cursor: pointer;
  border: none;
  background: linear-gradient(135deg, var(--accent), #cf6042);
  color: white;
  font-weight: 700;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  vertical-align: top;
  padding: 14px 10px;
  border-bottom: 1px solid #eadfcb;
}

.messages {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.message {
  padding: 12px 14px;
  border-radius: 12px;
}

.message.success {
  background: var(--success);
}

.message.error {
  background: var(--error);
}

.message.info {
  background: var(--info);
}

.offer {
  padding: 14px 0;
  border-bottom: 1px solid #eadfcb;
}

.offer:last-child {
  border-bottom: none;
}

.my-extra-duty { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.my-extra-duty p { margin: 7px 0; }
.my-extra-duty form { flex: 0 0 auto; }

.extra-duty-list { padding-block: 18px; }
.extra-duty-list h2 { display: flex; align-items: center; gap: 8px; }
.compact-decision { border-top: 1px solid #eadfcb; }
.decision-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; }
.decision-row p { margin: 0; }
.decision-row .inline-form { flex-wrap: nowrap; }
.compact-decision .inline-form button { width: auto; padding: 8px 12px; }

@media (max-width: 700px) {
  .decision-row { align-items: flex-start; flex-direction: column; }
}

.muted,
small {
  color: var(--muted);
}

.status {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 0.78rem;
  background: var(--info);
}

.status.approved { background: var(--success); }
.status.rejected { background: var(--error); }

.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}

.start-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; margin-bottom: 18px; }
.start-link { display: grid; place-items: center; min-height: 100%; color: var(--accent); font-weight: 800; }
.swap-summary { display: grid; grid-template-columns: 1.5fr 1.2fr auto; align-items: center; gap: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; margin-top: 10px; }
.swap-summary summary { display: contents; cursor: pointer; }
.swap-summary.has-counter-offer { background: #fff0e8; border: 2px solid var(--accent); }
.swap-summary a { color: var(--accent); font-weight: 800; }
.start-responses { grid-column: 1 / -1; }

.statistics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.statistics-grid article {
  display: grid;
  gap: 4px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fcf7ef;
}

.statistics-grid strong { font-size: 2rem; color: var(--accent-2); }
.statistics-grid span { color: var(--muted); font-size: 0.86rem; }
.table-wrap { overflow-x: auto; }

.calendar-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.calendar-weekdays {
  margin-top: 18px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  text-align: center;
}

.calendar-day {
  min-height: 118px;
  margin: 3px;
  padding: 10px;
  border: 1px solid #eadfcb;
  border-radius: 12px;
  background: #fcf7ef;
  text-align: left;
  color: var(--muted);
}

button.calendar-day { color: var(--ink); background: #fffaf3; }
button.calendar-day:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.calendar-day.duty { display: grid; align-content: start; gap: 5px; }
.calendar-day.duty.day { border-left: 5px solid var(--accent-2); }
.calendar-day.duty.night { border-left: 5px solid #293b68; background: #edf0f8; }
.calendar-day.free { opacity: 0.8; border-style: dashed; }
button.calendar-day.free:hover { opacity: 1; }
.calendar-day.blank { border-color: transparent; background: transparent; }
.calendar-day.today { outline: 2px solid var(--accent); outline-offset: -2px; }
.day-number { font-size: 1.1rem; font-weight: 800; }
.badge { width: fit-content; padding: 3px 7px; border-radius: 999px; background: var(--error); font-size: 0.72rem; }
.swap-badge { background: #f5c65b; color: #28312d; font-weight: 800; }
.takeover-badge { background: #bde5ca; color: #17412b; font-weight: 800; }
.absence-badge { background: #f6c3bb; color: #6d2018; font-weight: 800; }
.own-extra-badge { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 800; }
.own-extra-badge.registered, .own-extra-badge.pending { background: #f5c65b; color: #28312d; }
.own-extra-badge.approved { background: #bde5ca; color: #17412b; }
.own-extra-badge.rejected { background: #f6c3bb; color: #6d2018; }
.extra-badge { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: #a8dadc; color: #12363a; font-weight: 800; }
.own-swap-badge { background: var(--accent); color: white; font-weight: 800; }
.link-button { width: auto; padding: 4px 7px; background: transparent; color: var(--accent); text-decoration: underline; }
.response-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 7px 0; border-top: 1px solid #eadfcb; }
.response-row p { margin: 0; }
.status.accepted { background: var(--success); }

.month-nav { display: flex; align-items: center; gap: 10px; }
.month-nav p { margin: 0; }
.month-nav a { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--ink); color: white; text-decoration: none; font-size: 1.3rem; }

.swap-offer { border-bottom: 1px solid #eadfcb; }
.swap-offer summary { cursor: pointer; padding: 14px 0; }
.swap-offer summary span { color: var(--muted); font-size: 0.9rem; }
.swap-offer .offer { border-bottom: 0; padding-top: 0; }

.secondary-button { background: var(--accent-2); }
.counter-selection { padding: 10px 12px; border: 1px dashed var(--line); border-radius: 10px; color: var(--muted); font-weight: 700; }
.counter-selection.is-selected { border: 2px solid var(--accent-2); background: #e0f1f1; color: #12363a; }
.counter-calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; margin-top: 10px; }
.modal-month-nav { justify-content: flex-start; margin-top: 4px; }
.counter-calendar-day { min-height: 80px; padding: 8px; border: 1px solid #eadfcb; border-radius: 10px; background: #fcf7ef; color: var(--muted); }
button.counter-calendar-day { display: grid; align-content: start; gap: 3px; color: var(--ink); background: #fffaf3; text-align: left; }
button.counter-calendar-day.day { border-left: 4px solid var(--accent-2); }
button.counter-calendar-day.night { border-left: 4px solid #293b68; background: #edf0f8; }
button.counter-calendar-day:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

.shift-dialog {
  width: min(760px, calc(100% - 28px));
  border: none;
  border-radius: 20px;
  padding: 24px;
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 28px 80px rgba(18, 31, 30, 0.35);
}

.shift-dialog::backdrop { background: rgba(17, 35, 34, 0.54); }
.dialog-header { display: flex; justify-content: space-between; gap: 12px; }
.close-dialog { width: 42px; height: 42px; padding: 0; font-size: 1.7rem; background: var(--ink); }
.dialog-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; margin-top: 18px; }
.option-card { display: grid; gap: 10px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; }
.option-card h3 { margin: 0; }
.option-card p { margin-bottom: 0; color: var(--muted); }

.login-card {
  max-width: 460px;
  margin: 10vh auto 0;
}

/* Berlin Feuerwehr presentation design: flat white panels, red action colour, blue structure. */
.topbar {
  min-height: 120px;
  padding: 96px 0 18px;
  border-bottom: 1px solid var(--line);
  position: relative;
}

.topbar::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 72px;
  height: 5px;
  background: var(--accent);
}

.brand-lockup { display: flex; align-items: center; gap: 20px; }
.bfw-logo { display: block; width: 176px; height: auto; }

.function-bar {
  position: fixed;
  z-index: 1000;
  top: 7px;
  left: 0;
  width: 100%;
  min-height: 58px;
  padding: 0 max(16px, calc((100% - 1180px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: #fff;
  border-bottom: 3px solid var(--accent);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.12);
}

.function-user {
  color: var(--accent-2-dark);
  font-size: 0.88rem;
  font-weight: 800;
  white-space: nowrap;
}

.function-links {
  display: flex;
  align-items: stretch;
  align-self: stretch;
}

.function-bar a {
  display: grid;
  place-items: center;
  min-width: 94px;
  padding: 0 14px;
  color: var(--accent-2-dark);
  text-decoration: none;
  font-weight: 800;
  border-left: 1px solid var(--line);
}

.function-bar a:hover,
.function-bar a:focus-visible {
  color: #fff;
  background: var(--accent-2);
  text-decoration: none;
}

.function-bar a.current,
.function-bar a.current:visited {
  color: #fff;
  background: var(--accent-2);
}

.function-bar .logout-link { color: var(--accent); }
.function-bar .logout-link:hover,
.function-bar .logout-link:focus-visible { color: #fff; background: var(--accent); }

h1 {
  max-width: 720px;
  margin-bottom: 0;
  font-size: clamp(1.8rem, 3vw, 2.75rem);
  line-height: 1;
  letter-spacing: -0.035em;
}

h2, h3 { letter-spacing: -0.015em; }

.eyebrow { color: var(--accent-2); font-weight: 800; letter-spacing: 0.14em; }

.card {
  border: 1px solid var(--line);
  border-radius: 0;
  box-shadow: var(--shadow);
}

.hero .card:first-child { border-top: 5px solid var(--accent); }
.hero .card:last-child { border-top: 5px solid var(--accent-2); }

.account-assignment dl {
  display: grid;
  grid-template-columns: minmax(100px, 0.4fr) 1fr;
  gap: 8px 14px;
  margin: 0;
}

.account-assignment dt { color: var(--muted); font-weight: 800; }
.account-assignment dd { margin: 0; font-weight: 700; }

.legal-page { max-width: 880px; margin: 28px auto; }
.legal-page h3 { margin-top: 28px; }
.legal-notice { padding: 12px 14px; border-left: 4px solid var(--accent); background: #fff0f2; font-weight: 700; }

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 24px max(16px, calc((100% - 1180px) / 2));
  border-top: 3px solid var(--accent);
  background: #fff;
  color: var(--muted);
  font-size: 0.86rem;
}

.site-footer div,
.site-footer nav { display: flex; flex-wrap: wrap; gap: 12px; }
.site-footer a { color: var(--accent-2-dark); font-weight: 800; }

.userbar:not(.function-bar) a:hover,
.userbar:not(.function-bar) a:focus-visible {
  color: var(--accent-2);
  text-decoration: underline;
  text-underline-offset: 4px;
}

input, select, button { border-radius: 0; }

input:focus, select:focus {
  outline: 3px solid rgba(0, 79, 159, 0.2);
  border-color: var(--accent-2);
}

button { background: var(--accent); letter-spacing: 0.01em; }
button:hover, button:focus-visible { background: var(--accent-dark); }
.secondary-button, .month-nav a, .close-dialog { background: var(--accent-2); }
.secondary-button:hover, .month-nav a:hover, .close-dialog:hover { background: var(--accent-2-dark); }

.message { border-radius: 0; border-left: 5px solid var(--accent-2); }
.status, .badge { border-radius: 0; }

.calendar-day {
  border-color: var(--line);
  border-radius: 0;
  background: #fff;
}

button.calendar-day { background: #fff; }
.calendar-day.duty.day { border-left: 1px solid var(--line); border-top: 5px solid var(--accent-2); }
.calendar-day.duty.night { border-left: 1px solid var(--line); border-top: 5px solid var(--accent-2-dark); background: #f0f4f8; }
.calendar-day.school-holiday { background: #e4f3ff; }
.calendar-day.saturday { background: #ffe7eb; }
.calendar-day.sunday,
button.calendar-day.sunday { background: var(--accent); border-color: var(--accent); color: #fff; }
.calendar-day.sunday.free { opacity: 1; border-style: solid; }
.calendar-day.sunday small { color: #fff; }
.calendar-day.today { outline: 3px solid var(--accent); outline-offset: -3px; }

.month-nav a { border-radius: 0; }
.counter-selection, .counter-calendar-day, .option-card { border-radius: 0; }
.counter-selection.is-selected { background: #e7f0f8; color: var(--accent-2-dark); }
.counter-calendar-day { border-color: var(--line); background: #fff; }
button.counter-calendar-day { background: #fff; }
button.counter-calendar-day.day { border-left: 1px solid var(--line); border-top: 4px solid var(--accent-2); }
button.counter-calendar-day.night { border-left: 1px solid var(--line); border-top: 4px solid var(--accent-2-dark); background: #f0f4f8; }

.shift-dialog {
  border-radius: 0;
  border-top: 7px solid var(--accent);
  box-shadow: 0 28px 80px rgba(0, 40, 86, 0.35);
}

.shift-dialog::backdrop { background: rgba(0, 40, 86, 0.6); }

@media (max-width: 720px) {
  .topbar {
    align-items: start;
    flex-direction: column;
    padding-top: 150px;
  }

  .brand-lockup { align-items: flex-start; gap: 12px; }
  .bfw-logo { width: 112px; margin-top: 3px; }

  .function-bar {
    min-height: 72px;
    align-items: flex-start;
    flex-direction: column;
    gap: 0;
    padding: 7px 16px 0;
  }

  .function-user { font-size: 0.72rem; }
  .function-links { width: 100%; }
  .function-bar a { min-width: 0; flex: 1; padding: 9px 4px; font-size: 0.72rem; }
  .site-footer { flex-direction: column; }

  table,
  thead,
  tbody,
  th,
  td,
  tr {
    display: block;
  }

  thead {
    display: none;
  }

  td {
    padding: 10px 0;
  }

  .calendar-day { min-height: 78px; padding: 7px; }
  .calendar-day small, .badge { display: none; }
  .calendar-weekdays { font-size: 0.7rem; }
}
