/* Brooklyn Hive — demo styling. Vanilla CSS. ~200 lines. */
:root {
  --ink: #1a1a1a;
  --muted: #5a5a5a;
  --rule: #e6e6e6;
  --accent: #d35400;
  --accent-soft: #fdf3ec;
  --bg: #fafaf7;
  --ok: #2e7d32;
  --warn: #ed6c02;
  --bad: #c62828;
  --maxw: 1080px;
}
* { box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif; color: var(--ink); margin: 0; background: var(--bg); line-height: 1.5; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 24px 16px 64px; }

.site-header {
  display: flex; align-items: center; justify-content: space-between;
  max-width: var(--maxw); margin: 0 auto; padding: 16px;
  border-bottom: 1px solid var(--rule);
}
.brand { font-weight: 700; font-size: 1.2rem; color: var(--ink); }
.site-header nav a, .site-header nav button.link { margin-left: 16px; }
.cta { background: var(--accent); color: white; padding: 6px 12px; border-radius: 6px; }
.cta:hover { text-decoration: none; background: #b34a00; }
button.link { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; font: inherit; }
form.inline { display: inline; }

.site-footer { text-align: center; padding: 32px; color: var(--muted); border-top: 1px solid var(--rule); }

.hero { padding: 32px 0; }
.hero h1 { font-size: 2.4rem; margin: 0 0 12px; }
.hero p { color: var(--muted); max-width: 60ch; }

.listing-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }
.card { background: white; border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; color: var(--ink); display: block; }
.card:hover { text-decoration: none; box-shadow: 0 2px 16px rgba(0,0,0,0.06); }
.card img { width: 100%; height: 180px; object-fit: cover; display: block; }
.card h2 { margin: 12px 16px 4px; font-size: 1.1rem; }
.card .neighborhood, .card .price { margin: 0 16px 12px; color: var(--muted); font-size: 0.9rem; }
.card .price { color: var(--ink); }

.property header { margin-bottom: 16px; }
.property h1 { margin: 0 0 4px; font-size: 2rem; }
.property .neighborhood { color: var(--muted); margin: 0 0 4px; }
.property .breadcrumb { color: var(--muted); font-size: 0.9rem; }
.breadcrumb { color: var(--muted); font-size: 0.9rem; margin: 0 0 12px; }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--ink); text-decoration: underline; }
.property .specs { color: var(--muted); font-size: 0.9rem; }
.property .scope-media[hidden] { display: none; }
.property .hero-photo { width: 100%; aspect-ratio: 3 / 2; max-height: 480px; object-fit: cover; border-radius: 8px; background: var(--rule); }
.property .gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; margin-top: 8px; }
.property .gallery img { width: 100%; aspect-ratio: 3 / 2; height: auto; object-fit: cover; border-radius: 4px; background: var(--rule); }
.property .tiers { padding-left: 20px; }
.property .rooms { padding-left: 20px; }

.layout-cols { display: grid; grid-template-columns: 1fr; gap: 24px; margin-top: 24px; }
@media (min-width: 800px) { .layout-cols { grid-template-columns: 2fr 1fr; } }

.booking-card { background: white; border: 1px solid var(--rule); border-radius: 8px; padding: 20px; position: sticky; top: 16px; height: max-content; }
.booking-card h3 { margin: 0 0 12px; }
.booking-card label { display: block; margin: 8px 0; font-size: 0.9rem; color: var(--muted); }
.booking-card input, .booking-card select, .booking-card textarea { width: 100%; padding: 8px; border: 1px solid var(--rule); border-radius: 4px; font: inherit; margin-top: 4px; color: var(--ink); }
.booking-card button { width: 100%; background: var(--accent); color: white; border: 0; padding: 10px; border-radius: 6px; font-weight: 600; cursor: pointer; margin-top: 12px; }
.booking-card button:hover { background: #b34a00; }
.booking-card .fineprint { font-size: 0.75rem; color: var(--muted); margin-top: 12px; }
.booking-card .booking-date-error { color: #b00020; font-size: 0.85rem; margin: 8px 0 0; }

.availability-block { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--rule); }
.availability-block summary { font-weight: 600; cursor: pointer; font-size: 0.9rem; }
.availability-list { list-style: none; padding: 0; margin: 8px 0 0; font-size: 0.85rem; color: var(--muted); }
.availability-list li { padding: 4px 0; }
.availability-list .availability-state { display: inline-block; margin-left: 8px; padding: 1px 6px; border-radius: 3px; font-size: 0.7rem; background: #f3f3f3; color: var(--ink); }
.availability-list .state-approved { background: #fde2cd; color: #6b3000; }

.flash { padding: 12px 16px; margin: 16px 0; border-radius: 6px; font-size: 0.95rem; }
.flash-error { background: #fde2e2; color: #6b0000; border: 1px solid #f5b5b5; }
.flash-warn  { background: #fff4cf; color: #5a4500; border: 1px solid #f0d97a; }

.review { max-width: 720px; }
.review dl { display: grid; grid-template-columns: 200px 1fr; gap: 4px 16px; }
.review dt { color: var(--muted); }
.review .cta { margin: 24px 0 8px; display: flex; gap: 16px; align-items: center; }
.review .btn { background: var(--accent); color: white; padding: 10px 18px; border-radius: 6px; font-weight: 600; }
.review .btn:hover { text-decoration: none; background: #b34a00; }
.fineprint { color: var(--muted); font-size: 0.85rem; }

table.price, table.bookings, table.admin-queue { width: 100%; border-collapse: collapse; margin: 16px 0; }
table.price th, table.bookings th, table.admin-queue th { text-align: left; padding: 6px 8px; color: var(--muted); font-weight: 500; border-bottom: 1px solid var(--rule); }
table.price td, table.bookings td, table.admin-queue td { padding: 6px 8px; border-bottom: 1px solid var(--rule); }
table.price tr.total th, table.price tr.total td { font-weight: 700; color: var(--ink); }

.auth { max-width: 420px; margin: 16px auto; background: white; padding: 24px; border-radius: 8px; border: 1px solid var(--rule); }
.auth label { display: block; margin: 12px 0 4px; color: var(--muted); font-size: 0.9rem; }
.auth input { width: 100%; padding: 8px; border: 1px solid var(--rule); border-radius: 4px; font: inherit; }
.auth button { background: var(--accent); color: white; border: 0; padding: 10px; border-radius: 6px; font-weight: 600; cursor: pointer; width: 100%; margin-top: 12px; }
.error { background: #fdecea; color: var(--bad); padding: 10px; border-radius: 6px; }

.state { padding: 2px 8px; border-radius: 999px; font-size: 0.8rem; background: var(--accent-soft); color: var(--accent); }
.state-pending_screening { background: #fff3e0; color: #b35a00; }
.state-pending_review { background: #e3f2fd; color: #1565c0; }
.state-approved { background: #e8f5e9; color: var(--ok); }
.state-declined { background: #fdecea; color: var(--bad); }
.state-expired, .state-withdrawn { background: #f5f5f5; color: var(--muted); }

.timeline { list-style: none; padding: 0; display: flex; gap: 12px; margin: 16px 0; flex-wrap: wrap; }
.timeline li { flex: 1 1 200px; padding: 12px 16px; border-radius: 6px; background: #f0f0f0; color: var(--muted); border-left: 4px solid #ccc; }
.timeline li.active { background: #e3f2fd; color: #1565c0; border-left-color: #1565c0; }
.timeline li.done { background: #e8f5e9; color: var(--ok); border-left-color: var(--ok); }
.timeline li.declined { background: #fdecea; color: var(--bad); border-left-color: var(--bad); }
.timeline li .mark { display: inline-block; width: 1.2em; font-weight: 700; }
.timeline li.done .mark { color: var(--ok); }
.timeline li.declined .mark { color: var(--bad); }
.timeline li.active .mark { color: #1565c0; }

.admin-detail dl { display: grid; grid-template-columns: 200px 1fr; gap: 4px 16px; }
.admin-detail dt { color: var(--muted); }
.admin-detail form.inline { margin-right: 12px; }
.admin-detail input[type=text] { padding: 6px; border: 1px solid var(--rule); border-radius: 4px; }
button.danger { background: var(--bad); color: white; border: 0; padding: 8px 16px; border-radius: 4px; cursor: pointer; }
button:not(.danger):not(.link) { background: var(--accent); color: white; border: 0; padding: 8px 16px; border-radius: 4px; cursor: pointer; }

.mail-list { padding-left: 20px; }
.mail-list li { margin: 4px 0; }

code { background: #f0f0f0; padding: 1px 4px; border-radius: 3px; font-size: 0.85em; }

/* Admin properties — master apartment + linked rooms tree */
.property-group { background: white; border: 1px solid var(--rule); border-radius: 8px; margin: 16px 0; overflow: hidden; }
.property-group-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 16px 20px; background: #fafafa; border-bottom: 1px solid var(--rule); }
.property-group-header h2 { margin: 0 0 4px; font-size: 1.15rem; }
.property-group-header .fineprint { margin: 0; }
.property-group-meta { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.property-group-meta .rate { font-weight: 600; }
.rooms-table { width: 100%; border-collapse: collapse; }
.rooms-table th, .rooms-table td { padding: 8px 20px; border-bottom: 1px solid var(--rule); text-align: left; }
.rooms-table th { color: var(--muted); font-weight: 500; font-size: 0.85rem; }
.rooms-table tr:last-child td { border-bottom: 0; }
.rooms-table tbody tr:hover { background: #fafafa; }
.room-empty { padding: 12px 20px; color: var(--muted); margin: 0; }
.orphans { margin-top: 32px; }
.orphans h2 { margin-bottom: 4px; }
.orphans .rooms-table { background: white; border: 1px solid var(--rule); border-radius: 8px; margin-top: 12px; }
.rooms-table td.actions { display: flex; gap: 12px; align-items: center; }
.link-form { display: flex; gap: 8px; align-items: center; }
.link-form select { padding: 6px; border: 1px solid var(--rule); border-radius: 4px; font: inherit; min-width: 180px; }
.link-form button { background: var(--accent); color: white; border: 0; padding: 6px 12px; border-radius: 4px; cursor: pointer; }

/* Property detail — scope tabs (Whole apt / Room 1 / Room 2 …) */
.scope-tabs { margin-top: 24px; }
.scope-tabs .tablist {
  display: flex; flex-wrap: wrap; gap: 4px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 0;
}
.scope-tabs .tablist button {
  background: none; border: 0; border-bottom: 3px solid transparent;
  padding: 12px 16px; cursor: pointer; font: inherit; color: var(--ink);
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  border-radius: 0; min-width: 0;
}
.scope-tabs .tablist button:hover:not([disabled]) { background: #fafafa; }
.scope-tabs .tablist button[aria-selected=true] {
  border-bottom-color: var(--accent);
  color: var(--accent);
}
.scope-tabs .tablist button[aria-selected=true] .tab-label { font-weight: 600; }
.scope-tabs .tablist button[disabled] {
  color: var(--muted); cursor: not-allowed; opacity: 0.7;
}
.scope-tabs .tab-label {
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 14ch;
}
.scope-tabs .tab-price { font-size: 0.8rem; color: var(--muted); }
.scope-tabs .tablist button[aria-selected=true] .tab-price { color: var(--accent); }
.scope-panel { padding-top: 24px; }
.scope-panel[hidden] { display: none; }

/* Property detail — sub-unit room cards */
.rooms-section { margin-top: 48px; padding-top: 32px; border-top: 1px solid var(--rule); }
.rooms-section h2 { margin: 0 0 4px; }
.rooms-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; margin-top: 20px; }
.room-card { background: white; border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; display: flex; flex-direction: column; }
.room-card img { width: 100%; height: 160px; object-fit: cover; display: block; }
.room-card-body { padding: 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.room-card h3 { margin: 0; font-size: 1.05rem; }
.room-price { margin: 0; display: flex; align-items: baseline; gap: 8px; }
.room-card .cta { margin-top: auto; text-align: center; }
.cta-disabled { background: #ebebeb !important; color: var(--muted) !important; cursor: not-allowed; pointer-events: none; padding: 6px 12px; border-radius: 6px; text-align: center; }

/* Admin dashboard KPI cards */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin: 16px 0 32px; }
.kpi { background: white; border: 1px solid var(--rule); border-radius: 8px; padding: 20px; display: block; color: var(--ink); }
a.kpi:hover { text-decoration: none; box-shadow: 0 2px 16px rgba(0,0,0,0.06); }
.kpi h3 { margin: 0 0 8px; color: var(--muted); font-size: 0.85rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; }
.kpi .num { font-size: 2.2rem; font-weight: 700; line-height: 1.1; }
.kpi .num.pending { color: #1565c0; }
.kpi .num.approved { color: var(--ok); }
.kpi .num.declined { color: var(--bad); }
.kpi .fineprint { margin-top: 4px; }

/* Renter withdraw action on /account/bookings/{id} */
.withdraw-form { margin-top: 24px; }
.btn-danger { background: var(--bad); color: white; border: 0; border-radius: 6px; padding: 8px 16px; font-weight: 600; cursor: pointer; font-size: 0.95rem; }
.btn-danger:hover { filter: brightness(0.92); }

/* Monthly payment schedule */
.payment-schedule { margin-top: 24px; }
.payment-schedule h2 { margin-bottom: 8px; }
.payment-schedule-table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.payment-schedule-table th, .payment-schedule-table td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--rule); }
.payment-schedule-table th { background: #f6f6f6; font-weight: 600; color: var(--muted); }
.payment-schedule-table tr:last-child td { border-bottom: 0; }
.payment-schedule-table td:nth-child(3), .payment-schedule-table td:nth-child(4), .payment-schedule-table td:nth-child(5), .payment-schedule-table td:nth-child(6) { text-align: right; font-variant-numeric: tabular-nums; }
.payment-schedule-table th:nth-child(3), .payment-schedule-table th:nth-child(4), .payment-schedule-table th:nth-child(5), .payment-schedule-table th:nth-child(6) { text-align: right; }
