@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800;900&family=IBM+Plex+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

*, *::before, *::after { box-sizing: border-box; }

html {
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.app-shell, .auth-shell, .call-shell {
  min-height: 100vh;
  min-height: 100dvh;
}

.font-heading { font-family: 'Manrope', sans-serif; }
.font-mono2 { font-family: 'JetBrains Mono', monospace; }

.app-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.375rem;
  font-size: 1rem;
  color: #0f172a;
  background: #fff;
}
.app-input:focus {
  outline: none;
  border-color: #4338ca;
  box-shadow: 0 0 0 3px rgba(67, 56, 202, 0.15);
}

/* Select — normalizar Safari/iOS (remove estilo nativo) */
select.app-input,
.app-select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  display: block;
  min-height: 2.75rem;
  line-height: 1.25;
  padding-right: 2.5rem;
  cursor: pointer;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1rem;
}

select.app-input::-ms-expand,
.app-select::-ms-expand {
  display: none;
}

select.app-input:disabled,
.app-select:disabled {
  cursor: not-allowed;
  opacity: 0.7;
  background-color: #f8fafc;
}

@media (max-width: 899px) {
  select.app-input,
  .app-select {
    font-size: 16px; /* evita zoom automático no iOS */
  }
}

.scroll-thin::-webkit-scrollbar { width: 8px; height: 8px; }
.scroll-thin::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 999px; }

/* Sidebar */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  width: 18rem;
  max-width: 85vw;
  transform: translateX(-100%);
  transition: transform 0.22s ease;
}
#app.sidebar-open .sidebar {
  transform: translateX(0);
}
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  z-index: 30;
}
@media (max-width: 899px) {
  #app.sidebar-open .sidebar-backdrop {
    display: block;
  }
}
.sidebar-close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  min-width: 2.5rem;
  min-height: 2.5rem;
  padding: 0.5rem;
  border: none;
  background: transparent;
  border-radius: 0.375rem;
  color: #64748b;
  cursor: pointer;
  position: relative;
  z-index: 2;
}
.sidebar-close-btn:hover {
  background: #f1f5f9;
  color: #334155;
}
.sidebar-toggle-btn {
  display: flex;
  padding: 0.5rem;
  border: none;
  background: transparent;
  border-radius: 0.375rem;
  color: #475569;
  cursor: pointer;
}
.sidebar-toggle-btn:hover {
  background: #f1f5f9;
}
@media (min-width: 900px) {
  .sidebar {
    position: relative;
    transform: none;
    width: 18rem;
    max-width: none;
    flex-shrink: 0;
    overflow: hidden;
    transition: width 0.22s ease, opacity 0.22s ease, border-color 0.22s ease;
  }
  #app:not(.sidebar-open) .sidebar {
    width: 0;
    min-width: 0;
    opacity: 0;
    border-right-color: transparent;
    pointer-events: none;
  }
  #app.sidebar-open .sidebar {
    width: 18rem;
    opacity: 1;
    pointer-events: auto;
  }
  .sidebar-close-btn {
    display: none !important;
  }
}

/* Dialogs */
.dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
}
.dialog-overlay.hidden { display: none; }
.dialog-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}
.dialog-panel {
  position: relative;
  z-index: 1;
  max-height: 90vh;
  overflow: auto;
}

/* Slot view modal */
.slot-view-panel--past {
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 9rem);
  border-color: #e2e8f0;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.12);
}
.slot-view-header--past {
  background: #f1f5f9;
  border-color: #e2e8f0;
}
.slot-view-header--past #slot-view-title {
  color: #475569;
}
.slot-view-header--past .slot-view-close {
  color: #64748b;
}
.slot-view-eyebrow {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748b;
  margin: 0 0 0.2rem;
}
.slot-view-hero {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.95rem 1rem;
  border-radius: 0.75rem;
}
.slot-view-hero--past {
  background: #eef2f6;
  border: 1px solid #e2e8f0;
}
.slot-view-hero--active {
  background: #eef2ff;
  border: 1px solid #c7d2fe;
}
.slot-view-hero-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.slot-view-hero-icon--past {
  background: #e2e8f0;
  color: #64748b;
}
.slot-view-hero-icon--active {
  background: #e0e7ff;
  color: #4338ca;
}
.slot-view-hero-label {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: #334155;
}
.slot-view-hero-sub {
  margin: 0.15rem 0 0;
  font-size: 0.8rem;
  color: #64748b;
}
.slot-view-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  align-self: flex-start;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
}
.slot-view-badge--past {
  background: #e2e8f0;
  color: #64748b;
}
.slot-view-badge--active {
  background: #e0e7ff;
  color: #3730a3;
}
.slot-view-details {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.slot-view-detail-card {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.8rem 0.9rem;
  border-radius: 0.65rem;
  border: 1px solid #e2e8f0;
  background: #fff;
}
.slot-view-panel--past .slot-view-detail-card {
  background: rgba(255, 255, 255, 0.72);
  border-color: #e2e8f0;
}
.slot-view-detail-icon {
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.slot-view-detail-icon--past {
  background: #e2e8f0;
  color: #64748b;
}
.slot-view-detail-icon--active {
  background: #e0e7ff;
  color: #4338ca;
}
.slot-view-detail-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #94a3b8;
  margin-bottom: 0.15rem;
}
.slot-view-detail-value {
  font-size: 0.9rem;
  color: #334155;
  line-height: 1.35;
}
.slot-view-detail-value.font-mono2 {
  font-size: 0.85rem;
}
.slot-view-notes {
  font-size: 0.875rem;
  color: #64748b;
  line-height: 1.45;
  padding: 0.8rem 0.9rem;
  border-radius: 0.65rem;
  border: 1px dashed #cbd5e1;
  background: rgba(255, 255, 255, 0.55);
}
.slot-view-panel--past .slot-view-notes {
  background: rgba(255, 255, 255, 0.45);
}
.slot-view-call-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.8rem 1rem;
  border-radius: 0.65rem;
  background: #4338ca;
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.15s ease;
}
.slot-view-call-btn:hover {
  background: #3730a3;
}
.slot-view-hint {
  font-size: 0.7rem;
  color: #94a3b8;
  text-align: center;
  margin: 0;
}
.slot-view-wait {
  font-size: 0.85rem;
  color: #b45309;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 0.65rem;
  padding: 0.75rem 0.9rem;
  margin: 0;
}
.slot-view-cancel-btn {
  width: 100%;
  padding: 0.65rem 1rem;
  border-radius: 0.65rem;
  border: 1px solid #fecaca;
  color: #b91c1c;
  background: #fff;
  font-size: 0.875rem;
  font-weight: 600;
}
.slot-view-cancel-btn:hover {
  background: #fef2f2;
}
.slot-view-delete-btn {
  width: 100%;
  padding: 0.65rem 1rem;
  border-radius: 0.65rem;
  border: 1px solid #cbd5e1;
  color: #475569;
  background: #fff;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}
.slot-view-delete-btn:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #334155;
}
.slot-view-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.slot-view-edit-btn {
  width: 100%;
  padding: 0.65rem 1rem;
  border-radius: 0.65rem;
  border: 1px solid #c7d2fe;
  color: #4338ca;
  background: #eef2ff;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}
.slot-view-edit-btn:hover {
  background: #e0e7ff;
  border-color: #a5b4fc;
}

/* Toast */
.toast-container .toast-item {
  pointer-events: auto;
  background: #0f172a;
  color: #fff;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  animation: toast-in 0.2s ease;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Calendar */
.cal-month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  background: #e2e8f0;
  border: 1px solid #e2e8f0;
}
.cal-month-head {
  background: #f8fafc;
  padding: 0.5rem;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
}
.cal-day-cell {
  background: #fff;
  min-height: 100px;
  padding: 0.35rem;
  cursor: pointer;
  transition: background 0.15s;
  display: flex;
  flex-direction: column;
}
.cal-day-cell:hover { background: #f8fafc; }
.cal-day-cell.other-month { background: #fafafa; color: #94a3b8; }
.cal-day-cell.cal-day-free { background: #ecfdf5; }
.cal-day-cell.cal-day-free:hover { background: #d1fae5; }
.cal-day-cell.cal-day-busy { background: #fef2f2; }
.cal-day-cell.cal-day-busy:hover { background: #fee2e2; }
.cal-day-cell.other-month.cal-day-free { background: #f0fdf8; }
.cal-day-cell.other-month.cal-day-busy { background: #fff5f5; }
.cal-week-col.cal-day-free { background: #ecfdf5; }
.cal-week-col.cal-day-busy { background: #fef2f2; }
.cal-day-status {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: auto;
  padding-top: 0.25rem;
}
.cal-day-free .cal-day-status { color: #059669; }
.cal-day-busy .cal-day-status { color: #dc2626; }
.cal-day-cell.today .cal-day-num {
  background: #4338ca;
  color: #fff;
  border-radius: 999px;
}
.cal-day-num {
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  width: 1.75rem;
  height: 1.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 1;
}
.cal-slot-chip {
  font-size: 0.65rem;
  padding: 0.15rem 0.35rem;
  border-radius: 0.25rem;
  margin-bottom: 0.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border: 1px solid transparent;
  cursor: pointer;
}
.cal-slot-booked { background: #e0e7ff; color: #3730a3; border-color: #c7d2fe; }
.cal-slot-past { background: #f1f5f9; color: #94a3b8; border-color: #e2e8f0; }

.availability-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  background: #fff;
}
.availability-pick-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.75rem 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.availability-pick-item:hover {
  border-color: #a5b4fc;
  background: #eef2ff;
}

.sidebar-avail-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 2.75rem;
  padding: 0 1rem;
  border: none;
  border-radius: 0.5rem;
  background: #4338ca;
  color: #fff;
  font-weight: 600;
  font-size: 0.9375rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
  cursor: pointer;
  transition: background 0.15s ease;
}
.sidebar-avail-btn:hover {
  background: #3730a3;
}

.availability-form {
  border: 1px solid #f1f5f9;
  border-radius: 0.5rem;
  padding: 1rem;
  background: #f8fafc;
}

.app-btn-primary {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 0.375rem;
  background: #4338ca;
  color: #fff;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background 0.15s ease;
}
.app-btn-primary:hover {
  background: #3730a3;
}

.duration-option {
  display: block;
  cursor: pointer;
}
.duration-option span {
  display: block;
  text-align: center;
  padding: 0.5rem 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #475569;
  transition: all 0.15s;
}
.duration-option input:checked + span {
  background: #4338ca;
  border-color: #4338ca;
  color: #fff;
}
.duration-option:hover span {
  border-color: #a5b4fc;
}

.cal-week {
  display: flex;
  flex-direction: column;
  min-width: 700px;
}
.cal-week-header {
  display: grid;
  grid-template-columns: 56px repeat(7, 1fr);
  border-bottom: 1px solid #e2e8f0;
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 2;
}
.cal-week-body {
  display: grid;
  grid-template-columns: 56px repeat(7, 1fr);
  flex: 1;
}
.cal-hour-label {
  font-size: 0.7rem;
  color: #94a3b8;
  text-align: right;
  padding: 0.25rem 0.5rem;
  border-bottom: 1px solid #f1f5f9;
  height: 48px;
}
.cal-week-col {
  border-left: 1px solid #f1f5f9;
  position: relative;
}
.cal-week-day-head {
  padding: 0.5rem;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  border-left: 1px solid #f1f5f9;
}
.cal-week-day-head.today { color: #4338ca; }
.cal-week-slot {
  position: absolute;
  left: 2px;
  right: 2px;
  border-radius: 0.25rem;
  padding: 0.2rem 0.35rem;
  font-size: 0.65rem;
  overflow: hidden;
  cursor: pointer;
  z-index: 1;
  border: 1px solid transparent;
}

/* Mini calendar */
.mini-cal { width: 100%; }
.mini-cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}
.mini-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  text-align: center;
  font-size: 0.75rem;
}
.mini-cal-day {
  padding: 0.35rem 0;
  border-radius: 0.375rem;
  cursor: pointer;
}
.mini-cal-day:hover { background: #f1f5f9; }
.mini-cal-day.selected { background: #4338ca; color: #fff; }
.mini-cal-day.today:not(.selected) { font-weight: 700; color: #4338ca; }
.mini-cal-wd { color: #94a3b8; font-size: 0.65rem; font-weight: 600; }

.upcoming-item {
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid #e2e8f0;
  background: #fff;
  font-size: 0.8rem;
  cursor: pointer;
  transition: border-color 0.15s;
}
.upcoming-item:hover { border-color: #c7d2fe; }

#jitsi-container iframe { width: 100% !important; height: 100% !important; }
