/* Colours and font follow the SchweigAIR booking system (reservierung.schweigair.de). */
:root {
  --ink: #464d53;
  --muted: #696969;
  --line: #dee2e6;
  --grid-line: #a6a6a6;
  --paper: #ffffff;
  --soft: #f8f9fa;
  --nav: #1c4257;
  --nav-2: #36648b;
  --teal: #36648b;
  --teal-dark: #284c6b;
  --today: #5199d1;
  --reserved: #408ad2;
  --pending: #f2dfbf;
  --amber: #c58b1b;
  --danger: #b44242;
  --white: #ffffff;
  --shadow: 0 10px 30px rgba(24, 33, 47, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: Hind, system-ui, -apple-system, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--paper);
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button,
a.secondary-button {
  min-height: 40px;
}

button {
  cursor: pointer;
}

.app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex: 0 0 268px;
  flex-direction: column;
  gap: 24px;
  height: 100vh;
  padding: 22px 18px;
  background: var(--nav);
  color: var(--white);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  background: #f2b94b;
  color: #15243a;
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

.brand span,
.profile-box small {
  color: rgba(255, 255, 255, 0.68);
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  width: 100%;
  border: 0;
  border-radius: 8px;
  padding: 12px 14px;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  text-align: left;
}

.nav-item:hover,
.nav-item.is-active {
  background: rgba(255, 255, 255, 0.12);
  color: var(--white);
}

.profile-box {
  display: grid;
  gap: 8px;
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
}

.profile-box span {
  font-weight: 700;
}

.main {
  flex: 1;
  min-width: 0;
}

.auth-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(90deg, rgba(40, 125, 117, 0.08), transparent 45%),
    var(--paper);
}

.auth-panel,
.panel,
.modal-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.auth-panel {
  display: grid;
  width: min(420px, 100%);
  gap: 16px;
  padding: 28px;
}

.auth-panel h1,
.page-header h1,
.panel h2 {
  margin: 0;
  line-height: 1.1;
}

.auth-panel h1 {
  font-size: 30px;
}

.workspace {
  padding: 28px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.page-header h1 {
  font-size: 28px;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.week-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px 8px;
  background: var(--white);
}

.week-picker span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.week-picker input {
  width: 150px;
  border: 0;
  padding: 4px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

label {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-weight: 650;
}

label span,
legend {
  font-size: 13px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  background: var(--white);
  color: var(--ink);
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(40, 125, 117, 0.18);
  border-color: var(--teal);
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-button,
.mini-button,
.icon-button,
a.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 9px 13px;
  text-decoration: none;
  white-space: nowrap;
}

.primary-button {
  background: var(--teal);
  color: var(--white);
}

.primary-button:hover {
  background: var(--teal-dark);
}

.secondary-button,
a.secondary-button {
  border-color: var(--line);
  background: var(--soft);
  color: var(--ink);
}

.ghost-button {
  border-color: var(--line);
  background: var(--white);
  color: var(--ink);
}

.danger-button {
  border-color: rgba(180, 66, 66, 0.22);
  background: #fff1ef;
  color: var(--danger);
}

.mini-button,
.icon-button {
  min-height: 30px;
  padding: 5px 9px;
  border-color: var(--line);
  background: var(--white);
  color: var(--ink);
}

.icon-button {
  width: 34px;
  padding: 0;
}

.full {
  width: 100%;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(320px, 1.1fr);
  gap: 16px;
}

.panel {
  min-width: 0;
  padding: 18px;
}

.focus-panel {
  background: #f8faf6;
  border-color: #c9d8d4;
}

.wide-panel {
  grid-column: 1 / -1;
}

.big-date {
  margin: 14px 0 8px;
  color: var(--teal-dark);
  font-size: 24px;
  font-weight: 800;
}

.list-stack {
  display: grid;
  gap: 10px;
}

.booking-card {
  display: grid;
  width: 100%;
  gap: 4px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--teal);
  border-radius: 8px;
  padding: 11px;
  background: var(--white);
  color: var(--ink);
  text-align: left;
}

.booking-card:hover {
  border-color: #b9c8c3;
  box-shadow: 0 8px 20px rgba(24, 33, 47, 0.08);
}

.booking-card span,
.booking-card small,
td small {
  display: block;
  color: var(--muted);
}

.booking-card em {
  width: fit-content;
  border-radius: 8px;
  padding: 2px 7px;
  background: #e7f3f0;
  color: var(--teal-dark);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.booking-card.is-confirmed {
  border-left-color: var(--teal);
}

.booking-card.is-pending {
  border-left-color: #c58b1b;
  background: #fffaf0;
}

.booking-card.is-pending em {
  background: #fff4df;
  color: #8a5b10;
}

.booking-card.is-blocked {
  border-left-color: #94615f;
  background: #fff7f6;
}

.booking-card.is-blocked em {
  background: #f7e5e2;
  color: #7d4440;
}

.booking-card.compact {
  min-height: 78px;
}

.request-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 11px 9px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.calendar-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 16px;
}

.calendar-panel {
  overflow: hidden;
}

.subbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.filter-row {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.filter-row > span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.calendar-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--reserved);
}

.legend-dot.is-pending {
  background: var(--pending);
  box-shadow: inset 0 0 0 1px #c9a86a;
}

.legend-dot.is-blocked {
  background: #94615f;
}

.check-row,
.check-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.check-stack {
  display: grid;
}

.check-list {
  display: grid;
  gap: 8px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.check-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: auto;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  background: #fdfefb;
  font-weight: 650;
}

.check-pill input {
  width: auto;
}

.check-pill small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.check-pill.is-disabled {
  opacity: 0.62;
}

.booking-matrix-scroll {
  width: 100%;
  overflow-x: auto;
  padding-bottom: 2px;
}

.booking-matrix {
  display: grid;
  min-width: 1160px;
  grid-template-columns: minmax(190px, 230px) repeat(7, minmax(138px, 1fr));
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
  overflow: clip;
}

.matrix-corner,
.matrix-day-header,
.matrix-resource,
.matrix-cell {
  min-width: 0;
  background: var(--white);
}

.matrix-corner,
.matrix-day-header {
  position: sticky;
  top: 0;
  z-index: 3;
  min-height: 46px;
  padding: 12px 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.matrix-corner,
.matrix-resource {
  position: sticky;
  left: 0;
  z-index: 4;
  border-right: 1px solid var(--line);
}

.matrix-corner {
  z-index: 5;
  background: #36648b;
  color: #f0f0f0;
}

.matrix-day-header {
  border-left: 1px solid var(--grid-line);
  background: #36648b;
  color: #f0f0f0;
}

.matrix-day-header.is-today {
  background: var(--today);
  color: #ffffff;
}

.matrix-resource {
  display: grid;
  align-content: start;
  gap: 4px;
  min-height: 108px;
  padding: 12px;
  border-top: 1px solid var(--grid-line);
  border-left: 6px solid var(--resource-color, var(--reserved));
  background: #ededed;
}

.matrix-resource strong,
.calendar-booking strong {
  overflow-wrap: anywhere;
}

.matrix-resource small,
.calendar-booking small {
  color: var(--muted);
}

.matrix-cell {
  display: grid;
  align-content: start;
  gap: 7px;
  min-height: 108px;
  border-left: 1px solid var(--grid-line);
  border-top: 1px solid var(--grid-line);
  padding: 8px;
}

.matrix-cell.is-empty {
  padding: 6px;
  background: #ffffff;
}

.empty-cell-button {
  display: grid;
  width: 100%;
  height: 100%;
  min-height: 108px;
  place-items: center;
  min-height: 96px;
  border: 1px dashed #585754;
  border-radius: 4px;
  background: #ffffff;
  color: #585754;
  font-size: 12px;
  font-weight: 600;
}

.empty-cell-button:hover {
  background: #eef4fa;
  color: var(--teal-dark);
}

.calendar-booking {
  display: grid;
  width: 100%;
  gap: 2px;
  border: 1px solid #ffffff;
  border-radius: 4px;
  padding: 8px;
  background: var(--resource-stripes, var(--resource-color, var(--reserved)));
  color: var(--resource-text, #ffffff);
  text-align: left;
}

/* Stripes in light and dark colours: white text with a shadow stays readable on both. */
.calendar-booking.has-mixed-colors {
  text-shadow: 0 0 3px rgba(0, 0, 0, 0.85), 0 1px 1px rgba(0, 0, 0, 0.6);
}

.calendar-booking small {
  color: inherit;
  opacity: 0.85;
}

.calendar-booking:hover {
  box-shadow: 0 0 0 2px #79bf40;
}

.calendar-booking-time {
  color: inherit;
  font-size: 12px;
  font-weight: 700;
}

.calendar-booking.is-pending {
  border: 1px dashed #c9a86a;
  background: var(--pending);
  color: #5f4b26;
}

.calendar-booking.is-pending .calendar-booking-time {
  color: #8a5b10;
}

.calendar-booking.is-blocked {
  border-color: #deb8b2;
  background: #cf9d9b;
  color: #3f2322;
}

.calendar-booking.is-blocked .calendar-booking-time {
  color: inherit;
}

.matrix-empty-state {
  grid-column: 1 / -1;
  padding: 28px;
  background: var(--white);
  color: var(--muted);
}

.availability-panel {
  position: sticky;
  top: 28px;
  align-self: start;
  display: grid;
  gap: 12px;
}

.slot-list {
  display: grid;
  max-height: 520px;
  gap: 8px;
  overflow: auto;
}

.slot-button {
  display: grid;
  gap: 3px;
  border: 1px solid #c7d8d3;
  border-radius: 8px;
  padding: 10px;
  background: #f5fbf8;
  color: var(--ink);
  text-align: left;
}

.slot-button span {
  color: var(--teal-dark);
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 16px;
}

.edit-panel {
  display: grid;
  align-content: start;
  gap: 13px;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toggle-row input {
  width: auto;
}

.resource-subtitle {
  margin-top: 20px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-error {
  margin: 0;
  border: 1px solid rgba(180, 66, 66, 0.2);
  border-radius: 8px;
  padding: 9px 10px;
  background: #fff1ef;
  color: var(--danger);
}

.empty {
  margin: 0;
  color: var(--muted);
}

.empty.small {
  font-size: 13px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  max-width: min(380px, calc(100vw - 32px));
  border: 1px solid #c7d8d3;
  border-radius: 8px;
  padding: 12px 14px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.toast.error {
  border-color: rgba(180, 66, 66, 0.3);
  color: var(--danger);
}

.modal {
  width: min(720px, calc(100vw - 28px));
  border: 0;
  padding: 0;
  background: transparent;
}

.modal::backdrop {
  background: rgba(24, 33, 47, 0.48);
}

.modal-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.modal-panel header,
.modal-panel footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.modal-panel h2 {
  margin: 0;
}

.bzf-view.is-active {
  display: grid;
}

.bzf-frame-shell {
  height: calc(100vh - 128px);
  min-height: 620px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--white);
}

.bzf-frame-shell iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

[hidden] {
  display: none !important;
}

@media (max-width: 1120px) {
  .calendar-layout,
  .split-layout,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .availability-panel {
    position: static;
  }
}

@media (max-width: 760px) {
  .app {
    display: block;
  }

  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    padding: 14px;
  }

  .brand {
    margin-bottom: 4px;
  }

  .nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .nav-item {
    min-height: 42px;
    text-align: center;
  }

  .profile-box {
    margin-top: 8px;
  }

  .workspace {
    padding: 16px;
  }

  .page-header,
  .modal-panel header,
  .modal-panel footer {
    align-items: stretch;
    flex-direction: column;
  }

  .header-actions {
    justify-content: flex-start;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .booking-matrix {
    min-width: 1040px;
    grid-template-columns: minmax(160px, 190px) repeat(7, minmax(120px, 1fr));
  }

  .bzf-frame-shell {
    height: 72vh;
    min-height: 520px;
  }
}

.cell-add-button {
  width: 100%;
  border: 1px dashed #b8d2cc;
  border-radius: 8px;
  padding: 6px 8px;
  background: transparent;
  color: #6f7b77;
  font-size: 12px;
  font-weight: 750;
}

.cell-add-button:hover {
  background: #edf6f2;
  border-style: solid;
  color: var(--teal-dark);
}

.color-row input[type="color"] {
  width: 64px;
  height: 36px;
  padding: 2px;
}

.color-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 8px;
  border-radius: 3px;
  vertical-align: -1px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15);
}

/* Week navigation as on reservierung.schweigair.de */
.calendar-nav {
  display: grid;
  justify-items: center;
  gap: 8px;
  margin: 0 0 16px;
}

.calendar-nav-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.calendar-nav-icon {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #696969;
  cursor: pointer;
}

.calendar-nav-icon svg {
  width: 22px;
  height: 22px;
}

.calendar-nav-toggle {
  color: #585754;
}

.calendar-nav-toggle[aria-expanded="true"] {
  color: var(--teal);
}

.calendar-nav-icon:hover,
.calendar-nav-icon:focus-visible {
  color: var(--teal);
}

.calendar-nav-range {
  min-width: 210px;
  color: var(--ink);
  font-size: 20px;
  text-align: center;
}

.mini-calendars {
  display: grid;
  grid-template-columns: repeat(3, minmax(210px, 1fr));
  width: 100%;
  max-width: 900px;
  border: 1px solid #e3e3e3;
}

.mini-month + .mini-month {
  border-left: 1px solid #e3e3e3;
}

.mini-month-title {
  display: grid;
  grid-template-columns: 28px 1fr 28px;
  align-items: center;
  padding: 6px 4px;
  min-height: 36px;
  background: #696969;
  color: #ffffff;
  text-align: center;
}

.mini-month-title strong {
  font-size: 16px;
}

.mini-month-title strong span {
  font-weight: 400;
}

.mini-month-shift {
  border: 0;
  background: transparent;
  color: #ffffff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.mini-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: #696969;
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.mini-weekdays span {
  padding: 2px 0 6px;
}

.mini-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  padding: 6px;
}

.mini-day {
  justify-self: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  cursor: pointer;
}

.mini-day:hover {
  background: #eef4fa;
}

.mini-day.is-week {
  background: #e7eef5;
}

.mini-day.is-week-start {
  background: #696969;
  color: #ffffff;
}

.mini-day.is-today {
  border-color: #464d53;
}

@media (max-width: 760px) {
  .mini-calendars {
    grid-template-columns: 1fr;
  }

  .mini-month + .mini-month {
    border-left: 0;
    border-top: 1px solid #e3e3e3;
  }

  .calendar-nav-range {
    min-width: 0;
    font-size: 17px;
  }
}

/* Offline mode of the installed app */
.offline-banner { margin: 0 0 16px; padding: 10px 14px; border-radius: 6px; background: #fff4d6; color: #6b4e00; font-size: 14px; line-height: 1.4; }
.is-offline .nav-item[data-online-only] { opacity: .45; }
.offline-placeholder h2 { margin-top: 0; }
.check-row { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.check-row input { width: auto; }

/* Bookings made offline that are not uploaded yet */
.calendar-booking.is-unsynced, .booking-card.is-unsynced { outline: 2px dashed #b07d00; outline-offset: -2px; opacity: .85; }
.calendar-booking.is-unsynced-conflict, .booking-card.is-unsynced-conflict { outline: 2px dashed #b3261e; outline-offset: -2px; }
.calendar-offline-note { margin-bottom: 12px; }

/* Signed-in devices of a user */
.device-list { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line, #d9e1e7); }
.device-list h3 { margin: 0 0 8px; font-size: 15px; }
.device-list ul { list-style: none; margin: 0 0 8px; padding: 0; }
.device-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line, #d9e1e7); }
.device-list li span { display: grid; gap: 2px; }
.device-list small { color: var(--muted, #5f6f7d); }

/* Self-registration */
.auth-switch { margin: 0; font-size: 14px; color: var(--muted, #5f6f7d); }
.auth-hint { margin: 0; font-size: 14px; line-height: 1.5; color: var(--muted, #5f6f7d); }
.auth-panel label small { display: block; margin-top: 4px; font-size: 12px; color: var(--muted, #5f6f7d); }
.link-button { padding: 0; border: 0; background: none; color: var(--primary, #146c75); font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }
.form-note { margin: 0; border: 1px solid rgba(20, 108, 117, 0.25); border-radius: 8px; padding: 9px 10px; background: #eaf5f4; color: var(--primary, #146c75); }
.hp-field { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.nav-badge { display: inline-block; min-width: 20px; margin-left: 6px; padding: 1px 6px; border-radius: 10px; background: var(--danger, #b44242); color: #fff; font-size: 12px; font-weight: 700; text-align: center; }
.user-lists { display: grid; gap: 18px; align-content: start; }
.pending-panel { padding: 18px; border-color: rgba(180, 66, 66, 0.35); }
.pending-panel h2 { margin: 0 0 6px; font-size: 18px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.mini-button.danger { color: var(--danger, #b44242); border-color: rgba(180, 66, 66, 0.4); }
