/* ═══════════════════════════════════════════════════════
   Escala Médica — app.css
   Design minimalista · Inter + Bootstrap Icons
   ═══════════════════════════════════════════════════════ */

/* ── Tokens ──────────────────────────────────────────── */
:root {
  --primary:    #1b2a4a;
  --primary-dk: #111a2f;
  --primary-lt: #eef1f7;
  --danger:     #dc2626;
  --success:    #16a34a;
  --warning:    #d97706;
  --info:       #0891b2;
  --bg:         #f8fafc;
  --surface:    #ffffff;
  --border:     #e2e8f0;
  --text:       #0f172a;
  --text-muted: #64748b;
  --radius:     8px;
  --shadow:     0 1px 3px 0 rgb(0 0 0/.07), 0 1px 2px -1px rgb(0 0 0/.06);
  --shadow-md:  0 4px 6px -1px rgb(0 0 0/.08), 0 2px 4px -2px rgb(0 0 0/.06);
}

/* ── Reset mínimo ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { font-weight: 600; line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1rem; }
code {
  font-size: .8125rem;
  background: #f1f5f9;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: .1rem .4rem;
  color: var(--text-muted);
}

/* ── Navbar ───────────────────────────────────────────── */
.app-navbar {
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  position: sticky;
  top: 0;
  z-index: 100;
}
.app-navbar__left { display: flex; align-items: center; gap: .75rem; }
.app-navbar__brand {
  font-size: .8125rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: .5rem;
  letter-spacing: .07em;
  text-transform: uppercase;
}
.app-navbar__logo { width: 22px; height: 22px; flex-shrink: 0; }
.app-navbar__brand:hover { text-decoration: none; color: var(--primary); }
.app-navbar__toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: .35rem;
  color: var(--text-muted);
  border-radius: 6px;
  display: none;
  line-height: 1;
}
.app-navbar__toggle:hover { background: var(--bg); color: var(--text); }
.app-navbar__toggle i { font-size: 1.25rem; }
.app-navbar__right { display: flex; align-items: center; gap: .6rem; font-size: .875rem; }
.app-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: .75rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.app-navbar__right .name { color: var(--text); font-weight: 500; }

/* ── Layout ───────────────────────────────────────────── */
.app-layout { display: flex; min-height: calc(100vh - 56px); }

/* ── Sidebar ──────────────────────────────────────────── */
.app-sidebar {
  width: 232px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: .5rem 0 1.5rem;
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  overflow-y: auto;
}
.sidebar-section {
  padding: 1.1rem 1rem .3rem;
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
}
.sidebar-section:first-child { padding-top: .6rem; }
.sidebar-item {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .45rem .75rem .45rem 1rem;
  margin: .1rem .5rem;
  border-radius: 6px;
  font-size: .875rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: background .12s, color .12s;
}
.sidebar-item i { font-size: .9375rem; flex-shrink: 0; }
.sidebar-item:hover { background: var(--bg); color: var(--text); text-decoration: none; }
.sidebar-item.active {
  background: var(--primary-lt);
  color: var(--primary);
  font-weight: 600;
}
.sidebar-item--disabled {
  color: var(--text-muted);
  opacity: .5;
  cursor: not-allowed;
}
.sidebar-item--disabled:hover { background: none; color: var(--text-muted); }

/* ── Main content ─────────────────────────────────────── */
.app-main { flex: 1; padding: 1.75rem; min-width: 0; }

/* ── Page header ──────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: .75rem;
}

/* ── Alertas ──────────────────────────────────────────── */
.alert {
  padding: .75rem 1rem;
  border-radius: var(--radius);
  border-left: 3px solid;
  margin-bottom: 1rem;
  font-size: .875rem;
  display: flex;
  align-items: flex-start;
  gap: .5rem;
}
.alert-danger  { background: #fef2f2; border-color: var(--danger);  color: #991b1b; }
.alert-success { background: #f0fdf4; border-color: var(--success); color: #166534; }
.alert-warning { background: #fffbeb; border-color: var(--warning); color: #92400e; }
.alert-info    { background: #f0f9ff; border-color: var(--info);    color: #075985; }

/* ── Botões ───────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .5rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background .12s, border-color .12s, color .12s, box-shadow .12s;
  white-space: nowrap;
  line-height: 1.5;
}
.btn:hover { text-decoration: none; }
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-dk); border-color: var(--primary-dk); color: #fff; }
.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; color: #fff; }
.btn-outline {
  background: transparent;
  border-color: var(--border);
  color: var(--text-muted);
}
.btn-outline:hover { background: var(--bg); border-color: #cbd5e1; color: var(--text); }
.btn--disabled {
  opacity: .5;
  cursor: not-allowed;
  pointer-events: none;
}
.btn-sm { padding: .325rem .7rem; font-size: .8125rem; }
.btn-block { width: 100%; justify-content: center; }
.btn[data-loading] {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}
.btn[data-loading]::after {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: btn-spin .6s linear infinite;
}
.btn-outline[data-loading]::after {
  border-color: rgba(0,0,0,.15);
  border-top-color: var(--text-muted);
}
@keyframes btn-spin { to { transform: translate(-50%,-50%) rotate(360deg); } }

/* ── Badges ───────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: .2em .6em;
  border-radius: 99px;
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .01em;
  line-height: 1;
}
.badge-medico { background: #dcfce7; color: #166534; }
.badge-admin  { background: #dbeafe; color: #1d4ed8; }

/* ── Cards ────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  padding: .875rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
}
.card-header h3 { font-size: .9375rem; font-weight: 600; color: var(--text); }
.card-body { padding: 1.25rem; }

/* ── Lacunas em aberto (card recolhível) ─────────────────── */
.lacunas-card__summary {
  cursor: pointer;
  list-style: none;
}
.lacunas-card__summary::-webkit-details-marker { display: none; }
.lacunas-card__count {
  display: flex;
  align-items: center;
  gap: .5rem;
  color: var(--text-muted);
  font-size: .875rem;
}
.lacunas-card__chevron { transition: transform .2s ease; }
.lacunas-card[open] > .lacunas-card__summary .lacunas-card__chevron {
  transform: rotate(180deg);
}

/* ── MedNews ──────────────────────────────────────────── */
.card-header.mednews-header {
  position: relative;
  overflow: hidden;
  background: var(--primary);
  border-bottom-color: var(--primary-dk);
}
.mednews-header__halftone {
  position: absolute;
  top: -35%;
  right: -8%;
  width: 170px;
  height: 170px;
  opacity: .55;
  pointer-events: none;
}
.mednews-label {
  position: relative;
  z-index: 1;
  font-size: .8125rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #fff;
}
.mednews-updated {
  position: relative;
  z-index: 1;
  font-size: .75rem;
  color: rgba(255,255,255,.65);
}
.mednews-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.mednews-col { padding: 0 1.5rem; }
.mednews-col:first-child { padding-left: 0; }
.mednews-col:last-child { padding-right: 0; border-left: 1px solid var(--border); }
@media (max-width: 768px) {
  .mednews-grid { grid-template-columns: 1fr; }
  .mednews-col { padding: 0; }
  .mednews-col:last-child { border-left: none; border-top: 1px solid var(--border); padding-top: 1.25rem; margin-top: 1.25rem; }
}
.mednews-source-label {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: .3rem .65rem;
  border-radius: 4px;
  margin-bottom: 1rem;
}
.mednews-item {
  padding-left: .85rem;
  border-left: 2px solid var(--primary-lt);
  margin-bottom: 1.15rem;
}
.mednews-item:last-child { margin-bottom: 0; }
.mednews-item__title { font-size: .875rem; font-weight: 600; color: var(--text); margin-bottom: .35rem; line-height: 1.35; }
.mednews-item__meta {
  display: inline-block;
  background: var(--primary-lt);
  color: var(--primary);
  font-size: .7rem;
  font-weight: 600;
  padding: .1rem .55rem;
  border-radius: 99px;
  margin-bottom: .4rem;
}
.mednews-item__summary { font-size: .8125rem; color: var(--text-muted); line-height: 1.5; margin-bottom: .35rem; }
.mednews-item__link { font-size: .8125rem; font-weight: 600; color: var(--primary); }
.mednews-item__link:hover { text-decoration: underline; }

/* ── Formulários ──────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-label {
  display: block;
  font-size: .8125rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: .3rem;
}
.form-control {
  width: 100%;
  padding: .5rem .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: .875rem;
  color: var(--text);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
  appearance: none;
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.form-control.is-invalid { border-color: var(--danger); }
.form-control.is-invalid:focus { box-shadow: 0 0 0 3px rgba(220,38,38,.12); }
.form-error { color: var(--danger); font-size: .75rem; margin-top: .2rem; }
select.form-control { cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16'%3E%3Cpath fill='%2364748b' d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .75rem center; padding-right: 2.25rem; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-check { display: flex; align-items: center; gap: .5rem; }
.form-check input[type=checkbox] { width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; flex-shrink: 0; }
.form-check label, .form-check-label { font-size: .875rem; color: var(--text-muted); cursor: pointer; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } }

/* ── Tabelas ──────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  padding: .625rem 1rem;
  font-size: .6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  text-align: left;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: var(--surface);
}
tbody td {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: .875rem;
  vertical-align: middle;
  color: var(--text);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #fafbfc; }

/* ── KPI cards ────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow);
}
.kpi-card__label {
  font-size: .6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin-bottom: .4rem;
}
.kpi-card__value {
  font-size: 1.875rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  letter-spacing: -0.02em;
}
.kpi-card__sub { font-size: .75rem; color: var(--text-muted); margin-top: .35rem; }

/* ── Escala atual (mês corrente / mês seguinte) ──────────── */
.schedule-month-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.schedule-month-col { padding: 0 1.5rem; }
.schedule-month-col:first-child { padding-left: 0; }
.schedule-month-col:last-child { padding-right: 0; border-left: 1px solid var(--border); }
@media (max-width: 768px) {
  .schedule-month-grid { grid-template-columns: 1fr; }
  .schedule-month-col { padding: 0; }
  .schedule-month-col:last-child { border-left: none; border-top: 1px solid var(--border); padding-top: 1.25rem; margin-top: 1.25rem; }
}
.schedule-month-label { font-size: .8125rem; font-weight: 700; color: var(--text); margin-bottom: .75rem; }
.schedule-month-empty { font-size: .8125rem; color: var(--text-muted); }

/* ── Empty state ──────────────────────────────────────── */
.empty-state { text-align: center; padding: 3rem 1.5rem; color: var(--text-muted); }
.empty-state__icon { font-size: 2.25rem; margin-bottom: .75rem; opacity: .3; display: block; }
.empty-state h3 { font-size: 1rem; font-weight: 600; color: var(--text); margin-bottom: .35rem; }
.empty-state p { font-size: .875rem; }

/* ── Página de login ──────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 1.5rem;
}
.login-box { width: 100%; max-width: 380px; }
.login-logo {
  text-align: center;
  margin-bottom: 1.75rem;
}
.login-logo__mark { width: 64px; height: 64px; margin-bottom: .75rem; }
.login-logo h1 { font-size: 1.15rem; font-weight: 700; color: var(--text); letter-spacing: .12em; text-transform: uppercase; }
.login-logo p  { font-size: .8125rem; color: var(--text-muted); margin-top: .2rem; }
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  padding: 2rem;
}

/* ── Erros ────────────────────────────────────────────── */
.error-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; text-align: center; padding: 2rem; }
.error-page__code { font-size: 5rem; font-weight: 700; color: var(--border); line-height: 1; }
.error-page__title { font-size: 1.25rem; font-weight: 600; color: var(--text); margin: .5rem 0; }
.error-page__msg { color: var(--text-muted); font-size: .9375rem; margin-bottom: 1.5rem; }

/* ── Calendário ───────────────────────────────────────── */
.cal-card { margin-bottom: 1.25rem; }
.cal-grid-wrapper { overflow-x: auto; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(110px, 1fr)); min-width: 770px; }
.cal-grid__weekday {
  padding: .5rem .6rem;
  font-size: .6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  text-align: center;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.cal-day {
  min-height: 110px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: .35rem;
  display: flex;
  flex-direction: column;
  gap: .2rem;
  overflow-y: auto;
}
.cal-grid > .cal-day:nth-child(7n) { border-right: none; }
.cal-day--other-month { background: #fafbfc; }
.cal-day--other-month .cal-day__date { color: var(--text-muted); opacity: .5; }
.cal-day--today { background: var(--primary-lt); }
.cal-day--gap { background: #fef2f2; }
.cal-day__head { display: flex; align-items: center; justify-content: space-between; }
.cal-day__date { font-size: .75rem; font-weight: 600; color: var(--text); }
.cal-day--today .cal-day__date {
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  width: 20px; height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.cal-day__gap {
  font-size: .625rem;
  font-weight: 700;
  color: var(--danger);
  background: #fee2e2;
  border-radius: 4px;
  padding: .05rem .3rem;
  display: inline-flex;
  align-items: center;
  gap: .15rem;
}
.cal-day__holiday {
  font-size: .625rem;
  font-weight: 600;
  color: var(--warning);
  background: #fffbeb;
  border-radius: 4px;
  padding: .05rem .3rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-event {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .25rem;
  font-size: .6875rem;
  line-height: 1.3;
  border-radius: 4px;
  padding: .1rem .35rem;
}
.cal-event__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.cal-event__swap-form { display: inline-flex; flex-shrink: 0; line-height: 0; }
.cal-event__swap-btn {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  color: inherit;
  opacity: .55;
  font-size: .7rem;
  line-height: 1;
}
.cal-event__swap-btn:hover { opacity: 1; }
.cal-event__swap-pending { font-size: .7rem; opacity: .7; flex-shrink: 0; }
.cal-event--0 { background: var(--primary-lt); color: var(--primary-dk); }
.cal-event--1 { background: #dcfce7; color: #166534; }
.cal-event--2 { background: #fef3c7; color: #92400e; }
.cal-event--3 { background: #cffafe; color: #155e75; }
.cal-event--4 { background: #fee2e2; color: #991b1b; }
.cal-legend {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
  padding: .6rem 1.25rem;
  border-top: 1px solid var(--border);
  font-size: .75rem;
  color: var(--text-muted);
}
.cal-legend__dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .3rem; vertical-align: middle; }
.cal-legend__dot--gap { background: #fee2e2; border: 1px solid var(--danger); }
.cal-event--exception {
  opacity: .65;
  font-style: italic;
  border: 1px dashed currentColor;
  background-clip: padding-box;
}
.cal-mark-form { display: block; }
.cal-mark-btn {
  display: block;
  width: 100%;
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: 4px;
  padding: .1rem .35rem;
  font-size: .625rem;
  color: var(--text-muted);
  cursor: pointer;
  text-align: left;
  opacity: .45;
}
.cal-mark-btn:hover { opacity: 1; border-color: var(--primary); color: var(--primary); }
.cal-legend__dot--exception { background: transparent; border: 1px dashed var(--text-muted); }
.cal-tip__panel { display: none; }
.cal-tooltip {
  display: none;
  position: fixed;
  z-index: 1000;
  max-width: 240px;
  padding: .5rem .65rem;
  background: var(--text);
  color: #fff;
  font-size: .75rem;
  line-height: 1.5;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  pointer-events: none;
}
.cal-tooltip strong { display: block; margin-bottom: .15rem; }
.cal-tooltip ul { margin: .25rem 0 0; padding-left: 1.1rem; }
.cal-tooltip li { margin-bottom: .1rem; }

.cal-day__head-actions { display: flex; align-items: center; gap: .25rem; }
.cal-day__expand {
  background: none;
  border: none;
  padding: 0;
  color: var(--text-muted);
  opacity: .35;
  cursor: pointer;
  font-size: .7rem;
  line-height: 1;
}
.cal-day__expand:hover { opacity: 1; color: var(--primary); }

.day-editor-dialog {
  border: none;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 1.25rem;
  width: min(640px, 92vw);
  max-height: 85vh;
  overflow-y: auto;
}
.day-editor-dialog::backdrop { background: rgba(15, 23, 42, .45); }
.day-editor-dialog__title {
  font-weight: 700;
  font-size: 1rem;
  margin: 0 1.5rem .9rem 0;
}
.day-editor-dialog__close { position: absolute; top: .75rem; right: .75rem; }
.day-editor-dialog__close button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 1rem;
}
.day-editor-dialog__close button:hover { color: var(--text); }
.day-editor__holiday {
  color: var(--warning);
  font-size: .8125rem;
  font-weight: 600;
  margin-bottom: .75rem;
}
.day-editor__location {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.day-editor__location + .day-editor__location { margin-top: .65rem; }
.day-editor__location-header {
  margin: 0;
  padding: .5rem .9rem;
  font-size: .9rem;
  font-weight: 700;
}
.day-editor__location-body { padding: .85rem 1rem; }
.day-editor__entry, .day-editor__exception {
  display: flex;
  gap: .4rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: .4rem;
}
.day-editor__exception {
  justify-content: space-between;
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: var(--warning);
  border-radius: 6px;
  padding: .4rem .6rem;
  font-size: .8125rem;
}
.day-editor__entry-form { display: flex; gap: .35rem; align-items: center; flex: 1; min-width: 0; flex-wrap: wrap; }
.day-editor__entry-form .form-control { width: auto; padding: .3rem .6rem; font-size: .8125rem; }
.day-editor__doctor { flex: 1 1 auto; min-width: 8rem; }
.day-editor__scaletype { width: 5.5rem; flex: none; }
.day-editor__add { border-top: 1px dashed var(--border); padding-top: .5rem; margin-top: .15rem; }
.day-editor__mark-form { margin-top: .15rem; }
.day-editor__gap {
  display: flex;
  align-items: center;
  gap: .4rem;
  flex-wrap: wrap;
  border-radius: 6px;
  padding: .4rem .6rem;
  font-size: .8125rem;
  margin-bottom: .4rem;
}
.day-editor__gap--open { background: #fef2f2; border: 1px solid #fecaca; color: var(--danger); }
.day-editor__gap--open .form-control { flex: 1; min-width: 8rem; padding: .3rem .5rem; font-size: .8125rem; }
.day-editor__gap--accepted { background: #f0fdf4; border: 1px solid #bbf7d0; color: var(--success); justify-content: space-between; }
.day-editor__gap-label { white-space: nowrap; }

/* ── Responsivo ───────────────────────────────────────── */
@media (max-width: 768px) {
  .app-sidebar {
    position: fixed;
    top: 56px; left: 0; bottom: 0;
    z-index: 99;
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: var(--shadow-md);
  }
  .app-sidebar.open { transform: translateX(0); }
  .app-navbar__toggle { display: flex; }
  .app-main { padding: 1rem; }
  .app-navbar__right .name { display: none; }
  .page-header h1 { font-size: 1.25rem; }
  .kpi-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .kpi-card__value { font-size: 1.5rem; }
  thead th, tbody td { padding: .5rem .75rem; font-size: .8125rem; }
  .cal-day { min-height: 90px; }
}

/* ── Tooltip de regras do botão "Gerar escala" ─────────────────────────── */
.gen-tooltip-wrap { position: relative; display: inline-block; }
.gen-tooltip {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 360px;
  background: var(--text);
  color: #fff;
  font-size: .76rem;
  line-height: 1.55;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: .65rem .85rem;
  z-index: 1100;
  pointer-events: none;
  text-align: left;
}
.gen-tooltip-wrap:hover .gen-tooltip { display: block; }
.gen-tooltip strong { display: block; margin-bottom: .35rem; font-size: .78rem; }
.gen-tooltip ol { margin: 0; padding-left: 1.25rem; }
.gen-tooltip li { margin-bottom: .3rem; }
