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

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

:root {
  --shell-safe-top: env(safe-area-inset-top, 0px);
  --shell-safe-bottom: env(safe-area-inset-bottom, 0px);
  --shell-safe-left: env(safe-area-inset-left, 0px);
  --shell-safe-right: env(safe-area-inset-right, 0px);
  --impersonation-banner-height: 0px;
  --push-prompt-banner-height: 0px;
  --brand-dark: #1e1b4b;
  --brand-dark-hover: #312e81;
  --brand-dark-focus: rgba(30, 27, 75, 0.18);
  --brand-light: #eef0f8;
  --brand-light-hover: #e2e6f2;
  --brand-light-border: #c5cae4;
}

body.push-prompt-visible {
  --push-prompt-banner-height: 3.5rem;
}

body.push-prompt-visible:not(:has(.impersonation-banner)) {
  --push-prompt-banner-height: calc(3.5rem + var(--shell-safe-top));
}

body:has(.impersonation-banner),
body.push-prompt-visible {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  height: -webkit-fill-available;
  overflow: hidden;
}

body:has(.impersonation-banner) {
  --impersonation-banner-height: 2.75rem;
}

body:has(.impersonation-banner) #app.app-shell,
body.push-prompt-visible #app.app-shell {
  flex: 1;
  min-height: 0;
  height: auto !important;
}

body {
  margin: 0;
  font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-height: 100dvh;
  min-height: -webkit-fill-available;
}

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

.app-shell--impersonating {
  min-height: 0;
}

.impersonation-banner {
  position: sticky;
  top: 0;
  z-index: 60;
  background: linear-gradient(90deg, #7c2d12, #9a3412);
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  flex-shrink: 0;
  padding-top: var(--shell-safe-top);
}

.impersonation-banner-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.625rem 1rem;
  max-width: 100%;
}

.impersonation-banner-text {
  font-size: 0.8125rem;
  line-height: 1.4;
}

.impersonation-banner-btn {
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-radius: 0.5rem;
  padding: 0.4rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

.impersonation-banner-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.push-prompt-banner {
  position: sticky;
  top: 0;
  z-index: 55;
  flex-shrink: 0;
  background: linear-gradient(90deg, var(--brand-dark), var(--brand-dark-hover));
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

body:not(:has(.impersonation-banner)) .push-prompt-banner {
  padding-top: var(--shell-safe-top);
}

.push-prompt-banner.hidden {
  display: none;
}

.push-prompt-banner-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.625rem 1rem;
}

.push-prompt-banner-text {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.35;
  flex: 1;
  min-width: 0;
}

.push-prompt-banner-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.push-prompt-banner-btn {
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-radius: 0.5rem;
  padding: 0.4rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.push-prompt-banner-btn:hover {
  background: rgba(255, 255, 255, 0.18);
}

.push-prompt-banner-btn--primary {
  background: #fff;
  color: var(--brand-dark);
  border-color: #fff;
}

.push-prompt-banner-btn--primary:hover {
  background: #f8fafc;
}

@media (max-width: 520px) {
  .push-prompt-banner-inner {
    flex-direction: column;
    align-items: stretch;
  }

  body.push-prompt-visible {
    --push-prompt-banner-height: 5.5rem;
  }

  body.push-prompt-visible:not(:has(.impersonation-banner)) {
    --push-prompt-banner-height: calc(5.5rem + var(--shell-safe-top));
  }

  .push-prompt-banner-actions {
    justify-content: flex-end;
  }
}

.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: var(--brand-dark);
  box-shadow: 0 0 0 3px var(--brand-dark-focus);
}

/* 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;
}

input[type="time"].app-input,
input[type="date"].app-input,
input[type="month"].app-input,
input[type="datetime-local"].app-input {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  -webkit-min-logical-width: 0;
  height: 2.75rem;
  min-height: 2.75rem;
  max-height: 2.75rem;
  padding: 0 0.75rem;
  line-height: normal;
  box-sizing: border-box;
  background-color: #fff;
  color: #0f172a;
  font-family: inherit;
  overflow: hidden;
}

input[type="date"].app-input::-webkit-date-and-time-value,
input[type="month"].app-input::-webkit-date-and-time-value,
input[type="time"].app-input::-webkit-date-and-time-value {
  min-width: 0;
  text-align: left;
  margin: auto 0;
  line-height: 2.75rem;
  height: 2.75rem;
}

input[type="date"].app-input::-webkit-datetime-edit,
input[type="month"].app-input::-webkit-datetime-edit,
input[type="time"].app-input::-webkit-datetime-edit {
  display: flex;
  align-items: center;
  min-width: 0;
  max-width: 100%;
  height: 100%;
  padding: 0;
  margin: 0;
  line-height: 1.25;
  overflow: hidden;
}

input[type="date"].app-input::-webkit-datetime-edit-fields-wrapper,
input[type="month"].app-input::-webkit-datetime-edit-fields-wrapper,
input[type="time"].app-input::-webkit-datetime-edit-fields-wrapper {
  display: flex;
  align-items: center;
  min-width: 0;
  height: 100%;
  padding: 0;
}

input[type="date"].app-input::-webkit-datetime-edit-text,
input[type="date"].app-input::-webkit-datetime-edit-month-field,
input[type="date"].app-input::-webkit-datetime-edit-day-field,
input[type="date"].app-input::-webkit-datetime-edit-year-field,
input[type="month"].app-input::-webkit-datetime-edit-month-field,
input[type="month"].app-input::-webkit-datetime-edit-year-field,
input[type="time"].app-input::-webkit-datetime-edit-hour-field,
input[type="time"].app-input::-webkit-datetime-edit-minute-field,
input[type="time"].app-input::-webkit-datetime-edit-ampm-field {
  padding: 0;
  line-height: 1.25;
}

input[type="date"].app-input::-webkit-calendar-picker-indicator,
input[type="month"].app-input::-webkit-calendar-picker-indicator,
input[type="time"].app-input::-webkit-calendar-picker-indicator {
  margin: 0 0 0 0.25rem;
  padding: 0;
  flex-shrink: 0;
}

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,
  input[type="time"].app-input,
  input[type="date"].app-input,
  input[type="month"].app-input,
  input[type="datetime-local"].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-drag-zone {
  display: none;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  width: 18rem;
  max-width: 85vw;
  transform: translateX(-100%);
  transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
  background: #fff;
}
#app.sidebar-open .sidebar {
  transform: translateX(0);
}
.sidebar.is-sidebar-dragging {
  transition: none !important;
  will-change: transform;
}
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  z-index: 30;
  opacity: 0;
  transition: opacity 0.28s ease;
  min-height: 100dvh;
  min-height: -webkit-fill-available;
}

/* ——— Mobile app drawer (calendário + definições) ——— */
.app-drawer-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(15, 23, 42, 0.5);
  opacity: 0;
  transition: opacity 0.25s ease;
  -webkit-tap-highlight-color: transparent;
}

.app-drawer-drag {
  display: none;
}

@media (max-width: 899px) {
  body.drawer-open {
    overflow: hidden;
    touch-action: none;
  }

  .app-drawer {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(18.5rem, 88vw);
    max-width: 88vw;
    z-index: 50;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: #fff;
    box-shadow: 4px 0 28px rgba(15, 23, 42, 0.18);
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
    padding-top: var(--shell-safe-top);
    padding-bottom: var(--shell-safe-bottom);
    padding-left: var(--shell-safe-left);
    box-sizing: border-box;
    pointer-events: none;
    overflow: hidden;
    border: none;
    border-radius: 0;
  }

  #app.sidebar-open .sidebar.app-drawer,
  .settings-page.is-nav-open .settings-rail.app-drawer {
    transform: translateX(0);
    pointer-events: auto;
  }

  .settings-page .settings-rail.app-drawer {
    position: fixed;
  }

  .app-drawer-drag {
    display: block;
    flex-shrink: 0;
    touch-action: none;
    cursor: grab;
    padding-top: 0.35rem;
  }

  .app-drawer-brand,
  .sidebar-brand {
    flex-shrink: 0;
    min-height: 3.5rem;
    height: auto;
    padding-top: 0;
    border-bottom-color: rgba(226, 232, 240, 0.7);
  }

  .sidebar-body,
  .settings-rail-inner {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .settings-rail-inner {
    padding: 0.875rem 1.25rem 1rem;
  }

  .sidebar-footer {
    flex-shrink: 0;
    border-top-color: rgba(226, 232, 240, 0.7);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, rgba(248, 250, 252, 0.92) 100%);
    padding-bottom: 0.5rem;
  }

  .settings-page .settings-main {
    padding-top: calc(0.75rem + var(--shell-safe-top));
  }

  #app.sidebar-open .sidebar-backdrop,
  #app.sidebar-open .app-drawer-backdrop,
  .settings-page.is-nav-open .app-drawer-backdrop {
    display: block;
    opacity: 1;
  }
}

.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 (max-width: 899px) {
  /* Sem banner no topo: o cabeçalho precisa de safe-area (PWA / notch) */
  body:not(:has(.impersonation-banner)):not(.push-prompt-visible) .app-header {
    padding-top: calc(var(--shell-safe-top) + 0.5rem);
    height: auto !important;
    min-height: calc(4rem + var(--shell-safe-top) + 0.5rem);
  }

  .app-header {
    position: relative;
    z-index: 20;
    flex-shrink: 0;
  }

  .sidebar-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.75rem;
    min-height: 2.75rem;
    padding: 0;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    background: #fff;
    color: #334155;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }

  .sidebar-toggle-btn:hover,
  .sidebar-toggle-btn:active {
    background: #f8fafc;
  }

  .sidebar {
    pointer-events: none;
  }

  #app.sidebar-open .sidebar {
    pointer-events: auto;
  }
}
@media (min-width: 900px) {
  .sidebar-backdrop,
  .app-drawer-backdrop,
  .settings-nav-backdrop {
    display: none !important;
    pointer-events: none !important;
    opacity: 0 !important;
  }

  .sidebar {
    position: relative;
    transform: none;
    width: 18rem;
    max-width: none;
    height: 100%;
    min-height: 0;
    flex-shrink: 0;
    overflow: hidden;
    transition: width 0.22s ease, opacity 0.22s ease, border-color 0.22s ease;
    z-index: auto;
    padding: 0;
  }
  #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);
  touch-action: none;
}
.dialog-panel {
  position: relative;
  z-index: 1;
  max-height: 90vh;
  overflow: auto;
}

.sheet-drag-zone {
  display: none;
}

.sheet-handle {
  display: flex;
  justify-content: center;
  padding: 0.55rem 0 0.1rem;
}

.sheet-handle span {
  width: 2.5rem;
  height: 0.3rem;
  border-radius: 999px;
  background: rgba(100, 116, 139, 0.35);
}

.dialog-panel.is-sheet-dragging {
  transition: none !important;
  will-change: transform;
}

html.sheet-open,
html.sheet-open body {
  overflow: hidden;
  overscroll-behavior: none;
}

@keyframes sheet-up {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

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

@media (max-width: 899px) {
  .dialog-overlay {
    align-items: flex-end;
    justify-content: center;
    padding: 0;
  }

  .dialog-backdrop {
    background: rgba(15, 23, 42, 0.55);
  }

  .dialog-panel {
    width: 100%;
    max-width: 100% !important;
    margin: 0 !important;
    max-height: min(92dvh, 92vh);
    border-bottom-left-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
    border-top-left-radius: 1.25rem !important;
    border-top-right-radius: 1.25rem !important;
    box-shadow: 0 -12px 40px rgba(15, 23, 42, 0.18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    touch-action: pan-y;
    overscroll-behavior: contain;
    animation: sheet-up 0.28s cubic-bezier(0.32, 0.72, 0, 1);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .sheet-drag-zone {
    display: block;
    flex-shrink: 0;
    touch-action: none;
    cursor: grab;
  }

  .dialog-panel .overflow-auto,
  #slot-view-body,
  #slot-edit-form,
  #profile-form,
  .dialog-panel form {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  #slot-view-header,
  #slot-view-actions,
  .dialog-panel > .flex-shrink-0,
  .dialog-panel > .px-6.py-4.border-b {
    flex-shrink: 0;
  }

  .dialog-panel > .px-6.py-5.overflow-auto,
  .dialog-panel > .px-6.py-5.flex.flex-col.gap-4.overflow-auto,
  .dialog-panel > .px-6.py-5.flex.flex-col.gap-5.overflow-auto {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}

@media (min-width: 900px) {
  .dialog-panel {
    animation: dialog-pop 0.22s ease;
  }
}

/* Slot view modal */
.slot-view-panel {
  display: flex;
  flex-direction: column;
  max-height: min(90vh, 90dvh);
  overflow: hidden;
}
.slot-view-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.slot-view-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex-shrink: 0;
  background: #fff;
  border-top: 1px solid #f1f5f9;
  padding-bottom: max(1.25rem, env(safe-area-inset-bottom, 0px));
}
.slot-view-actions button {
  box-sizing: border-box;
  min-height: 2.75rem;
}
.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-badge--series {
  background: #f5f3ff;
  color: #6d28d9;
}
.slot-view-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.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: var(--brand-dark);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.15s ease;
}
.slot-view-call-btn:hover {
  background: var(--brand-dark-hover);
}
.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;
  cursor: pointer;
}
.slot-view-cancel-btn:hover {
  background: #fef2f2;
}
.slot-view-cancel-series-btn {
  width: 100%;
  padding: 0.65rem 1rem;
  border-radius: 0.65rem;
  border: 1px solid #ddd6fe;
  color: #6d28d9;
  background: #fff;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}
.slot-view-cancel-series-btn:hover {
  background: #f5f3ff;
}
.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-edit-btn {
  width: 100%;
  padding: 0.65rem 1rem;
  border-radius: 0.65rem;
  border: 1px solid rgba(30, 27, 75, 0.2);
  color: var(--brand-dark);
  background: rgba(30, 27, 75, 0.06);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}
.slot-view-edit-btn:hover {
  background: rgba(30, 27, 75, 0.1);
  border-color: rgba(30, 27, 75, 0.35);
}

/* 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 */
#calendar-view {
  transition: opacity 0.15s ease;
}
#calendar-view.is-loading {
  opacity: 0.55;
  pointer-events: none;
}
.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-month-head.weekend {
  color: #6d28d9;
  background: #f5f3ff;
  font-weight: 800;
}
.cal-day-cell {
  position: relative;
  background: #fff;
  min-height: 100px;
  padding: 0.35rem;
  padding-top: 0.55rem;
  cursor: pointer;
  transition: background 0.15s;
  display: flex;
  flex-direction: column;
}
.cal-day-holiday-badge {
  position: absolute;
  top: 0.15rem;
  right: 0.2rem;
  z-index: 1;
  pointer-events: none;
}
.cal-day-holiday-badge-star {
  font-size: 0.7rem;
  line-height: 1;
  color: #d97706;
}
.cal-day-cell:hover { background: #f8fafc; }
.cal-day-cell.other-month { color: #94a3b8; }
.cal-day-cell.other-month:not(.cal-day-free):not(.cal-day-busy) { background: #fafafa; }
.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: #f3faf7; }
.cal-day-cell.other-month.cal-day-free:hover { background: #eaf7f1; }
.cal-day-cell.other-month.cal-day-busy { background: #fdf5f5; }
.cal-day-cell.other-month.cal-day-busy:hover { background: #fbeaea; }
.cal-day-cell.cal-day-weekend:not(.cal-day-holiday):not(.cal-day-free):not(.cal-day-busy) { background: #f8fafc; }
.cal-day-cell.cal-day-weekend:not(.cal-day-holiday):not(.cal-day-free):not(.cal-day-busy):hover { background: #f1f5f9; }
.cal-day-cell.cal-day-holiday:not(.cal-day-free):not(.cal-day-busy) { background: #fffbeb; }
.cal-day-cell.cal-day-holiday:not(.cal-day-free):not(.cal-day-busy):hover { background: #fef3c7; }
.cal-day-cell.cal-day-holiday.cal-day-weekend:not(.cal-day-free):not(.cal-day-busy) {
  background: #fdf4ff;
  box-shadow: inset 0 0 0 1px rgba(217, 119, 6, 0.18);
}
.cal-day-cell.cal-day-holiday.cal-day-weekend:not(.cal-day-free):not(.cal-day-busy):hover { background: #fce7f3; }
.cal-day-cell.cal-day-past.cal-day-holiday.cal-day-weekend:not(.cal-day-free):not(.cal-day-busy) {
  background: #f8fafc;
  box-shadow: none;
}
.cal-day-cell.cal-day-past.cal-day-holiday.cal-day-weekend:not(.cal-day-free):not(.cal-day-busy):hover { background: #f1f5f9; }
.cal-day-cell.other-month.cal-day-past.cal-day-holiday.cal-day-weekend:not(.cal-day-free):not(.cal-day-busy) { background: #f5f7fa; }
.cal-day-cell.cal-day-holiday.cal-day-free { background: #ecfdf5; }
.cal-day-cell.cal-day-holiday.cal-day-busy { background: #fef2f2; }
.cal-day-cell.other-month.cal-day-weekend:not(.cal-day-holiday):not(.cal-day-free):not(.cal-day-busy) { background: #f5f7fa; }
.cal-day-cell.other-month.cal-day-holiday:not(.cal-day-free):not(.cal-day-busy) { background: #fffdf5; }
.cal-day-cell.other-month.cal-day-holiday.cal-day-weekend:not(.cal-day-free):not(.cal-day-busy) { background: #fdf8ff; }
.cal-week-col.cal-day-free { background: #ecfdf5; }
.cal-week-col.cal-day-busy { background: #fef2f2; }
.cal-week-col.cal-day-weekend:not(.cal-day-holiday):not(.cal-day-free):not(.cal-day-busy) { background: #f8fafc; }
.cal-week-col.cal-day-holiday:not(.cal-day-free):not(.cal-day-busy) { background: #fffbeb; }
.cal-week-col.cal-day-holiday.cal-day-weekend:not(.cal-day-free):not(.cal-day-busy) { background: #fdf4ff; }
.cal-week-col.cal-day-past.cal-day-holiday.cal-day-weekend:not(.cal-day-free):not(.cal-day-busy) { background: #f8fafc; }
.cal-week-col.other-month.cal-day-free,
.cal-week-col.cal-day-holiday.cal-day-free { background: #ecfdf5; }
.cal-week-col.other-month.cal-day-busy,
.cal-week-col.cal-day-holiday.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;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cal-day-free .cal-day-status { color: #059669; }
.cal-day-busy .cal-day-status { color: #dc2626; }
.cal-day-cell.other-month.cal-day-free .cal-day-status { color: #6ee7b7; }
.cal-day-cell.other-month.cal-day-busy .cal-day-status { color: #fca5a5; }
.cal-day-cell.other-month .cal-day-num { color: #94a3b8; }
.cal-day-cell.today .cal-day-num {
  background: var(--brand-dark);
  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: #e2e8f0; color: #64748b; border-color: #cbd5e1; }

.cal-slot-chip.cal-slot-colored,
.cal-week-slot.cal-slot-colored {
  background: color-mix(in srgb, var(--slot-color) 28%, #ffffff);
  color: var(--slot-text);
  border-color: color-mix(in srgb, var(--slot-color) 55%, #ffffff);
  font-weight: 600;
}

.cal-slot-chip.cal-slot-colored.cal-slot-colored-past,
.cal-week-slot.cal-slot-colored.cal-slot-colored-past {
  background: color-mix(
    in srgb,
    color-mix(in srgb, var(--slot-color) 14%, #ffffff) 70%,
    #e2e8f0
  );
  color: var(--slot-text);
  border-color: color-mix(
    in srgb,
    color-mix(in srgb, var(--slot-color) 28%, #ffffff) 55%,
    #cbd5e1
  );
  font-weight: 500;
  opacity: 0.88;
}

.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-avatar {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  background: var(--brand-dark);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

button.sidebar-avail-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0.625rem 1rem;
  border: none;
  border-radius: 0.5rem;
  background-color: var(--brand-dark);
  color: #fff;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.9375rem;
  line-height: 1.25;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: background-color 0.15s ease;
}
button.sidebar-avail-btn:hover {
  background-color: var(--brand-dark-hover);
}
button.sidebar-avail-btn:focus-visible {
  outline: 2px solid var(--brand-dark-hover);
  outline-offset: 2px;
}

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

.blocked-day-chip {
  cursor: pointer;
}
.blocked-day-chip span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.375rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #475569;
  background: #fff;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.blocked-day-chip input:checked + span {
  border-color: var(--brand-dark);
  background: rgba(30, 27, 75, 0.08);
  color: var(--brand-dark);
}

.app-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 0.375rem;
  background: var(--brand-dark);
  color: #fff;
  font-weight: 600;
  font-size: 0.875rem;
  line-height: 1.25;
  cursor: pointer;
  transition: background 0.15s ease;
}
.app-btn-primary:hover {
  background: var(--brand-dark-hover);
}
.app-btn-primary:focus-visible {
  outline: 2px solid var(--brand-dark-hover);
  outline-offset: 2px;
}
.app-btn-primary--block {
  width: 100%;
  min-height: 2.75rem;
  border-radius: 0.5rem;
  font-size: 1rem;
}
.app-btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.625rem 1rem;
  border: 1px solid rgba(30, 27, 75, 0.2);
  border-radius: 0.5rem;
  background: rgba(30, 27, 75, 0.04);
  color: var(--brand-dark);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.app-btn-outline:hover {
  background: rgba(30, 27, 75, 0.08);
  border-color: rgba(30, 27, 75, 0.35);
}
.app-text-link {
  color: var(--brand-dark);
  font-weight: 600;
}
.app-text-link:hover {
  color: var(--brand-dark-hover);
}

.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: var(--brand-dark);
  border-color: var(--brand-dark);
  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;
  align-items: start;
  align-content: start;
}
.cal-week-time-col {
  display: grid;
  grid-template-rows: repeat(28, 24px);
  align-content: start;
  height: 672px;
  box-shadow: inset -1px 0 0 #cbd5e1;
}
.cal-hour-label {
  grid-row: span 2;
  font-size: 0.7rem;
  color: #94a3b8;
  text-align: right;
  padding: 0.25rem 0.5rem;
  border-bottom: 1px solid #e2e8f0;
  box-sizing: border-box;
  min-height: 0;
}
.cal-week-col {
  position: relative;
  box-shadow: inset 1px 0 0 #cbd5e1;
}
.cal-week-day-track {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: repeat(28, 24px);
  height: 672px;
  position: relative;
}
.cal-week-hour-cell {
  grid-column: 1;
  border-bottom: 1px solid #f1f5f9;
  box-sizing: border-box;
  min-height: 0;
  pointer-events: none;
}
.cal-week-hour-cell--hour {
  border-bottom-color: #e2e8f0;
}
.cal-week-day-head {
  padding: 0.5rem;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  box-shadow: inset 1px 0 0 #cbd5e1;
}
.cal-week-day-head.today { color: var(--brand-dark); }
.cal-week-day-head.weekend { background: #f8fafc; color: #64748b; }
.cal-week-day-head.weekend .font-bold { color: #6d28d9; }
.cal-week-day-head.holiday { background: #fffbeb; color: #b45309; }
.cal-week-day-head.holiday.weekend { background: #fdf4ff; }
.cal-week-day-head.holiday.weekend .font-bold { color: #7c3aed; }
.cal-week-holiday-name {
  margin-top: 0.15rem;
  font-size: 0.55rem;
  font-weight: 700;
  line-height: 1.15;
  color: #b45309;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.cal-week-slot {
  grid-column: 1;
  z-index: 1;
  margin: 1px 2px;
  border-radius: 0.25rem;
  padding: 0.2rem 0.35rem;
  font-size: 0.65rem;
  overflow: hidden;
  cursor: pointer;
  border: 1px solid transparent;
  box-sizing: border-box;
  align-self: stretch;
  min-height: 0;
}

/* 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:not(.mini-cal-free):not(.mini-cal-busy):not(.mini-cal-booked):not(.selected):hover { background: #f1f5f9; }
.mini-cal-day.mini-cal-free:not(.selected):hover { background: #d1fae5; }
.mini-cal-day.mini-cal-busy:not(.selected):hover { background: #fee2e2; }
.mini-cal-day.mini-cal-booked:not(.selected):hover { background: #c7d2fe; }
.mini-cal-day.selected { background: var(--brand-dark); color: #fff !important; font-weight: 700; }
.mini-cal-day.today:not(.selected) { font-weight: 700; }
.mini-cal-day.today:not(.selected):not(.mini-cal-free):not(.mini-cal-busy):not(.mini-cal-booked) { color: var(--brand-dark); }
.mini-cal-day.weekend:not(.selected) { background: #f8fafc; }
.mini-cal-day.holiday:not(.selected) { background: #fffbeb; color: #b45309; font-weight: 700; }
.mini-cal-day.past.holiday.weekend:not(.selected):not(.mini-cal-booked) { background: #f8fafc; color: #94a3b8; font-weight: 600; }
.mini-cal-day.mini-cal-free:not(.selected) { background: #ecfdf5; color: #059669; font-weight: 600; }
.mini-cal-day.mini-cal-busy:not(.selected) { background: #fef2f2; color: #dc2626; font-weight: 600; }
.mini-cal-day.mini-cal-booked:not(.selected) { background: #e0e7ff; color: #3730a3; font-weight: 600; }
.mini-cal-day.other-month:not(.selected) { opacity: 0.55; }
.mini-cal-day.other-month.mini-cal-free:not(.selected) { background: #f3faf7; color: #6ee7b7; }
.mini-cal-day.other-month.mini-cal-busy:not(.selected) { background: #fdf5f5; color: #fca5a5; }
.mini-cal-day.other-month.mini-cal-booked:not(.selected) { background: #eef2ff; color: #818cf8; }
.mini-cal-day.past.mini-cal-booked:not(.selected) { opacity: 0.72; }
.mini-cal-wd { color: #94a3b8; font-size: 0.65rem; font-weight: 600; }
.mini-cal-wd.weekend { color: #6d28d9; font-weight: 800; }

.avail-picker-cal {
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  padding: 0.75rem;
  background: #fafafa;
  position: relative;
}
.avail-picker-cal.is-loading::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: rgba(255, 255, 255, 0.45);
  pointer-events: none;
}
.avail-picker-day.pending:not(.past) {
  background: #f8fafc;
  border-color: #e2e8f0;
  color: #94a3b8;
  cursor: wait;
}
.avail-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}
.avail-picker-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.35rem;
}
.avail-picker-wd {
  text-align: center;
  color: #94a3b8;
  font-size: 0.65rem;
  font-weight: 600;
  padding-bottom: 0.25rem;
}
.avail-picker-wd.weekend {
  color: #6d28d9;
  font-weight: 800;
}
.avail-picker-day {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: 3.5rem;
  padding: 0.45rem 0.15rem 0.35rem;
  border: 1px solid transparent;
  border-radius: 0.5rem;
  background: #fff;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
  overflow: hidden;
}
.avail-picker-day .cal-day-holiday-badge {
  position: absolute;
  top: 0.1rem;
  right: 0.12rem;
}
.avail-picker-day .cal-day-holiday-badge-star {
  font-size: 0.65rem;
}
.avail-picker-day:hover:not(:disabled) { background: #f8fafc; }
.avail-picker-day.other-month:not(.free):not(.busy):not(.holiday) { opacity: 0.35; }
.avail-picker-day.past:not(.holiday) {
  opacity: 0.45;
  cursor: not-allowed;
  background: #f8fafc;
}
.avail-picker-day.past.holiday:not(.free):not(.busy) {
  opacity: 0.72;
  cursor: not-allowed;
  background: #fffbeb;
  border-color: #fde68a;
}
.avail-picker-day.past.holiday.weekend:not(.free):not(.busy) {
  opacity: 0.45;
  cursor: not-allowed;
  background: #f8fafc;
  border-color: transparent;
}
.avail-picker-day.free { background: #ecfdf5; border-color: #a7f3d0; }
.avail-picker-day.busy { background: #fef2f2; border-color: #fecaca; }
.avail-picker-day.other-month.free { background: #f3faf7; border-color: #d1fae5; }
.avail-picker-day.other-month.busy { background: #fdf5f5; border-color: #fecdd3; }
.avail-picker-day.weekend:not(.holiday):not(.selected):not(.free):not(.busy) { background: #f8fafc; }
.avail-picker-day.holiday:not(.free):not(.busy) {
  background: #fffbeb;
  border-color: #fde68a;
}
.avail-picker-day.holiday.weekend:not(.free):not(.busy) {
  background: #fdf4ff;
  border-color: #e9d5ff;
}
.avail-picker-day.holiday.free { background: #ecfdf5; border-color: #a7f3d0; }
.avail-picker-day.holiday.busy { background: #fef2f2; border-color: #fecaca; }
.avail-picker-day.other-month .avail-picker-day-num { color: #94a3b8; }
.avail-picker-day.other-month.free .avail-picker-day-hint { color: #6ee7b7; }
.avail-picker-day.other-month.busy .avail-picker-day-hint { color: #fca5a5; }
.avail-picker-day.selected {
  border-color: var(--brand-dark);
  box-shadow: 0 0 0 2px rgba(30, 27, 75, 0.15);
}
.avail-picker-day.today .avail-picker-day-num { color: var(--brand-dark); font-weight: 800; }
.avail-picker-day-num {
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.2;
  flex-shrink: 0;
}
.avail-picker-day-hints {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  width: 100%;
  margin-top: 0.15rem;
}
.avail-picker-day-hint {
  display: block;
  width: 100%;
  font-size: 0.55rem;
  line-height: 1.15;
  color: #64748b;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.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, background 0.15s;
}
.upcoming-item:hover { border-color: #c7d2fe; }

.upcoming-item-title {
  font-weight: 600;
  color: #1e293b;
}

.upcoming-item-meta {
  font-size: 0.75rem;
  color: #64748b;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.upcoming-item-call {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #4338ca;
}

.upcoming-item-call:hover {
  color: #312e81;
}

.upcoming-item--colored {
  background: color-mix(in srgb, var(--slot-color) 16%, #ffffff);
  border-color: color-mix(in srgb, var(--slot-color) 45%, #ffffff);
}

.upcoming-item--colored:hover {
  border-color: color-mix(in srgb, var(--slot-color) 65%, #ffffff);
}

.upcoming-item--colored .upcoming-item-title {
  color: var(--slot-text);
}

.upcoming-item--colored .upcoming-item-meta {
  color: color-mix(in srgb, var(--slot-text) 70%, #64748b);
}

.upcoming-item--colored .upcoming-item-call {
  color: var(--slot-text);
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sidebar-section + .sidebar-section {
  padding-top: 1rem;
  border-top: 1px solid #e2e8f0;
}

.sidebar-section-title {
  margin: 0;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #64748b;
}

.sidebar-section--upcoming {
  gap: 0.5rem;
}

.sidebar-section--summary {
  padding-top: 1rem;
}

#monthly-summary {
  min-height: 0;
}

.monthly-summary-card {
  border: 1px solid #e0e7ff;
  border-radius: 0.75rem;
  background: linear-gradient(180deg, #eef2ff 0%, #ffffff 100%);
  padding: 0.875rem;
}

.monthly-summary-card--sidebar {
  padding: 0.625rem 0.75rem;
  border-color: #e2e8f0;
  border-radius: 0.625rem;
  background: #f8fafc;
}

.monthly-summary-month-label {
  min-width: 0;
  font-size: 0.75rem;
  font-weight: 600;
  color: #4338ca;
}

.monthly-summary-total-inline {
  font-size: 0.9375rem;
  font-weight: 800;
  color: #0f172a;
  white-space: nowrap;
}

.monthly-summary-meta,
.monthly-summary-empty {
  margin: 0;
  font-size: 0.6875rem;
  line-height: 1.35;
  color: #64748b;
}

.monthly-summary-rows-wrap {
  min-height: 0;
}

.monthly-summary-card--sidebar .monthly-summary-rows-wrap {
  margin-top: 0.375rem;
}

.monthly-summary-card--sidebar.monthly-summary-card--loading .monthly-summary-total-inline {
  animation: summary-pulse 1.2s ease-in-out infinite;
}

.monthly-summary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.monthly-summary-card--sidebar .monthly-summary-head {
  margin-bottom: 0.125rem;
}

.monthly-summary-total {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.monthly-summary-rows {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  max-height: 7.5rem;
  overflow-y: auto;
}

.monthly-summary-card--sidebar .monthly-summary-rows {
  max-height: 6.5rem;
}

.monthly-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  background: #fff;
}

.monthly-summary-card--sidebar .monthly-summary-row {
  gap: 0.5rem;
  padding: 0.4375rem 0.5rem;
  border-color: #e8edf3;
  border-radius: 0.4375rem;
  background: #fff;
}

.monthly-summary-row-name {
  font-size: 0.75rem;
  font-weight: 600;
  color: #1e293b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.monthly-summary-row-meta {
  font-size: 0.625rem;
  color: #64748b;
  line-height: 1.3;
}

.monthly-summary-row-amount {
  font-size: 0.75rem;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
}

.monthly-summary-row {
  background: rgba(255, 255, 255, 0.85);
}

@keyframes summary-pulse {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}

@media (max-width: 899px) {
  .sidebar-body {
    gap: 1rem;
    padding-top: 0.875rem;
    padding-bottom: 0.875rem;
  }

  .sidebar-section {
    gap: 0.4375rem;
  }

  .sidebar-section + .sidebar-section {
    padding-top: 0;
    margin-top: 0.125rem;
    border-top: none;
  }

  .sidebar-section--summary {
    padding-top: 0;
  }

  .sidebar-section-title {
    font-size: 0.625rem;
    letter-spacing: 0.07em;
    color: #94a3b8;
  }

  .sidebar-brand {
    border-bottom: none;
    box-shadow: inset 0 -1px 0 rgba(226, 232, 240, 0.65);
  }

  .sidebar-footer {
    border-top: none;
    box-shadow: inset 0 1px 0 rgba(226, 232, 240, 0.65);
  }
}

.pricing-student-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  background: #fff;
}

.book-group-student-item {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  padding: 0.625rem 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  background: #fff;
  cursor: pointer;
}

.cal-slot-chip.cal-slot-group {
  background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
  border-color: #a5b4fc;
}

.cal-week-slot.cal-slot-group {
  background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
  border-color: #a5b4fc;
}

.cal-slot-chip.cal-slot-group.cal-slot-colored,
.cal-week-slot.cal-slot-group.cal-slot-colored {
  background: color-mix(in srgb, var(--slot-color) 32%, #ffffff);
  border-color: color-mix(in srgb, var(--slot-color) 65%, #ffffff);
  color: var(--slot-text);
  font-weight: 600;
}

.cal-slot-chip.cal-slot-group.cal-slot-colored.cal-slot-colored-past,
.cal-week-slot.cal-slot-group.cal-slot-colored.cal-slot-colored-past {
  background: color-mix(
    in srgb,
    color-mix(in srgb, var(--slot-color) 16%, #ffffff) 70%,
    #e2e8f0
  );
  border-color: color-mix(
    in srgb,
    color-mix(in srgb, var(--slot-color) 30%, #ffffff) 55%,
    #cbd5e1
  );
  color: var(--slot-text);
  font-weight: 500;
  opacity: 0.88;
}

.slot-view-badge--group {
  background: #eef2ff;
  color: #4338ca;
  border: 1px solid #c7d2fe;
}

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

/* Garante estilo do botão Disponibilidade (complementa o Tailwind compilado) */
#sidebar button.sidebar-avail-btn {
  background-color: var(--brand-dark);
  color: #fff;
  margin-bottom: 0.75rem;
}
#sidebar button.sidebar-avail-btn:hover {
  background-color: var(--brand-dark-hover);
}

/* Honeypot — hidden from humans, visible to naive bots */
.hp-field {
  position: absolute !important;
  left: -10000px !important;
  top: auto !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* ——— Settings page ——— */
.settings-page {
  min-height: 100dvh;
}

.settings-shell {
  max-width: 72rem;
  margin: 0 auto;
}

.settings-rail-inner {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.settings-intro-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  padding: 1rem 1.25rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.settings-intro-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.settings-intro-menu {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  background: #fff;
  color: #475569;
  flex-shrink: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.settings-intro-menu:hover,
.settings-intro-menu:active {
  background: #f8fafc;
}

.settings-intro-title {
  margin: 0;
  font-family: 'Manrope', sans-serif;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #0f172a;
}

.settings-intro-subtitle {
  margin: 0.125rem 0 0;
  font-size: 0.8125rem;
  color: #64748b;
}

.settings-rail-back {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding: 0.625rem 0.75rem;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #475569;
  text-decoration: none;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.settings-rail-back:hover {
  background: #f1f5f9;
  color: #334155;
  border-color: #cbd5e1;
}

.settings-rail-group + .settings-rail-group {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #f1f5f9;
}

.settings-rail-group-title {
  margin: 0 0 0.5rem;
  padding: 0 0.375rem;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #94a3b8;
}

.settings-rail-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.settings-rail-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.6875rem 0.75rem;
  border: none;
  border-radius: 0.75rem;
  background: transparent;
  color: #334155;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.settings-rail-item:hover,
.settings-rail-item:focus-visible {
  background: #f8fafc;
}

.settings-rail-item.is-active {
  background: var(--brand-light);
  color: var(--brand-dark);
}

.settings-rail-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  background: #f1f5f9;
  color: #64748b;
  flex-shrink: 0;
}

.settings-rail-item.is-active .settings-rail-icon {
  background: #fff;
  color: var(--brand-dark);
}

.settings-rail-copy {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  min-width: 0;
  flex: 1;
}

.settings-rail-label {
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1.25;
}

.settings-rail-desc {
  font-size: 0.6875rem;
  line-height: 1.3;
  color: #94a3b8;
  font-weight: 500;
}

.settings-rail-item.is-active .settings-rail-desc {
  color: var(--brand-dark-hover);
}

.settings-rail-arrow {
  color: #cbd5e1;
  flex-shrink: 0;
}

.settings-rail-item.is-active .settings-rail-arrow {
  color: var(--brand-dark-hover);
}

.settings-main {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 0.75rem 1rem 1.5rem;
  min-width: 0;
}

.settings-panel {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  padding: 1.25rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  min-width: 0;
}

.settings-panel > h2 {
  margin: 0 0 0.25rem;
  font-family: 'Manrope', sans-serif;
  font-size: 1.0625rem;
  font-weight: 800;
  color: #0f172a;
}

.settings-panel > p.text-sm.text-slate-500,
.settings-panel > p.text-sm.text-slate-600 {
  margin-bottom: 1.25rem;
}

.settings-info-card {
  border: 1px solid var(--brand-light-border);
  border-radius: 0.875rem;
  background: linear-gradient(180deg, var(--brand-light) 0%, #ffffff 100%);
  padding: 1rem;
  min-width: 0;
}

.settings-info-card-title {
  margin: 0 0 0.5rem;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--brand-dark);
}

.settings-danger-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 0.75rem;
  border: 1px solid #fecaca;
  border-radius: 0.5rem;
  background: #fff;
  color: #b91c1c;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
}

.settings-danger-btn:hover {
  background: #fef2f2;
}

.settings-field {
  min-width: 0;
  max-width: 100%;
}

.settings-panel form {
  min-width: 0;
  max-width: 100%;
}

.settings-list-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  background: #fff;
  min-width: 0;
}

.settings-list-item-body {
  min-width: 0;
  flex: 1;
}

.settings-list-item-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  flex-shrink: 0;
}

.email-audience-btn {
  padding: 0.5rem 0.875rem;
  border-radius: 0.5rem;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #475569;
  font-size: 0.8125rem;
  font-weight: 600;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.email-audience-btn.is-active {
  border-color: #312e81;
  background: #eef0f8;
  color: #1e1b4b;
}

.email-template-audience {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
  background: #eef0f8;
  color: #4338ca;
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  vertical-align: middle;
}

.email-test-status {
  margin-bottom: 1rem;
  padding: 0.875rem 1rem;
  border-radius: 0.5rem;
  border: 1px solid #e2e8f0;
  font-size: 0.8125rem;
  line-height: 1.5;
}

.email-test-status.is-success {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #065f46;
}

.email-test-status.is-error {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.email-test-status-time {
  font-size: 0.6875rem;
  opacity: 0.75;
  margin-bottom: 0.25rem;
}

.email-test-status-message {
  word-break: break-word;
}

.settings-inline-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0.75rem;
  border: none;
  border-radius: 0.5rem;
  background: var(--brand-dark);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
  transition: background 0.15s ease;
}

.settings-inline-btn:hover {
  background: var(--brand-dark-hover);
}

.settings-inline-btn:focus-visible {
  outline: 2px solid var(--brand-dark-hover);
  outline-offset: 2px;
}

.pricing-student-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.pricing-student-color {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.375rem;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  cursor: pointer;
  overflow: hidden;
  flex-shrink: 0;
}

.pricing-student-color-input {
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
}

.pricing-student-color-clear {
  min-width: 1.5rem;
  padding: 0.25rem 0.35rem;
  line-height: 1;
  opacity: 0.7;
}

.pricing-student-color-clear:disabled {
  opacity: 0.25;
  cursor: default;
}

.pricing-student-rate-input {
  width: 6.5rem;
  min-width: 0;
}

@media (max-width: 899px) {
  .settings-panel form,
  .settings-panel .settings-info-card {
    max-width: 100% !important;
    min-width: 0;
  }

  .settings-panel .grid {
    min-width: 0;
  }

  .settings-panel .grid-cols-2 {
    grid-template-columns: 1fr !important;
  }

  .settings-panel .grid > * {
    min-width: 0;
  }

  .settings-panel .app-input,
  .settings-panel textarea,
  .settings-panel select {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  .settings-weekdays {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    min-width: 0;
  }

  .settings-panel form > .flex.gap-2,
  .settings-panel .settings-info-card form > .flex.gap-2,
  #pricing-default-form > .flex.gap-2,
  #subject-form > .flex.gap-2,
  #school-year-form > .flex.gap-2 {
    flex-direction: column;
    align-items: stretch;
  }

  #pricing-default-form > .flex.gap-2 > .app-btn-primary,
  #subject-form > .flex.gap-2 > .app-btn-primary,
  #school-year-form > .flex.gap-2 > .app-btn-primary {
    width: 100%;
  }

  .pricing-student-item {
    flex-direction: column;
    align-items: stretch;
  }

  .pricing-student-actions {
    width: 100%;
  }

  .pricing-student-rate-input {
    flex: 1 1 auto;
    width: auto !important;
    min-width: 0;
  }

  .settings-list-item {
    flex-direction: column;
    align-items: stretch;
  }

  .settings-list-item-actions {
    justify-content: flex-start;
  }

  .settings-panel .availability-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .settings-panel .availability-item > .flex {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 0.5rem;
  }
}

@media (min-width: 900px) {
  .settings-list-item-actions {
    justify-content: flex-end;
    align-self: flex-start;
  }
}

@media (min-width: 900px) {
  .settings-intro-card,
  .settings-rail .app-drawer-brand,
  .settings-rail .app-drawer-drag,
  .settings-rail .sidebar-close-btn {
    display: none !important;
  }

  .settings-page .settings-main {
    padding-top: 1.5rem;
  }

  .settings-shell {
    display: grid;
    grid-template-columns: minmax(15.5rem, 18rem) minmax(0, 1fr);
    gap: 1.5rem;
    align-items: start;
    padding: 0 1.5rem 2rem;
  }

  .settings-rail.app-drawer {
    position: sticky;
    top: 1.5rem;
    transform: none;
    width: auto;
    max-width: none;
    height: auto;
    bottom: auto;
    left: auto;
    box-shadow: none;
    background: transparent;
    align-self: start;
    max-height: calc(100dvh - 3rem);
    pointer-events: auto;
    border: none;
    padding: 0;
    overflow: visible;
  }

  .settings-rail-inner {
    height: auto;
    max-height: calc(100dvh - 3rem);
    padding: 0.875rem;
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  }

  .settings-main {
    padding: 0;
    gap: 1.25rem;
  }

  .settings-panel {
    padding: 1.5rem;
  }
}

@media (min-width: 1024px) {
  .settings-shell {
    padding-top: 1.5rem;
  }
}

.settings-rail-item:focus-visible,
.settings-intro-menu:focus-visible,
.settings-rail-back:focus-visible {
  outline: 2px solid var(--brand-dark-hover);
  outline-offset: 2px;
}

.settings-day-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.55rem;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  font-size: 0.75rem;
  cursor: pointer;
  user-select: none;
  position: relative;
}

.settings-day-chip:has(input:checked) {
  border-color: var(--brand-dark-hover);
  background: var(--brand-light);
  color: var(--brand-dark);
}

.settings-list-item.is-editing,
.settings-panel .availability-item.is-editing {
  box-shadow: 0 0 0 2px var(--brand-light-border);
}

.settings-day-chip input { position: absolute; opacity: 0; pointer-events: none; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.profile-notify-option {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 0.875rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.profile-notify-option:has(.profile-notify-radio:checked) {
  border-color: #a5b4fc;
  background: #eef2ff;
}

.profile-notify-radio {
  margin-top: 0.2rem;
  flex-shrink: 0;
  accent-color: var(--brand-dark, #4338ca);
}

.profile-notify-option-title {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: #1e293b;
}

.profile-notify-option-desc {
  display: block;
  font-size: 0.75rem;
  color: #64748b;
  margin-top: 0.125rem;
}

.export-filters {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  max-width: 40rem;
}

@media (min-width: 640px) {
  .export-filters {
    grid-template-columns: 1fr 1fr auto;
    align-items: end;
  }
}

.export-csv-btn {
  width: 100%;
  height: 2.75rem;
  min-height: 2.75rem;
  max-height: 2.75rem;
  padding: 0 1rem;
  box-sizing: border-box;
  white-space: nowrap;
  font-size: 1rem;
  line-height: 1.25;
}

@media (min-width: 640px) {
  .export-csv-btn {
    width: auto;
    min-width: 9.5rem;
  }
}

.directory-push-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.125rem 0.4rem;
  border-radius: 999px;
  line-height: 1.4;
}

.directory-push-badge--on {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.directory-push-badge--off {
  background: #f8fafc;
  color: #94a3b8;
  border: 1px solid #e2e8f0;
}

.directory-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  background: #fff;
  color: #475569;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.directory-action-btn:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #1e293b;
}

.directory-action-btn--primary {
  background: var(--brand-dark, #4338ca);
  border-color: var(--brand-dark, #4338ca);
  color: #fff;
}

.directory-action-btn--primary:hover {
  background: var(--brand-dark-hover, #3730a3);
  border-color: var(--brand-dark-hover, #3730a3);
  color: #fff;
}

.directory-action-btn--danger {
  color: #dc2626;
}

.directory-action-btn--danger:hover {
  background: #fef2f2;
  border-color: #fecaca;
  color: #b91c1c;
}

.slot-view-notes--internal {
  border-color: #fde68a;
  background: #fffbeb;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--brand-dark-hover);
  outline-offset: 2px;
}

/* ---------- Testes e notas ---------- */
.cal-test-chip {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.35rem;
  margin-bottom: 0.15rem;
  border-radius: 0.25rem;
  border: 1px solid #fbbf24;
  background: #fef3c7;
  color: #92400e;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.cal-test-chip--pending { border-style: dashed; background: #fff7ed; color: #9a3412; }
.cal-test-chip--good { background: #dcfce7; border-color: #86efac; color: #166534; }
.cal-test-chip--ok { background: #fef9c3; border-color: #fde047; color: #854d0e; }
.cal-test-chip--bad { background: #fee2e2; border-color: #fca5a5; color: #991b1b; }
.cal-week-tests { margin-top: 0.25rem; display: flex; flex-direction: column; }
.cal-week-tests .cal-test-chip { white-space: normal; }

.sidebar-section-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.5rem; }
.sidebar-section-head .sidebar-section-title { margin: 0; }
.sidebar-add-test-btn {
  display: inline-flex; align-items: center; gap: 0.25rem;
  padding: 0.2rem 0.55rem; border-radius: 999px;
  border: 1px solid #fbbf24; background: #fffbeb; color: #92400e;
  font-size: 0.7rem; font-weight: 700; cursor: pointer;
}
.sidebar-add-test-btn:hover { background: #fef3c7; }
.sidebar-tests-link {
  display: inline-flex; align-items: center; gap: 0.25rem; margin-top: 0.5rem;
  font-size: 0.75rem; font-weight: 600; color: var(--brand-dark); text-decoration: none;
}
.sidebar-tests-link:hover { text-decoration: underline; }
.upcoming-test-item { border-left: 3px solid #fbbf24; }
.upcoming-test-item:hover { border-color: #f59e0b; }
.test-grade-hint { font-size: 0.75rem; color: #64748b; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 0.5rem; padding: 0.5rem 0.75rem; }

.tests-page { max-width: 56rem; margin: 0 auto; padding: 1rem 1rem 3rem; min-height: 100vh; background: #fafafa; }
.tests-header { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; padding: 0.5rem 0 1rem; }
.tests-back { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.85rem; font-weight: 600; color: #475569; text-decoration: none; padding: 0.4rem 0.7rem; border: 1px solid #e2e8f0; border-radius: 0.5rem; background: #fff; }
.tests-back:hover { background: #f1f5f9; }
.tests-title { font-family: Manrope, system-ui, sans-serif; font-weight: 800; font-size: 1.4rem; letter-spacing: -0.02em; flex: 1; margin: 0; }
.tests-new-btn { display: inline-flex; align-items: center; gap: 0.35rem; }
.tests-filters { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.tests-filters .app-input { width: auto; min-width: 12rem; flex: 1 1 12rem; }
.tests-content { display: flex; flex-direction: column; gap: 1rem; }
.tests-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 1rem; padding: 1rem 1.1rem; }
.tests-card-title { font-size: 0.7rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: #64748b; margin: 0 0 0.75rem; }
.tests-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.75rem; }
.tests-stat { background: #fff; border: 1px solid #e2e8f0; border-radius: 0.9rem; padding: 0.8rem 0.9rem; display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.tests-stat-label { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: #64748b; }
.tests-stat-value { font-family: Manrope, system-ui, sans-serif; font-size: 1.6rem; font-weight: 800; color: var(--brand-dark); line-height: 1.1; }
.tests-stat-hint { font-size: 0.72rem; color: #94a3b8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tests-empty { font-size: 0.85rem; color: #94a3b8; margin: 0; }
.tests-list, .tests-summary-list { display: flex; flex-direction: column; gap: 0.5rem; }
.tests-row { display: flex; align-items: center; gap: 0.75rem; width: 100%; text-align: left; padding: 0.6rem 0.75rem; border: 1px solid #e2e8f0; border-radius: 0.7rem; background: #fff; cursor: pointer; font: inherit; }
.tests-row:hover { border-color: #c7d2fe; background: #fafaff; }
.tests-row--static { cursor: default; }
.tests-row--static:hover { border-color: #e2e8f0; background: #fff; }
.tests-row-date { display: flex; flex-direction: column; align-items: center; min-width: 3rem; line-height: 1.15; }
.tests-row-date strong { font-size: 0.85rem; color: #1e293b; }
.tests-row-date small { font-size: 0.65rem; color: #94a3b8; }
.tests-row-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.tests-row-title { font-size: 0.88rem; font-weight: 700; color: #1e293b; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tests-row-meta { font-size: 0.75rem; color: #64748b; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tests-grade { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 800; font-size: 0.95rem; padding: 0.2rem 0.6rem; border-radius: 999px; flex-shrink: 0; }
.tests-grade--good { background: #dcfce7; color: #166534; }
.tests-grade--ok { background: #fef9c3; color: #854d0e; }
.tests-grade--bad { background: #fee2e2; color: #991b1b; }
.tests-pending { font-size: 0.75rem; font-weight: 700; color: #9a3412; background: #fff7ed; border: 1px dashed #fdba74; border-radius: 999px; padding: 0.2rem 0.6rem; flex-shrink: 0; }
.tests-days { font-size: 0.75rem; font-weight: 600; color: #64748b; flex-shrink: 0; }
.tests-chart { width: 100%; height: auto; display: block; }
.tests-chart-grid { stroke: #e2e8f0; stroke-width: 1; }
.tests-chart-pass { stroke: #fca5a5; stroke-width: 1; stroke-dasharray: 4 3; }
.tests-chart-label { font-size: 10px; fill: #94a3b8; }
.tests-legend { display: flex; flex-wrap: wrap; gap: 0.4rem 0.9rem; margin-top: 0.6rem; }
.tests-legend-item { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.75rem; color: #475569; }
.tests-legend-item i { width: 0.6rem; height: 0.6rem; border-radius: 999px; display: inline-block; }
@media (max-width: 640px) {
  .tests-stats { grid-template-columns: repeat(2, 1fr); }
  .tests-title { font-size: 1.2rem; }
  .tests-filters .app-input { min-width: 100%; }
}

/* Calendário da página de testes */
.tests-cal-card { padding: 0.75rem; }
.tests-cal-head { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.6rem; }
.tests-cal-title { flex: 1; text-align: center; margin: 0; font-family: Manrope, system-ui, sans-serif; font-size: 1.05rem; font-weight: 800; text-transform: capitalize; }
.tests-cal-nav { display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; border: 1px solid #e2e8f0; border-radius: 0.5rem; background: #fff; color: #475569; cursor: pointer; }
.tests-cal-nav:hover { background: #f1f5f9; }
.tests-cal-today { padding: 0.35rem 0.75rem; border: 1px solid #e2e8f0; border-radius: 0.5rem; background: #fff; font-size: 0.8rem; font-weight: 600; color: #334155; cursor: pointer; }
.tests-cal-today:hover { background: #f1f5f9; }
.tests-cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid #e2e8f0; border-left: 1px solid #e2e8f0; }
.tests-cal-wd { padding: 0.35rem 0; text-align: center; font-size: 0.65rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; color: #64748b; background: #f8fafc; border-right: 1px solid #e2e8f0; border-bottom: 1px solid #e2e8f0; }
.tests-cal-wd.weekend { color: #6d28d9; }
.tests-cal-cell { min-height: 5.2rem; padding: 0.25rem; border-right: 1px solid #e2e8f0; border-bottom: 1px solid #e2e8f0; background: #fff; cursor: pointer; min-width: 0; overflow: hidden; }
.tests-cal-cell:hover { background: #fafaff; }
.tests-cal-cell.other { background: #f8fafc; }
.tests-cal-cell.other .tests-cal-num { color: #cbd5e1; }
.tests-cal-cell.weekend:not(.other) { background: #fcfcfd; }
.tests-cal-num { display: inline-flex; align-items: center; justify-content: center; min-width: 1.4rem; height: 1.4rem; margin-bottom: 0.15rem; font-size: 0.78rem; font-weight: 700; color: #334155; border-radius: 999px; }
.tests-cal-cell.today .tests-cal-num { background: var(--brand-dark); color: #fff; }
.tests-cal-cell .cal-test-chip { font-size: 0.68rem; line-height: 1.25; }
@media (max-width: 640px) {
  .tests-cal-cell { min-height: 4.2rem; padding: 0.15rem; }
  .tests-cal-cell .cal-test-chip { font-size: 0.6rem; padding: 0.1rem 0.2rem; }
  .tests-cal-title { font-size: 0.95rem; }
}

/* Teste com a cor do aluno (igual às aulas), com marca à esquerda para o distinguir */
.cal-test-chip--student {
  background: color-mix(in srgb, var(--slot-color) 28%, #ffffff);
  color: var(--slot-text);
  border-color: color-mix(in srgb, var(--slot-color) 55%, #ffffff);
  border-left: 3px solid var(--slot-color);
  font-weight: 700;
}
.cal-test-chip--student.cal-test-chip--pending { border-style: dashed; border-left-style: solid; }
.upcoming-test-item.upcoming-item--colored { border-left: 3px solid var(--slot-color); }

/* Login: manter sessão iniciada */
.auth-remember { display: flex; align-items: flex-start; gap: 0.5rem; font-size: 0.8rem; line-height: 1.3; color: #475569; cursor: pointer; }
.auth-remember input { width: 1.05rem; height: 1.05rem; margin-top: 0.1rem; accent-color: var(--brand-dark); flex-shrink: 0; cursor: pointer; }

/* Convite para instalar a app (telemóvel) */
.pwa-install {
  position: fixed;
  left: 0.75rem;
  right: 0.75rem;
  bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
  z-index: 60;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  max-width: 28rem;
  margin: 0 auto;
  padding: 0.85rem 0.9rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  box-shadow: 0 12px 36px rgba(15, 23, 42, 0.22);
  opacity: 0;
  transform: translateY(1rem);
  transition: opacity 0.22s ease, transform 0.22s cubic-bezier(0.32, 0.72, 0, 1);
}
.pwa-install.is-visible { opacity: 1; transform: none; }
.pwa-install-icon { width: 2.75rem; height: 2.75rem; border-radius: 0.65rem; flex-shrink: 0; }
.pwa-install-main { min-width: 0; flex: 1; }
.pwa-install-title { margin: 0; font-size: 0.95rem; font-weight: 800; color: #0f172a; }
.pwa-install-text { margin: 0.2rem 0 0; font-size: 0.8rem; line-height: 1.4; color: #475569; }
.pwa-install-share { display: inline-block; vertical-align: -0.28em; color: var(--brand-dark); }
.pwa-install-actions { display: flex; gap: 0.5rem; margin-top: 0.65rem; }
.pwa-install-btn { padding: 0.45rem 0.9rem; border-radius: 0.6rem; border: 1px solid #e2e8f0; background: #fff; font-size: 0.8rem; font-weight: 700; color: #475569; cursor: pointer; }
.pwa-install-btn--primary { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
@media (prefers-reduced-motion: reduce) { .pwa-install { transition: none; } }
