/* =========================================================================
   Portal de Evidências — estilos
   ========================================================================= */

@font-face {
  font-family: 'Inter';
  src: url('fonts/inter-latin.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e3e8ef;
  --border-strong: #cfd7e2;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --faint: #94a3b8;

  --primary: #0d7a64;
  --primary-hover: #0a6553;
  --primary-50: #ecf7f3;
  --primary-100: #d2ede3;
  --primary-ring: rgba(13, 122, 100, 0.22);

  --danger: #d03b3b;
  --danger-hover: #b42f2f;
  --danger-50: #fdf1f1;
  --success: #15803d;
  --success-50: #effbf3;
  --warning: #b45309;
  --warning-50: #fff8eb;
  --info: #1d4ed8;
  --info-50: #eff4ff;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 6px 16px -4px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 24px 64px -12px rgba(15, 23, 42, 0.28);

  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--font);
  font-feature-settings: 'cv11', 'ss01';
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; color: var(--text); letter-spacing: -0.015em; }
h1 { font-size: 1.6rem; font-weight: 700; }
h2 { font-size: 1.1rem; font-weight: 650; }
h3 { font-size: 0.95rem; font-weight: 650; }
p { margin: 0; }
strong { font-weight: 600; }

.icon { width: 18px; height: 18px; flex: none; }
.icon-sm { width: 15px; height: 15px; flex: none; }
.icon-lg { width: 26px; height: 26px; flex: none; }
.muted { color: var(--muted); }
.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;
}

:focus-visible { outline: 3px solid var(--primary-ring); outline-offset: 2px; border-radius: 6px; }

/* ---------- Barra superior ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 20px; min-height: 64px;
  display: flex; align-items: center; gap: 24px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, #12a383, var(--primary)); color: #fff;
  box-shadow: 0 4px 10px -2px rgba(13, 122, 100, 0.45);
}
.brand-mark .icon { width: 19px; height: 19px; }
.brand-text small { display: block; font-size: 0.72rem; font-weight: 500; color: var(--muted); letter-spacing: 0; line-height: 1.1; }

.nav { display: flex; align-items: center; gap: 2px; flex: 1; }
.nav a {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 9px;
  color: var(--text-2); font-weight: 500; font-size: 0.92rem; white-space: nowrap;
}
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.on { background: var(--primary-50); color: var(--primary); }
.nav .icon { width: 17px; height: 17px; }
.nav .badge { margin-left: 2px; }

.userbox { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.userbox-text { line-height: 1.2; text-align: right; }
.userbox-text strong { display: block; font-size: 0.86rem; max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.userbox-text span { font-size: 0.75rem; color: var(--muted); }

/* ---------- Layout ---------- */
.container { max-width: 1200px; margin: 0 auto; padding: 28px 20px 64px; }
.container.narrow { max-width: 600px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { color: var(--muted); margin-top: 4px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 500; font-size: 0.9rem; margin-bottom: 10px; }
.back-link:hover { color: var(--text); text-decoration: none; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card-body { padding: 24px; }
section.card + section.card, form.card + section.card { margin-top: 16px; }
.card-head { padding: 18px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { padding: 16px 18px; display: flex; align-items: center; gap: 14px; }
.stat-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; background: var(--primary-50); color: var(--primary); }
.stat strong { display: block; font-size: 1.35rem; line-height: 1.1; letter-spacing: -0.02em; }
.stat span { color: var(--muted); font-size: 0.83rem; }

/* ---------- Formulários ---------- */
.stack { display: flex; flex-direction: column; gap: 18px; }
.stack-sm { display: flex; flex-direction: column; gap: 10px; }
.grid-2 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

.field { display: flex; flex-direction: column; gap: 7px; }
.field > span, .label { font-weight: 600; font-size: 0.88rem; color: var(--text-2); }
label.field { cursor: default; }
.hint { font-size: 0.8rem; color: var(--muted); font-weight: 400; }

.input, input[type=text], input[type=email], input[type=password], input[type=date], input[type=search], select {
  width: 100%; height: 44px; padding: 0 14px; font: inherit; font-size: 0.95rem; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
select {
  appearance: none; padding-right: 40px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' 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 12px center;
}
input::placeholder { color: var(--faint); }
input:hover, select:hover { border-color: #b8c2d0; }
input:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-ring); }

.input-icon { position: relative; }
.input-icon > .icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.input-icon > input { padding-left: 40px; }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 600; font-size: 0.9rem;
  cursor: pointer; white-space: nowrap; text-decoration: none; box-shadow: var(--shadow-sm);
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.btn:hover { background: var(--surface-2); border-color: #b8c2d0; text-decoration: none; }
.btn:disabled { opacity: 0.65; cursor: progress; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(13, 122, 100, 0.3); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-danger { color: var(--danger); border-color: #f0c9c9; }
.btn-danger:hover { background: var(--danger-50); border-color: #e9aaaa; }
.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger-solid:hover { background: var(--danger-hover); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); border-color: transparent; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 0.84rem; border-radius: 9px; }
.btn-lg { height: 52px; padding: 0 22px; font-size: 1rem; border-radius: 12px; }
.btn-block { width: 100%; }
.btn-icon { width: 36px; padding: 0; }
.btn-icon.btn-sm { width: 34px; }

/* ---------- Alertas ---------- */
.alert {
  display: flex; gap: 12px; align-items: flex-start; padding: 13px 16px; border-radius: var(--radius);
  border: 1px solid transparent; margin-bottom: 18px; font-size: 0.92rem;
}
.alert .icon { margin-top: 1px; }
.alert ul { margin: 0; padding-left: 1.1rem; }
.alert-success { background: var(--success-50); border-color: #c6ebd2; color: #14532d; }
.alert-success .icon { color: var(--success); }
.alert-error { background: var(--danger-50); border-color: #f3cdcd; color: #7f1d1d; }
.alert-error .icon { color: var(--danger); }
.alert-info { background: var(--info-50); border-color: #d3defd; color: #1e3a8a; }
.alert-info .icon { color: var(--info); }
.alert-warning { background: var(--warning-50); border-color: #f6dfb5; color: #78350f; }
.alert-warning .icon { color: var(--warning); }

/* ---------- Badges / avatares ---------- */
.badge {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--primary); color: #fff; font-size: 0.72rem; font-weight: 700;
}
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px;
  font-size: 0.78rem; font-weight: 600; white-space: nowrap; background: var(--surface-2); color: var(--text-2);
  border: 1px solid var(--border);
}
.pill-dot::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill-ok { background: var(--success-50); border-color: #cfeeda; color: var(--success); }
.pill-off { background: #f1f5f9; border-color: #e2e8f0; color: var(--muted); }
.pill-warn { background: var(--warning-50); border-color: #f6dfb5; color: var(--warning); }

/* Cores por especialidade */
.spec { --c: #475569; --b: #f1f5f9; background: var(--b); color: var(--c); border-color: transparent; }
.spec-fisioterapia { --c: #0f766e; --b: #e6f6f3; }
.spec-fonoaudiologia { --c: #7c3aed; --b: #f3eefe; }
.spec-nutricao { --c: #c2410c; --b: #fff1e8; }
.spec-medicina { --c: #1d4ed8; --b: #ebf1ff; }
.spec-terapia-ocupacional { --c: #be185d; --b: #fdebf4; }
.spec-psicologia { --c: #4338ca; --b: #eeefff; }
.spec-psicopedagogia { --c: #0369a1; --b: #e7f4fc; }
.spec-servico-social { --c: #a16207; --b: #fdf6e3; }
.spec-enfermagem { --c: #be123c; --b: #fdecef; }

.avatar {
  display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 50%;
  background: var(--primary-50); color: var(--primary); font-weight: 700; font-size: 0.8rem; letter-spacing: 0.02em;
}
.avatar-sm { width: 32px; height: 32px; font-size: 0.74rem; }
.person { display: flex; align-items: center; gap: 12px; min-width: 0; }
.person-text { min-width: 0; }
.person-text strong { display: block; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; }
.person-text span { display: block; font-size: 0.82rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Barra de busca/filtros + tabela ---------- */
.toolbar { display: flex; gap: 10px; padding: 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; align-items: center; }
.toolbar .input-icon { flex: 1 1 280px; }
.toolbar select { width: auto; min-width: 170px; flex: 0 1 auto; }
.toolbar-count { margin-left: auto; color: var(--muted); font-size: 0.85rem; white-space: nowrap; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; padding: 11px 16px; font-size: 0.74rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap;
}
td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; font-size: 0.9rem; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fafbfd; }
tr.inactive .person-text strong, tr.inactive td { color: var(--muted); }
tr.inactive .avatar { background: #eef1f5; color: var(--faint); }
.col-actions { width: 1%; white-space: nowrap; text-align: right; }
.col-actions .btn + .btn { margin-left: 4px; }
.cell-sub { display: block; font-size: 0.8rem; color: var(--muted); max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--border); color: var(--muted); font-size: 0.85rem; }
.pager-buttons { display: flex; gap: 6px; }

.empty { padding: 48px 24px; text-align: center; color: var(--muted); }
.empty .icon-lg { color: var(--faint); margin-bottom: 8px; }
.empty strong { display: block; color: var(--text); font-size: 1rem; margin-bottom: 4px; }

/* ---------- Janelas (dialog) ---------- */
.modal {
  width: min(460px, calc(100vw - 24px)); max-height: calc(100vh - 32px); padding: 0; border: 0;
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); color: var(--text); background: var(--surface);
}
.modal-wide { width: min(760px, calc(100vw - 24px)); }
.modal::backdrop { background: rgba(15, 23, 42, 0.5); backdrop-filter: blur(2px); }
dialog:not([open]) { display: none !important; }
.modal[open] { display: flex; flex-direction: column; animation: pop 0.16s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(0.98); } }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 22px 16px; border-bottom: 1px solid var(--border); }
.modal-head p { color: var(--muted); font-size: 0.85rem; margin-top: 2px; }
.modal-head form { margin: 0; }
.modal-body { padding: 20px 22px; overflow-y: auto; display: flex; flex-direction: column; gap: 18px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.modal-section { display: flex; flex-direction: column; gap: 10px; }
.modal-section + .modal-section { padding-top: 18px; border-top: 1px solid var(--border); }
.modal-row { display: flex; gap: 8px; flex-wrap: wrap; }
.modal-row form { margin: 0; }
.inline-form { display: flex; gap: 8px; align-items: flex-end; }
.inline-form .field { flex: 1; }

/* ---------- Seletor de pacientes ---------- */
.picker { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.picker-head { display: flex; gap: 10px; align-items: center; padding: 10px; background: var(--surface-2); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.picker-head .input-icon { flex: 1 1 220px; }
.picker-head input[type=search] { height: 38px; }
.picker-only { display: inline-flex; align-items: center; gap: 6px; font-size: 0.84rem; color: var(--text-2); cursor: pointer; white-space: nowrap; }
.picker-list { max-height: 280px; overflow-y: auto; padding: 6px; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 2px; }
.check { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 8px; font-size: 0.87rem; cursor: pointer; }
.check:hover { background: var(--surface-2); }
.check input { width: 17px; height: 17px; accent-color: var(--primary); flex: none; }
.picker-foot { padding: 8px 12px; border-top: 1px solid var(--border); font-size: 0.82rem; color: var(--muted); background: var(--surface-2); }
.picker-foot strong { color: var(--primary); }

/* ---------- Login ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 24px; font-weight: 700; font-size: 1.05rem; letter-spacing: -0.01em; }
.auth-brand .brand-mark { width: 48px; height: 48px; border-radius: 14px; }
.auth-brand .brand-mark .icon { width: 24px; height: 24px; }
.auth-card h1 { font-size: 1.3rem; margin-bottom: 20px; }
.auth-card .card-body { padding: 28px; box-shadow: var(--shadow); }

/* ---------- Envio de foto (profissional) ---------- */
.hello { margin-bottom: 18px; }
.hello h1 { font-size: 1.45rem; }
.hello p { color: var(--muted); margin-top: 4px; }
.steps { display: flex; flex-direction: column; gap: 22px; }
.step { display: grid; grid-template-columns: 30px 1fr; gap: 14px; }
.step-num {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; font-weight: 700; font-size: 0.85rem;
  background: var(--primary-50); color: var(--primary); border: 1px solid var(--primary-100);
}
.step .field { min-width: 0; }

.dropzone {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center;
  min-height: 170px; padding: 22px; border: 2px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface-2);
  cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover, .dropzone.is-drag { border-color: var(--primary); background: var(--primary-50); }
.dropzone:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-ring); }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone-icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: var(--surface); color: var(--primary); box-shadow: var(--shadow); margin-bottom: 4px; }
.dropzone strong { font-size: 0.95rem; }
.dropzone-empty, .dropzone-preview { display: flex; flex-direction: column; align-items: center; gap: 6px; max-width: 100%; }
.dropzone-hint { font-size: 0.8rem; color: var(--muted); }
.dropzone.has-file { padding: 10px; border-style: solid; border-color: var(--primary-100); background: var(--surface); }
.dropzone img { display: block; max-width: 100%; max-height: 300px; border-radius: 9px; object-fit: contain; }
.dropzone-file { display: flex; align-items: center; gap: 8px; font-size: 0.84rem; color: var(--text-2); margin-top: 6px; max-width: 100%; }
.dropzone-file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropzone-change { color: var(--primary); font-weight: 600; font-size: 0.84rem; }

.progress { height: 6px; background: #e6eaf0; border-radius: 999px; overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: linear-gradient(90deg, #14a586, var(--primary)); transition: width 0.2s; }

.done { text-align: center; padding: 12px 0 4px; }
.done-icon { display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: var(--success-50); color: var(--success); margin-bottom: 14px; }
.done-icon .icon { width: 32px; height: 32px; }
.done-icon-wait { background: var(--warning-50); color: var(--warning); }
/* Barra indeterminada enquanto o Drive não confirma. */
.progress-wait { max-width: 260px; margin: 0 auto 8px; }
.progress-wait .progress-bar { width: 35%; animation: progress-wait 1.4s ease-in-out infinite; }
@keyframes progress-wait { from { transform: translateX(-100%); } to { transform: translateX(290%); } }
@media (prefers-reduced-motion: reduce) { .progress-wait .progress-bar { animation: none; width: 100%; opacity: 0.5; } }
.done h2 { font-size: 1.3rem; }
.done p { color: var(--muted); margin: 6px auto 22px; max-width: 380px; }

/* ---------- Telas simples (erro, senha) ---------- */
.center-card { max-width: 460px; margin: 40px auto 0; }
.state-icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; background: var(--primary-50); color: var(--primary); margin-bottom: 16px; }
.state-icon.is-error { background: var(--danger-50); color: var(--danger); }

/* ---------- Celular ---------- */
@media (max-width: 860px) {
  .userbox-text { display: none; }
}

@media (max-width: 760px) {
  body { font-size: 15px; }
  .topbar-inner { flex-wrap: wrap; gap: 10px 14px; padding: 10px 16px 0; min-height: 0; }
  .brand-text small { display: none; }
  .nav { order: 3; flex-basis: 100%; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 12px 8px; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { padding: 7px 10px; font-size: 0.88rem; }
  .container { padding: 20px 16px 48px; }
  h1 { font-size: 1.35rem; }
  .card-body { padding: 18px; }
  .page-head { align-items: flex-start; }
  .page-actions, .page-actions .btn { width: 100%; }

  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .stat { padding: 12px; flex-direction: column; align-items: flex-start; gap: 2px; }
  .stat-icon { display: none; }
  .stat strong { font-size: 1.2rem; }
  .stat span { font-size: 0.74rem; line-height: 1.25; }
  .toolbar { padding: 12px; }
  .toolbar select { flex: 1 1 140px; min-width: 0; font-size: 0.86rem; padding: 0 30px 0 12px; background-position: right 8px center; }
  .toolbar-count { width: 100%; margin-left: 0; }

  /* Tabela vira lista de cartões: nome + ações na 1ª linha, etiquetas lado a lado abaixo */
  table, thead, tbody, tr, td { display: block; }
  thead { display: none; }
  /* padding-left reserva o espaço do avatar: as etiquetas, mesmo quebrando linha, ficam alinhadas com o nome */
  tbody tr { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 6px; padding: 14px 12px 14px 64px; border-bottom: 1px solid var(--border); }
  tbody tr:last-child { border-bottom: 0; }
  tbody tr:hover td { background: none; }
  td { padding: 0; border: 0; }
  td.col-main { flex: 1 1 calc(100% - 84px); min-width: 0; order: 0; margin-left: -48px; }
  td.col-actions { flex: none; order: 1; margin-left: auto; width: auto; }
  td.col-actions .btn + .btn { margin-left: 0; }
  td.col-extra { flex: none; order: 2; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
  .cell-sub { max-width: none; white-space: normal; }

  .modal-foot { flex-direction: column-reverse; }
  .modal-foot .btn { width: 100%; }
  .step { grid-template-columns: 26px 1fr; gap: 12px; }
  .step-num { width: 26px; height: 26px; font-size: 0.8rem; }
}

/* Ajustes de componentes */
.input-icon { display: block; }
.modal > form { display: flex; flex-direction: column; min-height: 0; margin: 0; }
.center { text-align: center; }
.page-head + .stats { margin-top: -4px; }
.pill-xs { height: 20px; padding: 0 8px; font-size: 0.7rem; vertical-align: 1px; }
.alert-inset { margin: 16px 16px 0; }
.state-text { margin: 8px 0 22px; }

/* ---------- Histórico de envios ---------- */
.pill-err { background: var(--danger-50); border-color: #f3cdcd; color: var(--danger); }
.recent { margin-top: 16px; }
.recent .card-head a { font-weight: 600; font-size: 0.88rem; }
.empty-sm { padding: 22px 24px; font-size: 0.9rem; }

/* ---------- Visor do robô ---------- */
.robo-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.robo-grid > .card + .card { margin-top: 0; }
.robo-erros { margin-top: 16px; }
.robo-erros .robo-motivo { max-width: 460px; white-space: normal; color: var(--text-2); font-size: 0.84rem; }
.robo-erros form { margin: 0; }
.robo-tela { padding: 12px; background: #0f172a; border-radius: 0 0 var(--radius-lg) var(--radius-lg); min-height: 260px; display: grid; place-items: center; }
.robo-tela img { display: block; max-width: 100%; height: auto; border-radius: 6px; }
.robo-tela .empty { color: #94a3b8; }
.robo-tela .empty strong { color: #e2e8f0; }
.robo-eventos { list-style: none; margin: 0; padding: 6px 0; max-height: 620px; overflow-y: auto; }
.robo-evento { display: grid; grid-template-columns: 24px 1fr; gap: 10px; padding: 9px 18px; font-size: 0.88rem; border-bottom: 1px solid var(--border); }
.robo-evento:last-child { border-bottom: 0; }
.robo-marca { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; font-size: 0.75rem; font-weight: 700; background: var(--surface-2); color: var(--muted); }
.robo-sucesso .robo-marca { background: var(--success-50); color: var(--success); }
.robo-erro .robo-marca { background: var(--danger-50); color: var(--danger); }
.robo-aviso .robo-marca { background: var(--warning-50); color: var(--warning); }
.robo-etapa .robo-marca { background: var(--primary-50); color: var(--primary); }
.robo-meta { font-size: 0.76rem; color: var(--muted); margin-top: 2px; }
@media (max-width: 960px) { .robo-grid { grid-template-columns: 1fr; } }

/* Menu com muitos itens: não estoura a largura da página */
.nav { min-width: 0; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
@media (max-width: 1440px) { .userbox-text { display: none; } .nav a { padding: 8px 10px; } }
@media (max-width: 760px) { .stats-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* QR code da verificação em duas etapas */
.qr-box { text-align: center; margin: 12px 0; }
.qr-box img { background: #fff; padding: 8px; border-radius: 8px; }
