* { box-sizing: border-box; margin: 0; }
body { font-family: system-ui, -apple-system, sans-serif; background: #f2f5f7; color: #223; }
.hidden { display: none !important; }

/* Login */
#login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card { background: #fff; padding: 2.5rem; border-radius: 12px; box-shadow: 0 4px 20px rgba(0,0,0,.08); width: 320px; }
.login-card h1 { font-size: 1.4rem; text-align: center; margin-bottom: .3rem; }
.login-card .sub { text-align: center; color: #778; font-size: .85rem; margin-bottom: 1.5rem; }
.login-card label, #booking-form label { display: block; font-size: .85rem; color: #445; margin-bottom: .4rem; font-weight: 600; }
input { width: 100%; padding: .55rem .7rem; border: 1px solid #ccd; border-radius: 8px; font-size: 1rem; margin-top: .2rem; }
button { width: 100%; padding: .65rem; background: #2563eb; color: #fff; border: none; border-radius: 8px; font-size: 1rem; cursor: pointer; margin-top: 1rem; }
button:hover { background: #1d4ed8; }
button:disabled { background: #aab; cursor: not-allowed; }
button.ghost { width: auto; margin: 0; padding: .4rem .8rem; background: transparent; color: #667; font-size: .85rem; }
.error { color: #dc2626; font-size: .85rem; min-height: 1.2em; margin-top: .6rem; }

/* App */
header { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.5rem; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
header h1 { font-size: 1.2rem; }
.header-right { display: flex; align-items: center; gap: .8rem; font-size: .9rem; color: #556; }

.layout { display: grid; grid-template-columns: 1fr 380px; gap: 1.2rem; padding: 1.2rem; max-width: 1200px; margin: 0 auto; }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } }
.card { background: #fff; border-radius: 12px; padding: 1.2rem; margin-bottom: 1.2rem; box-shadow: 0 2px 8px rgba(0,0,0,.05); }
.card h2 { font-size: 1.05rem; margin-bottom: .8rem; }
.card-head { display: flex; justify-content: space-between; align-items: center; }
.hint { font-size: .82rem; color: #889; margin-bottom: .8rem; }

/* Calendar */
.nav { display: flex; align-items: center; gap: .4rem; }
.nav button.arrow { width: 2.2rem; min-width: 2.2rem; margin: 0; padding: .3rem 0; background: #e8ecf1; color: #223; }
.cal-controls { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.cal-controls select { width: auto; margin: 0; padding: .35rem .5rem; font-size: .85rem; }
.view-toggle { display: flex; border: 1px solid #ccd; border-radius: 8px; overflow: hidden; }
.view-toggle button { width: auto; margin: 0; padding: .35rem .7rem; font-size: .8rem; background: #fff; color: #556; }
.view-toggle button.active { background: #2563eb; color: #fff; }

/* Year view */
.year-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; margin-top: .6rem; }
.year-grid { align-self: stretch; }
.min-month { background: #f8fafc; border: 1px solid #eef1f5; border-radius: 8px; padding: .45rem .4rem; height: 100%; }
.min-month-head { text-align: center; font-size: .68rem; font-weight: 700; color: #556; padding: .15rem 0; cursor: pointer; text-transform: uppercase; }
.min-month-head:hover { color: #2563eb; }
.min-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; margin-top: .2rem; }
.min-day { height: 1.4rem; font-size: .62rem; display: flex; align-items: center; justify-content: center; border-radius: 3px; color: #445; }
.min-day.empty { }
.min-day.past { color: #c3c9d1; }
.min-day.booked { background: #fde8e8; color: #b45; }
.min-day.today { outline: 1px solid #2563eb; }
.min-day.sel { background: #2563eb; color: #fff; }
@media (max-width: 900px) { .year-grid { grid-template-columns: repeat(2, 1fr); } }

#calendar { margin-top: .6rem; }
#calendar.month-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.dow { text-align: center; font-size: .7rem; font-weight: 700; color: #99a; padding: .3rem 0; }
.day { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; border-radius: 6px; font-size: .85rem; cursor: pointer; border: 1px solid transparent; }
.day.empty { cursor: default; }
.day.past { color: #bcc; cursor: not-allowed; background: #f4f6f8; }
.day.booked { cursor: pointer; }
.day.booked { background: #fde8e8; color: #b45; }
.day.today { border-color: #2563eb; }
.day.sel-range { background: #dbeafe; }
.day.sel-edge { background: #2563eb; color: #fff; }
.day:not(.empty):not(.past):not(.booked):hover { background: #eaf1ff; }
.legend { display: flex; gap: 1.2rem; margin-top: .8rem; font-size: .78rem; color: #667; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: .3rem; vertical-align: -1px; }
.swatch.booked { background: #fde8e8; }
.swatch.selection { background: #2563eb; }

/* Booking form */
.dates { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; margin-bottom: .8rem; }
.guests-row { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; margin-bottom: .8rem; }
.guests-row label { margin-bottom: .2rem; }
.free-label { color: #059669; font-weight: 400; font-size: .78rem; }
#booking-form label { margin-bottom: .8rem; }
.required { color: #dc2626; }

/* Bookings list */
.booking-list { list-style: none; }
.booking-list li { display: flex; justify-content: space-between; align-items: center; gap: .6rem; padding: .6rem 0; border-bottom: 1px solid #eef; font-size: .88rem; }
.booking-list .who { font-weight: 700; }
.booking-list .meta { color: #667; font-size: .8rem; }
.booking-list .cancel { width: auto; margin: 0; padding: .3rem .6rem; background: #fee2e2; color: #b91c1c; font-size: .78rem; }
.price-preview { background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 8px; padding: .7rem .9rem; margin-bottom: .8rem; font-size: .95rem; color: #166534; }
.price-line { display: block; font-size: .85rem; color: #4d7c5f; padding: .1rem 0; }
.price-line.total { font-size: 1.05rem; font-weight: 700; color: #166534; margin-top: .35rem; }
.day.sel-end { background: #1e40af; color: #fff; }

.tabs { display: flex; gap: .4rem; border-bottom: 1px solid #eef; margin-bottom: .9rem; }
.tabs .tab { width: auto; margin: 0; padding: .4rem .9rem; font-size: .85rem; background: transparent; color: #667; border-radius: 8px 8px 0 0; border-bottom: 2px solid transparent; }
.tabs .tab.active { color: #2563eb; border-bottom-color: #2563eb; font-weight: 700; }

.totals-list { list-style: none; }
.totals-list li { display: flex; justify-content: space-between; padding: .6rem 0; border-bottom: 1px solid #eef; font-size: .9rem; }
.totals-list .who { font-weight: 700; }
.totals-list .meta { color: #2563eb; font-weight: 600; }
.totals-list .person-link { width: auto; margin: 0; padding: 0; background: none; font-size: .9rem; color: #223; font-weight: 700; text-align: left; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.totals-list .person-link:hover { color: #2563eb; }

.modal-overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,.45);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity .15s;
  z-index: 100;
}
.modal-overlay.visible { opacity: 1; pointer-events: auto; }
.modal {
  background: #fff; border-radius: 12px; padding: 1.5rem;
  width: min(90vw, 380px); box-shadow: 0 8px 30px rgba(0,0,0,.18);
}
.modal h3 { margin-bottom: 1rem; font-size: 1.05rem; }
.modal-row { display: flex; justify-content: space-between; gap: 1rem; padding: .45rem 0; border-bottom: 1px solid #eef; font-size: .88rem; }
.modal-row .modal-label { color: #667; font-weight: 600; }
.modal-row:last-of-type { border-bottom: none; }
.modal-buttons { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: flex-end; margin-top: 1.2rem; }
.modal-buttons button { white-space: nowrap; }
.modal-buttons button { width: auto; margin: 0; padding: .5rem 1rem; }
.modal-buttons button.primary { background: #2563eb; color: #fff; }
.modal-buttons button.ghost { background: #eef1f5; color: #334; }
.modal-buttons button.danger { background: #fee2e2; color: #b91c1c; }
.modal-row button { width: auto; margin: 0; }
.day.booked { position: relative; }
.day.booked::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
}


