/* Host dashboard styles — Stutoro Homes brand:
   green #0F766E, dark grey #374151, light grey #9CA3AF. */

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #374151;
  background: #f8fafc;
}
.container { max-width: 960px; margin: 0 auto; padding: 16px; }

.topbar {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 6px 12px;
  background: #374151; color: #fff; padding: 10px 20px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo { height: 36px; background: #fff; border-radius: 6px; padding: 2px 6px; }
.brand-sub { font-size: 1.05rem; font-weight: 600; }
.user-email { font-size: 0.9rem; color: #d1d5db; margin-right: 10px; }

.card {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 10px;
  padding: 20px; margin: 16px 0;
}
.hidden { display: none !important; }
.hint { color: #6b7280; font-size: 0.92rem; }
.error { color: #b91c1c; font-size: 0.92rem; }
code { background: #f3f4f6; padding: 1px 5px; border-radius: 4px; }

.btn {
  border: none; border-radius: 8px; padding: 9px 16px;
  font-size: 0.95rem; cursor: pointer; min-height: 44px;
}
.btn-primary { background: #0F766E; color: #fff; }
.btn-primary:hover { background: #0d5c55; }
.btn-secondary { background: #e5e7eb; color: #374151; }
.btn-secondary:hover { background: #d1d5db; }
.btn-danger { background: #b91c1c; color: #fff; }
.btn:disabled { opacity: 0.55; cursor: default; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0; }
.tab {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 8px;
  padding: 9px 14px; font-size: 0.95rem; cursor: pointer; color: #374151;
  min-height: 44px;
}
.tab.active { background: #0F766E; color: #fff; border-color: #0F766E; }
.badge {
  background: #b91c1c; color: #fff; border-radius: 999px;
  padding: 1px 7px; font-size: 0.8rem; margin-left: 4px;
}

.booking-card {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 10px;
  padding: 16px; margin: 12px 0;
}
.booking-card h3 { margin: 0 0 6px; }
.booking-card p { margin: 4px 0; font-size: 0.94rem; }
.booking-actions { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
.status {
  display: inline-block; font-size: 0.8rem; font-weight: 600;
  padding: 2px 8px; border-radius: 999px; text-transform: capitalize;
}
.status-pending_approval { background: #fef3c7; color: #92400e; }
.status-pending { background: #fef3c7; color: #92400e; }
.status-approved { background: #d1fae5; color: #065f46; }
.review-stars { color: #f59e0b; letter-spacing: 2px; }
.review-body { white-space: pre-wrap; }
.status-invoiced { background: #dbeafe; color: #1e40af; }
.status-paid { background: #d1fae5; color: #065f46; }
.status-cancelled, .status-refunded, .status-expired { background: #f3f4f6; color: #6b7280; }

.filter-row { display: flex; gap: 12px; align-items: end; margin: 12px 0; flex-wrap: wrap; }
.filter-row label { font-size: 0.9rem; color: #6b7280; }
/* 16px form text keeps iOS from auto-zooming on focus; 44px
   min-height keeps every control thumb-friendly. */
select, input[type="text"] {
  display: block; margin-top: 4px; padding: 8px; border: 1px solid #d1d5db;
  border-radius: 8px; font-size: 16px; min-height: 44px; min-width: 220px; background: #fff;
}
input[type="date"], input[type="number"] {
  display: block; margin-top: 4px; padding: 8px; border: 1px solid #d1d5db;
  border-radius: 8px; font-size: 16px; min-height: 44px; background: #fff;
}

table { width: 100%; border-collapse: collapse; background: #fff; font-size: 0.92rem; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid #e5e7eb; }
th { color: #6b7280; font-weight: 600; }

.legend { display: flex; gap: 16px; margin: 12px 0; font-size: 0.9rem; flex-wrap: wrap; }
.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: middle; margin-right: 5px; }
.swatch.blocked { background: #fca5a5; }
.swatch.held { background: #93c5fd; }
.swatch.free { background: #e5e7eb; }
.swatch.override { background: #0F766E; }
.swatch.selected { background: #f59e0b; }

.month { margin: 18px 0; }
.month h4 { margin: 0 0 8px; }
.cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px;
  max-width: 560px;
}
.cal-day {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  border-radius: 6px; font-size: 0.85rem; background: #f3f4f6;
}
.cal-day.blocked { background: #fca5a5; color: #7f1d1d; }
.cal-day.held { background: #93c5fd; color: #1e3a8a; }
.cal-day.past { opacity: 0.45; }
.cal-day.today { box-shadow: inset 0 0 0 3px #0F766E; font-weight: 800; }
.cal-dow { font-size: 0.75rem; color: #9CA3AF; text-align: center; }

.cal-nav { display: flex; align-items: center; gap: 12px; margin: 14px 0 2px; flex-wrap: wrap; }
.cal-nav h4 { margin: 0; }
.cal-controls { margin-top: 18px; }
/* Open nights are buttons: day number + effective nightly price. */
.cal-day.open-day {
  flex-direction: column; gap: 0; cursor: pointer; border: none;
  font: inherit; color: inherit; padding: 3px 0; height: auto;
  min-height: 44px;
}
.cal-day .day-num { font-weight: 600; line-height: 1.15; }
.cal-day .day-price { font-size: 0.68rem; color: #6b7280; line-height: 1.15; }
.cal-day.open-day.override { background: #ccfbf1; }
.cal-day.open-day.override .day-price { color: #0F766E; font-weight: 700; }
.cal-day.open-day.selected { box-shadow: inset 0 0 0 3px #f59e0b; }
/* Booked nights show the booking, not a price: "Booked" for
   Airbnb/VRBO, the guest's first name for a direct booking. */
.cal-day.has-label { flex-direction: column; gap: 0; padding: 3px 1px; min-height: 44px; }
.cal-day .day-label {
  font-size: 0.6rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.02em; line-height: 1.15; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal-card {
  background: #fff; border-radius: 12px; padding: 22px;
  max-width: 520px; width: 100%; max-height: 90vh; overflow-y: auto;
}
.modal-actions { display: flex; gap: 10px; margin-top: 16px; }
.invoice-lines { background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 8px; padding: 12px; margin: 12px 0; font-size: 0.93rem; }
.invoice-lines .line { display: flex; justify-content: space-between; padding: 4px 0; }
.invoice-lines .line.total { border-top: 1px solid #d1d5db; font-weight: 700; margin-top: 6px; padding-top: 8px; }
.invoice-lines .desc { color: #6b7280; font-size: 0.85rem; }

/* ---------- phone-first (Darren does back-office work on his phone) ----------
   Everything stays readable and tappable at phone width; nothing
   needs horizontal scrolling or a desktop screen. */
@media (max-width: 600px) {
  .container { padding: 10px; }
  .topbar { padding: 10px 12px; }
  .tabs { gap: 5px; }
  .tab { flex: 1 1 28%; padding: 9px 6px; text-align: center; }

  /* Calendar: full-width grid, tighter gaps, prices still legible. */
  .cal-grid { gap: 2px; max-width: none; }
  .cal-day { font-size: 0.8rem; border-radius: 5px; }
  .cal-day .day-price { font-size: 0.64rem; }
  .cal-nav { justify-content: space-between; }

  /* Filters and the price-editing controls stack full-width. */
  .filter-row { gap: 10px; }
  .filter-row > label { flex: 1 1 100%; }
  select { min-width: 0; width: 100%; }
  .cal-controls .filter-row { flex-direction: column; align-items: stretch; }
  .cal-controls input { width: 100%; }
  .cal-controls .booking-actions .btn { flex: 1 1 100%; min-height: 48px; }
  .booking-actions .btn { flex: 1 1 auto; }

  /* Deposits table becomes stacked cards instead of a wide table. */
  table, table tbody, table tr, table td { display: block; width: 100%; }
  table tr:first-child { display: none; }
  table tr {
    border: 1px solid #e5e7eb; border-radius: 10px;
    padding: 8px 12px; margin: 10px 0;
  }
  table td {
    border-bottom: none; padding: 5px 0; display: flex;
    justify-content: space-between; align-items: center; gap: 10px;
  }
  table td::before { content: attr(data-label); font-weight: 600; color: #6b7280; }
  table td .btn { width: 100%; }

  .modal { padding: 8px; }
  .modal-card { padding: 16px; }
}
