:root {
  color-scheme: light;
  --bg: #f7f4ef;
  --surface: #ffffff;
  --surface-soft: #f1ebe3;
  --line: #e2d9cf;
  --line-strong: #cdbfaf;
  --text: #1f2933;
  --muted: #6f6258;
  --green: #0f766e;
  --green-strong: #0a4f4a;
  --green-soft: #dff3ef;
  --amber: #a86435;
  --amber-soft: #f8eadf;
  --red: #dc2626;
  --red-soft: #fee2e2;
  --blue: #35698f;
  --blue-soft: #e1edf5;
  --shadow: 0 18px 50px rgba(80, 62, 44, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(180deg, rgba(8, 11, 13, 0.5), rgba(8, 11, 13, 0.72)),
    url("assets/dark-church-bg.svg") center / cover fixed no-repeat,
    var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  line-height: 1.45;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px clamp(16px, 4vw, 42px);
  background: rgba(255, 255, 255, 0.88);
  border-bottom: 1px solid rgba(255, 255, 255, 0.46);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

.brand-mark {
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #000 url("assets/ceh-logo-circle.jpg") center / cover no-repeat;
  box-shadow: 0 8px 18px rgba(29, 36, 32, 0.15);
}

.brand h1 {
  margin: 0;
  overflow: hidden;
  font-size: 18px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.container {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 22px clamp(14px, 4vw, 42px) 46px;
}

.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 22px;
}

.auth-panel {
  display: grid;
  grid-template-columns: minmax(280px, 0.85fr) minmax(300px, 1fr);
  width: min(980px, 100%);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-side {
  min-height: 520px;
  padding: 32px;
  background:
    linear-gradient(135deg, rgba(8, 11, 13, 0.78), rgba(15, 118, 110, 0.52)),
    url("assets/dark-church-bg.svg") center / cover no-repeat;
  background-position: center;
  background-size: cover;
  color: #fff;
}

.auth-logo {
  display: block;
  width: 118px;
  height: 118px;
  margin: 0 0 22px;
  border: 3px solid rgba(255, 255, 255, 0.82);
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.2);
}

.auth-side h1 {
  margin: 0 0 14px;
  font-size: clamp(30px, 5vw, 50px);
  line-height: 1.02;
  letter-spacing: 0;
}

.auth-side p {
  max-width: 420px;
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 16px;
}

.auth-card {
  padding: 30px;
}

.auth-tabs,
.tabs,
.month-controls,
.calendar-actions,
.inline-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.calendar-actions {
  justify-content: flex-end;
}

.auth-tabs {
  margin-bottom: 22px;
}

.tab-button,
.icon-button,
.ghost-button,
.primary-button,
.danger-button,
.soft-button {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 9px 13px;
  background: transparent;
  color: var(--text);
  font-weight: 700;
  white-space: nowrap;
}

.tab-button {
  border-color: var(--line);
  background: #fff;
}

.tab-button[aria-selected="true"] {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.icon-button {
  width: 40px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border-color: var(--line);
  background: #fff;
  font-size: 20px;
  line-height: 1;
}

.ghost-button {
  border-color: var(--line);
  background: #fff;
}

.primary-button {
  background: var(--green);
  color: #fff;
}

a.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.primary-button:hover,
.primary-button:focus-visible {
  background: var(--green-strong);
}

.danger-button {
  background: var(--red);
  color: #fff;
}

.soft-button {
  border-color: var(--line);
  background: var(--surface-soft);
}

.full-button {
  width: 100%;
}

.form-grid {
  display: grid;
  gap: 14px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.compact-field {
  max-width: 360px;
}

.permission-field {
  flex: 1 1 170px;
  min-width: 160px;
  max-width: 230px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 10px 12px;
  outline: none;
}

textarea {
  min-height: 94px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.16);
}

.hint,
.empty {
  color: var(--muted);
  font-size: 13px;
}

.booking-warning {
  border: 1px solid rgba(168, 100, 53, 0.38);
  border-radius: 8px;
  background: var(--amber-soft);
  color: #7c3f1f;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.4;
}

.booking-warning.is-blocking {
  border-color: rgba(220, 38, 38, 0.36);
  background: var(--red-soft);
  color: var(--red);
}

.booking-warning.is-hidden {
  display: none;
}

.is-hidden {
  display: none !important;
}

.form-note {
  align-self: end;
  min-height: 42px;
  display: flex;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.form-feedback {
  border: 1px solid var(--amber);
  border-radius: 8px;
  background: var(--amber-soft);
  color: var(--amber);
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 800;
}

.page-grid {
  display: grid;
  gap: 18px;
}

.nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.tabs {
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.tabs .tab-button {
  border-color: transparent;
}

.tabs .tab-button[aria-selected="true"] {
  background: var(--text);
  border-color: var(--text);
}

.tab-button.has-alert {
  border-color: var(--red);
  background: var(--red-soft);
  color: var(--red);
  animation: requestPulse 1.6s ease-in-out infinite;
}

.tabs .tab-button.has-alert[aria-selected="true"] {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

.calendar-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  align-items: start;
}

.booking-panel {
  width: min(760px, 100%);
}

.panel {
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.panel-inner {
  padding: 18px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.print-week {
  display: none;
}

.panel-title {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
}

.availability-date {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  min-height: 30px;
  border: 2px solid var(--green);
  border-radius: 8px;
  background: var(--green-soft);
  color: var(--green-strong);
  padding: 3px 9px;
  font-size: 21px;
  font-weight: 950;
  line-height: 1;
  white-space: nowrap;
}

.availability-date:hover,
.availability-date:focus-visible {
  background: #fff;
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.14);
}

.panel-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.month-title {
  min-width: 170px;
  text-align: center;
  font-weight: 800;
  text-transform: capitalize;
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.weekday {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.day-button,
.day-blank {
  min-height: 92px;
  border-radius: 8px;
}

.day-button {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: space-between;
  gap: 6px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 8px;
  color: var(--text);
  text-align: left;
}

.day-button:hover,
.day-button:focus-visible {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.day-button.is-selected {
  border: 3px solid var(--green);
  background: linear-gradient(180deg, #fff, var(--green-soft));
  padding: 6px;
  box-shadow:
    0 0 0 4px rgba(15, 118, 110, 0.18),
    inset 0 0 0 1px rgba(255, 255, 255, 0.82);
}

.day-number {
  font-weight: 850;
}

.day-indicators {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px;
  min-height: 20px;
}

.bus-day-icon,
.trailer-day-icon {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 18px;
  border-radius: 5px;
  background: #273038;
  color: #fff;
  font-size: 14px;
  line-height: 1;
}

.bus-day-icon-symbol,
.trailer-day-icon-symbol {
  display: block;
  filter: grayscale(1) brightness(0) invert(1);
}

.trailer-day-icon-symbol {
  font-size: 18px;
  line-height: 0.75;
}

.service-day-icon {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 5px;
  background: var(--green-strong);
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
}

.day-badge {
  display: inline-grid;
  place-items: center;
  justify-self: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  padding: 0;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.15;
  text-align: center;
}

.day-badge.has-text {
  width: auto;
  min-width: 0;
  height: auto;
  border-radius: 6px;
  padding: 3px 5px;
  overflow-wrap: anywhere;
}

.day-free .day-badge {
  background: var(--green);
}

.day-partial .day-badge {
  border: 1px solid rgba(29, 36, 32, 0.14);
  background: linear-gradient(90deg, var(--green) 0 50%, var(--red) 50% 100%);
}

.day-busy .day-badge {
  background: var(--red);
}

.day-pending .day-badge.has-text {
  background: var(--amber-soft);
  color: var(--amber);
}

.day-mine .day-badge.has-text {
  background: #fff7ed;
  color: #9a3412;
  border: 1px solid rgba(154, 52, 18, 0.22);
}

.availability-panel {
  grid-column: 1 / -1;
}

.availability-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.service-day-summary {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  border-left: 5px solid var(--green);
  border-radius: 8px;
  background: var(--green-soft);
  padding: 14px;
}

.service-day-summary-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.service-day-summary-head span,
.service-day-summary p {
  color: var(--muted);
  font-size: 13px;
}

.service-day-summary p {
  margin: 0;
}

.service-day-assignments {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.service-day-assignments span {
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: 6px;
  background: #fff;
  padding: 6px 8px;
  font-size: 12px;
}

.availability-room {
  position: relative;
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--green);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.availability-room.is-selectable {
  cursor: pointer;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease;
}

.availability-room.is-selectable:hover,
.availability-room.is-selectable:focus-visible {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14), var(--shadow);
  transform: translateY(-1px);
}

.availability-room-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.availability-dot {
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  border: 1px solid rgba(29, 36, 32, 0.16);
  border-radius: 50%;
}

.availability-dot.is-free {
  background: var(--green);
}

.availability-dot.is-busy {
  background: var(--red);
}

.availability-dot.is-partial {
  background: linear-gradient(90deg, var(--green) 0 50%, var(--red) 50% 100%);
}

.availability-dot.is-closed {
  background: var(--muted);
}

.availability-room h3,
.availability-section h4 {
  margin: 0;
}

.availability-room h3 {
  color: var(--green-strong);
  font-size: 20px;
  font-weight: 950;
  line-height: 1.15;
}

.availability-room p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.availability-sections {
  display: grid;
  gap: 12px;
}

.availability-section {
  display: grid;
  gap: 8px;
}

.availability-section h4 {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.time-row {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  border-radius: 8px;
  padding: 9px 10px;
  font-size: 13px;
}

.time-row b {
  white-space: nowrap;
}

.time-row span {
  overflow-wrap: anywhere;
}

.mini-action {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  margin-left: 6px;
  border: 1px solid currentColor;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.55);
  color: inherit;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 850;
}

.mini-action.danger-mini {
  color: var(--red);
}

.time-row.approved {
  background: var(--red-soft);
  color: var(--red);
}

.time-row.pending {
  background: var(--amber-soft);
  color: var(--amber);
}

.free-intervals {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.free-intervals span {
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green-strong);
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 850;
}

.badge.approved,
.badge.active {
  background: var(--green-soft);
  color: var(--green-strong);
}

.badge.pending {
  background: var(--amber-soft);
  color: var(--amber);
}

.badge.rejected,
.badge.inactive {
  background: var(--red-soft);
  color: var(--red);
}

.badge.busy {
  background: var(--red-soft);
  color: var(--red);
}

.badge.admin {
  background: var(--blue-soft);
  color: var(--blue);
}

.badge.service {
  background: var(--surface-soft);
  color: var(--text);
}

.request-list,
.card-grid,
.room-grid {
  display: grid;
  gap: 12px;
}

.card-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.service-schedule-page,
.service-schedule-list {
  display: grid;
  gap: 14px;
}

.service-add-form {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 10px;
}

.service-add-form label {
  width: min(280px, 100%);
}

.service-schedule-card .panel-head {
  align-items: center;
}

.service-schedule-date {
  margin: 0;
  font-size: 18px;
}

.service-delete-button {
  color: var(--red);
}

.service-assignment-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.service-schedule-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.room-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.request-card,
.room-card,
.user-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.request-card {
  display: grid;
  gap: 10px;
}

.request-card.is-active-admin-request {
  border-color: var(--red);
  background: linear-gradient(0deg, rgba(254, 226, 226, 0.78), rgba(255, 255, 255, 0.96));
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12), var(--shadow);
  animation: requestPulse 1.6s ease-in-out infinite;
}

.request-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.request-main h3,
.room-card h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.25;
}

.request-meta {
  color: var(--muted);
  font-size: 13px;
}

.reason-box {
  display: grid;
  gap: 4px;
  border: 1px solid var(--amber);
  border-radius: 8px;
  background: var(--amber-soft);
  color: var(--text);
  padding: 10px 12px;
  font-size: 13px;
}

.reason-box b {
  color: var(--amber);
}

.reason-box span {
  overflow-wrap: anywhere;
}

.admin-audit,
.decision-history {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 10px 12px;
  color: var(--text);
  font-size: 13px;
}

.decision-history {
  display: grid;
  gap: 8px;
}

.decision-history > b {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.decision-history-row {
  display: grid;
  gap: 2px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.decision-history-row:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.decision-history-row span {
  font-weight: 850;
}

.decision-history-row small {
  color: var(--muted);
  font-weight: 700;
}

.decision-history-row em {
  color: var(--text);
  font-style: normal;
  overflow-wrap: anywhere;
}

.telegram-note {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 13px;
  font-weight: 750;
  overflow-wrap: anywhere;
}

.telegram-note.sent {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green-strong);
}

.telegram-note.skipped,
.telegram-note.failed {
  border-color: var(--amber);
  background: var(--amber-soft);
  color: var(--amber);
}

.user-table {
  display: grid;
  gap: 8px;
}

.user-row {
  display: grid;
  grid-template-columns: minmax(170px, 1.2fr) minmax(160px, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.user-name {
  font-weight: 850;
}

@keyframes requestPulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.2);
  }

  50% {
    box-shadow: 0 0 0 6px rgba(220, 38, 38, 0.08);
  }
}

@media (prefers-reduced-motion: reduce) {
  .tab-button.has-alert,
  .request-card.is-active-admin-request {
    animation: none;
  }
}

.toast {
  position: fixed;
  right: clamp(12px, 4vw, 28px);
  bottom: 20px;
  z-index: 60;
  max-width: min(460px, calc(100vw - 24px));
  border-radius: 8px;
  background: var(--text);
  color: #fff;
  padding: 13px 15px;
  box-shadow: var(--shadow);
  font-weight: 700;
}

.toast.success {
  border: 1px solid rgba(15, 118, 110, 0.22);
  background: var(--green);
  box-shadow:
    0 0 0 4px rgba(15, 118, 110, 0.18),
    var(--shadow);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(29, 36, 32, 0.42);
}

.modal-card {
  width: min(560px, 100%);
  max-height: min(680px, calc(100vh - 36px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 18px;
}

.date-picker-card {
  width: min(680px, 100%);
}

.date-picker-controls {
  justify-content: space-between;
  margin-bottom: 14px;
}

.date-picker-grid .day-button,
.date-picker-grid .day-blank {
  min-height: 76px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.wait-panel {
  width: min(720px, 100%);
  margin: 42px auto;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  text-align: center;
}

.wait-panel h2 {
  margin: 0 0 8px;
}

.wait-panel p {
  margin: 0 auto 18px;
  max-width: 520px;
  color: var(--muted);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 1050px) {
  .room-grid,
  .availability-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .calendar-layout,
  .auth-panel {
    grid-template-columns: 1fr;
  }

  .service-assignment-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .availability-panel {
    order: 2;
  }

  .booking-panel {
    order: 3;
  }

  .auth-side {
    min-height: 320px;
  }
}

@media (max-width: 720px) {
  body {
    background-attachment: scroll;
  }

  .topbar {
    align-items: flex-start;
  }

  .calendar-panel .panel-head {
    flex-direction: column;
  }

  .calendar-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .calendar-actions > .primary-button {
    width: 100%;
    white-space: normal;
  }

  .brand h1 {
    white-space: normal;
  }

  .form-row,
  .card-grid,
  .room-grid,
  .availability-list,
  .user-row,
  .service-assignment-grid {
    grid-template-columns: 1fr;
  }

  .service-day-summary-head,
  .service-schedule-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .day-button,
  .day-blank {
    min-height: 70px;
  }

  .day-badge {
    width: 16px;
    height: 16px;
    font-size: 10px;
  }

  .day-badge.has-text {
    width: auto;
    height: auto;
  }

  .auth-side,
  .auth-card,
  .panel-inner {
    padding: 18px;
  }

  .time-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  :root {
    --shadow: 0 10px 28px rgba(8, 17, 20, 0.12);
  }

  body {
    line-height: 1.4;
  }

  .topbar {
    position: sticky;
    display: grid;
    grid-template-columns: 1fr;
    align-items: center;
    gap: 7px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
  }

  .brand {
    gap: 9px;
  }

  .brand-mark {
    flex-basis: 34px;
    width: 34px;
    height: 34px;
  }

  .brand h1 {
    font-size: 16px;
    line-height: 1.15;
    white-space: nowrap;
  }

  .brand span {
    display: none;
  }

  .top-actions {
    display: flex;
    width: 100%;
    justify-content: flex-start;
    flex-wrap: nowrap;
    gap: 6px;
  }

  .top-actions .badge {
    min-height: 20px;
    max-width: 190px;
    padding: 2px 7px;
    overflow: hidden;
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .top-actions .ghost-button {
    margin-left: auto;
    min-height: 32px;
    padding: 5px 10px;
    font-size: 12px;
  }

  .container {
    padding: 10px 10px 32px;
  }

  .nav-row {
    display: grid;
    gap: 8px;
    margin-bottom: 10px;
  }

  .tabs {
    display: flex;
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    gap: 4px;
    padding: 4px;
    scrollbar-width: none;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
  }

  .tabs::-webkit-scrollbar {
    display: none;
  }

  .tabs .tab-button {
    flex: 0 0 auto;
    min-height: 38px;
    padding: 7px 11px;
    font-size: 13px;
    scroll-snap-align: start;
  }

  .nav-row > .soft-button {
    justify-self: start;
    min-height: 32px;
    border-color: rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.9);
    padding: 5px 10px;
    font-size: 11px;
  }

  .page-grid,
  .calendar-layout {
    gap: 10px;
  }

  .panel {
    border-radius: 8px;
    box-shadow: var(--shadow);
  }

  .panel-inner,
  .auth-card {
    padding: 14px;
  }

  .panel-head {
    gap: 8px;
    margin-bottom: 12px;
  }

  .panel-title {
    font-size: 17px;
  }

  .panel-subtitle {
    font-size: 12px;
    line-height: 1.35;
  }

  .calendar-panel .panel-head {
    gap: 10px;
  }

  .calendar-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .month-controls {
    width: 100%;
    justify-content: space-between;
    gap: 6px;
  }

  .month-title {
    min-width: 0;
    font-size: 15px;
  }

  .icon-button {
    width: 38px;
    min-height: 38px;
  }

  .calendar-actions > .primary-button {
    min-height: 42px;
    padding: 8px 10px;
    font-size: 13px;
  }

  .month-grid {
    gap: 3px;
  }

  .weekday {
    padding-bottom: 2px;
    font-size: 10px;
  }

  .day-button,
  .day-blank {
    min-height: 60px;
    border-radius: 7px;
  }

  .day-button {
    gap: 2px;
    padding: 5px 4px;
  }

  .day-button.is-selected {
    border-width: 2px;
    padding: 4px 3px;
    box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.2);
  }

  .day-number {
    font-size: 13px;
  }

  .day-indicators {
    align-content: end;
    gap: 2px;
    min-height: 17px;
  }

  .day-badge {
    width: 14px;
    height: 14px;
  }

  .day-badge.has-text {
    max-width: 100%;
    padding: 2px 3px;
    font-size: 8px;
    line-height: 1.05;
  }

  .service-day-icon {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    font-size: 10px;
  }

  .bus-day-icon,
  .trailer-day-icon {
    width: 19px;
    height: 15px;
    border-radius: 4px;
    font-size: 11px;
  }

  .trailer-day-icon-symbol {
    font-size: 14px;
  }

  .availability-panel .panel-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
  }

  .availability-panel .panel-title {
    line-height: 1.45;
  }

  .availability-date {
    min-height: 28px;
    padding: 3px 6px;
    font-size: 17px;
  }

  .availability-panel .ghost-button {
    min-height: 36px;
    padding: 6px 9px;
    font-size: 12px;
  }

  .availability-list {
    gap: 8px;
  }

  .availability-room {
    gap: 10px;
    border-left-width: 4px;
    padding: 12px;
  }

  .availability-room h3 {
    font-size: 17px;
  }

  .availability-sections {
    gap: 9px;
  }

  .availability-section {
    gap: 5px;
  }

  .time-row {
    gap: 3px;
    padding: 8px 9px;
    font-size: 12px;
  }

  .free-intervals span {
    padding: 4px 7px;
    font-size: 11px;
  }

  .service-day-summary {
    gap: 8px;
    margin-bottom: 10px;
    padding: 11px;
  }

  .service-day-assignments {
    display: grid;
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .service-day-assignments span {
    padding: 6px 8px;
    font-size: 11px;
  }

  .booking-panel {
    width: 100%;
  }

  .booking-panel,
  .availability-panel {
    scroll-margin-top: 104px;
  }

  input,
  select,
  textarea {
    min-height: 48px;
    font-size: 16px;
  }

  textarea {
    min-height: 104px;
  }

  label {
    gap: 5px;
    font-size: 12px;
  }

  .form-grid,
  .form-row {
    gap: 11px;
  }

  .form-grid > .primary-button,
  .form-grid > .danger-button,
  .modal-actions .primary-button,
  .modal-actions .danger-button {
    width: 100%;
    min-height: 48px;
  }

  .service-schedule-page,
  .service-schedule-list {
    gap: 10px;
  }

  .service-add-form {
    display: grid;
    gap: 9px;
  }

  .service-add-form label {
    width: 100%;
  }

  .service-add-form .primary-button {
    width: 100%;
    min-height: 48px;
  }

  .service-schedule-card .panel-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .service-schedule-date {
    font-size: 17px;
    line-height: 1.25;
  }

  .service-schedule-footer .primary-button {
    width: 100%;
    min-height: 48px;
  }

  .request-card,
  .room-card,
  .user-row {
    padding: 12px;
  }

  .request-main {
    gap: 8px;
  }

  .request-main h3,
  .room-card h3 {
    font-size: 15px;
  }

  .request-meta {
    font-size: 12px;
  }

  .inline-actions {
    width: 100%;
  }

  .inline-actions > button {
    flex: 1 1 auto;
    min-height: 42px;
    white-space: normal;
  }

  .modal-backdrop {
    align-items: end;
    padding: 8px;
  }

  .modal-card {
    width: 100%;
    max-height: calc(100dvh - 16px);
    border-radius: 8px 8px 0 0;
    padding: 15px;
  }

  .date-picker-card .day-button,
  .date-picker-card .day-blank {
    min-height: 52px;
  }

  .modal-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .modal-actions .ghost-button {
    min-height: 44px;
  }

  .toast {
    right: 10px;
    bottom: 10px;
    left: 10px;
    max-width: none;
    padding: 11px 13px;
    font-size: 13px;
  }

  .auth-wrap {
    place-items: start center;
    padding: 10px;
  }

  .auth-panel {
    overflow: visible;
  }

  .auth-side {
    min-height: 0;
    padding: 22px 18px;
  }

  .auth-logo {
    width: 72px;
    height: 72px;
    margin-bottom: 14px;
  }

  .auth-side h1 {
    margin-bottom: 8px;
    font-size: 28px;
  }

  .auth-side p {
    font-size: 13px;
  }

}

@media print {
  @page {
    size: A4 landscape;
    margin: 10mm;
  }

  * {
    box-shadow: none !important;
    text-shadow: none !important;
  }

  body {
    background: #fff !important;
    color: #111 !important;
  }

  .topbar,
  .nav-row,
  .calendar-panel,
  .availability-panel,
  .booking-panel,
  .toast,
  .modal-backdrop {
    display: none !important;
  }

  .container {
    width: 100%;
    padding: 0;
  }

  .calendar-layout,
  .page-grid {
    display: block;
  }

  .print-week {
    display: block;
    color: #111;
    font-family: Arial, sans-serif;
  }

  .print-week-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #111;
  }

  .print-week-head h1 {
    margin: 0;
    font-size: 22px;
    line-height: 1.1;
  }

  .print-week-head p,
  .print-week-range {
    margin: 4px 0 0;
    font-size: 12px;
    font-weight: 700;
  }

  .print-week-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(36mm, 1fr));
    gap: 6px;
  }

  .print-day {
    min-height: 78mm;
    border: 1px solid #222;
    break-inside: avoid;
    padding: 6px;
  }

  .print-day h2 {
    margin: 0 0 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid #999;
    font-size: 11px;
    line-height: 1.25;
    text-transform: capitalize;
  }

  .print-bookings {
    display: grid;
    gap: 5px;
  }

  .print-booking {
    display: grid;
    gap: 1px;
    padding: 4px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 10px;
    line-height: 1.2;
  }

  .print-booking b {
    font-size: 11px;
  }

  .print-empty {
    margin: 0;
    color: #555;
    font-size: 11px;
  }
}
