:root {
  --buffer-blue: #2c4bff;
  --buffer-blue-soft: #e8ecff;
  --buffer-coral: #ee6c4d;
  --buffer-coral-soft: #fff0ed;
  --buffer-gray: #4a5568;
  --buffer-gray-light: #718096;
  --buffer-bg: #f7fafc;
  --buffer-card: #ffffff;
  --buffer-radius: 12px;
  --buffer-shadow: 0 2px 12px rgba(44, 75, 255, 0.08);
}

body {
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  padding: 24px 32px;
  max-width: 1200px;
  margin: 0 auto;
  background: var(--buffer-bg);
  color: #1a202c;
}
body.panel-open {
  overflow: hidden;
}

@media (min-width: 901px) {
  body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
  }
  .page-header {
    flex-shrink: 0;
  }
  .main-layout {
    flex: 1 1 0;
    min-height: 0;
    align-items: stretch;
  }
  .main-left,
  .main-right {
    overflow-y: auto;
    min-height: 0;
    align-self: stretch;
  }
  .main-right {
    position: relative;
    top: auto;
  }
}

/* Page header - Buffer style */
.page-header {
  text-align: center;
  margin-bottom: 36px;
  padding: 24px 0;
}
.page-header-logo {
  display: block;
  margin: 0 auto 12px;
  width: 56px;
  height: 56px;
  object-fit: contain;
}
.page-title {
  font-size: 2rem;
  font-weight: 700;
  color: #1a202c;
  margin: 0 0 8px;
  letter-spacing: -0.02em;
}
.page-subtitle {
  font-size: 1.05rem;
  color: var(--buffer-gray-light);
  margin: 0;
}

/* Main layout: left = times (heatmap + legend + proposed), right = setup controls */
.main-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 28px;
  align-items: start;
}
@media (max-width: 900px) {
  .main-layout {
    grid-template-columns: 1fr;
  }
}

.main-left {
  display: flex;
  flex-direction: column;
  gap: 20px;
}


.main-right {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.setup-col {
  background: var(--buffer-card);
  border-radius: var(--buffer-radius);
  padding: 20px;
  box-shadow: var(--buffer-shadow);
  border: 1px solid rgba(44, 75, 255, 0.06);
}

.setup-heading {
  font-size: 1rem;
  font-weight: 600;
  color: #2d3748;
  margin: 0 0 14px;
}

.setup-field {
  margin-bottom: 12px;
}
.setup-field label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--buffer-gray);
  margin-bottom: 6px;
}
.setup-col select {
  width: 100%;
  padding: 10px 12px;
  font-size: 0.9375rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  font-family: inherit;
  color: #2d3748;
}
.setup-col select:focus {
  outline: none;
  border-color: var(--buffer-blue);
  box-shadow: 0 0 0 2px rgba(44, 75, 255, 0.15);
}

.buffer-input-wrap .searchable-select-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  font-size: 0.9375rem;
}

.checkbox-not-attend {
  display: block;
  margin-top: 12px;
  padding: 8px 0;
  font-size: 0.875rem;
  color: var(--buffer-gray);
}
.checkbox-not-attend input {
  margin-right: 8px;
}

.hint-inline {
  font-size: 0.8125rem;
  color: var(--buffer-gray-light);
  margin: 0 0 8px;
}

.btn-secondary {
  margin-top: 10px;
  padding: 6px 12px;
  font-size: 0.875rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  color: var(--buffer-gray);
  cursor: pointer;
  font-family: inherit;
}
.btn-secondary:hover {
  background: #f7fafc;
  border-color: #cbd5e0;
}

.btn-calendar-toggle {
  display: block;
  width: 100%;
  padding: 10px 16px;
  font-size: 0.9375rem;
  font-weight: 500;
  border: 2px dashed #cbd5e0;
  border-radius: 8px;
  background: #f7fafc;
  color: var(--buffer-blue);
  cursor: pointer;
  font-family: inherit;
  margin-bottom: 12px;
}
.btn-calendar-toggle:hover {
  background: var(--buffer-blue-soft);
  border-color: var(--buffer-blue);
}

.meeting-date-calendar-wrap .calendar-any {
  display: block;
  margin-bottom: 12px;
  padding: 8px 0;
}
.meeting-date-calendar-wrap .calendar-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  font-size: 0.875rem;
}

.setup-actions-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}
.panel-trigger-pop {
  padding: 12px 16px;
  font-size: 0.9375rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  background: var(--buffer-blue);
  color: #fff;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 2px 8px rgba(44, 75, 255, 0.25);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.panel-trigger-pop:hover {
  background: #1e3dbf;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(44, 75, 255, 0.3);
}
.panel-trigger-pop:last-of-type {
  background: var(--buffer-coral);
  box-shadow: 0 2px 8px rgba(238, 108, 77, 0.25);
}
.panel-trigger-pop:last-of-type:hover {
  background: #e55a3a;
  box-shadow: 0 4px 12px rgba(238, 108, 77, 0.3);
}

/* Primary action buttons: Block no-meeting time & Create invite – more visible */
.panel-trigger-primary {
  padding: 14px 20px;
  font-size: 1rem;
  font-weight: 700;
  color: #fff !important;
  box-shadow: 0 3px 12px rgba(44, 75, 255, 0.35);
  width: 100%;
  margin-top: 4px;
}
.panel-trigger-primary:hover {
  color: #fff !important;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(44, 75, 255, 0.4);
}
.btn-create-invite.panel-trigger-primary {
  background: var(--buffer-coral);
  color: #fff !important;
  box-shadow: 0 3px 12px rgba(238, 108, 77, 0.35);
  margin-top: 12px;
}
.btn-create-invite.panel-trigger-primary:hover {
  background: #e55a3a;
  color: #fff !important;
  box-shadow: 0 6px 18px rgba(238, 108, 77, 0.4);
}

/* Score system legend */
.score-legend {
  padding: 18px 20px;
  background: var(--buffer-card);
  border-radius: var(--buffer-radius);
  box-shadow: var(--buffer-shadow);
  font-size: 0.875rem;
  border: 1px solid rgba(44, 75, 255, 0.06);
}

.score-legend h3 {
  margin: 0 0 10px;
  font-size: 1rem;
  font-weight: 600;
  color: #2d3748;
}

.score-legend p {
  margin: 0 0 8px;
  color: var(--buffer-gray-light);
}

.legend-list {
  margin: 0 0 8px;
  padding-left: 20px;
}

.legend-list li {
  margin: 4px 0;
}

.legend-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  vertical-align: middle;
  margin-right: 6px;
}

.legend-green { background: hsl(120, 85%, 45%); }
.legend-yellow { background: hsl(60, 85%, 45%); }
.legend-red { background: hsl(0, 85%, 45%); }
.legend-blocked { background: #555; }

.checkbox-label {
  font-weight: normal;
  cursor: pointer;
  font-size: 0.875rem;
}

.mini-calendar {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px;
  background: #fafbfc;
  font-size: 13px;
}
.mini-calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.mini-calendar-header button {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  color: var(--buffer-gray);
}
.mini-calendar-header button:hover {
  background: var(--buffer-blue-soft);
  border-color: var(--buffer-blue);
  color: var(--buffer-blue);
}
.mini-calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-bottom: 6px;
  text-align: center;
  font-weight: 600;
  font-size: 0.75rem;
  color: var(--buffer-gray-light);
}
.mini-calendar-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.calendar-day {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
}
.calendar-day:hover {
  background: var(--buffer-blue-soft);
  border-color: var(--buffer-blue);
}
.calendar-day.selected {
  background: var(--buffer-blue);
  color: #fff;
  border-color: var(--buffer-blue);
}
.calendar-day-pad {
  background: transparent;
  cursor: default;
  border: none;
}
.calendar-day-pad:hover {
  background: transparent;
}


.panel-trigger {
  padding: 6px 12px;
  font-size: 14px;
  border: 1px solid #1a73e8;
  border-radius: 6px;
  background: #fff;
  color: #1a73e8;
  cursor: pointer;
}
.panel-trigger:hover {
  background: #e8f0fe;
}

/* Side panel popups */
.panel-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  pointer-events: none;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}
.panel-overlay.is-open {
  pointer-events: auto;
  visibility: visible;
  opacity: 1;
}

.panel-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  cursor: pointer;
}

.side-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(380px, 100vw);
  background: #fff;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  overflow: hidden;
}
.panel-overlay.is-open .side-panel {
  transform: translateX(0);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #eee;
  flex-shrink: 0;
}
.panel-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #333;
}

.panel-close {
  width: 36px;
  height: 36px;
  padding: 0;
  font-size: 24px;
  line-height: 1;
  border: none;
  background: none;
  color: #666;
  cursor: pointer;
  border-radius: 4px;
}
.panel-close:hover {
  background: #f0f0f0;
  color: #333;
}

.panel-body {
  flex: 1;
  overflow: auto;
  padding: 20px;
  font-size: 14px;
}
.panel-body .hint {
  margin-bottom: 12px;
}
.panel-body .add-rule-row,
.panel-body .create-invite-row {
  margin-top: 12px;
}
.panel-body .create-invite-actions {
  margin-top: 16px;
}

/* Searchable select (replaces dropdowns for names) */
.searchable-select-wrap {
  position: relative;
  display: inline-block;
  min-width: 180px;
  max-width: 280px;
}

.searchable-select-wrap.searchable-select-inline {
  min-width: 200px;
}

.searchable-select-input {
  width: 100%;
  padding: 6px 10px;
  font-size: 14px;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box;
}

.searchable-select-input:focus {
  outline: none;
  border-color: #1a73e8;
}

.searchable-select-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 2px;
  max-height: 220px;
  overflow: auto;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  z-index: 20;
}

.searchable-select-item {
  display: block;
  width: 100%;
  padding: 8px 10px;
  text-align: left;
  font-size: 14px;
  border: none;
  background: none;
  cursor: pointer;
}

.searchable-select-item:hover {
  background: #f0f0f0;
}

.hint {
  font-size: 12px;
  color: #555;
  margin-bottom: 8px;
}

/* Searchable name picker */
.name-picker-wrap {
  position: relative;
  max-width: 360px;
  margin-bottom: 20px;
}

.name-search {
  width: 100%;
  padding: 8px 12px;
  font-size: 14px;
  border: 1px solid #ccc;
  border-radius: 6px;
  box-sizing: border-box;
}

.name-search:focus,
.searchable-select-input:focus {
  outline: none;
  border-color: var(--buffer-blue);
  box-shadow: 0 0 0 2px rgba(44, 75, 255, 0.2);
}

.name-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  max-height: 220px;
  overflow: auto;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  z-index: 10;
}

.name-dropdown-item {
  display: block;
  width: 100%;
  padding: 10px 12px;
  text-align: left;
  font-size: 14px;
  border: none;
  background: none;
  cursor: pointer;
}

.name-dropdown-item:hover {
  background: #f0f0f0;
}

.selected-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 0.8125rem;
  background: var(--buffer-blue-soft);
  color: var(--buffer-blue);
  border-radius: 20px;
}

.chip-remove {
  padding: 0 2px;
  font-size: 16px;
  line-height: 1;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--buffer-blue);
  border-radius: 2px;
}

.chip-remove:hover {
  background: rgba(0,0,0,0.08);
}

/* Add rule (block time) */
.add-rule-section {
  margin-bottom: 20px;
  padding: 14px 16px;
  background: #fefce8;
  border: 1px solid #e7e0a8;
  border-radius: 8px;
  font-size: 14px;
}

.add-rule-section h3 {
  margin: 0 0 8px;
  font-size: 15px;
  color: #333;
}

.add-rule-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-top: 8px;
}

.add-rule-row label { font-weight: 500; }

.add-rule-row input[type="time"] {
  padding: 6px 8px;
  font-size: 14px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.rule-list {
  margin: 10px 0 0;
  padding-left: 20px;
}

.rule-list li {
  margin: 4px 0;
}

.rule-remove {
  margin-left: 8px;
  padding: 2px 8px;
  font-size: 12px;
  cursor: pointer;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
}

.rule-remove:hover {
  background: #f0f0f0;
}

.add-rule-apply {
  margin-top: 12px;
}
.add-rule-apply .radio-label {
  margin-right: 12px;
  font-weight: normal;
}
.rule-date-input {
  margin-left: 8px;
  padding: 4px 8px;
  font-size: 14px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

/* Create invite */
.create-invite-section {
  margin-bottom: 20px;
  padding: 14px 16px;
  background: #e8f4fd;
  border: 1px solid #a8d4f0;
  border-radius: 8px;
  font-size: 14px;
}

.create-invite-section h3 {
  margin: 0 0 8px;
  font-size: 15px;
  color: #333;
}

.create-invite-row {
  margin-top: 10px;
}

.create-invite-row label {
  display: block;
  font-weight: 500;
  margin-bottom: 4px;
}

.create-invite-row input[type="text"],
.create-invite-row select {
  padding: 6px 10px;
  font-size: 14px;
  border: 1px solid #ccc;
  border-radius: 4px;
  max-width: 360px;
  width: 100%;
  box-sizing: border-box;
}

.create-invite-row textarea {
  width: 100%;
  max-width: 480px;
  padding: 8px 10px;
  font-size: 14px;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box;
  font-family: inherit;
}

.create-invite-actions {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.create-invite-actions button {
  padding: 8px 14px;
  font-size: 14px;
  border: 1px solid #1a73e8;
  border-radius: 6px;
  background: #1a73e8;
  color: #fff;
  cursor: pointer;
}

.create-invite-actions button:hover {
  background: #1557b0;
}

.create-invite-actions button:last-of-type {
  border-color: #0078d4;
  background: #0078d4;
}

.create-invite-actions button:last-of-type:hover {
  background: #106ebe;
}

.invite-time-custom {
  margin-left: 8px;
  padding: 6px 8px;
  font-size: 14px;
  border: 1px solid #ccc;
  border-radius: 4px;
  vertical-align: middle;
}
.invite-time-utc-hint {
  margin-left: 4px;
  font-size: 12px;
  color: #666;
}

/* Proposed best times - on left below legend */
.best-times {
  padding: 20px;
  background: var(--buffer-card);
  border-radius: var(--buffer-radius);
  box-shadow: var(--buffer-shadow);
  border: 1px solid rgba(44, 75, 255, 0.06);
}
.best-times-left {
  min-width: 0;
}

.best-times h3 {
  margin: 0 0 12px;
  font-size: 1rem;
  font-weight: 600;
  color: #2d3748;
}

.best-times-list {
  margin: 0;
  font-size: 0.875rem;
  color: #2d3748;
  line-height: 1.5;
}

.best-time-slot {
  margin-bottom: 10px;
}
.best-time-slot:last-child {
  margin-bottom: 0;
}
.best-time-per-person {
  font-size: 12px;
  color: #555;
  margin-top: 4px;
  margin-left: 0.5em;
}
.best-time-reds {
  font-size: 12px;
  color: #c00;
  margin-top: 4px;
  margin-left: 0.5em;
}

.setup-col-proposed .setup-heading {
  margin-bottom: 12px;
}
.best-times-right {
  min-height: 60px;
  margin-bottom: 16px;
}
.setup-col-proposed .btn-create-invite {
  width: 100%;
  margin-top: 0;
}

/* Vertical calendar (Google Calendar style) */
.calendar-wrap {
  background: var(--buffer-card);
  padding: 16px;
  border-radius: var(--buffer-radius);
  box-shadow: var(--buffer-shadow);
  border: 1px solid rgba(44, 75, 255, 0.06);
  min-height: 120px;
}

.calendar-wrap-title {
  margin: 0 0 8px 0;
  font-size: 1rem;
  font-weight: 600;
  color: #1a202c;
}

/* Compact heatmap so full calendar (all hours) is visible */
.calendar-vertical {
  display: flex;
  flex-direction: column;
  gap: 1px;
  max-width: 400px;
  min-height: 120px;
}

.calendar-row {
  display: grid;
  grid-template-columns: minmax(44px, 44px) 1fr;
  gap: 6px;
  align-items: stretch;
  min-height: 14px;
}

.calendar-time {
  font-size: 10px;
  color: #555;
  display: flex;
  align-items: center;
  padding-right: 4px;
  border-right: 1px solid #eee;
  min-width: 44px;
  width: 44px;
  box-sizing: border-box;
  white-space: nowrap;
  overflow: visible;
  flex-shrink: 0;
}
.calendar-time.past {
  color: #999;
}

.calendar-cell {
  min-height: 12px;
  border-radius: 2px;
  cursor: default;
  transition: box-shadow 0.15s ease;
}

.calendar-cell:hover {
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.calendar-cell.top {
  box-shadow: inset 0 0 0 2px black;
}
.calendar-cell.past {
  background: #c8c8c8 !important;
  opacity: 0.85;
}
.calendar-cell.past:hover {
  opacity: 1;
}

.calendar-row-per-person {
  grid-template-columns: 44px 1fr;
  min-height: 12px;
}

.calendar-per-person-times {
  min-height: 0;
  font-size: 9px;
  color: #555;
  background: transparent !important;
  box-shadow: none !important;
}

/* Collapsibles inside calendar (Score system, Proposed best times) */
.calendar-desplegable {
  margin-top: 12px;
  border: 1px solid rgba(44, 75, 255, 0.12);
  border-radius: 8px;
  overflow: hidden;
}
.calendar-desplegable summary {
  padding: 8px 12px;
  font-size: 0.875rem;
  font-weight: 600;
  color: #2d3748;
  background: var(--buffer-bg);
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.calendar-desplegable summary::-webkit-details-marker {
  display: none;
}
.calendar-desplegable summary::before {
  content: "▶";
  display: inline-block;
  margin-right: 6px;
  font-size: 0.7rem;
  transition: transform 0.2s ease;
}
.calendar-desplegable[open] summary::before {
  transform: rotate(90deg);
}
.score-legend-inner,
.best-times-inner {
  padding: 12px 14px;
  font-size: 0.8125rem;
  color: var(--buffer-gray);
  background: var(--buffer-card);
}
.score-legend-inner p,
.best-times-inner p {
  margin: 0 0 6px;
}
.score-legend-inner .legend-list,
.best-times-inner .legend-list {
  margin: 0 0 6px;
  padding-left: 18px;
}
.best-times-list {
  margin: 0;
  font-size: 0.8125rem;
}

.calendar-per-person-times.past {
  color: #999;
}

.slot-detail {
  display: none;
}

/* Where is Octa? popup */
.where-is-octa-modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}
.where-is-octa-modal.is-open {
  pointer-events: auto;
  visibility: visible;
  opacity: 1;
}

.where-is-octa-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  cursor: pointer;
}

.where-is-octa-box {
  position: relative;
  background: #fff;
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  max-width: 320px;
  width: 90%;
}

.where-is-octa-box h3 {
  margin: 0 0 12px;
  font-size: 20px;
  color: #333;
}

.where-is-octa-box p {
  margin: 0 0 20px;
  font-size: 14px;
  color: #555;
}

.where-is-octa-ok {
  display: block;
  width: 100%;
  padding: 10px 16px;
  font-size: 15px;
  font-weight: 500;
  border: none;
  border-radius: 8px;
  background: #1a73e8;
  color: #fff;
  cursor: pointer;
}
.where-is-octa-ok:hover {
  background: #1557b0;
}

#ticks {
  display: none !important;
}

.heatmap-placeholder {
  margin: 0;
  padding: 24px 0;
  color: var(--buffer-gray-light);
  font-size: 14px;
}

#heatmap {
  overflow: visible;
  display: block;
  min-height: 100px;
}

#heatmap .cell {
  height: auto;
}
