/* Identidade visual — vermelho/marsala */
:root {
  --ea-primary: #7B2D3B;
  --ea-primary-600: #6a2532;
  --ea-secondary: #A84B5C;
  --ea-soft: #F6EDEE;
  --ea-soft-2: #fbf7f7;
  --ea-text: #2B2B2B;
  --ea-muted: #6c6466;
  --ea-border: #e9dfe1;
  --bs-primary: #7B2D3B;
  --bs-primary-rgb: 123, 45, 59;
  --bs-link-color: #7B2D3B;
  --bs-link-color-rgb: 123, 45, 59;
  --bs-link-hover-color: #5a1f2a;
  --bs-body-font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --bs-body-color: #2B2B2B;
  --bs-border-color: #e9dfe1;
}
body { background: var(--ea-soft-2); color: var(--ea-text); }
.btn-primary { --bs-btn-bg: var(--ea-primary); --bs-btn-border-color: var(--ea-primary); --bs-btn-hover-bg: var(--ea-primary-600); --bs-btn-hover-border-color: var(--ea-primary-600); --bs-btn-active-bg: #57202a; --bs-btn-disabled-bg: var(--ea-secondary); --bs-btn-disabled-border-color: var(--ea-secondary); }
.btn-outline-primary { --bs-btn-color: var(--ea-primary); --bs-btn-border-color: var(--ea-primary); --bs-btn-hover-bg: var(--ea-primary); --bs-btn-hover-border-color: var(--ea-primary); --bs-btn-active-bg: var(--ea-primary); }
.text-primary { color: var(--ea-primary) !important; }
.bg-soft { background: var(--ea-soft) !important; }
.form-control:focus, .form-select:focus { border-color: var(--ea-secondary); box-shadow: 0 0 0 .2rem rgba(123,45,59,.15); }
.form-check-input:checked { background-color: var(--ea-primary); border-color: var(--ea-primary); }
.page-link { color: var(--ea-primary); }

/* Layout */
.ea-shell { display: flex; min-height: 100vh; }
@media (min-width: 992px) { .ea-shell { background: linear-gradient(to right, var(--ea-primary) 248px, transparent 248px); } }
.ea-sidebar { width: 248px; background: var(--ea-primary); color: #fff; flex-shrink: 0; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.ea-sidebar .brand { padding: 1.25rem 1.25rem 1rem; font-weight: 600; letter-spacing: .02em; border-bottom: 1px solid rgba(255,255,255,.12); }
.ea-sidebar .brand small { display: block; font-weight: 400; opacity: .75; font-size: .75rem; }
.ea-sidebar .nav-section { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; opacity: .6; padding: 1rem 1.25rem .35rem; }
.ea-sidebar a.nav-link { color: rgba(255,255,255,.88); padding: .5rem 1.25rem; display: flex; gap: .6rem; align-items: center; border-left: 3px solid transparent; }
.ea-sidebar a.nav-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.ea-sidebar a.nav-link.active { background: rgba(255,255,255,.14); color: #fff; border-left-color: #f3c6cf; }
.ea-main { flex: 1; min-width: 0; }
.ea-topbar { background: #fff; border-bottom: 1px solid var(--ea-border); padding: .6rem 1.25rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; position: sticky; top: 0; z-index: 10; }
.ea-content { padding: 1.5rem 1.25rem 3rem; max-width: 1280px; }
.ea-mobile-toggle { display: none; }
@media (max-width: 991.98px) {
  .ea-sidebar { position: fixed; left: -260px; z-index: 1040; transition: left .2s ease; }
  .ea-sidebar.open { left: 0; }
  .ea-mobile-toggle { display: inline-flex; }
  .ea-backdrop.open { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 1030; }
  .ea-content { padding: 1rem .75rem 4rem; }
}

/* Componentes */
.card { border: 1px solid var(--ea-border); border-radius: .75rem; box-shadow: 0 1px 2px rgba(60,20,30,.04); }
.card-header { background: #fff; border-bottom: 1px solid var(--ea-border); font-weight: 600; }
.kpi .label { color: var(--ea-muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.kpi .value { font-size: 1.6rem; font-weight: 600; color: var(--ea-primary); }
.table > :not(caption) > * > * { padding: .55rem .6rem; }
.table thead th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--ea-muted); font-weight: 600; background: var(--ea-soft-2); }
.table-hover tbody tr:hover { --bs-table-hover-bg: var(--ea-soft); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.page-title { font-size: 1.4rem; font-weight: 600; margin: 0; }
.page-head { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.badge-soft { background: var(--ea-soft); color: var(--ea-primary); font-weight: 500; }
.chart-box { position: relative; height: 340px; }
.chart-box.tall { height: 520px; }
.guest-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem; background: linear-gradient(160deg, var(--ea-soft) 0%, #fff 60%); }
.guest-card { width: 100%; max-width: 420px; }
.guest-brand { text-align: center; color: var(--ea-primary); margin-bottom: 1.25rem; }
.guest-brand .logo { width: 56px; height: 56px; border-radius: 50%; background: var(--ea-primary); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 1.4rem; font-weight: 600; }
.qr-box { display: inline-block; padding: .75rem; background: #fff; border: 1px solid var(--ea-border); border-radius: .5rem; }
.qr-box svg, .qr-box img { width: 200px; height: 200px; display: block; }
.codigos { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1.05rem; columns: 2; }
.ficha-row .form-control, .ficha-row .form-select { min-width: 0; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; }
.text-pre { white-space: pre-line; }
.w-qtd { max-width: 140px; }
.sticky-actions { position: sticky; bottom: 0; background: var(--ea-soft-2); box-shadow: 0 -6px 12px rgba(251,247,247,1); padding: .75rem 0; border-top: 1px solid var(--ea-border); z-index: 5; }
.hidden { display: none !important; }
@media (max-width: 575.98px) {
  .btn, .form-control, .form-select { min-height: 44px; }
  .chart-box { height: 280px; }
}

/* Fase 2 */
.foto-thumb { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; background: var(--ea-soft); }
.ficha-sn { border-bottom: 1px dashed var(--ea-border); padding-bottom: .6rem; }
.ficha-secao { margin-bottom: 1rem; }
.ficha-secao-titulo { background: var(--ea-primary); color: #fff; font-weight: 600; padding: .35rem .75rem; border-radius: .4rem; margin-bottom: .5rem; }
.assinatura-pad .pad-canvas { width: 100%; height: auto; aspect-ratio: 900 / 260; border: 1px dashed var(--ea-secondary); border-radius: .5rem; background: #fff; touch-action: none; cursor: crosshair; }
.mapa-canvas { width: 100%; max-width: 900px; height: auto; display: block; border: 1px solid var(--ea-border); border-radius: .5rem; touch-action: none; cursor: crosshair; background: #fff; }
.assinatura-img { max-width: 320px; width: 100%; height: auto; display: block; }
.assinaturas { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; align-items: end; }
.assinaturas .linha { border-top: 1px solid #555; margin-top: .25rem; padding-top: .25rem; text-align: center; font-size: .8rem; }
.assinatura-vazia { height: 80px; }
.documento-texto { line-height: 1.55; }
[data-busca-lista] { z-index: 20; left: 0; right: 0; }
.print-body { background: #fff; }
.print-toolbar { padding: .75rem 1rem; border-bottom: 1px solid var(--ea-border); background: var(--ea-soft-2); }
.print-page { max-width: 820px; margin: 0 auto; padding: 1.5rem; color: #3b1a20; }
.print-head { text-align: center; margin-bottom: 1rem; }
.print-logo { font-size: 1.8rem; color: var(--ea-primary); font-weight: 500; letter-spacing: .02em; }
.print-sub { font-size: .8rem; color: var(--ea-secondary); font-weight: 600; }
.print-head h1 { font-size: 1rem; letter-spacing: .25em; color: var(--ea-primary); margin-top: .75rem; font-weight: 400; }
.print-rodape { font-size: .7rem; color: #777; margin-top: 1.5rem; border-top: 1px solid #ddd; padding-top: .4rem; }
@media print {
  .no-print, .ea-sidebar, .ea-topbar { display: none !important; }
  .print-page { padding: 0; max-width: none; }
  .ficha-secao { break-inside: avoid; }
  .ficha-secao-titulo { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body { font-size: 11pt; }
}
@media (max-width: 575.98px) { .assinaturas { grid-template-columns: 1fr; } }

/* Fase 3: agenda */
.agenda-scroll { overflow-x: auto; }
.agenda-grid { display: grid; }
.agenda-grid.d7 { grid-template-columns: 52px repeat(7, minmax(100px, 1fr)); min-width: 760px; }
.agenda-grid.d1 { grid-template-columns: 52px 1fr; }
.agenda-cab { height: 34px; display: flex; align-items: center; justify-content: center; font-size: .8rem; border-bottom: 1px solid var(--ea-border); }
.agenda-cab a { text-decoration: none; color: inherit; }
.agenda-dia.hoje .agenda-cab { background: var(--ea-soft); color: var(--ea-primary); }
.agenda-corpo { position: relative; }
.agenda-dia .agenda-corpo { border-left: 1px solid var(--ea-border); cursor: copy; }
.agenda-hora { height: 48px; font-size: .7rem; color: var(--ea-muted); text-align: right; padding-right: 6px; transform: translateY(-6px); }
.agenda-slot { height: 48px; border-bottom: 1px dashed #eee; }
.agenda-ev { position: absolute; left: 3px; right: 3px; border-radius: 6px; padding: 2px 6px; font-size: .72rem; line-height: 1.2; overflow: hidden; text-decoration: none; color: #2b2b2b;
  background: #f3e3e6; border-left: 4px solid var(--ea-primary); box-shadow: 0 1px 2px rgba(0,0,0,.08); cursor: pointer; display: flex; flex-direction: column; }
.agenda-ev .ag-hora { font-weight: 600; } .agenda-ev .ag-nome { font-weight: 600; } .agenda-ev .ag-det { color: #5c5456; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ag-confirmado { background: #e3ecfb; } .ag-realizado { background: #e3f4e8; } .ag-cancelado, .ag-faltou { background: #eee; color: #888 !important; text-decoration: line-through; opacity: .75; }
.ag-reserva { background: repeating-linear-gradient(45deg, #f6edee, #f6edee 6px, #fff 6px, #fff 12px); }
.ag-sala { background: repeating-linear-gradient(45deg, #e9e9e9, #e9e9e9 6px, #f6f6f6 6px, #f6f6f6 12px); border-left-color: #999; color: #666; cursor: default; left: 55%; right: 2px; }
.legenda { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: middle; border: 1px solid #ccc; }

/* =====================================================================
   Layout v3 — barra de ícones + painel de submenus (padrão "Clínica Experts")
   ===================================================================== */
.ea-v3 { --rail-w: 76px; --subnav-w: 232px; background: #f6f4f5; }
.ea-v3 .ea-shell { background: none; }
.ea-rail { width: var(--rail-w); background: var(--ea-primary); flex-shrink: 0; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; align-items: stretch; padding: .5rem 0; z-index: 1041; }
.ea-rail-brand { display: flex; align-items: center; justify-content: center; height: 52px; color: #fff; font-size: 1.5rem; text-decoration: none; margin-bottom: .25rem; }
.ea-rail-item { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: .55rem .25rem; margin: 2px 8px; border-radius: 12px; color: rgba(255,255,255,.78); text-decoration: none; font-size: .66rem; line-height: 1.1; text-align: center; }
.ea-rail-item i { font-size: 1.25rem; }
.ea-rail-item:hover { background: rgba(255,255,255,.1); color: #fff; }
.ea-rail-item.active { background: #fff; color: var(--ea-primary); font-weight: 600; }
.ea-subnav { width: var(--subnav-w); background: #fff; border-right: 1px solid var(--ea-border); flex-shrink: 0; position: sticky; top: 0; height: 100vh; overflow-y: auto; padding-bottom: 1rem; }
.ea-subnav-head { padding: 1rem 1.1rem .9rem; font-weight: 700; color: var(--ea-primary); border-bottom: 1px solid var(--ea-border); font-size: .95rem; }
.ea-subnav-head small { display: block; color: var(--ea-muted); font-weight: 400; font-size: .72rem; }
.ea-subnav-group { display: none; padding: .5rem .6rem; }
.ea-subnav-group.open { display: block; }
.ea-subnav-title { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ea-muted); padding: .6rem .6rem .4rem; font-weight: 600; }
.ea-subnav-link { display: block; padding: .55rem .75rem; border-radius: 10px; color: #3a3335; text-decoration: none; font-size: .9rem; margin-bottom: 2px; }
.ea-subnav-link:hover { background: var(--ea-soft); color: var(--ea-primary); }
.ea-subnav-link.active { background: var(--ea-soft); color: var(--ea-primary); font-weight: 600; box-shadow: inset 3px 0 0 var(--ea-primary); }
.ea-v3 .ea-topbar { background: #fff; padding: .55rem 1.25rem; gap: .75rem; }
.ea-busca { position: relative; flex: 1; max-width: 560px; }
.ea-busca > i { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--ea-muted); }
.ea-busca .form-control { padding-left: 2.2rem; border-radius: 999px; background: #f6f4f5; border-color: transparent; }
.ea-busca .form-control:focus { background: #fff; }
.ea-busca-lista { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: #fff; border: 1px solid var(--ea-border); border-radius: 12px; box-shadow: 0 10px 30px rgba(60,20,30,.12); z-index: 1060; max-height: 420px; overflow-y: auto; padding: .35rem; }
.ea-busca-item { display: flex; align-items: center; gap: .6rem; padding: .5rem .6rem; border-radius: 8px; color: inherit; text-decoration: none; cursor: pointer; }
.ea-busca-item:hover, .ea-busca-item.sel { background: var(--ea-soft); }
.ea-busca-item .ini { width: 32px; height: 32px; border-radius: 50%; background: var(--ea-soft); color: var(--ea-primary); display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: .8rem; flex-shrink: 0; }
.ea-busca-item .sub { font-size: .78rem; color: var(--ea-muted); }
.ea-busca-sec { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ea-muted); padding: .45rem .6rem .2rem; }
.ea-btn-mais { border-radius: 999px; padding-inline: .9rem; }
.ea-avatar { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--ea-border); background: var(--ea-soft); color: var(--ea-primary); font-weight: 700; font-size: .8rem; }
.ea-crumbs { padding: .6rem 1.5rem 0; font-size: .82rem; color: var(--ea-muted); display: flex; align-items: center; gap: .4rem; }
.ea-crumbs .atual { color: #3a3335; }
.ea-crumbs i { font-size: .65rem; }
.ea-v3 .ea-content { padding: 1rem 1.5rem 3rem; max-width: 1360px; }

/* Componentes no novo padrão */
.ea-v3 .card { border-radius: 14px; border-color: #eee6e8; box-shadow: 0 1px 3px rgba(60,20,30,.05); }
.ea-v3 .card-header { border-radius: 14px 14px 0 0 !important; padding: .8rem 1rem; }
.ea-v3 .page-title { font-size: 1.35rem; font-weight: 700; }
.ea-v3 .page-head { margin-bottom: 1rem; }
.ea-v3 .btn { border-radius: 10px; }
.ea-v3 .btn-sm { border-radius: 8px; }
.ea-v3 .form-control, .ea-v3 .form-select { border-radius: 10px; }
.ea-v3 .table thead th { background: #fff; border-bottom: 1px solid var(--ea-border); }
.ea-v3 .table tbody tr td { border-color: #f1eaec; }
.ea-v3 .nav-tabs { border-bottom: 0; gap: .35rem; flex-wrap: nowrap; overflow-x: auto; }
.ea-v3 .nav-tabs .nav-link { border: 1px solid var(--ea-border); border-radius: 999px; color: #4a4245; padding: .38rem .9rem; font-size: .88rem; white-space: nowrap; background: #fff; }
.ea-v3 .nav-tabs .nav-link.active { background: var(--ea-primary); border-color: var(--ea-primary); color: #fff; }
.ea-v3 .badge { font-weight: 500; }
.ea-v3 .alert { border-radius: 12px; }
.status-pill { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 500; background: #f1eaec; color: #5c5456; }
.status-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-pill.ok { background: #e3f4e8; color: #1e7b3c; } .status-pill.info { background: #e3ecfb; color: #2557a7; }
.status-pill.warn { background: #fff4dc; color: #9a6400; } .status-pill.danger { background: #fde7e7; color: #b42318; }
.kpi-card { padding: 1rem 1.1rem; } .kpi-card .label { color: var(--ea-muted); font-size: .8rem; } .kpi-card .value { font-size: 1.5rem; font-weight: 700; color: #2b2b2b; }
.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--ea-muted); } .empty-state i { font-size: 2rem; color: var(--ea-secondary); display: block; margin-bottom: .5rem; }

@media (max-width: 991.98px) {
  .ea-v3 .ea-rail { position: fixed; left: calc(-1 * var(--rail-w)); transition: left .2s ease; }
  .ea-v3 .ea-subnav { position: fixed; left: calc(-1 * (var(--rail-w) + var(--subnav-w))); z-index: 1040; transition: left .2s ease; }
  .ea-v3 .ea-subnav.open { left: var(--rail-w); }
  .ea-v3 .ea-subnav.open ~ .ea-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 1039; }
  body.menu-aberto .ea-rail { left: 0; }
  .ea-v3 .ea-content { padding: .9rem .75rem 4rem; }
  .ea-crumbs { padding: .5rem .75rem 0; }
  .ea-busca .form-control::placeholder { font-size: .85rem; }
}

/* KPIs: valor numa linha só, encolhendo com a largura do cartão */
.kpi-card .value, .kpi .value { font-size: clamp(1.05rem, 1.6vw, 1.5rem); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-card .label { overflow-wrap: normal; word-break: normal; hyphens: auto; }
.col-4 > .kpi-card { padding: .7rem .75rem; } .col-4 > .kpi-card .label { font-size: .72rem; }

/* abas (pills) sempre na cor da clínica */
.nav-pills .nav-link { color: var(--ea-primary); }
.nav-pills .nav-link.active, .nav-pills .show > .nav-link { background-color: var(--ea-primary); color: #fff; }
