* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: #17202a; background: #f5f7f9; }
a { color: #116466; }
h1, h2 { margin: 0 0 12px; letter-spacing: 0; }
input, select, textarea, button { font: inherit; }
input, select, textarea { width: 100%; border: 1px solid #c8d2dc; border-radius: 6px; padding: 10px 12px; background: #fff; }
input[type="checkbox"], input[type="radio"] { width: auto; padding: 0; accent-color: #116466; }
textarea { min-height: 84px; resize: vertical; }
label { display: grid; gap: 6px; font-weight: 700; }
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { border-bottom: 1px solid #e3e8ee; padding: 10px; text-align: left; vertical-align: top; }
th { background: #edf3f3; font-size: 13px; }
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-panel, .panel { background: #fff; border: 1px solid #dbe3ea; border-radius: 8px; padding: 24px; box-shadow: 0 8px 24px rgba(16, 24, 40, .06); }
.auth-panel { width: min(440px, 100%); }
.auth-link { margin: 18px 0 0; text-align: center; }
.page { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 24px 0 48px; }
.admin-page { width: min(1760px, calc(100% - 40px)); }
.narrow { width: min(820px, calc(100% - 32px)); }
.topbar { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 18px; }
.nav-actions, .form-actions, .row-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.muted { color: #657380; margin: 0 0 12px; }
.button, button { display: inline-flex; justify-content: center; align-items: center; min-height: 40px; border: 1px solid #b6c4ce; border-radius: 6px; padding: 8px 14px; background: #fff; color: #17202a; text-decoration: none; cursor: pointer; }
.primary { background: #116466; border-color: #116466; color: #fff; font-weight: 700; }
.secondary { background: #eef4f4; }
.danger { background: #fff3f2; border-color: #f0b8b2; color: #a33125; }
.form-stack { display: grid; gap: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.check-label { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; font-weight: 700; }
.long-date-field { display: none; }
.long-mode .normal-date-field { display: none; }
.long-mode .long-date-field { display: grid; }
.full { grid-column: 1 / -1; }
.alert { border-radius: 6px; padding: 12px; margin: 10px 0 14px; }
.alert-error { background: #fff3f2; border: 1px solid #f0b8b2; color: #7f271d; }
.alert-success { background: #edf8f1; border: 1px solid #a9d8b8; color: #285b36; }
.calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.weekday { text-align: center; font-weight: 700; color: #51616f; padding: 8px; }
.day { min-height: 154px; background: #fff; border: 1px solid #dbe3ea; border-radius: 8px; padding: 10px; display: grid; align-content: start; gap: 8px; }
.day.blank { background: transparent; border: 0; }
.day-head { display: flex; justify-content: space-between; gap: 8px; }
.day dl { display: grid; gap: 4px; margin: 0; }
.day dl div { display: flex; justify-content: space-between; gap: 8px; }
.day dt { color: #657380; }
.day dd { margin: 0; font-weight: 700; }
.available { border-top: 5px solid #2f855a; }
.limited { border-top: 5px solid #c27a13; }
.full-booked { border-top: 5px solid #b42318; }
.note { margin: 0; font-size: 13px; color: #344054; }
.updated { margin: 0; font-size: 12px; color: #7b8794; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: #fff; border: 1px solid #dbe3ea; border-radius: 8px; padding: 14px; }
.stat span { display: block; color: #657380; font-size: 13px; }
.stat strong { display: block; font-size: 28px; }
.admin-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 20px; }
.admin-menu { background: #fff; border: 1px solid #dbe3ea; border-radius: 8px; padding: 12px; align-self: start; }
.admin-menu a { display: block; padding: 10px; border-radius: 6px; text-decoration: none; color: #17202a; }
.admin-menu a:hover { background: #eef4f4; }
.nowrap { white-space: nowrap; }
.schedule-panel { padding: 18px; }
.schedule-wrap { width: 100%; overflow: auto; border: 1px solid #d8e1e8; border-radius: 8px; background: #fff; }
.schedule-grid { min-width: 1480px; width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; user-select: none; }
.schedule-grid th, .schedule-grid td { border-right: 1px solid #dfe6ed; border-bottom: 1px solid #dfe6ed; padding: 0; text-align: center; }
.schedule-grid thead th { position: sticky; top: 0; z-index: 4; height: 44px; background: #edf3f3; color: #344054; }
.schedule-grid thead th span { display: block; font-weight: 800; }
.schedule-grid thead th small { display: block; color: #667085; font-size: 11px; }
.schedule-grid .weekend { background: #f7eeee; }
.schedule-grid .sticky-bed, .schedule-grid .sticky-bed-name { position: sticky; left: 0; z-index: 3; background: #f8fafc; }
.schedule-grid .sticky-bed { width: 54px; min-width: 54px; font-size: 13px; }
.schedule-grid .sticky-bed-name { left: 54px; width: 92px; min-width: 92px; z-index: 3; }
.schedule-grid thead .sticky-bed, .schedule-grid thead .sticky-bed-name { z-index: 5; }
.schedule-grid .gender-band { writing-mode: vertical-rl; letter-spacing: 0; font-weight: 800; }
.schedule-grid .gender-band.female { background: #fff1f4; color: #9f2f55; }
.schedule-grid .gender-band.male { background: #eef6ff; color: #175b91; }
.schedule-grid .bed-name { font-size: 13px; font-weight: 800; background: #fff; }
.summary-row .summary-label { background: #233947; color: #fff; font-weight: 800; }
.summary-cell { height: 36px; background: #f7fafc; color: #22313d; font-size: 12px; font-weight: 800; }
.summary-cell span { display: inline-block; margin: 0 2px; }
.summary-cell.total { background: #e8f4f3; color: #0f4f50; font-size: 16px; }
.schedule-cell { width: 40px; min-width: 40px; min-height: 78px; background: #fff; cursor: crosshair; position: relative; vertical-align: top; padding: 2px; }
.schedule-cell.empty:hover, .schedule-cell.selectable.occupied:hover { background: #e8f4f3; outline: 2px solid #7fb9b6; outline-offset: -2px; }
.schedule-cell.selecting { background: #bfe3df; outline: 2px solid #116466; outline-offset: -2px; }
.schedule-cell.occupied { background: #eaf2ed; cursor: default; }
.schedule-cell.occupied.selectable { cursor: crosshair; background: linear-gradient(135deg, #eaf2ed 0 65%, #fff6df 65% 100%); }
.schedule-cell.blocked { cursor: not-allowed; }
.stay-chip { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; min-height: 28px; margin-bottom: 2px; padding: 3px; color: #173b2f; text-decoration: none; font-size: 12px; font-weight: 800; line-height: 1.15; overflow-wrap: anywhere; border-radius: 3px; }
.stay-chip small { display: block; margin-top: 2px; color: #8a4b00; font-size: 10px; }
.stay-chip:hover { background: #d5eadc; }
.time-tags { display: grid; gap: 2px; margin-top: 2px; pointer-events: none; }
.time-tag { display: block; border-radius: 3px; padding: 2px 2px; color: #fff; font-size: 9px; line-height: 1.1; font-weight: 800; white-space: nowrap; }
.time-tag.in { background: #2f855a; }
.time-tag.out { background: #b7791f; }
.stay-form-panel { margin-top: 18px; }
@media (min-width: 1280px) {
  .admin-page .form-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .admin-page .form-grid .full { grid-column: 1 / -1; }
  .admin-page .stay-form-panel .form-actions { justify-content: flex-start; }
}
@media (max-width: 780px) {
  .topbar, .admin-layout { display: block; }
  .nav-actions { margin-top: 12px; }
  .form-grid, .stats { grid-template-columns: 1fr; }
  .calendar { display: grid; grid-template-columns: 1fr; }
  .weekday, .day.blank { display: none; }
  .schedule-grid { min-width: 980px; }
  table { display: block; overflow-x: auto; }
}
