/* =========================================================================
   AmaClin · components.css
   Componentes: botões, cards, listas, campos do motor de formulários
   (chips, sliders, steppers, toggles), modal, toast, dashboard,
   página do caso, configurações e pré-visualização de documentos.
   ========================================================================= */

/* ============================ BOTÕES ============================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font-family: var(--font); font-size: 14px; font-weight: 600;
  border-radius: var(--radius-sm); border: 1px solid transparent;
  padding: 9px 16px; cursor: pointer; text-decoration: none;
  transition: transform .12s ease, box-shadow .15s, background .15s, border-color .15s;
  color: var(--ink); background: transparent;
}
.btn:active { transform: scale(.97); }
.btn .ico svg { width: 16px; height: 16px; display: block; }

.btn-gold { background: var(--gold); color: #fff; box-shadow: 0 2px 8px rgba(200, 151, 74, .35); }
.btn-gold:hover { background: var(--gold-strong); }
.btn-outline { border-color: var(--line); background: var(--surface); }
.btn-outline:hover { border-color: var(--ocean); color: var(--ocean); }
.btn-ghost { color: var(--ink-soft); }
.btn-ghost:hover { background: var(--navy-soft); color: var(--ink); }
.btn-danger-ghost { color: var(--red); }
.btn-danger-ghost:hover { background: var(--red-soft); }
.btn-sm { font-size: 13px; padding: 6px 12px; }
.btn-lg { font-size: 15px; padding: 12px 26px; }
.btn-mini { padding: 6px 8px; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; cursor: pointer; color: var(--ink-soft); }
.btn-mini:hover { color: var(--ocean); border-color: var(--ocean); }
.btn-mini.danger:hover { color: var(--red); border-color: var(--red); }
.btn-mini .ico svg { width: 15px; height: 15px; display: block; }
.btn-back .ico svg { width: 18px; height: 18px; }

/* ============================ CARDS & LISTAS ============================ */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 20px; margin-bottom: 16px;
}
.card-label { font-size: 11.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--gold-strong); margin-bottom: 10px; }

.list { display: flex; flex-direction: column; gap: 8px; }
.list-item {
  display: flex; align-items: center; gap: 13px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 13px 16px;
  text-decoration: none; color: var(--ink);
  transition: border-color .15s, box-shadow .15s, transform .12s;
}
a.list-item:hover, .list-item:hover { border-color: var(--ocean); box-shadow: var(--shadow); }
.list-item.warn { border-left: 3px solid var(--amber); }
.list-item > .ico svg { width: 20px; height: 20px; color: var(--ocean); }
.list-item.warn > .ico svg { color: var(--amber); }
.li-body { flex: 1; min-width: 0; }
.li-title { font-weight: 600; font-size: 14.5px; }
.li-sub { font-size: 12.5px; color: var(--ink-soft); margin-top: 1px; }
.li-and { color: var(--gold-strong); font-weight: 400; }
.li-chev { color: var(--ink-soft); font-size: 18px; }
.doc-row .li-body { text-decoration: none; color: var(--ink); }
.empty { color: var(--ink-soft); font-size: 14px; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); padding: 22px; text-align: center; }

.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--navy); color: #fff; font-weight: 700; font-size: 15px;
}
.avatar.foto { object-fit: cover; }
img.avatar { object-fit: cover; }

.chip-status { font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 20px; letter-spacing: .03em; white-space: nowrap; }
.chip-status.draft { background: var(--navy-soft); color: var(--ink-soft); }
.chip-status.done { background: var(--green-soft); color: var(--green); }
.chip-status.active { background: var(--ocean-soft); color: var(--ocean); }
.chip-status.follow { background: var(--gold-soft); color: var(--gold-strong); }

/* ============================ DASHBOARD ============================ */
.banner-config {
  display: flex; align-items: center; gap: 14px;
  background: var(--gold-soft); border: 1px solid color-mix(in srgb, var(--gold) 40%, transparent);
  border-radius: var(--radius); padding: 15px 18px; margin-bottom: 18px;
}
.banner-config .ico svg { width: 22px; height: 22px; color: var(--gold-strong); }
.banner-config div { flex: 1; font-size: 14px; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 8px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; text-decoration: none; color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.stat-card:hover { border-color: var(--ocean); box-shadow: var(--shadow); }
.stat-card .ico svg { width: 19px; height: 19px; color: var(--ocean); }
.stat-num { font-size: 26px; font-weight: 800; margin-top: 6px; color: var(--navy); }
[data-theme="dark"] .stat-num { color: var(--ink); }
.stat-label { font-size: 12.5px; color: var(--ink-soft); }

.dash-cols { display: grid; grid-template-columns: 1.4fr 1fr; gap: 26px; align-items: start; }
.shortcut-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.shortcut {
  display: flex; gap: 11px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 13px 14px; text-decoration: none; color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.shortcut:hover { border-color: var(--gold); box-shadow: var(--shadow); }
.shortcut .ico svg { width: 19px; height: 19px; color: var(--gold-strong); }
.sc-title { font-size: 13.5px; font-weight: 700; }
.sc-sub { font-size: 11.5px; color: var(--ink-soft); }

.fluxo-card { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12px; }
.fluxo-step { display: inline-flex; align-items: center; gap: 6px; background: var(--navy-soft); border-radius: 20px; padding: 5px 11px 5px 6px; font-weight: 600; }
.fluxo-num { width: 18px; height: 18px; border-radius: 50%; background: var(--navy); color: #fff; font-size: 10.5px; display: inline-flex; align-items: center; justify-content: center; }
[data-theme="dark"] .fluxo-num { background: var(--ocean); }
.fluxo-step .ico svg { width: 13px; height: 13px; color: var(--ocean); }
.fluxo-arrow { color: var(--ink-soft); }

@media (max-width: 900px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-cols { grid-template-columns: 1fr; }
}

/* ============================ BUSCA & FILTROS ============================ */
.searchbar {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 15px; margin-bottom: 15px;
}
.searchbar .ico svg { width: 17px; height: 17px; color: var(--ink-soft); }
.searchbar input { flex: 1; border: none; outline: none; background: none; font-family: var(--font); font-size: 14.5px; color: var(--ink); }
.filtros { margin-bottom: 16px; }

/* ============================ FORMULÁRIOS (motor) ============================ */
.form-wrap { max-width: 860px; }
.form-card { padding: 22px 24px; }

.form-section {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px 24px; margin-bottom: 18px;
}
.section-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px; }
.section-num {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  background: var(--navy); color: #fff; font-size: 13px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; margin-top: 1px;
}
[data-theme="dark"] .section-num { background: var(--ocean); color: #0B1524; }
.section-head h3 { margin: 0; font-size: 16.5px; font-weight: 700; }
.section-nota { margin: 3px 0 0; font-size: 12.5px; color: var(--ink-soft); }

.fields { display: flex; flex-wrap: wrap; gap: 14px 16px; }
.field { flex: 1 1 100%; min-width: 0; }
.field.half { flex: 1 1 calc(50% - 8px); min-width: 220px; }
.field-label { display: block; font-size: 12.5px; font-weight: 700; color: var(--ink); margin-bottom: 6px; letter-spacing: .01em; }
.field-hint { font-size: 11.5px; color: var(--ink-soft); margin-top: 5px; }

.field input[type="text"], .field input[type="number"], .field input[type="date"],
.field input[type="time"], .field input[type="email"], .field textarea, .field select {
  width: 100%; font-family: var(--font); font-size: 14.5px; color: var(--ink);
  background: var(--cream); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 10px 12px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--ocean); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ocean) 15%, transparent);
  background: var(--surface);
}
.field textarea { resize: vertical; line-height: 1.5; }
.input-suffix { position: relative; }
.input-suffix .suffix { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 12.5px; color: var(--ink-soft); pointer-events: none; }

/* -------- Chips (a alma do produto) -------- */
.chip-group { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font-family: var(--font); font-size: 13.5px; font-weight: 600;
  padding: 9px 15px; border-radius: 22px; cursor: pointer;
  background: var(--surface); color: var(--ink);
  border: 1.5px solid var(--line);
  transition: all .13s ease;
  min-height: 38px;
}
.chip:hover { border-color: var(--ocean); }
.chip.on {
  background: var(--navy-soft); border-color: var(--navy); color: var(--navy);
  box-shadow: inset 0 0 0 .5px var(--navy);
}
[data-theme="dark"] .chip.on { background: var(--navy-soft); color: var(--ink); border-color: var(--ocean); }
.chip.on::before { content: "✓ "; font-weight: 800; }
.chip.sexo.on::before { content: ""; }

/* -------- Toggle -------- */
.toggle {
  width: 46px; height: 26px; border-radius: 20px; border: none; cursor: pointer;
  background: var(--line); position: relative; transition: background .18s; padding: 0;
}
.toggle .knob {
  position: absolute; top: 3px; left: 3px; width: 20px; height: 20px;
  background: #fff; border-radius: 50%; transition: left .18s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
}
.toggle.on { background: var(--green); }
.toggle.on .knob { left: 23px; }

/* -------- Slider (escala de dor) -------- */
.slider-row { display: flex; align-items: center; gap: 14px; }
.slider-row input[type="range"] {
  flex: 1; -webkit-appearance: none; appearance: none; height: 6px; border-radius: 4px;
  background: linear-gradient(to right, var(--green) 0%, var(--gold) 55%, var(--red) 100%);
  outline: none;
}
.slider-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%;
  background: var(--surface); border: 2.5px solid var(--navy); cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .2);
}
[data-theme="dark"] .slider-row input[type="range"]::-webkit-slider-thumb { border-color: var(--ocean); }
.slider-badge {
  min-width: 38px; text-align: center; font-weight: 800; font-size: 15px;
  background: var(--navy-soft); color: var(--navy); border-radius: 9px; padding: 5px 8px;
}
[data-theme="dark"] .slider-badge { color: var(--ink); }
.slider-badge.hot { background: var(--red-soft); color: var(--red); }

/* -------- Stepper -------- */
.stepper { display: inline-flex; align-items: center; gap: 4px; }
.stepper-btn {
  width: 36px; height: 36px; border-radius: 10px; border: 1.5px solid var(--line);
  background: var(--surface); font-size: 17px; font-weight: 700; color: var(--ink);
  cursor: pointer; transition: border-color .15s;
}
.stepper-btn:hover { border-color: var(--ocean); color: var(--ocean); }
.stepper-val { min-width: 44px; text-align: center; font-size: 16px; font-weight: 700; }
.stepper-suffix { font-size: 12.5px; color: var(--ink-soft); margin-left: 4px; }

/* -------- Campos automáticos -------- */
.field.auto { background: var(--ocean-soft); border-radius: var(--radius-sm); padding: 10px 14px; border: 1px dashed color-mix(in srgb, var(--ocean) 45%, transparent); }
.auto-field { display: flex; flex-direction: column; gap: 2px; }
.auto-label { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--ocean); }
.auto-value { font-size: 14px; font-weight: 600; }

/* -------- Diretriz e alertas -------- */
.diretriz {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--gold-soft); border: 1px solid color-mix(in srgb, var(--gold) 35%, transparent);
  border-radius: var(--radius); padding: 14px 17px; margin-bottom: 16px;
  font-size: 13px; color: var(--ink);
}
.diretriz .ico svg { width: 19px; height: 19px; color: var(--gold-strong); flex-shrink: 0; margin-top: 1px; }

.form-alerts { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.alert {
  display: flex; gap: 11px; align-items: flex-start;
  border-radius: var(--radius-sm); padding: 12px 15px; font-size: 13.5px; font-weight: 500;
  animation: alertIn .25s ease;
}
@keyframes alertIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.alert.warn { background: var(--amber-soft); color: var(--amber); border: 1px solid color-mix(in srgb, var(--amber) 35%, transparent); }
.alert.danger { background: var(--red-soft); color: var(--red); border: 1px solid color-mix(in srgb, var(--red) 35%, transparent); }
.alert .ico svg { width: 17px; height: 17px; flex-shrink: 0; margin-top: 1px; }

/* -------- Cabeçalho da tela de documento -------- */
.doc-head { display: flex; align-items: flex-start; gap: 13px; margin-bottom: 14px; flex-wrap: wrap; }
.doc-head-body { flex: 1; min-width: 240px; }
.doc-head h1 { font-size: 20px; }
.doc-head-sub { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 13.5px; color: var(--ink-soft); }
.doc-head-sub .avatar { width: 26px; height: 26px; font-size: 12px; }
.idade-chip { background: var(--ocean-soft); color: var(--ocean); border-radius: 20px; padding: 2px 9px; font-size: 11.5px; font-weight: 700; }
.doc-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.progress-row { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.progress { flex: 1; height: 7px; background: var(--line); border-radius: 6px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(to right, var(--navy), var(--ocean)); border-radius: 6px; transition: width .35s ease; }
[data-theme="dark"] .progress-fill { background: linear-gradient(to right, var(--ocean), var(--gold)); }
.progress-label { font-size: 12px; color: var(--ink-soft); white-space: nowrap; }
.autosave { font-size: 11.5px; color: var(--green); font-weight: 600; white-space: nowrap; opacity: .75; transition: opacity .2s; }
.autosave.pulse { opacity: 1; }

/* ============================ PÁGINA DO CASO ============================ */
.case-head { display: flex; align-items: center; gap: 13px; }
.case-head .avatar { width: 46px; height: 46px; font-size: 19px; }
.contexto-card p { margin: 0; font-size: 14px; }

.peso-card { padding-bottom: 14px; }
.peso-chart { width: 100%; height: 72px; }
.peso-chart polyline { fill: none; stroke: var(--ocean); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.peso-row { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.peso-pt { display: flex; flex-direction: column; font-size: 12px; color: var(--ink-soft); }
.peso-pt strong { color: var(--ink); font-size: 13.5px; }
.peso-trend { margin-top: 10px; font-size: 12.5px; font-weight: 700; }
.peso-trend.good { color: var(--green); }
.peso-trend.bad { color: var(--red); }

.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.tl-item { position: relative; display: flex; align-items: center; gap: 12px; padding: 9px 0; }
.tl-dot {
  position: absolute; left: -22px; top: 50%; transform: translateY(-50%);
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--surface); border: 2.5px solid var(--ocean);
}
.tl-dot.done { background: var(--green); border-color: var(--green); }
.tl-body { flex: 1; }
.tl-title { font-weight: 600; font-size: 14px; color: var(--ink); text-decoration: none; }
.tl-title:hover { color: var(--ocean); }
.tl-sub { font-size: 12px; color: var(--ink-soft); }

/* ============================ BIBLIOTECA ============================ */
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 13px; }
.doc-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 17px 18px; display: flex; flex-direction: column; gap: 9px;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.doc-card:hover { border-color: var(--gold); transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.doc-card-head { display: flex; align-items: flex-start; gap: 10px; }
.doc-card-head .ico svg { width: 21px; height: 21px; color: var(--ocean); flex-shrink: 0; margin-top: 2px; }
.doc-card-head h3 { margin: 0; font-size: 14.5px; font-weight: 700; line-height: 1.35; }
.doc-card-desc { margin: 0; font-size: 12.5px; color: var(--ink-soft); flex: 1; }
.doc-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.doc-card-tag { font-size: 11px; color: var(--ink-soft); }

.lgpd-note { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-soft); margin-top: 18px; }
.lgpd-note .ico svg { width: 15px; height: 15px; }

/* ============================ MODAL & TOAST ============================ */
.modal-overlay[hidden] { display: none; }
.modal-overlay {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(13, 27, 46, .5); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg);
  width: 100%; max-width: 520px; max-height: 82vh; overflow-y: auto; padding: 22px 24px;
  animation: modalIn .22s ease;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-x { background: none; border: none; font-size: 16px; cursor: pointer; color: var(--ink-soft); padding: 4px 8px; border-radius: 8px; }
.modal-x:hover { background: var(--navy-soft); }
.modal-sub { color: var(--ink-soft); font-size: 13.5px; margin: 0 0 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 16px; }
.modal-doclist { display: flex; flex-direction: column; gap: 6px; }
.modal-cat { font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--gold-strong); margin: 12px 0 3px; }
.modal-doc {
  display: flex; align-items: center; gap: 12px; text-align: left;
  background: var(--cream); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 11px 13px; cursor: pointer; font-family: var(--font); width: 100%;
  transition: border-color .13s;
}
.modal-doc:hover { border-color: var(--ocean); }
.modal-doc.new { border-style: dashed; }
.modal-doc .ico svg { width: 19px; height: 19px; color: var(--ocean); flex-shrink: 0; }
.md-title { font-size: 13.5px; font-weight: 700; color: var(--ink); }
.md-sub { font-size: 11.5px; color: var(--ink-soft); }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 20px);
  background: var(--navy); color: #fff; font-size: 13.5px; font-weight: 600;
  padding: 11px 22px; border-radius: 30px; box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none; transition: all .25s ease; z-index: 120;
}
[data-theme="dark"] .toast { background: var(--ocean); color: #0B1524; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.danger { background: var(--red); color: #fff; }
.toast.warn { background: var(--amber); color: #fff; }

/* ============================ CONFIGURAÇÕES ============================ */
.config-cols { display: grid; grid-template-columns: 1.5fr 1fr; gap: 22px; align-items: start; }
.config-preview { position: sticky; top: 76px; }
.preview-note { font-size: 12.5px; color: var(--ink-soft); margin: 0 0 12px; }
.preview-note.small { font-size: 11px; margin: 10px 0 0; }
@media (max-width: 1000px) { .config-cols { grid-template-columns: 1fr; } .config-preview { position: static; } }

.upload-row { display: flex; align-items: center; gap: 12px; }
.upload-preview {
  width: 74px; height: 74px; border-radius: var(--radius-sm); overflow: hidden;
  background: var(--cream); border: 1px dashed var(--line);
  display: flex; align-items: center; justify-content: center;
  font-size: 10.5px; color: var(--ink-soft); text-align: center;
}
.upload-preview.round { border-radius: 50%; }
.upload-preview img { width: 100%; height: 100%; object-fit: contain; }
.upload-preview.round img { object-fit: cover; }
.upload-btn { position: relative; overflow: hidden; }

.swatches { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.swatch { width: 32px; height: 32px; border-radius: 50%; border: 2.5px solid transparent; cursor: pointer; transition: transform .12s; }
.swatch:hover { transform: scale(1.12); }
.swatch.on { border-color: var(--ink); box-shadow: 0 0 0 2px var(--surface) inset; }
#cor-custom { width: 32px; height: 32px; border: none; background: none; cursor: pointer; padding: 0; }

.sign-box { position: relative; background: var(--cream); border: 1px dashed var(--line); border-radius: var(--radius-sm); overflow: hidden; }
#sign-canvas { width: 100%; height: 120px; display: block; touch-action: none; cursor: crosshair; }
.sign-saved { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; pointer-events: none; background: var(--cream); }
.sign-actions { display: flex; gap: 8px; margin-top: 8px; }

.mod-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.mod-card { background: var(--cream); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; }
.mod-nome { width: 100%; font-family: var(--font); font-size: 14px; font-weight: 700; color: var(--ink); background: none; border: none; outline: none; margin-bottom: 8px; }
.mod-fields { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--ink-soft); }
.mod-fields label { display: flex; align-items: center; gap: 6px; }
.mod-fields input { width: 74px; font-family: var(--font); font-size: 13.5px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--ink); }

.backup-row { display: flex; gap: 10px; flex-wrap: wrap; }
.form-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 18px; }
.form-footer.sticky { position: sticky; bottom: 14px; background: color-mix(in srgb, var(--cream) 92%, transparent); backdrop-filter: blur(6px); padding: 12px 4px; border-radius: var(--radius); }

/* Prévia ao vivo (mini documento) */
.mini-doc { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 16px; box-shadow: var(--shadow); }
.mini-doc-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.mini-logo { width: 40px; height: 40px; object-fit: contain; }
.mini-logo-fb { width: 40px; height: 40px; border-radius: 50%; border: 2px solid; display: flex; align-items: center; justify-content: center; font-family: Georgia, serif; font-size: 19px; font-weight: 700; }
.mini-nome { font-weight: 800; font-size: 14px; }
.mini-sub { font-size: 10.5px; color: #5B6B7C; }
.mini-bar { color: #fff; font-size: 10px; font-weight: 800; letter-spacing: .06em; padding: 6px 10px; border-radius: 4px; margin-bottom: 10px; }
.mini-lines { display: flex; flex-direction: column; gap: 6px; }
.mini-lines span { display: block; height: 7px; background: #EEE9E1; border-radius: 4px; }

/* ============================ PRÉ-VISUALIZAÇÃO DE DOCUMENTO ============================ */
.print-root:empty { display: none; }
body.previewing .app { display: none; }
.print-root { background: #5B6B7C; min-height: 100vh; padding-bottom: 60px; }
[data-theme="dark"] .print-root { background: #0B1524; }

.preview-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--navy); color: #fff; padding: 12px 22px;
  position: sticky; top: 0; z-index: 50; flex-wrap: wrap;
}
.preview-bar .btn-ghost { color: #C3D2E8; }
.preview-bar .btn-ghost:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.preview-title { font-weight: 700; font-size: 14px; flex: 1; text-align: center; }
.preview-actions { display: flex; gap: 8px; }
.preview-hint { text-align: center; color: #DDE6F2; font-size: 12px; padding: 10px; }

/* A folha A4 na tela */
.doc-page {
  width: 210mm; min-height: 297mm; margin: 18px auto; background: #fff; color: #1d2733;
  padding: 16mm 15mm 14mm; box-shadow: 0 8px 40px rgba(0, 0, 0, .35);
  font-size: 12.5px; line-height: 1.55; font-family: var(--font);
  display: flex; flex-direction: column;
}
.doc-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.doc-header-left { display: flex; gap: 12px; align-items: center; }
.doc-logo { max-width: 64px; max-height: 64px; object-fit: contain; }
.doc-logo-fallback { width: 52px; height: 52px; border-radius: 50%; border: 2.5px solid; display: flex; align-items: center; justify-content: center; font-family: Georgia, serif; font-size: 24px; font-weight: 700; }
.doc-prof-nome { font-size: 16px; font-weight: 800; }
.doc-prof-sub { font-size: 10.5px; color: #5B6B7C; }

.doc-title-bar { border-radius: 6px; padding: 8px 14px; margin: 6px 0 4px; }
.doc-title-bar h1 { color: #fff; font-size: 15px; font-weight: 800; margin: 0; letter-spacing: .02em; }
.doc-subtitle { font-size: 10.5px; color: #5B6B7C; font-style: italic; margin: 4px 2px 10px; }
.doc-diretriz {
  background: #FBF6EA; border-left: 3px solid var(--cor-marca, #C8974A);
  font-size: 10px; color: #5c5030; padding: 8px 12px; border-radius: 0 6px 6px 0; margin-bottom: 12px;
}
.doc-paciente {
  display: flex; justify-content: space-between; gap: 10px;
  border: 1.5px solid; border-radius: 7px; padding: 9px 14px; margin-bottom: 12px;
  font-size: 12px;
}
.doc-body { flex: 1; }
.doc-body h3, .doc-sec {
  font-size: 12px; font-weight: 800; color: #fff; background: var(--cor-marca, #0D2B5C);
  padding: 6px 12px; border-radius: 5px; margin: 16px 0 8px; letter-spacing: .02em;
}
.doc-body p { margin: 0 0 8px; text-align: justify; }
.doc-table { width: 100%; border-collapse: collapse; margin-bottom: 6px; }
.doc-table td { border: 1px solid #E2DED6; padding: 6px 10px; vertical-align: top; font-size: 11.5px; }
.doc-label { width: 38%; color: #5B6B7C; font-weight: 600; background: #FAF8F5; }
.doc-val.auto { color: #1E6B8A; }
.doc-checkbox { font-size: 14px; margin-right: 4px; }
.doc-localdata { margin-top: 18px; }
.doc-alertas {
  background: #FDF2E3; border: 1px solid #ECD9B4; border-radius: 7px;
  padding: 10px 14px; font-size: 11px; margin-bottom: 12px;
}
.doc-alertas ul { margin: 6px 0 0; padding-left: 18px; }
.doc-alerta-box { border: 1.5px solid #E5B8B4; border-radius: 8px; padding: 4px 14px 8px; margin: 12px 0; }
.doc-carta-abertura { font-size: 14px; }
.doc-paragrafos p { margin-bottom: 4px; }
.doc-recibo-valor { font-size: 16px; text-align: right; }

.doc-signs { display: flex; gap: 40px; margin-top: 34px; }
.doc-signs.single { justify-content: flex-start; max-width: 55%; }
.doc-sign { flex: 1; text-align: center; }
.doc-sign-space { height: 46px; display: flex; align-items: flex-end; justify-content: center; }
.doc-assinatura-img { max-height: 44px; max-width: 80%; object-fit: contain; }
.doc-sign-line { border-top: 1.5px solid #1d2733; margin-bottom: 5px; }
.doc-sign-nome { font-size: 11.5px; font-weight: 700; }
.doc-sign-sub { font-size: 9.5px; color: #5B6B7C; }

.doc-footer {
  display: flex; justify-content: space-between; gap: 10px;
  border-top: 1px solid #E2DED6; margin-top: 26px; padding-top: 8px;
  font-size: 9px; color: #8B97A5;
}

@media (max-width: 900px) {
  .doc-page { width: 100%; min-height: auto; padding: 20px 16px; }
}

/* ============================ TELA DE AUTENTICAÇÃO E LANDING ULTRA-MODERNA ============================ */
body.auth-mode .main {
  margin-left: 0 !important;
  width: 100% !important;
  min-height: 100vh;
}

body.auth-mode .content {
  max-width: 100% !important;
  padding: 0 !important;
  margin: 0 !important;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at top left, #17386D 0%, #0D2B5C 50%, #06152E 100%);
}

.auth-wrapper {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 50px;
  align-items: center;
  width: 100%;
  max-width: 1060px;
  margin: 0 auto;
  padding: 40px 24px;
}

/* Hero em destaque */
.auth-hero { padding-right: 10px; }
.hero-badge {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 700;
  color: #E2B76F;
  background: rgba(200, 151, 74, 0.18);
  border: 1px solid rgba(200, 151, 74, 0.35);
  padding: 6px 14px;
  border-radius: 20px;
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-bottom: 20px;
}

.hero-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.hero-mark {
  width: 52px; height: 52px; font-size: 26px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.1); border: 2px solid #C8974A;
  color: #C8974A; display: inline-flex; align-items: center; justify-content: center;
  font-family: Georgia, serif; font-weight: 700; flex-shrink: 0;
  box-shadow: 0 4px 18px rgba(0,0,0,0.2);
}
.hero-brand h1 { font-size: 36px; font-weight: 800; color: #FFFFFF; margin: 0; letter-spacing: -.03em; }
.hero-tagline { font-size: 16.5px; color: #B3C7E6; margin: 0 0 28px; font-weight: 400; line-height: 1.45; }

.hero-features { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.hero-features li {
  display: flex; align-items: center; gap: 12px;
  font-size: 14.5px; color: #F1F5F9; line-height: 1.4;
  background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 11px 16px; border-radius: 12px; backdrop-filter: blur(8px);
}
.feat-ico {
  color: #4ADE80; font-weight: 800; background: rgba(74, 222, 128, 0.15);
  width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; font-size: 12px; flex-shrink: 0;
}

/* Card de formulário ultra-moderno */
.auth-card-box {
  background: #FFFFFF;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 20px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.35);
  padding: 36px 32px;
  width: 100%;
}

.auth-nav-tabs {
  display: flex; background: #F1F5F9; border-radius: 12px; padding: 4px; margin-bottom: 26px;
}
.tab-btn {
  flex: 1; border: none; background: transparent; padding: 10px 14px; font-size: 13.5px;
  font-weight: 700; color: #64748B; border-radius: 9px; cursor: pointer;
  transition: all .2s ease; text-align: center;
}
.tab-btn.active {
  background: #FFFFFF; color: #0D2B5C; box-shadow: 0 3px 10px rgba(0,0,0,0.08);
}

.auth-form .form-group { margin-bottom: 20px; }
.auth-form label { display: block; font-size: 13.5px; font-weight: 700; margin-bottom: 7px; color: #1E293B; }
.form-hint { display: block; font-size: 11.5px; color: #64748B; margin-top: 5px; }

.label-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 7px; }
.label-row label { margin-bottom: 0; }
.link-sm { font-size: 12.5px; color: #1E6B8A; text-decoration: none; font-weight: 600; }
.link-sm:hover { text-decoration: underline; color: #0D2B5C; }

/* Botão principal em destaque */
.btn-block {
  width: 100%;
  height: 48px;
  padding: 0 20px;
  font-size: 15.5px;
  font-weight: 700;
  border-radius: 12px;
  margin-top: 10px;
  background: linear-gradient(135deg, #C8974A 0%, #B08236 100%);
  color: #FFFFFF;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(176, 130, 54, 0.35);
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.btn-block:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 22px rgba(176, 130, 54, 0.45);
  background: linear-gradient(135deg, #D8A85C 0%, #B8893B 100%);
}

.auth-footer {
  text-align: center; margin-top: 24px; font-size: 13px; color: #64748B;
  border-top: 1px solid #E2E8F0; padding-top: 20px;
}
.auth-footer a { color: #1E6B8A; font-weight: 700; text-decoration: none; }
.auth-footer a:hover { text-decoration: underline; }

@media (max-width: 860px) {
  .auth-wrapper { grid-template-columns: 1fr; gap: 32px; padding: 24px 16px; }
  .auth-hero { padding-right: 0; text-align: center; }
  .hero-brand { justify-content: center; }
  .hero-features { text-align: left; }
  .auth-card-box { padding: 28px 20px; }
}



