/* ============ Componentes base (CSS puro; Tailwind CDN não processa @apply em arquivos externos) ============ */
:root {
  --brand: #0369a1;
  --brand-hover: #075985;
  --brand-soft: #f0f7ff;
  --ring: rgba(2, 132, 199, 0.25);
  --border: #e2e8f0;
  --muted: #64748b;
}

html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }
body.modal-open { overflow: hidden; }

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

.section-title { font-size: 1.0625rem; font-weight: 700; color: #0f172a; letter-spacing: -0.01em; }
.label-caps { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }

/* Botões */
.btn-primary, .btn-secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  padding: 0.5rem 0.9rem; border-radius: 0.75rem; font-size: 0.8125rem; font-weight: 600;
  transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s;
  white-space: nowrap;
}
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 1px 2px rgba(3, 105, 161, .25); }
.btn-primary:hover { background: var(--brand-hover); }
.btn-secondary { background: #fff; color: #334155; border: 1px solid var(--border); }
.btn-secondary:hover { background: #f8fafc; border-color: #cbd5e1; color: #0f172a; }
.btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.25rem; height: 2.25rem; border-radius: 0.65rem; color: #475569;
  border: 1px solid var(--border); background: #fff; transition: background-color .15s, color .15s;
}
.btn-icon:hover { background: #f1f5f9; color: #0f172a; }
.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2rem; height: 2rem; border-radius: 0.6rem; color: #64748b; transition: background-color .15s, color .15s;
}
.btn-ghost:hover { background: #f1f5f9; color: #0f172a; }
.btn-ghost.danger:hover { background: #fff1f2; color: #be123c; }
:is(.btn-primary, .btn-secondary, .btn-icon, .btn-ghost, .chip, .nav-btn, .mnav-btn, .seg-btn, .fmt-btn):focus-visible {
  outline: none; box-shadow: 0 0 0 3px var(--ring);
}

/* Chips / filtros */
.chip {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.4rem 0.75rem; border-radius: 9999px; font-size: 0.75rem; font-weight: 600;
  color: #475569; background: #fff; border: 1px solid var(--border); transition: all .15s; white-space: nowrap;
}
.chip:hover { border-color: #cbd5e1; color: #0f172a; }
.chip.is-active, .chip[aria-pressed="true"] { background: #0f172a; color: #fff; border-color: #0f172a; }
.chip-sm { padding: 0.2rem 0.6rem; font-size: 0.72rem; font-weight: 500; }
.chip .count { font-size: 0.68rem; opacity: .65; font-weight: 600; }

/* Campos */
.field {
  width: 100%; padding: 0.55rem 0.8rem; font-size: 0.875rem; color: #0f172a;
  background: #f8fafc; border: 1px solid var(--border); border-radius: 0.75rem;
  transition: border-color .15s, box-shadow .15s, background-color .15s;
}
.field:focus { outline: none; background: #fff; border-color: #0284c7; box-shadow: 0 0 0 3px var(--ring); }
.field::placeholder { color: #94a3b8; }
.field-label { display: block; font-size: 0.78rem; font-weight: 600; color: #334155; margin-bottom: 0.35rem; }
.check-row { display: flex; align-items: center; gap: 0.6rem; font-size: 0.85rem; color: #334155; cursor: pointer; }
.check-row input { width: 1rem; height: 1rem; border-radius: 0.3rem; accent-color: var(--brand); }

/* Navegação */
.nav-btn {
  display: inline-flex; align-items: center; gap: 0.45rem; padding: 0.45rem 0.8rem;
  border-radius: 0.65rem; font-size: 0.8125rem; font-weight: 600; color: #475569; transition: all .15s;
}
.nav-btn:hover { color: #0f172a; background: #f1f5f9; }
.nav-btn.is-active { color: var(--brand); background: var(--brand-soft); }
.mnav-btn {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 0.55rem 0 0.5rem; font-size: 10.5px; font-weight: 600; color: #64748b;
}
.mnav-btn.is-active { color: var(--brand); }

/* Controle segmentado */
.segmented { display: inline-flex; padding: 3px; gap: 2px; background: #f1f5f9; border: 1px solid var(--border); border-radius: 0.8rem; }
.seg-btn {
  display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.45rem 0.85rem; border-radius: 0.6rem;
  font-size: 0.8125rem; font-weight: 600; color: #475569; transition: all .15s;
}
.seg-btn.is-active { background: #fff; color: #0f172a; box-shadow: 0 1px 3px rgba(15, 23, 42, .1); }
.seg-radio { display: block; cursor: pointer; }
.seg-radio span {
  display: block; text-align: center; padding: 0.4rem 0.4rem; border-radius: 0.55rem;
  font-size: 0.75rem; font-weight: 600; color: #475569; transition: all .15s;
}
.seg-radio input:checked + span { background: #fff; color: #0f172a; box-shadow: 0 1px 3px rgba(15, 23, 42, .1); }
.seg-radio input:focus-visible + span { box-shadow: 0 0 0 3px var(--ring); }

/* Botões de formato do relatório */
.fmt-btn {
  display: flex; align-items: center; gap: 0.45rem; padding: 0.6rem 0.7rem; border-radius: 0.7rem;
  font-size: 0.8rem; font-weight: 600; color: #334155; background: #fff; border: 1px solid var(--border); text-align: left; transition: all .15s;
}
.fmt-btn:hover { border-color: #cbd5e1; }
.fmt-btn.is-active { border-color: #0284c7; background: var(--brand-soft); color: var(--brand-hover); box-shadow: inset 0 0 0 1px #0284c7; }

/* Paleta de cores do dia */
.swatch { display: block; width: 1.75rem; height: 1.75rem; border-radius: 9999px; cursor: pointer; transition: transform .12s, box-shadow .12s; }
.swatch:hover { transform: scale(1.08); }
input:checked + .swatch { box-shadow: 0 0 0 2px #fff, 0 0 0 4px #0f172a; }
input:focus-visible + .swatch { box-shadow: 0 0 0 2px #fff, 0 0 0 4px #0284c7; }

/* Modais */
.modal {
  position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-start; justify-content: center;
  padding: 1rem; overflow-y: auto; background: rgba(15, 23, 42, 0.45); backdrop-filter: blur(2px);
}
.modal.hidden { display: none; }
@media (min-width: 640px) { .modal { align-items: center; padding: 2rem 1rem; } }
.modal-panel {
  width: 100%; background: #fff; border-radius: 1rem; box-shadow: 0 25px 50px -12px rgba(15, 23, 42, .3);
  animation: modal-in .16s ease-out; margin: auto 0;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem; border-bottom: 1px solid #f1f5f9; }
.modal-title { display: flex; align-items: center; gap: 0.5rem; font-size: 1rem; font-weight: 700; color: #0f172a; }
.modal-body { padding: 1.25rem; }
.modal-foot { display: flex; justify-content: flex-end; gap: 0.5rem; padding-top: 1rem; border-top: 1px solid #f1f5f9; }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }

/* Diário */
.day-card { transition: box-shadow .15s; }
.day-card:hover { box-shadow: 0 4px 12px -4px rgba(15, 23, 42, .08); }
.day-toggle { cursor: pointer; }
.chev { transition: transform .2s; }
.day-card.is-open .chev { transform: rotate(180deg); }
.entry-row .entry-actions { opacity: 1; }
@media (hover: hover) and (min-width: 768px) {
  .entry-row .entry-actions { opacity: 0; transition: opacity .15s; }
  .entry-row:hover .entry-actions, .entry-row:focus-within .entry-actions { opacity: 1; }
}
.progress { height: 6px; background: #f1f5f9; border-radius: 9999px; overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: #10b981; }

.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.flash { animation: flash 1.2s ease-out; }
@keyframes flash { 0% { box-shadow: 0 0 0 3px rgba(2, 132, 199, .45); } 100% { box-shadow: 0 0 0 3px rgba(2, 132, 199, 0); } }

/* Tabela de horários */
.sched-table th:first-child, .sched-table td:first-child { position: sticky; left: 0; z-index: 1; }

/* Barras de rolagem */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 9999px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: #94a3b8; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Impressão: só o relatório */
@media print {
  body { background: #fff !important; color: #000 !important; }
  .no-print, header, nav, .modal, #toast-container { display: none !important; }
  main { padding: 0 !important; max-width: none !important; }
  .report-preview-box { box-shadow: none !important; border: none !important; padding: 0 !important; overflow: visible !important; }
  #report-output { font-size: 10.5pt !important; color: #000 !important; }
  @page { margin: 20mm 15mm; }
}
