/* ---------- Brand font: Bw Modelica ---------- */
@font-face {
  font-family: "Bw Modelica";
  src: url("fonts/BwModelica-Regular.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Bw Modelica";
  src: url("fonts/BwModelica-Medium.woff") format("woff");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Bw Modelica";
  src: url("fonts/BwModelica-Bold.woff") format("woff");
  font-weight: 600 700;  /* covers 600 weight mappings too */
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Bw Modelica";
  src: url("fonts/BwModelica-ExtraBold.woff") format("woff");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Bw Modelica";
  src: url("fonts/BwModelica-Black.woff") format("woff");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  --free: #22a06b;
  --free-dark: #1b8557;
  --booked: #e03956;
  --booked-dark: #bd2544;
  --ink: #1a1d23;
  --ink-2: #5b6270;
  --ink-3: #8a909b;
  --line: #ececf0;
  --bg-soft: #f7f7f9;
  --white: #ffffff;
  --shadow-sm: 0 1px 2px rgba(20, 25, 35, 0.05);
  --shadow-md: 0 6px 20px rgba(20, 25, 35, 0.08);
  --shadow-lg: 0 20px 50px rgba(20, 25, 35, 0.18);
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-pill: 999px;
}

/* ---------- Reset ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  overflow: hidden;
  font-family: "Bw Modelica", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--ink);
  color: var(--white);
  user-select: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }

/* ---------- App layout ---------- */
.app { display: flex; flex-direction: column; height: 100vh; width: 100vw; }

/* ---------- Header ---------- */
.header {
  display: flex;
  align-items: center;
  padding: 16px 22px;
  background: var(--ink);
  color: var(--white);
  gap: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.room-name {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.header-logo {
  height: 40px;
  width: auto;
  display: block;
  background: #fff;
  padding: 6px 14px;
  border-radius: 10px;
}

.offline-badge {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 10px;
  background: #3a2020;
  color: #ffb3b3;
  border-radius: var(--r-pill);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.2px;
  border: 1px solid #5b2e2e;
  margin-right: 12px;
}

.offline-badge[hidden] { display: none; }

.offline-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff6b6b;
  animation: pulse-red 1.6s infinite;
}

@keyframes pulse-red {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Push logo to the right if offline badge not present */
.header-logo { margin-left: auto; }
.offline-badge + .header-logo { margin-left: 0; }

/* ---------- Main grid ---------- */
.main {
  display: grid;
  grid-template-columns: 3fr 2fr;
  flex: 1;
  min-height: 0;
}

/* ---------- Status panel ---------- */
.status-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 36px 44px;
  color: #fff;
  transition: background-color 0.5s ease;
  overflow: hidden;
  background-color: var(--free);
}

.app[data-status="free"]   .status-panel { background-color: var(--free); }
.app[data-status="booked"] .status-panel { background-color: var(--booked); }

.status-top {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.clock {
  display: flex;
  align-items: baseline;
  gap: 14px;
  opacity: 0.95;
  margin-bottom: 8px;
}

.clock-time {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.clock-date {
  font-size: 1rem;
  font-weight: 500;
  opacity: 0.88;
}

.status-label {
  font-size: 4.8rem;
  font-weight: 800;
  letter-spacing: -2px;
  line-height: 0.95;
  margin-top: 8px;
}

.status-sublabel {
  font-size: 1.15rem;
  font-weight: 500;
  opacity: 0.92;
  margin-top: 10px;
}

/* ---------- Quick actions (FREE) ---------- */
.quick-actions {
  margin-top: auto;
  padding-top: 32px;
}

.app[data-status="booked"] .quick-actions { display: none; }

.quick-actions-title {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  opacity: 0.85;
  margin-bottom: 14px;
}

.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.quick-btn {
  aspect-ratio: 1.1 / 1;
  background: rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(6px);
  border-radius: var(--r-md);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  transition: transform 0.1s, background 0.15s;
}

.quick-btn:hover { background: rgba(255, 255, 255, 0.22); }
.quick-btn:active { transform: scale(0.97); }

.quick-btn-num {
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -1px;
}

.quick-btn-unit {
  font-size: 0.9rem;
  font-weight: 600;
  opacity: 0.92;
}

.quick-btn--custom { background: rgba(0, 0, 0, 0.22); }
.quick-btn--custom:hover { background: rgba(0, 0, 0, 0.32); }
.quick-btn--custom .quick-btn-unit { font-size: 0.88rem; }

/* ---------- Booked info ---------- */
.booked-info {
  margin-top: auto;
  padding-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.app[data-status="free"] .booked-info { display: none; }

.booked-person {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.25);
  letter-spacing: 0.5px;
}

.booked-text {
  flex: 1;
  min-width: 0;
}

.booked-title {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.3px;
}

.booked-with {
  font-size: 1.1rem;
  opacity: 0.92;
  font-weight: 500;
  margin-top: 2px;
}

.booked-with strong {
  font-weight: 700;
}

.booked-meta {
  font-size: 0.9rem;
  opacity: 0.85;
  margin-top: 2px;
}

.booked-meta:empty { display: none; }

.next-meeting {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px 8px 10px;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border-radius: var(--r-pill);
  font-size: 0.95rem;
  font-weight: 600;
  align-self: flex-start;
  margin-bottom: 12px;
  animation: pulse-soft 2s ease-in-out infinite;
}

.next-meeting[hidden] { display: none; }

.next-meeting-label {
  background: rgba(0, 0, 0, 0.22);
  padding: 2px 10px;
  border-radius: var(--r-pill);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

@keyframes pulse-soft {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.85; }
}

.countdown {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-top: 6px;
  margin-bottom: 18px;
}

.countdown-label {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  opacity: 0.82;
}

.countdown-time {
  font-size: 3.2rem;
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1;
  transition: color 0.3s ease;
}

.countdown--ending .countdown-time {
  color: #ffd866;
  animation: pulse-ending 1.3s ease-in-out infinite;
}

.countdown--ending .countdown-label {
  color: #ffd866;
  opacity: 1;
}

@keyframes pulse-ending {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

/* ---------- Check-in banner ---------- */
.checkin-banner {
  margin-top: 12px;
  margin-bottom: 20px;
  padding: 22px 24px;
  background: rgba(0, 0, 0, 0.28);
  border-radius: var(--r-lg);
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  animation: banner-pop 0.4s cubic-bezier(.2, 1.1, .4, 1);
}

.checkin-banner[hidden] { display: none; }

@keyframes banner-pop {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.checkin-banner-welcome {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
  font-weight: 600;
  opacity: 0.9;
  letter-spacing: 0.1px;
  margin-bottom: 2px;
}

.checkin-banner-emoji {
  font-size: 1.25rem;
  animation: wave 2s ease-in-out infinite;
  transform-origin: 70% 70%;
  display: inline-block;
}

@keyframes wave {
  0%, 60%, 100% { transform: rotate(0deg); }
  10%, 30% { transform: rotate(14deg); }
  20% { transform: rotate(-8deg); }
  40% { transform: rotate(-4deg); }
  50% { transform: rotate(10deg); }
}

.checkin-banner-title {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.4px;
  line-height: 1.15;
}

.checkin-banner-sub {
  font-size: 1rem;
  opacity: 0.9;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  margin-top: 4px;
  margin-bottom: 12px;
}

.checkin-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 22px 34px;
  background: #fff;
  color: var(--booked-dark);
  border-radius: var(--r-pill);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.2px;
  box-shadow: var(--shadow-md);
  transition: transform 0.1s, box-shadow 0.15s;
}

.checkin-btn:hover { box-shadow: var(--shadow-lg); }
.checkin-btn:active { transform: scale(0.97); }
.checkin-btn:disabled { opacity: 0.7; cursor: not-allowed; }

.checkin-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.checkin-cancel-btn {
  padding: 10px 16px;
  background: transparent;
  color: #fff;
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  opacity: 0.85;
}

.checkin-cancel-btn:hover { opacity: 1; }

/* ---------- End button (big, high-contrast) ---------- */
.end-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 18px 28px;
  background: #fff;
  color: var(--booked-dark);
  border-radius: var(--r-pill);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.2px;
  box-shadow: var(--shadow-md);
  transition: transform 0.1s, box-shadow 0.15s;
  align-self: flex-start;
}

.end-btn:hover { box-shadow: var(--shadow-lg); }
.end-btn:active { transform: scale(0.97); }

.booked-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.schedule-other-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 16px 22px;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  border-radius: var(--r-pill);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.2px;
  backdrop-filter: blur(6px);
  transition: background 0.15s, transform 0.1s;
}

.schedule-other-btn:hover { background: rgba(255, 255, 255, 0.28); }
.schedule-other-btn:active { transform: scale(0.97); }

/* ---------- Progress bar ---------- */
.progress-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 5px;
  background: rgba(0, 0, 0, 0.2);
}

.progress-bar-fill {
  height: 100%;
  background: rgba(255, 255, 255, 0.9);
  transition: width 0.9s linear;
}

.progress-bar[hidden] { display: none; }

/* ---------- Events panel ---------- */
.events-panel {
  background: var(--white);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  border-left: 1px solid var(--line);
}

.events-header {
  padding: 16px 22px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-bottom: 1px solid var(--line);
}

.events-header > span:first-child {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--ink-2);
}

.events-header-sub {
  font-size: 0.82rem;
  color: var(--ink-3);
  font-weight: 500;
  letter-spacing: 0.1px;
}

/* ---------- Day tabs ---------- */
.day-tabs {
  display: flex;
  gap: 6px;
  padding: 10px 18px 8px;
  border-bottom: 1px solid var(--line);
}

.day-tabs button {
  flex: 1;
  padding: 10px 8px;
  border: none;
  background: var(--bg-soft);
  color: var(--ink-2);
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  border-radius: var(--r-sm);
  transition: all 0.15s;
}

.day-tabs button:hover { background: #e8e8ec; }

.day-tabs button.active {
  background: var(--ink);
  color: #fff;
}

/* ---------- Mini timeline ---------- */
.timeline {
  padding: 14px 22px 12px;
  border-bottom: 1px solid var(--line);
  user-select: none;
}

.timeline-hours {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--ink-3);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  margin-bottom: 6px;
  padding: 0 1px;
}

.timeline-track {
  position: relative;
  height: 26px;
  background:
    linear-gradient(to right, transparent calc(16.66% - 1px), rgba(0,0,0,0.06) calc(16.66% - 1px), rgba(0,0,0,0.06) 16.66%, transparent 16.66%) 0 0 / 16.66% 100% no-repeat,
    var(--bg-soft);
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  background-image:
    linear-gradient(to right,
      transparent 0%, transparent calc(100%/6 - 1px),
      rgba(0,0,0,0.06) calc(100%/6 - 1px), rgba(0,0,0,0.06) calc(100%/6),
      transparent calc(100%/6), transparent calc(200%/6 - 1px),
      rgba(0,0,0,0.06) calc(200%/6 - 1px), rgba(0,0,0,0.06) calc(200%/6),
      transparent calc(200%/6), transparent calc(300%/6 - 1px),
      rgba(0,0,0,0.06) calc(300%/6 - 1px), rgba(0,0,0,0.06) calc(300%/6),
      transparent calc(300%/6), transparent calc(400%/6 - 1px),
      rgba(0,0,0,0.06) calc(400%/6 - 1px), rgba(0,0,0,0.06) calc(400%/6),
      transparent calc(400%/6), transparent calc(500%/6 - 1px),
      rgba(0,0,0,0.06) calc(500%/6 - 1px), rgba(0,0,0,0.06) calc(500%/6),
      transparent calc(500%/6), transparent 100%);
  background-color: var(--bg-soft);
}

.timeline-block {
  position: absolute;
  top: 3px;
  bottom: 3px;
  background: rgba(224, 57, 86, 0.78);
  border-radius: 4px;
  transition: transform 0.1s;
  cursor: default;
}

.timeline-block--current {
  background: var(--booked);
  box-shadow: 0 0 0 2px rgba(224, 57, 86, 0.35);
}

.timeline-now {
  position: absolute;
  top: -5px;
  bottom: -5px;
  width: 2px;
  background: var(--ink);
  z-index: 2;
  pointer-events: none;
}

.timeline-now[hidden] { display: none; }

.timeline-now::before {
  content: "";
  position: absolute;
  top: -3px;
  left: -3px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ink);
}

.timeline-legend {
  display: flex;
  gap: 18px;
  margin-top: 8px;
  font-size: 0.72rem;
  color: var(--ink-3);
  font-weight: 500;
}

.timeline-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.timeline-legend-swatch {
  width: 12px;
  height: 10px;
  border-radius: 2px;
  display: inline-block;
}

.timeline-legend-swatch--busy { background: var(--booked); opacity: 0.8; }
.timeline-legend-swatch--free { background: var(--bg-soft); border: 1px solid #dcdce1; }

.events-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px 70px;
}

.events-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--ink-3);
  font-size: 0.95rem;
}

.events-group-header {
  padding: 14px 8px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--ink-3);
  text-transform: uppercase;
}

.event-item {
  padding: 14px 14px;
  border-radius: var(--r-md);
  margin-bottom: 6px;
  transition: background 0.15s;
  position: relative;
}

.event-item:hover { background: var(--bg-soft); }

.event-item--current {
  background: #fff3f5;
  border-left: 3px solid var(--booked);
  padding-left: 13px;
}

.event-item--current .event-title {
  color: var(--booked-dark);
}

.event-header {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.event-main { flex: 1; min-width: 0; }

.event-cancel-btn {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-3);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
  margin-top: -6px;
  margin-right: -6px;
}

.event-cancel-btn:hover {
  background: #fde8eb;
  color: var(--booked);
}

.event-cancel-btn:active { transform: scale(0.92); }

.event-time {
  font-size: 0.88rem;
  color: var(--ink-2);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.event-time-arrow { color: var(--ink-3); font-weight: 400; }

.event-title {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.3;
  margin-bottom: 3px;
}

.event-organizer {
  font-size: 0.85rem;
  color: var(--ink-2);
}

/* ---------- Modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal[hidden] { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 25, 35, 0.55);
  backdrop-filter: blur(3px);
}

.modal-panel {
  position: relative;
  background: #fff;
  color: var(--ink);
  border-radius: var(--r-lg);
  padding: 30px 28px 24px;
  width: min(500px, 92vw);
  max-height: 90vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  box-shadow: var(--shadow-lg);
}

.modal-panel::-webkit-scrollbar { width: 8px; }
.modal-panel::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 4px;
}
.modal-panel::-webkit-scrollbar-track { background: transparent; }

.modal-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.3px;
}

.modal-text {
  color: var(--ink-2);
  margin-bottom: 18px;
  line-height: 1.5;
}

.modal-field {
  display: block;
  margin-bottom: 20px;
}

.modal-field > span {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-2);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
}

.modal-field input {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  font: inherit;
  font-size: 1rem;
  outline: none;
  color: var(--ink);
  transition: border-color 0.15s;
}

.modal-field input:focus { border-color: var(--free); }

.modal-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* ---------- Date trigger (button that opens calendar) ---------- */
.date-trigger {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: #fff;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: border-color 0.15s;
}

.date-trigger:hover { border-color: var(--ink-3); }
.date-trigger svg { color: var(--ink-2); flex-shrink: 0; }

/* ---------- Calendar modal (tablet-friendly) ---------- */
.modal-panel--cal {
  width: min(420px, 94vw);
  padding: 20px 20px 18px;
}

.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.cal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
  text-transform: capitalize;
  letter-spacing: -0.2px;
}

.cal-nav {
  width: 44px;
  height: 44px;
  border-radius: var(--r-sm);
  background: var(--bg-soft);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.cal-nav:hover { background: #ececf0; }

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  padding: 0 2px 6px;
}

.cal-weekdays span {
  text-align: center;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: var(--ink-3);
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 14px;
}

.cal-day {
  aspect-ratio: 1 / 1;
  border: none;
  background: #fff;
  border-radius: var(--r-sm);
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s, color 0.12s;
  min-height: 44px;
}

.cal-day:hover:not(:disabled):not(.cal-day--selected) { background: var(--bg-soft); }

.cal-day--muted { color: var(--ink-3); opacity: 0.5; }

.cal-day--today {
  box-shadow: inset 0 0 0 2px var(--ink);
  font-weight: 700;
}

.cal-day--selected {
  background: var(--free);
  color: #fff;
  font-weight: 700;
  box-shadow: none;
}

.cal-day:disabled {
  color: var(--ink-3);
  opacity: 0.35;
  cursor: not-allowed;
}

.duration-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.duration-options[hidden] { display: none; }

.duration-options button {
  padding: 14px 8px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  background: #fff;
  transition: all 0.15s;
}

.duration-options button:hover { border-color: var(--ink-3); }

.duration-options button.selected {
  background: var(--free);
  color: #fff;
  border-color: var(--free);
}

.duration-more {
  grid-column: span 3;
  background: var(--bg-soft) !important;
  color: var(--ink) !important;
  font-weight: 700 !important;
}

.duration-custom {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.duration-custom[hidden] { display: none; }

.duration-custom-field {
  display: block;
}

.duration-custom-field > span {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-2);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
}

.duration-custom-field input {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  font: inherit;
  font-size: 1rem;
  outline: none;
  color: var(--ink);
}

.duration-custom-field input:focus { border-color: var(--free); }

.duration-custom-info {
  font-size: 0.95rem;
  color: var(--ink-2);
  font-weight: 600;
  padding: 8px 12px;
  background: var(--bg-soft);
  border-radius: var(--r-sm);
}

.duration-custom-info.is-error {
  background: #fde8e8;
  color: #c92a2a;
}

#duration-back { align-self: flex-start; }

/* ---------- Time trigger (button that opens time picker) ---------- */
.time-trigger {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: #fff;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: border-color 0.15s;
}

.time-trigger:hover { border-color: var(--ink-3); }
.time-trigger svg { color: var(--ink-2); flex-shrink: 0; }

/* ---------- Time picker modal ---------- */
.modal-panel--time {
  width: min(520px, 96vw);
  padding: 22px 22px 18px;
}

.time-display {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  margin: 6px 0 18px;
  font-variant-numeric: tabular-nums;
}

.time-display-value {
  font-size: 3rem;
  font-weight: 700;
  letter-spacing: -1px;
  color: var(--ink);
  min-width: 1.6em;
  text-align: center;
}

.time-display-sep {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--ink-3);
  margin: 0 2px;
}

.time-picker {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.time-col-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: var(--ink-3);
  text-transform: uppercase;
  margin-bottom: 8px;
  text-align: center;
}

.time-grid {
  display: grid;
  gap: 6px;
}

.time-grid--hours {
  grid-template-columns: repeat(6, 1fr);
}

.time-grid--minutes {
  grid-template-columns: 1fr;
}

.time-cell {
  border: 1.5px solid var(--line);
  background: #fff;
  border-radius: var(--r-sm);
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  padding: 12px 4px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  font-variant-numeric: tabular-nums;
}

.time-cell:hover:not(.time-cell--selected) { background: var(--bg-soft); border-color: var(--ink-3); }

.time-cell--selected {
  background: var(--free);
  color: #fff;
  border-color: var(--free);
}

.time-grid--minutes .time-cell {
  padding: 14px 4px;
  font-size: 1.05rem;
}

@media (max-height: 680px) {
  .time-display { margin: 2px 0 10px; }
  .time-display-value { font-size: 2.2rem; }
  .time-display-sep { font-size: 1.8rem; }
  .time-cell { padding: 9px 4px; min-height: 38px; font-size: 0.95rem; }
  .time-grid--minutes .time-cell { padding: 10px 4px; font-size: 1rem; }
}

/* ---------- People picker ---------- */
.people-picker {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.people-selected-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px 10px 14px;
  background: var(--free);
  color: #fff;
  border-radius: var(--r-pill);
  font-size: 0.95rem;
  align-self: flex-start;
  max-width: 100%;
}

.people-selected-chip[hidden] { display: none; }

.people-selected-label {
  opacity: 0.85;
  font-weight: 500;
}

.people-selected-chip strong {
  font-weight: 700;
}

.people-selected-clear {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.people-selected-clear:hover { background: rgba(255, 255, 255, 0.4); }

.people-selected-change {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 6px 12px;
  border-radius: var(--r-pill);
  transition: background 0.15s;
}

.people-selected-change:hover { background: rgba(255, 255, 255, 0.4); }

/* Collapsed state: only the "Seleccionado" chip is visible. */
.people-picker.people-picker--collapsed .people-search,
.people-picker.people-picker--collapsed .people-initials,
.people-picker.people-picker--collapsed .people-grid { display: none; }

.people-search {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  font: inherit;
  font-size: 0.98rem;
  outline: none;
}
.people-search:focus { border-color: var(--free); }

.people-initials {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.people-initials button {
  width: 34px;
  height: 34px;
  border: 1.5px solid var(--line);
  background: #fff;
  border-radius: var(--r-sm);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ink-2);
  transition: all 0.15s;
}

.people-initials button:hover { border-color: var(--ink-3); }

.people-initials button.active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.people-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
  padding: 2px;
}

.people-grid button {
  padding: 12px 10px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink);
  background: #fff;
  transition: all 0.15s;
  text-align: center;
  line-height: 1.25;
}

.people-grid button:hover { border-color: var(--ink-3); }

.people-grid button.selected {
  background: var(--free);
  color: #fff;
  border-color: var(--free);
}

.people-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--ink-3);
  padding: 20px;
  font-size: 0.92rem;
}

/* Large variant for the "who" modal (quick book) */
.people-picker--large .people-grid {
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  max-height: 380px;
}

.people-picker--large .people-grid button {
  padding: 16px 10px;
  font-size: 0.98rem;
  font-weight: 700;
}

.modal-panel--wide { width: min(720px, 94vw); }

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 24px;
}

.btn {
  padding: 14px 24px;
  border-radius: var(--r-sm);
  font-size: 1rem;
  font-weight: 700;
  transition: all 0.15s;
}

.btn-secondary {
  background: var(--bg-soft);
  color: var(--ink);
}
.btn-secondary:hover { background: #ececf0; }

.btn-primary {
  background: var(--free);
  color: #fff;
}
.btn-primary:hover { background: var(--free-dark); }
.btn-primary:disabled { background: #aaa; cursor: not-allowed; }

.btn-big {
  width: 100%;
  padding: 18px 24px;
  font-size: 1.1rem;
  font-weight: 800;
  border-radius: var(--r-md);
}

.btn-link {
  background: transparent;
  color: var(--ink-2);
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 10px 16px;
}

.btn-link:hover { color: var(--ink); }

.modal-actions--stack {
  flex-direction: column;
  gap: 4px;
  align-items: stretch;
  margin-top: 20px;
}

/* Title chips */
.title-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.title-chip {
  padding: 14px 20px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-pill);
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  background: #fff;
  transition: all 0.15s;
}

.title-chip:hover { border-color: var(--ink-3); }

.title-chip.selected {
  background: var(--free);
  color: #fff;
  border-color: var(--free);
}

.modal-field--collapsible > span {
  font-size: 0.72rem;
  opacity: 0.7;
}

.modal-field--collapsible input {
  padding: 10px 14px;
  font-size: 0.95rem;
}

.btn-danger {
  background: var(--booked);
  color: #fff;
}
.btn-danger:hover { background: var(--booked-dark); }
.btn-danger:disabled { background: #aaa; cursor: not-allowed; }

.modal-error {
  margin-top: 14px;
  padding: 14px 16px;
  background: #fde8e8;
  color: #c92a2a;
  border-radius: var(--r-sm);
  font-size: 0.98rem;
  font-weight: 600;
  border: 1.5px solid #f5b5b5;
}

.required-mark {
  font-style: normal;
  color: var(--booked);
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
  margin-left: 4px;
  font-size: 0.72rem;
}

/* Highlight an invalid field */
.is-invalid {
  animation: field-shake 0.45s cubic-bezier(.36,.07,.19,.97);
}

.is-invalid .people-picker,
.is-invalid > span {
  color: var(--booked-dark);
}

.is-invalid .people-grid,
.is-invalid .people-search,
.is-invalid .people-initials button {
  border-color: var(--booked) !important;
}

.is-invalid .people-picker {
  box-shadow: 0 0 0 2px rgba(224, 57, 86, 0.25);
  border-radius: var(--r-sm);
  padding: 4px;
  margin: -4px;
}

@keyframes field-shake {
  10%, 90%  { transform: translateX(-1px); }
  20%, 80%  { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-4px); }
  40%, 60%  { transform: translateX(4px); }
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 14px 22px;
  border-radius: var(--r-pill);
  font-size: 0.98rem;
  font-weight: 600;
  z-index: 200;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.25s ease;
}

.toast[hidden] { display: none; }
.toast--error   { background: var(--booked); }
.toast--success { background: var(--free); }

@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .main { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .events-panel { max-height: 42vh; }
  .status-label { font-size: 3.4rem; }
  .countdown-time { font-size: 2.4rem; }
  .quick-btn-num { font-size: 1.8rem; }
}

/* ---------- Compact layout for 7" tablets (short height) ---------- */
@media (max-height: 680px) {
  .header { padding: 8px 16px; }
  .header-btn, .header-logo { height: 34px; }
  .room-name { font-size: 1.15rem; }

  .status-panel { padding: 14px 24px 10px; }
  .clock-time { font-size: 1.5rem; }
  .clock-date { font-size: 0.9rem; }
  .clock { margin-bottom: 2px; gap: 8px; }
  .status-label { font-size: 2.6rem; margin-top: 2px; }
  .status-sublabel { font-size: 0.95rem; margin-top: 4px; }

  /* Quick actions (FREE) compacts */
  .quick-actions { padding-top: 12px; }
  .quick-actions-title { font-size: 0.75rem; margin-bottom: 8px; }
  .quick-actions-grid { gap: 8px; }
  .quick-btn { aspect-ratio: auto; padding: 10px 6px; }
  .quick-btn-num { font-size: 1.6rem; }
  .quick-btn-unit { font-size: 0.75rem; }

  /* Booked info compacts */
  .booked-person { gap: 10px; margin-bottom: 6px; }
  .avatar { width: 42px; height: 42px; font-size: 1rem; }
  .booked-title { font-size: 1.2rem; }
  .booked-with { font-size: 0.95rem; }
  .booked-meta { font-size: 0.8rem; }

  .next-meeting {
    font-size: 0.85rem;
    padding: 5px 10px 5px 6px;
    margin-bottom: 6px;
  }
  .next-meeting-label { font-size: 0.7rem; padding: 1px 6px; }

  /* Check-in banner compacts — the critical fix */
  .checkin-banner {
    padding: 12px 16px;
    margin-top: 4px;
    margin-bottom: 8px;
    border-radius: 12px;
  }
  .checkin-banner-welcome { font-size: 0.82rem; margin-bottom: 0; }
  .checkin-banner-emoji { font-size: 1rem; }
  .checkin-banner-title { font-size: 1.15rem; line-height: 1.1; }
  .checkin-banner-sub { font-size: 0.82rem; margin-top: 2px; margin-bottom: 8px; }
  .checkin-btn { padding: 12px 22px; font-size: 1rem; gap: 8px; }
  .checkin-btn svg { width: 18px; height: 18px; }
  .checkin-cancel-btn { padding: 6px 10px; font-size: 0.85rem; }
  .checkin-actions { gap: 10px; }

  /* Countdown + end button compacts */
  .countdown { margin-top: 2px; margin-bottom: 10px; gap: 10px; }
  .countdown-label { font-size: 0.7rem; }
  .countdown-time { font-size: 2rem; }
  .end-btn { padding: 10px 18px; font-size: 0.95rem; }
  .end-btn svg { width: 18px; height: 18px; }
  .schedule-other-btn { padding: 8px 14px; font-size: 0.88rem; }

  /* Events panel compacts */
  .events-header { padding: 10px 16px 8px; }
  .events-header > span:first-child { font-size: 0.72rem; }
  .events-header-sub { font-size: 0.72rem; }
  .day-tabs { padding: 6px 14px 6px; gap: 4px; }
  .day-tabs button { padding: 6px 4px; font-size: 0.78rem; }
  .timeline { padding: 8px 16px 6px; }
  .timeline-track { height: 20px; }
  .timeline-legend { font-size: 0.65rem; margin-top: 4px; }
  .events-list { padding: 6px 10px 40px; }
  .event-item { padding: 10px 12px; }
  .event-title { font-size: 0.95rem; }
  .event-time { font-size: 0.82rem; }
  .event-organizer { font-size: 0.78rem; }
  .events-group-header { padding: 8px 6px 4px; font-size: 0.66rem; }
}

/* Even tighter for really short heights */
@media (max-height: 520px) {
  .clock-time { font-size: 1.2rem; }
  .status-label { font-size: 2rem; }
  .checkin-banner { padding: 8px 12px; margin-bottom: 4px; }
  .checkin-banner-welcome { display: none; }
  .checkin-banner-title { font-size: 1rem; }
  .checkin-btn { padding: 10px 18px; font-size: 0.92rem; }
  .countdown-time { font-size: 1.6rem; }
  .booked-person { margin-bottom: 4px; }
  .avatar { width: 36px; height: 36px; font-size: 0.9rem; }
}
