/* ------------------------------------------------------------------
   Aileron Room Reservations — palette pulled from the reference screenshots
   ------------------------------------------------------------------ */
:root {
  --bg:           #FAF6F0;       /* page cream */
  --surface:      #FFFFFF;
  --ink:          #2A2118;
  --ink-soft:     #5C5448;
  --ink-muted:    #8B8579;
  --line:         #E8E1D6;
  --line-strong:  #D9D0BF;

  --header:       #3D2F25;       /* dark brown header */
  --header-fg:    #F5EFE3;

  /* Family colors */
  --large:        #1F4E79;       /* navy */
  --large-soft:   #E5ECF3;
  --meeting:      #6B8E76;       /* sage/teal */
  --meeting-soft: #E8EFE9;
  --focus:        #D78A3C;       /* warm orange */
  --focus-soft:   #FBEEDD;
  --office:       #6B5536;       /* warm brown */
  --office-soft:  #EDE6D9;

  --accent-blue:  #2D6CB0;       /* the "today" highlight blue */

  --shadow-sm:    0 1px 2px rgba(40, 32, 22, 0.05);
  --shadow-md:    0 8px 24px rgba(40, 32, 22, 0.08);
  --shadow-lg:    0 24px 60px rgba(40, 32, 22, 0.18);

  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 14px;

  /* Aileron brand typography — single-font system per brand.aileron.org/typography.
     Aileron Public Sans is the corporate-branded build of Google's Public Sans;
     Public Sans is the public equivalent. */
  --font-sans: 'Public Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Public Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  /* Brand modular scale: base 15px (x), 0.8x / 1x / 1.5x / 2x / 6x / 8x */
  --text-xs: 12px;
  --text-s:  15px;
  --text-m:  21.5px;
  --text-l:  30px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--text-s);          /* 15px brand base */
  line-height: 1.45;
  text-align: left;                  /* brand: always left-align */
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button { font-family: inherit; cursor: pointer; border: 0; background: transparent; color: inherit; }

/* ============================== Topbar ============================== */
.topbar {
  background: var(--header);
  color: var(--header-fg);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--header-fg); }
.brand-mark { width: 28px; height: 28px; color: rgba(255,255,255,0.06); }
.brand-text { line-height: 1.1; }
.brand-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.brand-sub {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(245, 239, 227, 0.65);
  margin-top: 3px;
}

.view-toggle {
  display: inline-flex;
  background: rgba(255,255,255,0.10);
  border-radius: 999px;
  padding: 3px;
}
.vt-btn {
  padding: 6px 16px;
  font-size: 12px;
  font-weight: 600;
  color: rgba(245, 239, 227, 0.75);
  border-radius: 999px;
  letter-spacing: 0.02em;
  transition: background 0.15s, color 0.15s;
}
.vt-btn:hover { color: var(--header-fg); }
.vt-btn.is-active {
  background: var(--header-fg);
  color: var(--header);
}

/* ============================== Page chrome ============================== */
.page {
  max-width: 1440px;
  margin: 0 auto;
  padding: 28px 28px 60px;
}

.controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 24px;
  flex-wrap: wrap;
}
.period-nav { display: flex; align-items: center; gap: 8px; }
.nav-btn {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px;
  color: var(--ink-soft);
  transition: background 0.15s, color 0.15s;
}
.nav-btn:hover { background: var(--line); color: var(--ink); }
.period-text { padding: 0 6px; }
.period-title {
  font-family: var(--font-display);
  font-size: var(--text-l);          /* 30px = brand L */
  font-weight: 200;                  /* Extralight per brand sample */
  letter-spacing: -0.01em;
  line-height: 1.05;
  color: var(--ink);
}
.period-range { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.today-btn {
  margin-left: 8px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--accent-blue);
  background: var(--surface);
  transition: all 0.15s;
}
.today-btn:hover { border-color: var(--accent-blue); }

.metrics { display: flex; align-items: center; gap: 14px; }
.metric {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 18px;
  text-align: center;
  min-width: 96px;
}
.metric-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--meeting);
  line-height: 1.1;
}
.metric:nth-of-type(2) .metric-value { color: var(--ink); }
.metric-label {
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-top: 4px;
  font-weight: 600;
}
.legend { display: flex; gap: 12px; align-items: center; padding-left: 8px; flex-wrap: wrap; }
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--ink-soft);
}
.swatch {
  width: 11px; height: 11px;
  border-radius: 3px;
  display: inline-block;
  flex-shrink: 0;
}
.swatch-large    { background: var(--large); }
.swatch-meeting  { background: var(--meeting); }
.swatch-focus    { background: var(--focus); }
.swatch-office   { background: var(--office); }
.swatch-available { background: var(--surface); border: 1px solid var(--line-strong); border-style: dashed; }
.legend-divider {
  width: 1px; height: 14px; background: var(--line-strong);
  margin: 0 4px;
}

/* ============================== Week board (table) ============================== */
.board {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.week-grid {
  width: 100%;
  border-collapse: collapse;
}
.week-grid thead th {
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 2;
  font-weight: 500;
  text-align: center;
  padding: 14px 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.week-grid thead th.col-room {
  text-align: left;
  padding-left: 22px;
  width: 200px;
  min-width: 180px;
}
.week-grid thead th .dow {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-muted);
  font-weight: 600;
}
.week-grid thead th .dom {
  font-family: var(--font-display);
  font-size: var(--text-l);          /* 30px L */
  font-weight: 200;                  /* Extralight */
  letter-spacing: -0.01em;
  color: var(--ink);
  margin-top: 3px;
  display: block;
  line-height: 1.0;
}
.week-grid thead th.is-today {
  background: #FFF6E8;
  border-bottom: 2px solid var(--focus);
}
.week-grid thead th.is-today .dow { color: var(--focus); }
.week-grid thead th.is-today .dom { color: var(--focus); }
.week-grid thead th.is-today::after {
  content: "•";
  display: block;
  color: var(--focus);
  font-size: 14px;
  margin-top: 2px;
  line-height: 0.5;
}

.section-row td {
  background: transparent;
  padding: 22px 22px 8px;
  border: 0;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--meeting);
}
.section-row.section-large td   { color: var(--large); }
.section-row.section-meeting td { color: var(--meeting); }
.section-row.section-focus td   { color: var(--focus); }
.section-row.section-office td  { color: var(--office); }

.room-row td {
  border-bottom: 1px solid var(--line);
  padding: 0;
  vertical-align: top;
}
.room-row td.cell-room {
  padding: 14px 18px 14px 22px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  background: var(--surface);
  border-right: 1px solid var(--line);
}
.room-row td.cell-day {
  border-right: 1px solid var(--line);
  width: 14.28%;
  min-height: 64px;
}
.room-row td.cell-day:last-child { border-right: 0; }
.room-row td.cell-day.is-today { background: #FFFCF5; }

.slot {
  display: block;
  padding: 4px 10px;
  margin: 4px 6px;
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink-muted);
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 600;
  border: 1px dashed var(--line-strong);
  text-align: left;
  width: calc(100% - 12px);
  cursor: default;
  min-height: 22px;
  position: relative;
}
.slot.is-booked {
  cursor: pointer;
  border-style: solid;
  font-size: 9.5px;
  letter-spacing: 0.04em;
  text-transform: none;
  font-weight: 500;
  padding: 5px 10px 5px 32px;
  color: #fff;
}
.slot.is-booked::before {
  content: attr(data-period);
  position: absolute;
  left: 6px; top: 50%;
  transform: translateY(-50%);
  font-size: 9px;
  letter-spacing: 0.14em;
  font-weight: 700;
  background: rgba(255,255,255,0.18);
  padding: 1.5px 5px;
  border-radius: 3px;
  text-transform: uppercase;
}
.slot.is-booked .slot-name {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Family fills for booked slots */
.fam-large   .slot.is-booked { background: var(--large);   }
.fam-meeting .slot.is-booked { background: var(--meeting); }
.fam-focus   .slot.is-booked { background: var(--focus);   }
.fam-office  .slot.is-booked { background: var(--office);  }

/* unavailable slot label color when no booking */
.slot:not(.is-booked) {
  color: rgba(140, 130, 110, 0.55);
  border-color: rgba(180, 170, 150, 0.35);
  background: rgba(0,0,0,0);
}

/* ============================== Day view (cards) ============================== */
.board-day { background: transparent; border: 0; padding: 0; box-shadow: none; }
.day-chips {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
.day-chip {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 0 12px;
  text-align: center;
  transition: all 0.15s;
}
.day-chip:hover { border-color: var(--line-strong); }
.day-chip.is-active {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
  color: #fff;
}
.day-chip-dow {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--ink-muted);
}
.day-chip.is-active .day-chip-dow { color: rgba(255,255,255,0.8); }
.day-chip-num {
  font-family: var(--font-display);
  font-size: var(--text-l);          /* 30px L */
  font-weight: 200;                  /* Extralight */
  letter-spacing: -0.01em;
  margin-top: 2px;
}
.day-chip-count {
  font-size: 11px;
  color: var(--ink-muted);
  margin-top: 4px;
}
.day-chip.is-active .day-chip-count { color: rgba(255,255,255,0.85); }

.day-section { margin-top: 18px; }
.day-section-title {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--meeting);
  margin: 0 0 10px;
}
.day-section.section-large   .day-section-title { color: var(--large); }
.day-section.section-meeting .day-section-title { color: var(--meeting); }
.day-section.section-focus   .day-section-title { color: var(--focus); }
.day-section.section-office  .day-section-title { color: var(--office); }
.day-section .divider {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 0 0 12px;
}

.day-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.day-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px 14px;
}
.day-card.is-full    { box-shadow: 0 0 0 2px var(--card-accent, var(--meeting)); }
.day-card.is-partial { box-shadow: inset 0 0 0 1px var(--card-accent, var(--meeting)); }
.day-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}
.day-card-name { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.day-card-status {
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--ink-muted);
}
.day-card.is-full    .day-card-status { color: var(--card-accent, var(--meeting)); }
.day-card.is-partial .day-card-status { color: var(--card-accent, var(--meeting)); }

.day-card .slot-row {
  display: flex; gap: 8px; align-items: center;
  padding: 7px 10px;
  border-radius: 6px;
  background: var(--bg);
  margin-top: 6px;
  font-size: 12px;
  border: 1px solid transparent;
  transition: background 0.12s;
}
.day-card .slot-row .period-tag {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  background: var(--line);
  color: var(--ink-muted);
  padding: 2px 6px;
  border-radius: 3px;
}
.day-card .slot-row .slot-text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink-soft);
}
.day-card .slot-row.is-booked {
  background: var(--card-soft, var(--meeting-soft));
  cursor: pointer;
}
.day-card .slot-row.is-booked .period-tag {
  background: var(--card-accent, var(--meeting));
  color: #fff;
}
.day-card .slot-row.is-booked .slot-text { color: var(--ink); font-weight: 500; }
.day-card .slot-row.is-booked:hover { filter: brightness(0.97); }
.day-card .slot-row .chev {
  color: var(--ink-muted);
  margin-left: 4px;
  flex-shrink: 0;
}

/* card family accents (set as CSS vars per section) */
.section-large   .day-card { --card-accent: var(--large);   --card-soft: var(--large-soft); }
.section-meeting .day-card { --card-accent: var(--meeting); --card-soft: var(--meeting-soft); }
.section-focus   .day-card { --card-accent: var(--focus);   --card-soft: var(--focus-soft); }
.section-office  .day-card { --card-accent: var(--office);  --card-soft: var(--office-soft); }

/* ============================== Month view ============================== */
.board-month { padding: 18px; }
.month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.month-grid .month-head {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--ink-muted);
  text-align: center;
  padding: 6px 4px;
}
.month-cell {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 8px 8px 6px;
  min-height: 96px;
  position: relative;
  border: 1px solid transparent;
  transition: border-color 0.15s, background 0.15s;
}
.month-cell.is-other-month { opacity: 0.4; }
.month-cell.is-today {
  background: #FFF6E8;
  border-color: var(--focus);
}
.month-cell-num {
  font-family: var(--font-display);
  font-size: var(--text-m);          /* 21.5px M */
  font-weight: 200;                  /* Extralight */
  letter-spacing: -0.005em;
  color: var(--ink);
  line-height: 1;
}
.month-cell-count {
  font-size: 10px;
  color: var(--ink-muted);
  margin-top: 2px;
}
.month-cell-bar {
  margin-top: 8px;
  height: 6px;
  border-radius: 3px;
  background: var(--line);
  overflow: hidden;
}
.month-cell-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--meeting), var(--meeting));
  border-radius: 3px;
}
.month-cell-pct {
  position: absolute;
  top: 8px; right: 8px;
  font-size: 10px;
  font-weight: 600;
  color: var(--meeting);
}

/* ============================== Modal ============================== */
[hidden] { display: none !important; }
.modal {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
}
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(40, 32, 22, 0.45);
}
.modal-card {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: min(420px, calc(100% - 32px));
  padding: 22px 24px 18px;
  animation: modalIn 0.18s ease-out;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.modal-grip {
  width: 38px; height: 4px;
  background: var(--line-strong);
  border-radius: 999px;
  margin: -6px auto 18px;
}
.modal-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 12px;
  margin-bottom: 18px;
}
.modal-eyebrow {
  font-size: 9.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--accent-blue);
  margin-bottom: 4px;
}
.modal-title {
  font-family: var(--font-display);
  font-size: var(--text-l);          /* 30px L */
  font-weight: 200;                  /* Extralight */
  letter-spacing: -0.01em;
  color: var(--ink);
  line-height: 1.1;
}
.modal-time {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
  background: var(--line);
  padding: 5px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.modal-grid {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 10px 12px;
  margin: 0 0 18px;
  padding: 14px 0 4px;
  border-top: 1px solid var(--line);
}
.modal-grid dt {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--ink-muted);
  align-self: center;
}
.modal-grid dd {
  margin: 0;
  font-size: 13px;
  color: var(--ink);
  text-align: left;                  /* brand: left-align always */
  word-break: break-word;
}
.modal-grid dd a { color: var(--accent-blue); text-decoration: none; }
.modal-grid dd a:hover { text-decoration: underline; }

/* Set Up Requests — multi-line block separate from the dt/dd grid */
.modal-setup {
  margin: 0 0 22px;
  padding: 14px 14px;
  background: var(--surface-alt, #F7F2EA);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.modal-setup-label {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--ink-muted);
  margin-bottom: 6px;
}
.modal-setup-text {
  font-size: 13px;
  color: var(--ink);
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.modal-close {
  width: 100%;
  padding: 12px 0;
  background: var(--header);
  color: var(--header-fg);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: background 0.15s;
}
.modal-close:hover { background: #2C2018; }

/* ============================== Footer ============================== */
.page-footer {
  margin-top: 28px;
  font-size: 11.5px;
  color: var(--ink-soft);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.page-footer .muted { color: var(--ink-muted); }

/* Empty / loading state */
.data-state {
  display: flex; justify-content: center; align-items: center;
  padding: 60px 20px;
}
.data-state-card {
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 30px 50px;
}
.data-state-title { font-size: 16px; font-weight: 600; color: var(--ink); }
.data-state-sub { color: var(--ink-soft); margin-top: 4px; font-size: 13px; }

/* ============================== Responsive ============================== */
@media (max-width: 1100px) {
  .controls { flex-direction: column; align-items: stretch; }
  .metrics { justify-content: flex-start; }
  .week-grid thead th .dom { font-size: 24px; }
  .room-row td.cell-room { font-size: 12.5px; padding: 12px 12px 12px 18px; }
  .slot.is-booked { font-size: 9px; padding-left: 28px; }
}
@media (max-width: 760px) {
  .topbar { flex-direction: column; gap: 10px; padding: 14px 18px; }
  .page { padding: 18px 14px 40px; }
  .day-chips { grid-template-columns: repeat(5, 1fr); gap: 6px; }
  .day-chip { padding: 10px 0 8px; }
  .day-chip-num { font-size: 22px; }
  /* On small screens the week table needs to scroll horizontally */
  .board { overflow-x: auto; }
  .week-grid { min-width: 920px; }
}

/* ------------------------------------------------------------------
   Password gate (staff access)
   ------------------------------------------------------------------ */
.gate {
  position: fixed; inset: 0;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
  padding: 24px;
}
.gate-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px 32px 28px;
  width: 100%; max-width: 380px;
  box-shadow: 0 4px 24px rgba(61,47,37,0.08);
  display: flex; flex-direction: column; align-items: flex-start;
  text-align: left;
}
.gate-mark { width: 36px; height: 36px; margin-bottom: 16px; }
.gate-title {
  font-size: var(--text-l);
  font-weight: 200;
  color: #3D2F25;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}
.gate-sub {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
  margin-bottom: 24px;
}
.gate-label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
  margin-bottom: 8px;
}
.gate-input {
  width: 100%;
  padding: 12px 14px;
  font: inherit;
  font-size: var(--text-s);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
  outline: none;
  margin-bottom: 16px;
  box-sizing: border-box;
}
.gate-input:focus {
  border-color: #3D2F25;
  background: #fff;
}
.gate-btn {
  width: 100%;
  padding: 12px 16px;
  font: inherit;
  font-size: var(--text-s);
  font-weight: 500;
  background: #3D2F25;
  color: #FAF6F0;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.gate-btn:hover { background: #2a201a; }
.gate-error {
  margin-top: 12px;
  font-size: var(--text-xs);
  color: #b04040;
}

/* ------------------------------------------------------------------
   Additional sections: Info Commons + Other Rooms (added when feed
   includes rooms beyond the original 4 featured families)
   ------------------------------------------------------------------ */
.section-row.section-commons td { color: var(--meeting); }
.section-row.section-other   td { color: var(--ink-muted); }

.fam-commons .slot.is-booked { background: var(--meeting); }
.fam-other   .slot.is-booked { background: var(--ink-soft); }

.day-section.section-commons .day-section-title { color: var(--meeting); }
.day-section.section-other   .day-section-title { color: var(--ink-muted); }

.section-commons .day-card { --card-accent: var(--meeting);  --card-soft: var(--meeting-soft); }
.section-other   .day-card { --card-accent: var(--ink-soft); --card-soft: rgba(92,84,72,0.08); }
