/* ===========================================================
   Painel Sabrina · Design System V2
   Tokens + base components + layout shell + persona workspaces
   =========================================================== */

:root {
  /* Surfaces · paleta macOS Light Mode (cinza-branco frio) */
  --bg:        #f5f5f7;  /* canonical Apple/macOS window bg */
  --bg2:       #ffffff;  /* cards / topbar / modais (branco puro) */
  --bg3:       #ececef;  /* hovers / search / badges sutis */
  --bg4:       #d2d2d7;  /* avatar default / accents secundários */

  /* Lines · UIColor separator/systemGray */
  --line:      #d2d2d7;
  --line2:     #b8b8bd;

  /* Text */
  --text:      #1d1b17;
  --text2:     #5d574b;
  --text3:     #8e8777;

  /* Brand */
  --gold:      #903a67;
  --gold2:     #7a2e55;
  --gold-soft: #f5e1ef;

  /* Status — primitivos */
  --green:     #3f8361;
  --amber:     #b6843a;
  --red:       #b84a3b;
  --blue:      #3d6a7e;

  /* Status — aliases semânticos (usar estes nas views) */
  --success:      var(--green);
  --danger:       var(--red);
  --warn:         var(--amber);
  --info:         var(--blue);

  /* Status — fundos suaves */
  --success-soft: #e8f5ef;
  --danger-soft:  #faeaea;
  --warn-soft:    #fdf3e3;
  --info-soft:    #e8f0fa;

  /* Aliases curtos · usados em estilos inline ad-hoc nas views */
  --accent:    var(--gold);
  --accent2:   var(--gold2);
  --ok:        var(--green);
  --err:       var(--red);

  /* Radii */
  --r-sm:  6px;
  --r-md:  10px;
  --r-lg:  14px;
  --r-xl:  20px;

  /* Shadow */
  --shadow:    0 10px 40px -10px rgba(0,0,0,.12);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.04);

  /* Tipografia · system stack UTF-8 (manifesto §4.1 — sem Google Fonts) */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  height: 100%;
}
a { color: inherit; text-decoration: none; }

/* code/kbd/pre · força fonte mono do design system (browser default é Courier/feio) */
code, kbd, samp, pre, tt {
  font-family: var(--font-mono);
  font-size: 0.92em;
  font-feature-settings: 'tnum' 1;
}

/* A11y · skip link (visível só ao receber foco por teclado) */
.skip-link {
  position: absolute; top: -999px; left: 8px;
  background: var(--gold); color: #fff;
  padding: 6px 14px; border-radius: var(--r-sm);
  font-size: 13px; font-weight: 600; z-index: 9999;
  transition: top .1s;
}
.skip-link:focus { top: 8px; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }

/* === SVG icons === */
.icon       { width: 18px; height: 18px; flex-shrink: 0; stroke: currentColor; color: inherit; vertical-align: middle; }
.icon.sm    { width: 15px; height: 15px; }
.icon.lg    { width: 22px; height: 22px; }

/* === App shell === */
.app {
  display: grid;
  grid-template-columns: 240px 1fr 340px;
  height: 100vh; overflow: hidden;
  transition: grid-template-columns .25s cubic-bezier(.4,0,.2,1);
}
.app.no-cp        { grid-template-columns: 240px 1fr; }
.app.sb-collapsed { grid-template-columns: 64px 1fr 340px; }
.app.sb-collapsed.no-cp { grid-template-columns: 64px 1fr; }
.app.auth         { grid-template-columns: 1fr; place-items: center; }

/* === Topbar === */
.topbar {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--bg2);
  position: sticky; top: 0; z-index: 5;
}
/* Toggle dentro da sidebar (modelo Claude Console) */
.sb-toggle {
  position: absolute;
  top: 14px; right: 10px;
  width: 26px; height: 26px;
  border-radius: 6px;
  color: var(--text3);
  display: grid; place-items: center;
  transition: all .15s;
  z-index: 4;
}
.sb-toggle:hover { background: var(--bg3); color: var(--text); }
.sb-toggle .icon { width: 16px; height: 16px; transition: transform .25s; }
.sb-collapsed .sb-toggle { right: auto; left: 50%; transform: translateX(-50%); }
.sb-collapsed .sb-toggle .icon { transform: rotate(180deg); }
.logo {
  display: flex; align-items: center; gap: 8px;
  font-weight: 600; font-size: 13px;
  padding-right: 12px;
  border-right: 1px solid var(--line);
  margin-right: 4px;
}
.logo-img {
  height: 36px; width: auto;
  display: block;
  object-fit: contain;
}
.logo-mark {
  width: 24px; height: 24px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--gold), var(--gold2));
  display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 13px;
}
.ws { display: flex; gap: 4px; padding: 4px; background: var(--bg3); border: 1px solid var(--line); border-radius: var(--r-md); }
.ws button { padding: 6px 12px; font-size: 12px; font-weight: 500; border-radius: var(--r-sm); color: var(--text2); display: flex; align-items: center; gap: 6px; }
.ws button.on    { background: var(--bg2); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.ws button:hover:not(.on) { color: var(--text); }
.ws button .icon { width: 14px; height: 14px; }
.cmdk {
  flex: 1; max-width: 480px;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  background: var(--bg3); border: 1px solid var(--line);
  border-radius: var(--r-md);
  color: var(--text3); font-size: 13px; cursor: pointer;
}
.cmdk kbd { margin-left: auto; padding: 2px 6px; background: var(--bg2); border: 1px solid var(--line); border-radius: 4px; font-size: 11px; color: var(--text2); }
.tb-spacer { flex: 1; }
.tb-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: var(--r-md); color: var(--text2); position: relative; }
.tb-icon:hover { background: var(--bg3); color: var(--text); }
.tb-icon .badge { position: absolute; top: 4px; right: 4px; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); border: 2px solid var(--bg2); }

/* Sino · drill-down de alertas */
.bell-drop { position: relative; display: inline-block; }
.bell-badge {
  position: absolute; top: -2px; right: -2px;
  width: 18px; height: 18px;
  padding: 0; border-radius: 50%;
  background: #c15c83; color: #fff;
  border: 2px solid var(--bg2);
  font-size: 10px; font-weight: 700; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  box-sizing: border-box;
  pointer-events: none;
}
.bell-badge.wide {
  width: auto; min-width: 22px; padding: 0 5px;
  border-radius: 9px;
}
.bell-menu {
  position: absolute; top: calc(100% + 6px); right: 0;
  width: 360px; max-height: 480px; overflow-y: auto;
  background: var(--bg2); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 10px 32px rgba(0,0,0,.10);
  z-index: 100;
}
.bell-h {
  display: flex; justify-content: space-between; align-items: center;
  padding: 11px 14px; border-bottom: 1px solid var(--line);
  font-size: 13px; font-weight: 600;
}
.bell-all { font-size: 11.5px; font-weight: 500; color: var(--gold2); text-decoration: none; }
.bell-all:hover { color: var(--gold); }
.bell-loading, .bell-empty {
  padding: 30px 16px; text-align: center; color: var(--text3); font-size: 12.5px;
}
.bell-section {
  padding: 8px 14px; font-size: 10.5px; font-weight: 600;
  color: var(--text3); text-transform: uppercase; letter-spacing: .06em;
  background: var(--bg2); border-bottom: 1px solid var(--line);
}
.bell-item {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 11px 14px; border-bottom: 1px solid var(--line);
  text-decoration: none; color: inherit; font-size: 12.5px;
  border-left: 3px solid transparent;
  transition: background .15s ease;
}
.bell-item:last-child { border-bottom: 0; }
.bell-item:hover { background: var(--bg3); }
.bell-item.sev-critico { border-left-color: #9b2c2c; }
.bell-item.sev-alta    { border-left-color: #b45309; }
.bell-item.sev-warn    { border-left-color: #b45309; opacity: .9; }
.bell-sev {
  flex: 0 0 18px; height: 18px; border-radius: 50%;
  background: var(--bg3); color: var(--text2);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; margin-top: 1px;
}
.bell-item.sev-critico .bell-sev { background: #fee2e2; color: #9b2c2c; }
.bell-item.sev-alta .bell-sev    { background: #fef3c7; color: #854d0e; }
.bell-item.sev-warn .bell-sev    { background: #fef3c7; color: #854d0e; }
.bell-body { flex: 1; min-width: 0; }
.bell-tt { font-weight: 500; color: var(--text); margin-bottom: 2px; }
.bell-sub { color: var(--text2); font-size: 11.5px; line-height: 1.4; margin-bottom: 3px; }
.bell-meta { font-size: 10.5px; color: var(--text3); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.tb-user { display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: 999px; border: 1px solid var(--line); cursor: pointer; background: transparent; font-family: inherit; transition: background .15s; }
.tb-user:hover { background: var(--bg3); }
.avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--bg4); display: grid; place-items: center; font-size: 11px; font-weight: 600; color: var(--text2); }
.muted { color: var(--text3); }

/* User dropdown */
.user-drop { position: relative; display: inline-block; }
.user-menu {
  position: absolute; top: calc(100% + 6px); right: 0;
  min-width: 180px;
  background: var(--bg2); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.10);
  z-index: 100; overflow: hidden;
}
.user-menu-name {
  padding: 10px 14px 8px;
  font-size: 11.5px; font-weight: 700; color: var(--text3);
  text-transform: uppercase; letter-spacing: .04em;
  border-bottom: 1px solid var(--line);
}
.user-menu a {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 14px;
  font-size: 13px; color: var(--text2); text-decoration: none;
  border-bottom: 1px solid var(--line);
  transition: background .12s;
}
.user-menu a:last-child { border-bottom: 0; }
.user-menu a:hover { background: var(--bg3); color: var(--text); }
.user-menu .user-menu-sair { color: #c15c5c; }
.user-menu .user-menu-sair:hover { background: #fff0f0; color: #9b2c2c; }

/* === Sidebar === */
.sb {
  padding: 14px 10px;
  border-right: 1px solid var(--line);
  background: var(--bg);
  overflow-y: auto; overflow-x: hidden;
  position: relative;
}
.persona-card { padding: 11px 12px; background: var(--bg3); border-radius: var(--r-md); margin: 8px 4px 12px 4px; padding-right: 40px; font-size: 12px; transition: all .25s; }
.persona-card .nm { font-weight: 600; font-size: 13px; margin-bottom: 2px; white-space: nowrap; }
.persona-card .role { color: var(--text3); font-size: 11px; white-space: nowrap; }
.sb-section { margin: 14px 4px 4px; padding: 0 8px; font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text3); white-space: nowrap; }
.sb-item { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: var(--r-sm); color: var(--text2); font-size: 13px; cursor: pointer; position: relative; white-space: nowrap; transition: all .15s; }
.sb-item:hover { background: var(--bg3); color: var(--text); }
.sb-item.active { background: var(--gold-soft); color: var(--gold2); font-weight: 500; }
.sb-item .icon { width: 17px; height: 17px; }
.sb-item .lbl { flex: 1; overflow: hidden; text-overflow: ellipsis; transition: opacity .15s; }
.sb-item .ct { font-size: 10.5px; color: var(--text3); background: var(--bg3); padding: 1px 7px; border-radius: 999px; font-weight: 600; transition: opacity .15s; }
.sb-item .ct.ct-warn { background: #fde7e3; color: #dc2626; }
.sb-item.active .ct { background: var(--bg2); color: var(--gold2); }
.sb-item.active .ct.ct-warn { background: #fde7e3; color: #dc2626; }
.sb-item .ct-dot { display: none; }

/* Persistência do estado colapsado */
.sb-collapsed .sb { padding: 50px 8px 14px; }
.sb-collapsed .sb-item { justify-content: center; padding: 9px 0; gap: 0; }
.sb-collapsed .sb-item .lbl,
.sb-collapsed .sb-item .ct { opacity: 0; width: 0; padding: 0; margin: 0; pointer-events: none; }
.sb-collapsed .sb-section { opacity: 0; height: 1px; margin: 8px 8px 0; padding: 0; border-top: 1px solid var(--line); font-size: 0; }
.sb-collapsed .persona-card { display: none; }
.sb-collapsed .sb-item::after { content: attr(data-tip); position: absolute; left: calc(100% + 8px); top: 50%; transform: translateY(-50%); background: var(--text); color: var(--bg); padding: 5px 10px; border-radius: 6px; font-size: 12px; font-weight: 500; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .12s; z-index: 50; box-shadow: 0 4px 12px rgba(0,0,0,.15); }
.sb-collapsed .sb-item:hover::after { opacity: 1; }
.sb-collapsed .sb-item .ct-dot { display: block; position: absolute; top: 6px; right: 8px; width: 6px; height: 6px; border-radius: 50%; background: var(--gold); }
.sb-collapsed .sb-item:not(:has(.ct)) .ct-dot { display: none; }

/* === Main === */
.main { overflow-y: auto; padding: 24px 28px; }
.flash-msg {
  padding: 11px 16px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 14px;
  font-weight: 500;
  border: 1px solid;
}
.flash-msg.flash-ok  { background: #dff1e6; color: #047857; border-color: #a7e3c2; }
.flash-msg.flash-err { background: #fde7e3; color: #991b1b; border-color: #f4b8ad; }
.crumb { color: var(--text3); font-size: 12px; margin-bottom: 6px; }
.crumb b { color: var(--text2); font-weight: 500; }
.h1 { margin: 0 0 4px; font-size: 22px; font-weight: 600; letter-spacing: -.01em; }
.h1 .pill { display: inline-block; margin-left: 8px; padding: 3px 9px; font-size: 11px; font-weight: 600; background: var(--gold-soft); color: var(--gold2); border-radius: 999px; vertical-align: middle; }
.sub { color: var(--text2); font-size: 13px; margin-bottom: 20px; }
.head-row { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.head-row .actions { margin-left: auto; display: flex; gap: 6px; }

/* === Cards & primitives === */
.card { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r-md); padding: 18px; margin-bottom: 16px; }
.card.flush { padding: 0; }
.card-h { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; }
.card-h h3 { margin: 0; font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 7px; }
.card-h h3 .icon { color: var(--gold2); width: 16px; height: 16px; }
.card-h .right { margin-left: auto; color: var(--text3); font-size: 12px; }

.btn { padding: 7px 13px; border-radius: var(--r-sm); font-size: 12.5px; font-weight: 500; border: 1px solid var(--line); background: var(--bg2); color: var(--text); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { background: var(--bg3); }
.btn.primary { background: var(--gold); color: #fff; border-color: var(--gold); }
.btn.primary:hover { background: var(--gold2); border-color: var(--gold2); }
.btn.ghost { border-color: transparent; color: var(--text2); }
.btn.sm { padding: 4px 9px; font-size: 11.5px; }
.btn.lg { padding: 10px 18px; font-size: 13.5px; }
.btn:disabled, .btn[disabled] { opacity: .45; cursor: not-allowed; pointer-events: none; }
.btn.danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.danger:hover { filter: brightness(.9); }

/* Microcopy de campo · dicas e validações em linha */
.field-hint { font-size: 11.5px; color: var(--text3); margin-top: 3px; }
.field-hint.ok   { color: var(--success); }
.field-hint.warn { color: var(--warn); }
.field-hint.err  { color: var(--danger); }

/* Tags com tokens semânticos */
.tag.success { background: var(--success-soft); color: var(--success); }
.tag.danger  { background: var(--danger-soft);  color: var(--danger); }
.tag.warn    { background: var(--warn-soft);     color: var(--warn); }
.tag.info    { background: var(--info-soft);     color: var(--info); }

.tag { display: inline-block; padding: 2px 8px; font-size: 10.5px; font-weight: 600; background: var(--bg3); color: var(--text2); border-radius: 999px; }
.tag.gold  { background: var(--gold-soft); color: var(--gold2); }
.tag.green { background: #dff1e6; color: var(--green); }
.tag.amber { background: #f6ead0; color: var(--amber); }
.tag.red   { background: #fde7e3; color: var(--red); }
.tag.blue  { background: #dde9ee; color: var(--blue); }

/* === /atendimento · modo "Dra com paciente AGORA" ============= */

/* Cards de execuções pendentes */
.atend-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 14px;
}
.atend-card {
  display: flex; flex-direction: column; gap: 12px;
  padding: 18px 20px;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--line);
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
  transition: all 0.15s;
  position: relative;
}
.atend-card:hover {
  border-color: var(--line2);
  border-left-color: var(--gold);
  background: linear-gradient(180deg, var(--bg2), #fdfaf3);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px -8px rgba(0,0,0,.08);
}
.atend-card.is-andamento {
  border-left-color: var(--gold);
  background: linear-gradient(135deg, #fdf6ea 0%, #f6e9d4 100%);
}
.atend-card-head {
  display: flex; align-items: center; gap: 12px;
}
.atend-card-id { flex: 1; min-width: 0; }
.atend-card-nome {
  font-size: 14px; font-weight: 600; color: var(--text);
  letter-spacing: -0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.atend-card-sub {
  font-size: 11.5px; color: var(--text3); margin-top: 2px;
}
.atend-card-status { flex-shrink: 0; }
.atend-card-body {
  display: flex; flex-direction: column; gap: 6px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}
.atend-card-proc {
  font-size: 12.5px; color: var(--text2);
  letter-spacing: -0.005em;
}
.atend-card-meta {
  display: flex; gap: 14px; align-items: center;
  font-size: 11px; color: var(--text3);
  font-feature-settings: 'tnum' 1;
}
.atend-card-cta {
  font-size: 12.5px;
  color: var(--gold2);
  font-weight: 500;
  margin-top: 2px;
  letter-spacing: -0.005em;
}
.atend-card.is-andamento .atend-card-cta { color: var(--gold); font-weight: 600; }

/* Pill de status */
.atend-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.atend-pill-pendente {
  background: #f1efeb;
  color: #6b6661;
}
.atend-pill-andamento {
  background: var(--gold-soft);
  color: var(--gold2);
}

/* Cronômetro */
.atend-cronometro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 28px;
  background: linear-gradient(135deg, #fdf6ea 0%, #f6e9d4 100%);
  border: 1px solid #e8dcc4;
  border-radius: 14px;
  margin-bottom: 28px;
}
.atend-crono-lbl {
  font-size: 11px;
  font-weight: 700;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}
.atend-crono-num {
  font-family: var(--font-mono);
  font-size: 48px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1;
  font-feature-settings: 'tnum' 1;
}
.atend-crono-status {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  text-align: right;
}
.atend-crono-status small {
  font-size: 11px;
  color: var(--text3);
  font-style: italic;
  max-width: 240px;
  line-height: 1.4;
}

/* Cards de kits */
.kit-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}
.kit-card {
  display: flex; flex-direction: column; gap: 10px;
  padding: 18px 20px;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
  transition: all 0.15s;
}
.kit-card:hover {
  border-color: var(--line2);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px -8px rgba(0,0,0,.08);
  background: linear-gradient(180deg, var(--bg2), #fdfaf3);
}
.kit-card-h {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
}
.kit-card-id { flex: 1; min-width: 0; }
.kit-card-nome {
  margin: 0;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}
.kit-card-slug {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text3);
  background: var(--bg3);
  padding: 2px 7px;
  border-radius: 4px;
  margin-top: 4px;
}
.kit-card-desc {
  font-size: 12.5px;
  color: var(--text2);
  margin: 0;
  line-height: 1.5;
}
.kit-card-stats {
  display: flex; align-items: center; gap: 6px;
  font-size: 12.5px;
  color: var(--text2);
}
.kit-card-stats b {
  color: var(--text);
  font-weight: 600;
  font-feature-settings: 'tnum' 1;
}
.kit-card-insumos {
  font-size: 11.5px;
  color: var(--text3);
  font-style: italic;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
  line-height: 1.5;
}

/* Linha do protocolo · timeline horizontal de sessões */
.atend-protocolo {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px 24px;
  margin-bottom: 22px;
}
.atend-protocolo-h { margin-bottom: 18px; }
.atend-protocolo-line {
  display: flex;
  gap: 16px;
  align-items: stretch;
  position: relative;
  flex-wrap: wrap;
}
.atend-prot-step {
  flex: 1;
  min-width: 140px;
  padding: 14px 16px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
  display: flex; align-items: center; gap: 12px;
  transition: all 0.15s;
  position: relative;
}
.atend-prot-step:hover {
  border-color: var(--line2);
  background: var(--bg3);
}
.atend-prot-num {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--bg4);
  color: var(--text2);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
  flex-shrink: 0;
  font-feature-settings: 'tnum' 1;
}
.atend-prot-meta { flex: 1; min-width: 0; }
.atend-prot-data {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
  font-feature-settings: 'tnum' 1;
}
.atend-prot-status {
  font-size: 11px;
  color: var(--text3);
  margin-top: 2px;
}
/* Estados */
.atend-prot-step.is-concluida { background: linear-gradient(180deg, #f0f7f0, #e8f1e8); border-color: #c5d8c5; }
.atend-prot-step.is-concluida .atend-prot-num { background: #2d6a4f; color: #fff; }
.atend-prot-step.is-concluida .atend-prot-status { color: #2d6a4f; font-weight: 500; }

.atend-prot-step.is-atual {
  background: linear-gradient(135deg, #fdf6ea 0%, #f6e9d4 100%);
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(144, 58, 103, .15);
}
.atend-prot-step.is-atual .atend-prot-num { background: var(--gold); color: #fff; }
.atend-prot-step.is-atual .atend-prot-status { color: var(--gold2); font-weight: 600; }

.atend-prot-step.is-andamento { background: var(--gold-soft); border-color: var(--gold); }
.atend-prot-step.is-andamento .atend-prot-num { background: var(--gold); color: #fff; }

.atend-prot-step.is-pendente { opacity: 0.7; }
.atend-prot-step.is-pendente:hover { opacity: 1; }

/* Alertas clínicos · crítico (alergias, contraindicações) e atenção */
.atend-alerta-critico,
.atend-alerta-atencao {
  padding: 18px 22px;
  border-radius: 12px;
  border: 1px solid;
  border-left-width: 4px;
  margin-bottom: 22px;
}
.atend-alerta-critico {
  background: linear-gradient(180deg, #fbe9e6 0%, #f8e1dd 100%);
  border-color: #f4b8ad;
  border-left-color: #9b2c2c;
}
.atend-alerta-atencao {
  background: linear-gradient(180deg, #faedda 0%, #f5e3c5 100%);
  border-color: #e8d2a8;
  border-left-color: #b45309;
}
.atend-alerta-h {
  display: flex; align-items: baseline; gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.atend-alerta-tag {
  display: inline-block;
  padding: 3px 10px;
  background: #9b2c2c;
  color: #fff;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.atend-alerta-tag-warn {
  display: inline-block;
  padding: 3px 10px;
  background: #b45309;
  color: #fff;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.atend-alerta-sub {
  font-size: 12px;
  color: var(--text2);
  letter-spacing: -0.005em;
}
.atend-alerta-lista {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex; flex-direction: column; gap: 6px;
}
.atend-alerta-lista li {
  font-size: 13.5px;
  color: var(--text);
  letter-spacing: -0.005em;
  padding-left: 16px;
  position: relative;
}
.atend-alerta-lista li::before {
  content: '';
  position: absolute;
  left: 0; top: 7px;
  width: 8px; height: 8px;
  border-radius: 50%;
}
.atend-alerta-critico .atend-alerta-lista li::before { background: #9b2c2c; }
.atend-alerta-atencao .atend-alerta-lista li::before { background: #b45309; }
.atend-alerta-lista strong {
  font-weight: 600;
  color: var(--text);
}
.atend-alerta-det {
  color: var(--text2);
  font-size: 12.5px;
}

.atend-alerta-vazio {
  padding: 18px 22px;
  background: var(--bg2);
  border: 1px dashed var(--line2);
  border-radius: 12px;
  font-size: 13px;
  color: var(--text3);
  text-align: center;
  margin-bottom: 22px;
}
.atend-alerta-vazio a { margin-left: 8px; }

/* Anamnese completa colapsível */
.atend-anam-full {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
}
.atend-anam-full.is-open {
  max-height: 2000px;
}

/* Estado de carregamento da próxima sessão */
.atend-empty {
  padding: 56px 20px;
  text-align: center;
  color: var(--text3);
  font-size: 13.5px;
  font-style: italic;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 14px;
}

@media (max-width: 720px) {
  .atend-cards { grid-template-columns: 1fr; }
  .atend-cronometro { flex-direction: column; align-items: flex-start; }
  .atend-crono-status { align-items: flex-start; text-align: left; }
}

/* === /clinica/fornecedores · chips por tipo + tabela === */
.fn-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-bottom: 16px;
}
.fn-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg2);
  color: var(--text2);
  text-decoration: none;
  font-size: 12px;
  transition: all 0.15s;
  --chip-cor: var(--text3);
}
.fn-chip:hover {
  border-color: var(--line2);
  background: var(--bg3);
  color: var(--text);
}
.fn-chip.is-active {
  border-color: var(--chip-cor);
  background: var(--bg);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--chip-cor);
}
.fn-chip-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--chip-cor);
}
.fn-chip-lbl {
  font-weight: 500;
  letter-spacing: -0.005em;
}
.fn-chip-num {
  font-size: 11px;
  color: var(--text3);
  font-feature-settings: 'tnum' 1;
  background: var(--bg3);
  padding: 1px 7px;
  border-radius: 999px;
  font-weight: 600;
}
.fn-chip.is-active .fn-chip-num {
  background: var(--chip-cor);
  color: #fff;
  opacity: 0.85;
}

.fn-search {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 18px;
}
.fn-search-input {
  flex: 1;
  border: 0;
  background: transparent;
  outline: none;
  font-size: 13px;
  color: var(--text);
  font-family: inherit;
}
.fn-search-input::placeholder { color: var(--text3); }

.fn-empty {
  padding: 56px 20px;
  text-align: center;
  color: var(--text3);
  font-size: 13.5px;
  font-style: italic;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 14px;
}

/* Linha de stats sóbria · número grande + label cinza pequeno · separador "·" */
.al-stats {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 16px 4px 22px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.al-stat {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  white-space: nowrap;
}
.al-stat-num { font-size: 22px; font-weight: 600; letter-spacing: -.01em; line-height: 1; font-feature-settings: 'tnum' 1; }
.al-stat-lbl { font-size: 12px; color: var(--text2); }
.al-stat-sep { color: var(--text3); font-size: 16px; }

/* Tabs do detalhe do fornecedor */
.fn-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.fn-tab {
  padding: 10px 16px;
  font-size: 13px;
  color: var(--text2);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  letter-spacing: -0.005em;
  transition: all 0.15s;
}
.fn-tab:hover {
  color: var(--text);
  border-bottom-color: var(--line2);
}
.fn-tab.is-active {
  color: var(--text);
  border-bottom-color: var(--gold);
  font-weight: 600;
}
.fn-tab-num {
  font-size: 10.5px;
  font-weight: 600;
  background: var(--bg3);
  color: var(--text3);
  padding: 1px 7px;
  border-radius: 999px;
  font-feature-settings: 'tnum' 1;
}
.fn-tab.is-active .fn-tab-num {
  background: var(--gold);
  color: #fff;
}

/* DL · pares de label/valor estilo "ficha técnica" */
.fn-dl {
  margin: 0;
  display: grid;
  grid-template-columns: minmax(120px, auto) 1fr;
  row-gap: 8px;
  column-gap: 14px;
  font-size: 13px;
}
.fn-dl dt {
  color: var(--text3);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding-top: 1px;
}
.fn-dl dd {
  margin: 0;
  color: var(--text);
  letter-spacing: -0.005em;
}

.fn-row { border-left: 3px solid transparent; transition: background 0.15s; }
.fn-row:hover { background: rgba(144, 58, 103, 0.04) !important; }

.fn-nome {
  font-weight: 500;
  font-size: 13.5px;
  color: var(--text);
  letter-spacing: -0.005em;
}
.fn-sub {
  font-size: 11.5px;
  color: var(--text3);
  margin-top: 3px;
}
.fn-wa {
  color: var(--gold2);
  text-decoration: none;
  font-weight: 500;
}
.fn-wa:hover { text-decoration: underline; }

.fn-tipo-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--tipo-cor, var(--text2));
  background: rgba(0,0,0,0.03);
  border: 1px solid currentColor;
  letter-spacing: -0.005em;
  white-space: nowrap;
}

.fn-tags {
  display: flex; flex-wrap: wrap; gap: 4px;
}
.fn-tag {
  font-size: 10.5px;
  padding: 2px 7px;
  background: var(--bg3);
  color: var(--text2);
  border-radius: 4px;
  font-weight: 500;
}
.fn-tag-more {
  font-size: 10.5px;
  color: var(--text3);
  padding: 2px 4px;
}

.fn-num {
  font-size: 13px;
  font-feature-settings: 'tnum' 1;
  color: var(--text);
  font-weight: 500;
}
.fn-cell-data {
  font-size: 12px;
  color: var(--text2);
  font-feature-settings: 'tnum' 1;
}
.fn-col-tipo  { width: 160px; }
.fn-col-num   { width: 90px; }
.fn-col-data  { width: 120px; }

/* === /alertas · sóbrio premium · sem emoji, sem demo glow === */

/* Header da página · linha dourada fina marca identidade */
.al-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 24px;
  padding-bottom: 22px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--line);
}
.al-header-text { flex: 1; }
.al-title {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0 0 6px;
  color: var(--text);
  line-height: 1.15;
}
.al-meta { font-size: 12.5px; color: var(--text3); margin: 0; }
.al-header-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* Indicador principal · número grande + breakdown lateral */
.al-summary {
  display: grid;
  grid-template-columns: minmax(180px, 220px) 1fr;
  gap: 32px;
  align-items: stretch;
  padding: 28px 32px;
  background: linear-gradient(135deg, var(--bg2) 0%, var(--bg3) 100%);
  border: 1px solid var(--line);
  border-radius: 14px;
  margin-bottom: 32px;
  position: relative;
  overflow: hidden;
}
.al-summary::before {
  content: '';
  position: absolute; left: 0; top: 24px; bottom: 24px;
  width: 3px;
  background: var(--gold);
  border-radius: 0 2px 2px 0;
}
.al-summary-main {
  display: flex; flex-direction: column; justify-content: center;
  padding-right: 24px;
  border-right: 1px solid var(--line);
}
.al-big-num {
  font-size: 64px;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 0.95;
  font-feature-settings: 'tnum' 1;
}
.al-big-lbl {
  font-size: 12.5px;
  color: var(--text2);
  margin-top: 8px;
  letter-spacing: 0.01em;
}

.al-summary-breakdown {
  display: flex; flex-direction: column; justify-content: center; gap: 14px;
}
.al-bd-row {
  display: grid;
  grid-template-columns: 36px 110px 1fr;
  align-items: baseline;
  gap: 12px;
  opacity: 0.45;
  transition: opacity 0.15s;
}
.al-bd-row.is-active { opacity: 1; }
.al-bd-num {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--text);
  font-feature-settings: 'tnum' 1;
}
.al-bd-row.al-bd-critico.is-active .al-bd-num { color: #9b2c2c; }
.al-bd-row.al-bd-warn.is-active    .al-bd-num { color: #92400e; }
.al-bd-row.al-bd-info.is-active    .al-bd-num { color: #365070; }
.al-bd-lbl {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
}
.al-bd-hint {
  font-size: 11.5px;
  color: var(--text3);
  font-style: italic;
}

/* Section title (compartilhado · resumo + lista) */
.al-section-title {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 4px;
  color: var(--text);
  letter-spacing: -0.005em;
}
.al-section-sub {
  font-size: 12px;
  color: var(--text3);
  margin: 0;
}

/* Resumo pra envio */
.al-resumo {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px 24px;
  margin-bottom: 32px;
}
.al-resumo-h {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 20px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.al-resumo-actions { display: flex; gap: 8px; flex-shrink: 0; flex-wrap: wrap; }
.al-resumo-card {
  background: linear-gradient(180deg, #fdfaf3, var(--bg2));
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px 20px;
}
.al-resumo-txt {
  margin: 0;
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--text);
  white-space: pre-wrap;
  overflow-x: auto;
  letter-spacing: -0.005em;
}

/* Seção da lista */
.al-list-section { margin-bottom: 32px; }
.al-list-h {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 20px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.al-toolbar { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.al-select {
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg2);
  font-size: 12.5px;
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s;
}
.al-select:hover, .al-select:focus { border-color: var(--line2); outline: none; }

/* Tabela */
.al-table-wrap {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: var(--bg2);
}
.al-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.al-table thead th {
  text-align: left;
  padding: 14px 18px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text3);
  background: var(--bg3);
  border-bottom: 1px solid var(--line);
}
.al-table tbody td {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  color: var(--text);
}
.al-table tbody tr:last-child td { border-bottom: 0; }
.al-table tbody tr:hover { background: rgba(144, 58, 103, 0.04); }
.al-col-check  { width: 36px; }
.al-col-tipo   { width: 130px; }
.al-col-sev    { width: 110px; }
.al-col-quando { width: 110px; }
.al-col-aviso  { width: 170px; }
.al-col-acoes  { width: 170px; text-align: right; }

.al-link {
  color: var(--text);
  font-weight: 500;
  text-decoration: none;
  font-size: 13.5px;
  letter-spacing: -0.005em;
}
.al-link:hover { color: var(--gold2); }
.al-cell-detalhe {
  color: var(--text3);
  font-size: 12px;
  margin-top: 3px;
  line-height: 1.5;
}
.al-cell-quando { font-size: 11.5px; color: var(--text2); }
.al-cell-aviso { font-size: 11.5px; line-height: 1.4; }
.al-aviso-on { color: var(--text2); display: block; }
.al-aviso-para { color: var(--text3); font-size: 10.5px; display: block; }
.al-aviso-off { color: var(--text3); font-style: italic; }

.al-row { border-left: 3px solid transparent; transition: background 0.15s; }
.al-sev-critico { border-left-color: #9b2c2c; }
.al-sev-warn    { border-left-color: #b45309; }
.al-sev-info    { border-left-color: #365070; }

/* Tag de tipo · BG colorido suave (não só texto, não saturado) */
.al-tipo-tag {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.al-tipo-zerado   { background: #fbe9e6; color: #9b2c2c; }
.al-tipo-vencido  { background: #fbe9e6; color: #9b2c2c; }
.al-tipo-vencendo { background: #faedda; color: #92400e; }
.al-tipo-baixo    { background: #faedda; color: #92400e; }

/* Pill de severidade · refinado */
.al-sev-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: -0.005em;
}
.al-sev-pill::before {
  content: '';
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
  opacity: 0.85;
}
.al-sev-pill-critico { color: #9b2c2c; }
.al-sev-pill-warn    { color: #b45309; }
.al-sev-pill-info    { color: #365070; }

/* Ações inline · texto-link refinado */
.al-cell-acoes { font-size: 12.5px; }
.al-action {
  background: transparent;
  border: 0;
  padding: 0;
  font-size: 12.5px;
  color: var(--gold2);
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
  letter-spacing: -0.005em;
  transition: color 0.15s;
}
.al-action:hover { color: var(--gold); text-decoration: underline; }
.al-action.al-action-mute { color: var(--text3); }
.al-action.al-action-mute:hover { color: var(--text2); }
.al-action-sep { color: var(--line2); margin: 0 8px; }

/* Ações em massa · barra discreta abaixo da tabela */
.al-bulk {
  display: flex; align-items: center; gap: 10px;
  margin-top: 16px;
  padding: 14px 18px;
  background: linear-gradient(180deg, var(--bg2), var(--bg3));
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 12.5px;
}
.al-bulk-label {
  color: var(--text2);
  font-size: 12px;
  margin-right: auto;
  letter-spacing: -0.005em;
}

.al-empty {
  text-align: center;
  padding: 56px 20px;
  color: var(--text3);
  font-size: 13.5px;
  font-style: italic;
}

/* Responsivo */
@media (max-width: 900px) {
  .al-summary { grid-template-columns: 1fr; gap: 20px; padding: 22px; }
  .al-summary-main { border-right: 0; padding-right: 0; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
  .al-bd-row { grid-template-columns: 28px 90px 1fr; }
  .al-list-h, .al-resumo-h { flex-direction: column; align-items: stretch; }
}

/* Aviso de preço fora da faixa (Lançar venda) */
.lanc-valor.lanc-fora-faixa {
  border-color: #b45309;
  background: #fef7e0;
}
.lanc-warning-faixa {
  font-size: 11px;
  color: #92400e;
  background: #fef7e0;
  border-left: 3px solid #b45309;
  padding: 6px 10px;
  margin-top: 4px;
  border-radius: 0 6px 6px 0;
  letter-spacing: -0.005em;
}

/* === Quadro 2 · Insumos usados (CMV) ============================ */
.ins-list { display: flex; flex-direction: column; gap: 6px; padding: 4px 0; }
.ins-grupo-h {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 4px 4px;
  margin-top: 4px;
  border-bottom: 1px solid var(--line);
}
.ins-grupo-h:first-child { margin-top: 0; }
.ins-grupo-titulo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.ins-grupo-titulo > span:first-of-type { flex: 1; }
.ins-grupo-count {
  font-size: 9.5px;
  background: var(--bg3);
  color: var(--text3);
  padding: 1px 7px;
  border-radius: 99px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
}
.ins-grupo-cmv {
  font-size: 11px;
  color: var(--gold2);
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
}
.ins-grupo-vazio {
  padding: 6px 4px 4px;
}
.ins-row {
  display: grid;
  grid-template-columns: minmax(220px, 2.5fr) minmax(110px, 0.9fr) minmax(110px, 0.9fr) minmax(80px, 0.7fr) 32px;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 8px;
  align-items: center;
}
.ins-row:hover { border-color: var(--line2); }
.ins-cell { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ins-cell-nome .ins-meta { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; }
.ins-cell .lanc-input { padding: 5px 8px; font-size: 12px; }
.ins-cell-qtd small,
.ins-cell-custo small { font-size: 10px; color: var(--text3); }
.ins-cell-total .ins-total { font-size: 12.5px; font-weight: 600; color: var(--text); text-align: right; padding-right: 4px; }
.ins-tag {
  font-size: 9.5px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.ins-tag-principal { background: #f3e8ff; color: #6b21a8; }
.ins-tag-consumivel { background: #f1efeb; color: #6b6661; }
.ins-origem {
  font-size: 10px;
  color: var(--text3);
  font-style: italic;
}
.ins-origem.ins-origem-manual {
  background: #fef7e0;
  color: #92400e;
  padding: 1px 5px;
  border-radius: 4px;
  font-style: normal;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 9px;
}
.ins-warn {
  font-size: 10px;
  color: #dc2626;
  font-weight: 600;
  margin-left: 4px;
}
.ins-foot {
  margin-top: 12px;
  padding: 10px 14px;
  background: var(--bg3);
  border-top: 1px dashed var(--line2);
  border-radius: 0 0 var(--r-md) var(--r-md);
}
.ins-foot-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  font-size: 13px;
}
.ins-foot-row b { font-size: 14px; }
.ins-foot-row:last-child { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 4px; }

/* === DEPRECATED: prévia inline (substituída pelo Quadro 2) === */
.lanc-estoque-preview {
  margin-top: 10px;
  padding: 10px 12px;
  background: linear-gradient(180deg, #fbf6ee, var(--bg2));
  border: 1px solid #e8dcc4;
  border-radius: 8px;
  font-size: 11.5px;
}
.est-pr-h {
  display: flex; align-items: center; gap: 6px;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 10px;
  margin-bottom: 8px;
}
.est-pr-meta {
  margin-left: auto;
  font-size: 10px;
  font-weight: 400;
  color: var(--text3);
  text-transform: none;
  letter-spacing: 0;
  font-style: italic;
}
.est-pr-line {
  display: flex; align-items: center; gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.est-pr-line:last-child { margin-bottom: 0; }
.est-pr-tag {
  font-size: 9.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.est-pr-tag-principal { background: #f3e8ff; color: #6b21a8; }
.est-pr-tag-consumivel { background: #f1efeb; color: #6b6661; }
.est-pr-item {
  font-size: 11.5px;
  color: var(--text);
  font-weight: 500;
}
.est-pr-item:not(:last-child)::after {
  content: '·';
  margin-left: 5px;
  color: var(--text3);
  font-weight: 300;
}
.est-pr-item.est-pr-warn { color: #dc2626; }
.est-pr-alert {
  font-size: 10px;
  color: #dc2626;
  font-weight: 600;
  margin-left: 3px;
}

/* === Badge "consumível" (insumo de custo embutido, não vai na NF) === */
.tag-uso {
  font-size: 9.5px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  background: #f1efeb;
  color: #6b6661;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: 1px dashed #d4cfc7;
  cursor: help;
}

/* === Tabela padrão === */
.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: auto;
}
.tbl thead th {
  padding: 12px 16px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text3);
  text-align: left;
  border-bottom: 1px solid var(--line);
  background: var(--bg3);
  white-space: nowrap;
}
.tbl tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  color: var(--text);
}
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: var(--bg3); }
.tbl tbody tr:hover td { color: var(--text); }
/* alinhamento auxiliar quando o autor já manda style inline */
.tbl th[style*="text-align:right"],
.tbl td[style*="text-align:right"] { text-align: right; }

.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }

/* === KPI === */
.kpi { padding: 16px; background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r-md); }
.kpi .lbl   { color: var(--text3); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.kpi .val   { margin: 6px 0 4px; font-size: 22px; font-weight: 600; letter-spacing: -.01em; }
.kpi .delta { font-size: 12px; color: var(--text2); }
.kpi .delta b      { color: var(--green); font-weight: 600; }
.kpi .delta b.bad  { color: var(--red); }
.kpi .bar    { margin-top: 10px; height: 4px; background: var(--bg4); border-radius: 2px; overflow: hidden; }
.kpi .bar i  { display: block; height: 100%; background: var(--gold); border-radius: 2px; }
a.kpi { text-decoration: none; color: inherit; transition: all .15s; cursor: pointer; }
a.kpi:hover { border-color: var(--line2); transform: translateY(-1px); }
a.kpi.kpi-on { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold-soft); }

/* === Auth · login split-screen ======================================== */
.auth-shell {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
  background: var(--bg);
}

/* ── Painel esquerdo · marca ── */
.auth-brand {
  position: relative;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 48px 52px;
  background-color: #1a1410; /* base escura */
  color: #fff;
  overflow: hidden;
}
/* Foto da Dra Sabrina · P&B em transparência · ocupa todo o painel esquerdo */
.auth-brand::after {
  content: '';
  position: absolute; inset: 0;
  background: url('/assets/img/dra-sabrina-login.jpg') center/cover no-repeat;
  filter: grayscale(100%) contrast(1.05) brightness(0.85);
  opacity: 0.35;
  pointer-events: none;
  z-index: 0;
}
/* Gradiente quente sobre a foto pra dar profundidade + legibilidade do texto */
.auth-brand::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(160deg,
    rgba(26,20,16,0.55) 0%,
    rgba(58,30,28,0.40) 60%,
    rgba(100,50,30,0.50) 100%);
  pointer-events: none;
  z-index: 1;
}
/* Garante que todo o conteúdo (logo, nome, quote) fique acima da foto */
.auth-brand > * { position: relative; z-index: 2; }

.auth-brand-top { display: flex; flex-direction: column; gap: 16px; }
.auth-logo-img  { max-height: 52px; max-width: 130px; object-fit: contain; filter: brightness(0) invert(1); }
.auth-logo-mark {
  width: 52px; height: 52px; border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,.5);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 300; letter-spacing: .05em; color: #fff;
}
.auth-brand-tag {
  font-size: 10px; font-weight: 700; letter-spacing: .18em;
  color: rgba(255,255,255,.55); text-transform: uppercase;
}

.auth-brand-mid   { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.auth-brand-pre   { font-size: 18px; font-style: italic; font-weight: 300; color: rgba(255,255,255,.75); margin-bottom: 2px; }
.auth-brand-name  {
  font-size: 44px; font-weight: 300; line-height: 1.1;
  letter-spacing: -.02em; color: #fff;
  font-family: Georgia, 'Times New Roman', serif;
}
.auth-brand-rule  { width: 36px; height: 2px; background: var(--gold); margin: 20px 0; border-radius: 1px; }
.auth-brand-desc  { font-size: 13.5px; color: rgba(255,255,255,.65); line-height: 1.6; margin: 0; }

.auth-brand-quote {
  font-size: 12.5px; font-style: italic;
  color: rgba(255,255,255,.5);
  border-left: 2px solid rgba(255,255,255,.2);
  padding-left: 14px; margin: 0;
  line-height: 1.7;
}

/* ── Painel direito · form ── */
.auth-form-panel {
  display: flex; flex-direction: column;
  justify-content: space-between;
  background: var(--bg2);
}
.auth-form-wrap {
  flex: 1; display: flex; flex-direction: column; justify-content: center;
  padding: 60px 60px 40px;
  max-width: 480px; width: 100%; margin: 0 auto;
}
.auth-title { font-size: 28px; font-weight: 700; letter-spacing: -.02em; margin: 0 0 6px; }
.auth-sub   { font-size: 14px; color: var(--text2); margin: 0 0 32px; }

.auth-err {
  background: var(--danger-soft); color: var(--danger);
  padding: 10px 14px; border-radius: var(--r-sm);
  font-size: 13px; margin-bottom: 20px;
  border-left: 3px solid var(--danger);
}
.auth-form   { display: flex; flex-direction: column; gap: 18px; }
.auth-field  { display: flex; flex-direction: column; gap: 6px; }
.auth-field label {
  font-size: 13px; font-weight: 500; color: var(--text);
}
.auth-field input {
  padding: 11px 14px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--bg); font-size: 14px; outline: none;
  transition: border .15s, box-shadow .15s;
}
.auth-field input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(144,58,103,.1);
}
.auth-field input::placeholder { color: var(--text3); }

.auth-submit {
  margin-top: 6px;
  padding: 13px 20px;
  background: var(--text); color: #fff;
  border: none; border-radius: var(--r-sm);
  font-size: 14.5px; font-weight: 600; cursor: pointer;
  transition: background .15s;
  letter-spacing: -.01em;
}
.auth-submit:hover { background: #000; }

.auth-help {
  margin-top: 28px;
  padding: 14px 16px;
  background: var(--bg3);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.auth-help-title { font-size: 13px; font-weight: 600; margin-bottom: 3px; }
.auth-help-body  { font-size: 12.5px; color: var(--text2); line-height: 1.5; }

.auth-form-foot {
  padding: 16px 60px;
  display: flex; justify-content: space-between; align-items: center;
  border-top: 1px solid var(--line);
  font-size: 12px; color: var(--text3);
}
.auth-foot-link { color: var(--text3); text-decoration: underline; text-underline-offset: 2px; }

/* mobile */
@media (max-width: 720px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .auth-form-wrap { padding: 40px 28px 24px; }
  .auth-form-foot { padding: 14px 28px; }
}

/* === Misc === */
.danger { color: var(--red); }
.ok     { color: var(--green); }
.warn   { color: var(--amber); }
.row    { display: flex; gap: 12px; align-items: center; }

/* === DRA HOME · concierge === */
.dra-home { max-width: 1080px; margin: 0 auto; padding: 0 0 40px; }

.hero {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  margin: 8px 0 36px;
  min-height: 260px;
  box-shadow: 0 10px 40px -18px rgba(0,0,0,.18);
}
.hero-bg { position: absolute; inset: 0; overflow: hidden; }
.hero-aurora {
  position: absolute; inset: -30%;
  background:
    radial-gradient(ellipse at 20% 30%, #ffd7b3 0%, transparent 45%),
    radial-gradient(ellipse at 80% 20%, #f4b090 0%, transparent 50%),
    radial-gradient(ellipse at 60% 80%, #e8a4c4 0%, transparent 55%),
    radial-gradient(ellipse at 30% 90%, #b8d4e8 0%, transparent 50%),
    linear-gradient(135deg, #fde7c8 0%, #f4c4a0 35%, #e8b5a8 60%, #cfd9e8 100%);
  filter: blur(30px);
  animation: aurora 22s ease-in-out infinite alternate;
}
@keyframes aurora {
  0%   { transform: translate(0,0) scale(1);     filter: blur(30px) hue-rotate(0deg); }
  50%  { transform: translate(2%,-1%) scale(1.05); filter: blur(40px) hue-rotate(-8deg); }
  100% { transform: translate(-2%,1%) scale(1.02); filter: blur(32px) hue-rotate(6deg); }
}
/* Hero waves · três camadas com loop seamless infinito (paths repetem a cada 50%) */
.hero-waves {
  position: absolute; bottom: -10px;
  left: 0;
  width: 200%;
  height: 100px;
  pointer-events: none;
  will-change: transform;
}
.hero-waves--back  { animation: wave-slide-left  34s linear infinite; }
.hero-waves--mid   { animation: wave-slide-right 22s linear infinite; }
.hero-waves--front { animation: wave-slide-left  16s linear infinite; }

@keyframes wave-slide-left {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(-50%, 0, 0); }
}
@keyframes wave-slide-right {
  from { transform: translate3d(-50%, 0, 0); }
  to   { transform: translate3d(0, 0, 0); }
}
.hero-particles { position: absolute; inset: 0; pointer-events: none; }
.hero-particles span {
  position: absolute; width: 6px; height: 6px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.9), rgba(255,255,255,0));
  animation: float 14s ease-in-out infinite;
}
.hero-particles span:nth-child(1) { top: 30%; left: 10%; animation-delay: 0s; }
.hero-particles span:nth-child(2) { top: 55%; left: 25%; animation-delay: -2s; width: 4px; height: 4px; }
.hero-particles span:nth-child(3) { top: 20%; left: 50%; animation-delay: -4s; width: 8px; height: 8px; }
.hero-particles span:nth-child(4) { top: 70%; left: 65%; animation-delay: -6s; }
.hero-particles span:nth-child(5) { top: 40%; left: 80%; animation-delay: -8s; width: 5px; height: 5px; }
.hero-particles span:nth-child(6) { top: 60%; left: 92%; animation-delay: -10s; }
@keyframes float {
  0%, 100% { transform: translateY(0) scale(1); opacity: .6; }
  50%      { transform: translateY(-18px) scale(1.3); opacity: .95; }
}
.hero-content { position: relative; padding: 32px 36px 36px; color: var(--text); }
.hero-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 18px; gap: 16px; }
.hero-content .hello-date { color: rgba(29,27,23,.72); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .1em; }
.hero-content .hello-h { font-size: 36px; margin: 0 0 14px; letter-spacing: -.02em; line-height: 1.1; font-weight: 600; text-shadow: 0 1px 2px rgba(255,255,255,.4); }
.hello-spark { color: var(--gold); font-weight: 400; margin-left: 4px; }
.hero-content .hello-msg { color: rgba(29,27,23,.78); font-size: 16px; max-width: 640px; font-weight: 300; line-height: 1.55; margin: 0; text-shadow: 0 1px 2px rgba(255,255,255,.3); }
.hero-content .hello-msg b { color: rgba(29,27,23,.95); font-weight: 600; }

.weather { display: flex; align-items: center; gap: 14px; padding: 14px 18px; background: rgba(255,255,255,.55); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid rgba(255,255,255,.6); border-radius: 16px; }
.w-ico   { line-height: 1; }
.w-temp  { font-size: 22px; font-weight: 600; letter-spacing: -.01em; line-height: 1; }
.w-loc   { font-size: 11px; color: var(--text2); margin-top: 4px; }

.widgets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 40px; }
.widget { padding: 22px; background: var(--bg2); border: 1px solid var(--line); border-radius: 16px; transition: all .2s; }
.widget:hover { border-color: var(--line2); transform: translateY(-1px); }
.w-lbl { font-size: 10.5px; color: var(--gold2); font-weight: 700; text-transform: uppercase; letter-spacing: .1em; margin-bottom: 12px; }
.widget p { margin: 0; font-size: 13.5px; line-height: 1.55; color: var(--text); font-weight: 300; }
.widget p b { font-weight: 500; }
.widget-quote { background: linear-gradient(135deg, var(--gold-soft), #fef5ec); border-color: transparent; }
.widget-quote p { font-style: italic; font-size: 14px; line-height: 1.5; color: var(--text); }
.widget-quote.widget-devocional { background: linear-gradient(160deg, #fdf6ea 0%, #f6e9d4 100%); }
.w-author { font-size: 11px; color: var(--text3); margin-top: 10px; }
.widget-pulse { background: linear-gradient(180deg, var(--bg3), var(--bg2)); }

/* === Devocional · café com Deus Pai === */
.widget-devocional {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 22px 24px;
  min-height: 220px;
}
.widget-devocional .w-lbl { margin-bottom: 0; }
.widget-devocional .devocional-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 4px;
}
.widget-devocional p.devocional-msg {
  font-style: normal;
  font-weight: 800;
  font-size: 19px;
  line-height: 1.4;
  color: var(--text);
  letter-spacing: -0.3px;
  margin: 0;
  text-align: center;
  max-width: 100%;
}
.widget-devocional .w-author {
  text-align: center;
  margin-top: 0;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--text3);
  font-style: italic;
}

/* === Insight · alinhado pra ficar harmônico ao lado do devocional === */
.widget-insight {
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.widget-insight p {
  font-size: 13.5px;
  line-height: 1.55;
  margin: 0;
}

/* === Agenda pessoal · widget === */
.widget-agenda-pessoal { background: linear-gradient(180deg, #fbf6ee, var(--bg2)); }
.widget-agenda-pessoal .w-lbl-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.widget-agenda-pessoal .w-more { font-size: 11px; color: var(--gold2); text-decoration: none; font-weight: 500; }
.widget-agenda-pessoal .w-more:hover { text-decoration: underline; }
.agp-empty { font-size: 12.5px; color: var(--text2); line-height: 1.5; margin: 8px 0 0; }
.agp-empty small { color: var(--text3); font-size: 11px; }
.agp-list { display: flex; flex-direction: column; gap: 8px; }
.agp-row {
  display: flex; gap: 10px; align-items: center;
  padding: 8px 10px; background: rgba(255,255,255,0.6);
  border-left: 3px solid var(--cor, var(--gold));
  border-radius: 7px;
}
.agp-when {
  display: flex; flex-direction: column; align-items: flex-start;
  min-width: 56px; line-height: 1.1;
}
.agp-when b { font-size: 12px; font-weight: 700; color: var(--text); text-transform: lowercase; }
.agp-when small { font-size: 10.5px; color: var(--text3); margin-top: 2px; font-family: var(--font-mono); }
.agp-info { flex: 1; min-width: 0; }
.agp-tt {
  font-size: 12.5px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.agp-meta { display: flex; gap: 4px; align-items: center; margin-top: 3px; font-size: 10.5px; }
.agp-tag {
  font-size: 10px; padding: 1px 6px;
  border-radius: 99px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.3px;
}
.pulse-row { display: flex; justify-content: space-between; align-items: baseline; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.pulse-row:last-child { border-bottom: 0; }
.pulse-row span { color: var(--text2); font-weight: 300; }
.pulse-row b { font-weight: 600; font-size: 15px; letter-spacing: -.01em; }
.pulse-row b.ok { color: var(--green); }

.widget-fin { background: linear-gradient(135deg, var(--bg2), #fef7f1); border-color: #f4d8c4; }

/* === Widgets do Hoje da Dra · altura uniforme === */
.dra-home .widgets > .widget { display: flex; flex-direction: column; min-height: 220px; }
.dra-home .widget-fin .fin-actions { margin-top: auto; }
.dra-home .widget-agenda-pessoal .agp-list,
.dra-home .widget-agenda-pessoal .agp-empty { flex: 1; }
.dra-home .widget-insight p { margin-top: auto; margin-bottom: auto; }

/* === Aniversariantes widget === */
.widget-aniver { background: linear-gradient(180deg, #faf3e6, var(--bg2)); }
.widget-aniver .ani-list { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.widget-aniver .ani-row { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 7px; text-decoration: none; color: inherit; border-left: 3px solid var(--accent, #c9a661); background: rgba(255,255,255,0.6); transition: background .15s ease; }
.widget-aniver .ani-row:hover { background: rgba(255,255,255,0.95); }
.widget-aniver .ani-info { flex: 1; min-width: 0; }
.widget-aniver .ani-tt { font-size: 12.5px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.widget-aniver .ani-meta { font-size: 11px; color: var(--text3); margin-top: 1px; }
.widget-aniver .ani-when { font-weight: 500; color: var(--text2); }
.widget-aniver .ani-when.hoje { color: #9c7c3e; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }

.w-lbl-row  { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.w-lbl-row .w-lbl { margin-bottom: 0; }
.w-more     { font-size: 11px; color: var(--gold2); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.w-more:hover { text-decoration: underline; }
.fin-big    { font-size: 28px; font-weight: 600; letter-spacing: -.02em; line-height: 1; }
.fin-sub    { font-size: 12px; color: var(--text2); margin-top: 4px; }
.fin-sub b  { color: var(--gold2); font-weight: 600; }
.fin-bar    { height: 5px; background: var(--bg4); border-radius: 3px; overflow: hidden; margin: 12px 0 14px; }
.fin-bar i  { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold2)); border-radius: 3px; }
.fin-actions{ display: flex; gap: 6px; flex-wrap: wrap; }

.day-h { font-size: 11.5px; color: var(--text3); text-transform: uppercase; letter-spacing: .1em; font-weight: 700; margin: 0 0 14px; padding: 0 4px; }
.day-list { display: flex; flex-direction: column; gap: 12px; }
.appt { display: grid; grid-template-columns: 80px 50px 1fr auto; gap: 14px; padding: 18px 20px; background: var(--bg2); border: 1px solid var(--line); border-radius: 14px; align-items: center; transition: all .2s; }
.appt:hover { border-color: var(--line2); box-shadow: 0 4px 14px -8px rgba(0,0,0,.1); }
.appt.now { background: linear-gradient(135deg, var(--gold-soft), #fef7f1); border: 0; box-shadow: 0 4px 18px -6px rgba(144,58,103,.25); }
.appt .hr { font-size: 20px; font-weight: 600; color: var(--text); }
.appt .hr small { display: block; font-size: 10.5px; color: var(--text3); font-weight: 400; text-transform: uppercase; letter-spacing: .06em; }
.appt .av { width: 50px; height: 50px; border-radius: 50%; color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 13px; }
.av-1 { background: linear-gradient(135deg, #903a67, #7a2e55); }
.av-2 { background: linear-gradient(135deg, #3f8361, #2d6048); }
.av-3 { background: linear-gradient(135deg, #3d6a7e, #2a4d5f); }
.av-4 { background: linear-gradient(135deg, #b6843a, #8e6228); }
.av-5 { background: linear-gradient(135deg, #9a6ba8, #724d80); }
.appt .who { font-weight: 600; font-size: 15px; }
.appt .what { font-size: 12.5px; color: var(--text2); margin-top: 4px; }
.appt .story { font-size: 12.5px; color: var(--text3); margin-top: 6px; font-style: italic; font-weight: 300; line-height: 1.45; }
.appt .actions { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }

.end-note { margin-top: 28px; padding: 16px 20px; background: var(--bg3); border-radius: 12px; display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--text2); font-weight: 300; }
.end-note span { flex: 1; }

/* === Paciente 360º === */
.pf-page { max-width: 1280px; margin: 0 auto; }
.pf-head {
  background: linear-gradient(180deg, var(--bg3) 0%, var(--bg2) 100%);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 24px 28px;
  margin-bottom: 0;
}
.pf-top { display: flex; align-items: center; gap: 16px; }
.pf-name-block { flex: 1; }
.pf-name { margin: 0 0 6px; font-size: 22px; font-weight: 600; letter-spacing: -.01em; }
.pf-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.pf-actions { display: flex; gap: 6px; align-items: center; }
.pf-stats { display: flex; gap: 28px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.pf-stat-lbl { font-size: 10.5px; color: var(--text3); text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.pf-stat-val { font-size: 16px; font-weight: 600; margin-top: 4px; letter-spacing: -.01em; }
.pf-stat-val.warn { color: var(--amber); }
.pf-stat-val.danger { color: var(--red); }
.pf-stat-val.ok { color: var(--green, #2f9e44); }
.pf-stat-val.muted { color: var(--text3); font-weight: 500; }
.pf-stat-sub { font-size: 11px; color: var(--text3); margin-top: 2px; }

/* Tabs */
.pf-tabs-wrap {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-top: 0;
  margin: 0;
}
.pf-tabs {
  display: flex; gap: 0;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
.pf-tab {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 14px 16px;
  font-size: 13px; color: var(--text2);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: all .15s;
}
.pf-tab:hover { color: var(--text); }
.pf-tab.active { color: var(--text); font-weight: 500; border-bottom-color: var(--gold); }
.pf-tab .icon { color: var(--text3); }
.pf-tab.active .icon { color: var(--gold2); }

.pf-body {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  padding: 24px 28px;
}

/* Visão · grid duas colunas */
.pf-grid { display: grid; grid-template-columns: 260px 1fr; gap: 28px; }
.pf-grid-thin { grid-template-columns: 200px 1fr; gap: 24px; }
.pf-side { padding-right: 24px; border-right: 1px solid var(--line); }
.pf-side-thin { padding-right: 18px; border-right: 1px solid var(--line); }
.pf-side h4, .pf-side-thin h4 {
  margin: 18px 0 8px;
  font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .08em; color: var(--text3); font-weight: 700;
}
.pf-side h4:first-child, .pf-side-thin h4:first-child { margin-top: 0; }
.pf-field { font-size: 12.5px; margin-bottom: 10px; }
.pf-field .k { color: var(--text3); font-size: 11px; margin-bottom: 2px; }
.pf-field .v { color: var(--text); font-weight: 500; }
.pf-alert {
  background: #fde7e3;
  border-left: 3px solid var(--red);
  padding: 10px 12px;
  border-radius: var(--r-sm);
  font-size: 12.5px;
  color: var(--text);
  margin-bottom: 8px;
}

.pf-main, .pf-main-thin { min-width: 0; }

.pf-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 18px 20px;
  margin-bottom: 16px;
}
.pf-card.flush { padding: 0; }
.pf-card-h { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.pf-card-h h3 { margin: 0; font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 7px; }
.pf-card-h h3 .icon { color: var(--gold2); width: 16px; height: 16px; }

.pf-card-ai {
  background: linear-gradient(135deg, var(--gold-soft), #fef7f1);
  border-color: transparent;
}

.pf-md {
  font-size: 13.5px; line-height: 1.6;
  color: var(--text);
}
.pf-md p { margin: 0 0 10px; }
.pf-md p:last-child { margin-bottom: 0; }
.pf-md ul { margin: 6px 0 10px; padding-left: 22px; }
.pf-md li { margin-bottom: 4px; font-size: 13px; }

/* Timeline interna */
.tl-year { margin-bottom: 18px; }
.tl-year-label {
  font-size: 11px; color: var(--text3);
  text-transform: uppercase; letter-spacing: .1em; font-weight: 700;
  margin-bottom: 8px;
}
.tl-event {
  display: grid; grid-template-columns: 32px 1fr;
  gap: 12px; align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.tl-event:last-child { border-bottom: 0; }
.tl-icon {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--gold-soft);
  display: grid; place-items: center;
}
.tl-tt { font-size: 13.5px; font-weight: 500; color: var(--text); }
.tl-meta { font-size: 11.5px; color: var(--text3); margin-top: 2px; }
.tl-desc { font-size: 12.5px; color: var(--text2); margin-top: 6px; line-height: 1.5; font-style: italic; }

@media (max-width: 980px) {
  .pf-grid, .pf-grid-thin { grid-template-columns: 1fr; }
  .pf-side, .pf-side-thin { border-right: 0; padding-right: 0; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
}

/* === Agenda geral · grade semanal === */
.ag-grid {
  display: grid;
  grid-template-columns: 64px repeat(7, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  margin-top: 8px;
}
.ag-h {
  background: var(--bg2);
  padding: 12px 10px;
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.ag-h-time { background: var(--bg3); }
.ag-h-dia {
  font-size: 10.5px; color: var(--text3);
  text-transform: uppercase; letter-spacing: .08em; font-weight: 600;
}
.ag-h-num {
  font-size: 18px; font-weight: 600; letter-spacing: -.01em; color: var(--text);
}
.ag-h-hoje .ag-h-num,
.ag-h-hoje .ag-h-dia { color: var(--gold2); }
.ag-h-hoje { background: var(--gold-soft); }
.ag-h-atend .ag-h-dia::after { content: ' · atendimento'; color: var(--gold2); font-weight: 700; }

/* ── Botão "Dia todo" — toggle pill ── */
.ev-diatodo-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 999px;
  border: 1.5px solid #d4c4cc;
  background: #faf7f9;
  font-size: 12px; font-weight: 600; color: var(--text2);
  cursor: pointer; white-space: nowrap; line-height: 1;
  transition: all .18s cubic-bezier(.34,1.36,.64,1);
}
.ev-diatodo-btn:hover {
  border-color: var(--gold); color: var(--gold2);
  background: var(--gold-soft);
}
.ev-diatodo-btn.on {
  background: var(--gold); border-color: var(--gold2);
  color: #fff;
  box-shadow: 0 3px 12px -4px rgba(144,58,103,.5);
}

/* ── Seções colapsáveis (Serviços / Observação) ── */
.ev-collapse-section {
  border: 1px solid var(--line); border-radius: 10px;
  overflow: hidden; margin-bottom: 10px;
}
.ev-collapse-hdr {
  display: flex !important; align-items: center; gap: 8px;
  padding: 9px 12px; cursor: pointer;
  background: rgba(0,0,0,.035); user-select: none;
  transition: background .12s;
}
.ev-collapse-hdr:hover { background: rgba(0,0,0,.06); }
.ev-collapse-lbl {
  font-size: 11px; font-weight: 700; color: var(--text3);
  text-transform: uppercase; letter-spacing: .06em;
}
.ev-collapse-summary {
  font-size: 11.5px; color: var(--text2); font-weight: 400;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 220px;
}
.ev-collapse-arrow {
  margin-left: auto; font-size: 11px; color: var(--text3);
  transition: transform .2s; flex-shrink: 0;
}
.ev-collapse-section.open .ev-collapse-arrow { transform: rotate(180deg); }
.ev-collapse-body {
  display: none !important; padding: 10px 12px;
}
.ev-collapse-section.open .ev-collapse-body { display: block !important; }

/* Faixa dia-todo */
.ag-allday-label {
  background: var(--bg3);
  border-top: 1px solid var(--line);
  padding: 6px 8px;
  font-size: 9.5px; color: var(--text3);
  text-transform: uppercase; letter-spacing: .07em; font-weight: 600;
  text-align: right;
  display: flex; align-items: center; justify-content: flex-end;
}
.ag-allday-cell {
  background: var(--bg2);
  border-top: 1px solid var(--line);
  padding: 4px;
  min-height: 30px;
  display: flex; flex-direction: column; gap: 2px;
  cursor: pointer;
  transition: background .12s;
}
.ag-allday-cell:hover { background: var(--bg3); }
.ag-allday-cell:empty::after,
.ag-allday-cell:not(:has(.ag-allday-ev)):hover::after {
  content: '+ dia todo';
  font-size: 10px; color: var(--text3); padding: 2px 4px;
  pointer-events: none;
}
.ag-allday-ev {
  border-left: 3px solid var(--amber);
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 11px; font-weight: 600;
  cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: opacity .12s;
  /* default: bloqueio */
  background: #fef3d8; color: #6b4c00;
}
.ag-allday-ev:hover { opacity: .8; }

/* Externo / evento pessoal */
.ag-allday-ev-externo {
  background: #f0f8f3; border-left-color: var(--green); color: #1e4d35;
}
/* Pausa */
.ag-allday-ev-pausa {
  background: #f5f0fa; border-left-color: #8b5cf6; color: #4c2d7a;
}
/* Admin */
.ag-allday-ev-admin {
  background: #eef4f7; border-left-color: var(--blue); color: #1e3d50;
}
/* Procedimento/consulta (caso alguém coloque 8h+) */
.ag-allday-ev-procedimento,
.ag-allday-ev-consulta {
  background: #f0f8f3; border-left-color: var(--green); color: #1e4d35;
}

/* Filtro por profissional */
.ag-prof-filter {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin-bottom: 10px;
}
.ag-prof-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--bg2);
  font-size: 12px; font-weight: 500; color: var(--text2);
  cursor: pointer; transition: all .15s;
}
.ag-prof-btn:hover { border-color: var(--gold); color: var(--text); }
.ag-prof-btn.active {
  background: var(--gold-soft); border-color: var(--gold);
  color: var(--gold2); font-weight: 600;
}
.ag-prof-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--pcor, var(--text3)); flex-shrink: 0;
}

.ag-time {
  background: var(--bg3);
  padding: 6px 8px;
  text-align: right;
  font-size: 10.5px;
  color: var(--text3);
  font-weight: 600;
}
.ag-cell {
  background: var(--bg2);
  min-height: 56px;
  padding: 4px;
  cursor: pointer;
  transition: background .12s;
}
/* Heatmap de ocupação — fundo mais quente conforme mais eventos */
.ag-cell[data-ev-count="1"] { background: color-mix(in srgb, var(--gold-soft) 18%, var(--bg2)); }
.ag-cell[data-ev-count="2"] { background: color-mix(in srgb, var(--gold-soft) 32%, var(--bg2)); }
.ag-cell[data-ev-count="3"] { background: color-mix(in srgb, var(--gold-soft) 46%, var(--bg2)); }
.ag-cell[data-ev-count]:not([data-ev-count="0"]):hover { background: var(--bg3); }
.ag-cell:hover { background: var(--bg3); }
.ag-cell:hover::after {
  content: '+';
  display: block;
  text-align: center;
  color: var(--text3);
  font-size: 14px;
  pointer-events: none;
}

.ag-ev {
  padding: 6px 9px;
  border-radius: 6px;
  font-size: 11px;
  cursor: pointer;
  margin: 1px 0;
  transition: transform .1s, box-shadow .1s;
  border-left: 3px solid;
  border-right: 3px solid var(--prof-cor, transparent);
  background: var(--bg2);
  /* Altura proporcional à duração */
  min-height: max(28px, calc(var(--dur-min, 60) * 0.84px));
}
.ag-ev:hover { transform: translateX(1px); box-shadow: 0 2px 6px -3px rgba(0,0,0,.15); }
.ag-ev-tt { font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ag-ev-meta { font-size: 10px; color: var(--text3); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ag-ev-pend { color: var(--amber); font-weight: 600; }

/* Nova consulta = verde · sempre */
.ag-ev-procedimento { background: #f0f8f3; border-left-color: var(--green); }
.ag-ev-procedimento .ag-ev-tt { color: #2d6048; }
/* Retorno = azul */
.ag-ev-consulta     { background: #eef4f7; border-left-color: var(--blue); }
.ag-ev-consulta .ag-ev-tt { color: var(--blue); }
/* Bloqueio · estilo Google Calendar "out of office" · cinza sólido suave */
.ag-ev-bloqueio {
  background: #d6cfc4;
  border-left-color: #8a7d6d;
}
.ag-ev-bloqueio .ag-ev-tt {
  color: #5e544a;
  font-weight: 600;
}

.ag-ev-admin,
.ag-ev-externo      { background: #f3faf6; border-left-color: var(--green); }
.ag-ev-admin .ag-ev-tt,
.ag-ev-externo .ag-ev-tt { color: var(--green); }

/* Pausa · cinza claro sólido */
.ag-ev-pausa {
  background: #ebe6df;
  border-left-color: var(--text3);
}
.ag-ev-pausa .ag-ev-tt { color: #6b5d51; font-style: italic; }

/* All-day events de bloqueio/pausa · cinza sólido estilo GCal */
.ag-allday-ev-bloqueio,
.ag-allday-ev-pausa {
  background: #d6cfc4 !important;
  color: #5e544a !important;
  font-weight: 600;
}

/* === DIA INTEIRO BLOQUEADO · estilo Google Calendar ===
   Coluna inteira fica com fundo CINZA SÓLIDO (sem listras),
   exatamente como o Google Calendar mostra "out of office". */
.ag-h-bloqueado {
  background: #ebe6df !important;
}
.ag-h-bloqueado .ag-h-dia,
.ag-h-bloqueado .ag-h-num {
  color: #8a7d6d;
  font-weight: 500;
}

.ag-cell-bloqueada {
  background: #ebe6df !important;
  cursor: not-allowed;
  position: relative;
  /* remove borda interna pra parecer faixa contínua na coluna */
  border-color: rgba(212, 200, 184, .55) !important;
}
/* Eventos dentro de uma célula bloqueada permanecem visíveis (Dra pode ter
   marcado consulta antes do bloqueio · só o fundo sinaliza indisponibilidade). */

.ag-allday-cell-bloqueada {
  background: #ebe6df;
}

/* O evento de bloqueio dentro da faixa all-day vira "rótulo" sólido,
   sem ícone duplicado, harmonizado com a coluna abaixo */
.ag-allday-cell-bloqueada .ag-allday-ev-bloqueio,
.ag-allday-cell-bloqueada .ag-allday-ev-pausa {
  background: #d6cfc4 !important;
  color: #5e544a !important;
  font-weight: 600;
  opacity: 1;
  border-radius: 4px;
  padding: 3px 8px;
}

.ag-st-pendente { opacity: .85; }
.ag-st-cancelado { text-decoration: line-through; opacity: .5; }

/* Status icon dentro do card */
.ag-ev-tt { display: flex; align-items: center; gap: 5px; }
.ag-ev-st-icon {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--bg3);
  color: var(--text3);
  display: inline-grid; place-items: center;
  font-size: 9px;
  font-weight: 700;
  flex-shrink: 0;
  line-height: 1;
}
.ag-ev-st-icon.ag-st-confirmado { background: var(--green); color: #fff; }
.ag-ev-st-icon.ag-st-agendado   { background: var(--bg4); color: var(--text2); }
.ag-ev-st-icon.ag-st-realizado  { background: var(--text2); color: #fff; }
.ag-ev-st-icon.ag-st-no-show    { background: var(--red); color: #fff; }
.ag-ev-st-icon.ag-st-cancelado  { background: var(--red); color: #fff; }
/* Badge de sincronização com Google Calendar */
.ag-ev-gcal { font-size: 9px; color: var(--text3); opacity: .7; margin-left: auto; flex-shrink: 0; }

/* Linha "agora" */
.ag-now-line {
  position: absolute;
  height: 2px;
  background: var(--red);
  z-index: 5;
  pointer-events: none;
  box-shadow: 0 0 6px rgba(184, 74, 59, .4);
}
.ag-now-line::before {
  content: '';
  position: absolute;
  left: -5px; top: -3px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--red);
}
.ag-now-line[hidden] { display: none; }

/* Tooltip custom de evento */
.ag-tooltip {
  position: fixed;

  /* ── Dark Liquid Glass ── */
  background: rgba(22, 20, 16, 0.72);
  backdrop-filter: blur(40px) saturate(180%) brightness(0.96);
  -webkit-backdrop-filter: blur(40px) saturate(180%) brightness(0.96);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  box-shadow:
    0 24px 48px -10px rgba(0, 0, 0, 0.50),
    0 8px 16px -4px rgba(0, 0, 0, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    inset 0 -1px 0 rgba(0, 0, 0, 0.2);

  color: rgba(255, 255, 255, 0.92);
  padding: 14px 16px;
  font-size: 12px;
  z-index: 9000;
  pointer-events: none;
  max-width: 290px;
  line-height: 1.45;
  animation: tip-in .15s cubic-bezier(.2, 0, 0, 1);
}
@keyframes tip-in {
  from { opacity: 0; transform: translateY(4px) scale(.97); }
  to   { opacity: 1; transform: none; }
}
.ag-tooltip[hidden] { display: none; }
.ag-tooltip .tt-h { font-size: 13.5px; font-weight: 700; letter-spacing: -.01em; margin-bottom: 9px; padding-bottom: 7px; border-bottom: 1px solid rgba(255,255,255,.13); }
.ag-tooltip .tt-row { display: flex; justify-content: space-between; gap: 12px; padding: 2.5px 0; }
.ag-tooltip .tt-row > span { color: rgba(255,255,255,.48); font-size: 10px; text-transform: uppercase; letter-spacing: .05em; }
.ag-tooltip .tt-row b { color: rgba(255, 255, 255, 0.88); font-weight: 600; text-align: right; }
.ag-tooltip .tt-obs {
  display: block; margin-top: 6px; padding-top: 6px;
  border-top: 1px solid rgba(255,255,255,.1);
  font-style: italic; color: rgba(255,255,255,.85);
  font-size: 11.5px;
}

.ag-legend {
  display: flex; flex-wrap: wrap; gap: 16px;
  margin-top: 14px; padding: 12px 16px;
  background: var(--bg3); border-radius: 8px;
  font-size: 11.5px; color: var(--text2);
}
.ag-legend .ag-lg { display: flex; align-items: center; gap: 6px; }
.ag-legend i {
  width: 12px; height: 12px;
  border-radius: 3px;
  display: inline-block;
}

#ev-modal .btn.danger { background: transparent; color: var(--red); border-color: #f1d4cd; margin-right: auto; }
#ev-modal .btn.danger:hover { background: #fde7e3; }

/* Chips de serviço no modal */
.ev-svc-picker {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 12px;
  background: rgba(255,255,255,0.5);
  backdrop-filter: blur(12px);
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.7);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.9), 0 1px 4px rgba(0,0,0,.04);
  max-height: 130px; overflow-y: auto;
}
.ev-svc-chip {
  padding: 5px 13px;
  border: 1.5px solid var(--line);
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(6px);
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text2);
  cursor: pointer;
  transition: all .15s cubic-bezier(.34,1.36,.64,1);
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.ev-svc-chip:hover {
  border-color: var(--gold);
  color: var(--gold2);
  background: var(--gold-soft);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px -2px rgba(144,58,103,.2);
}
.ev-svc-chip.on {
  background: var(--gold);
  color: #fff;
  border-color: var(--gold2);
  box-shadow: 0 3px 10px -3px rgba(144,58,103,.45);
  transform: translateY(-1px);
}
.ev-svc-chip.on::before { content: '✓ '; font-weight: 700; }

/* Card mostra serviços como tags · só no detalhe (futuro) */
.ag-ev-svcs {
  display: flex; gap: 3px; flex-wrap: wrap;
  margin-top: 4px;
}
.ag-ev-svc {
  font-size: 9.5px;
  padding: 1px 6px;
  background: rgba(255,255,255,.7);
  border-radius: 999px;
  color: var(--text2);
  font-weight: 500;
}

/* Status na agenda */
.ag-st-cancelado { opacity: .55; text-decoration: line-through; }
.ag-st-realizado { opacity: .85; }
.ag-st-no-show   { background: #fde7e3 !important; border-left-color: var(--red) !important; }
.ag-st-no-show .ag-ev-tt { color: var(--red); }

/* === Modo reagendamento · banner + grade highlight === */
.resched-banner[hidden] { display: none !important; }
.resched-banner {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 105;
  background: var(--gold);
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  display: flex; align-items: center; gap: 10px;
  font-size: 13px;
  box-shadow: 0 8px 24px -6px rgba(144, 58, 103, .5);
  animation: resched-slide .25s ease-out;
}
.resched-banner b { font-weight: 700; }
.resched-banner .icon { width: 16px; height: 16px; }
.resched-banner .btn {
  background: rgba(255,255,255,.2);
  border-color: rgba(255,255,255,.3);
  color: #fff;
}
.resched-banner .btn:hover { background: rgba(255,255,255,.3); }
@keyframes resched-slide {
  from { opacity: 0; transform: translate(-50%, -10px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

body.reschedule-mode .ag-cell:not(:has(.ag-ev)) {
  background: var(--gold-soft);
  cursor: copy;
}
body.reschedule-mode .ag-cell:not(:has(.ag-ev)):hover {
  background: var(--gold);
}
body.reschedule-mode .ag-cell:not(:has(.ag-ev)):hover::after {
  content: '↻ aqui';
  color: #fff;
  font-weight: 700;
  font-size: 13px;
}
body.reschedule-mode .ag-ev { pointer-events: none; opacity: .5; }

/* === Agenda · responsividade mobile ============================================
 * Estratégia: scroll horizontal snap por coluna em telas < 768px.
 * A grade mantém largura fixa; ag-scroll-wrap provê o overflow.
 * ============================================================================ */
.ag-scroll-wrap {
  /* desktop: wrapper transparente */
}
@media (max-width: 768px) {
  /* ── Grade: scroll horizontal com snap ── */
  .ag-scroll-wrap {
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    border-radius: 12px;
    border: 1px solid var(--line);
    /* scroll suave em iOS */
    scroll-behavior: smooth;
  }
  .ag-grid {
    width: max-content;
    min-width: 100%;
    /* coluna de hora fixa · 7 colunas de 110px = 770px total */
    grid-template-columns: 46px repeat(7, 110px);
    border-radius: 0;
    border: none;
    margin-top: 0;
  }
  /* Cada cabeçalho de dia = ponto de snap */
  .ag-h:not(.ag-h-time) { scroll-snap-align: start; }

  /* ── KPIs: 2×2 em vez de 4×1 ── */
  .ag-kpi-row { grid-template-columns: 1fr 1fr !important; }

  /* ── Cabeçalho da página: empilha nav + botões ── */
  .head-row { flex-direction: column; align-items: flex-start; gap: 10px; }
  .head-row .actions {
    display: flex; flex-wrap: wrap; gap: 6px; width: 100%;
  }
  .head-row .actions .btn,
  .head-row .actions .btn-group { font-size: 12px; padding: 6px 10px; }
  .head-row .actions .btn-group .btn { padding: 6px 10px; }

  /* ── Filtro de profissional: scroll horizontal ── */
  .ag-prof-filter { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }

  /* ── Modal: ocupa a largura toda, centralizado em column ── */
  .modal { align-items: flex-end; padding: 0; }
  .modal-panel,
  .modal-panel.modal-sm,
  .modal-panel.modal-md,
  .modal-panel.modal-lg,
  .modal-panel.modal-xl {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 92vh;
    border-radius: 22px 22px 0 0;
    padding: 18px 16px 24px;
  }
  /* cmdk-modal: centralizado e largo */
  .cmdk-modal {
    top: auto; bottom: 0;
    left: 0; right: 0;
    transform: none;
    width: 100%;
    max-width: 100%;
    border-radius: 22px 22px 0 0;
  }
  /* Botões de ação do modal: empilha se necessário */
  .modal-actions { flex-wrap: wrap; }

  /* ── Recolhe a legenda ── */
  .ag-legend { display: none; }

  /* ── Painel cancelados/reagendados: reduz espaçamento ── */
  .ag-painel { margin-top: 16px; }
}

/* Breakpoint ainda menor: 480px — telas de phone pequeno */
@media (max-width: 480px) {
  .ag-grid {
    grid-template-columns: 40px repeat(7, 96px);
  }
  .head-row h1.h1 { font-size: 18px; }
}

/* === Banner de alerta crítico (cross-cutting) === */
.alert-banner {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px;
  background: linear-gradient(90deg, #fde7e3 0%, #fbf0ec 100%);
  border-left: 4px solid var(--red);
  border-radius: var(--r-md);
  margin-bottom: 16px;
  animation: alert-pulse 2.4s ease-in-out infinite;
}
@keyframes alert-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(184, 74, 59, 0); }
  50%      { box-shadow: 0 0 0 4px rgba(184, 74, 59, .12); }
}
.alert-banner .icon { width: 22px; height: 22px; color: var(--red); flex-shrink: 0; }
.alert-banner b { display: block; color: var(--red); font-size: 14px; font-weight: 700; margin-bottom: 2px; }
.alert-banner span { display: block; color: var(--text2); font-size: 12.5px; }

/* === Resumo executivo (TL;DR da IA) === */
.resumo-exec {
  background: linear-gradient(135deg, var(--gold-soft), #fef7f1);
  border: 1px solid #f4d8c4;
  border-radius: var(--r-md);
  padding: 16px 18px;
  margin: 14px 0 18px;
}
.resumo-h {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--gold2); margin-bottom: 8px;
}
.resumo-h .icon { width: 14px; height: 14px; }
.resumo-body {
  font-size: 14px; line-height: 1.55;
  color: var(--text);
  font-weight: 400;
}

/* Painel de cancelados / reagendados */
.ag-painel { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.ag-painel-card {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
}
.ag-painel-h {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--text3); margin-bottom: 10px;
}
.ag-painel-h .icon { width: 14px; height: 14px; }
.ag-painel-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
}
.ag-painel-item:last-child { border-bottom: 0; }
.ag-painel-item .pi-tt { font-weight: 600; color: var(--text); }
.ag-painel-item .pi-meta { font-size: 11px; color: var(--text3); margin-top: 2px; }
.ag-painel-item .pi-motivo { font-size: 11.5px; color: var(--text2); margin-top: 4px; font-style: italic; }
.ag-painel-empty { font-size: 12px; color: var(--text3); font-style: italic; }

/* Autocomplete de paciente no modal de evento */
.ev-pac-dropdown {
  position: absolute;
  top: 100%; left: 0; right: 0;
  margin-top: 4px;
  background: var(--bg2);
  border: 1px solid var(--line2);
  border-radius: 8px;
  box-shadow: 0 8px 24px -8px rgba(0,0,0,.18);
  max-height: 240px;
  overflow-y: auto;
  z-index: 200;
}
.ev-pac-item {
  padding: 9px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
  transition: background .1s;
}
.ev-pac-item:last-child { border-bottom: 0; }
.ev-pac-item:hover { background: var(--gold-soft); }
.ev-pac-nome { font-size: 13px; font-weight: 500; color: var(--text); }
.ev-pac-meta { font-size: 11px; color: var(--text3); margin-top: 1px; }
.ev-pac-empty {
  padding: 10px 12px; font-size: 12px; color: var(--text3); font-style: italic;
  border-bottom: 1px solid var(--line);
}
.ev-pac-cta {
  padding: 10px 12px;
  cursor: pointer;
  font-size: 12.5px;
  color: var(--gold2);
  font-weight: 600;
  display: flex; align-items: center; gap: 8px;
  transition: background .12s;
  background: var(--gold-soft);
}
.ev-pac-cta:hover { background: var(--gold); color: #fff; }
.ev-pac-cta-plus {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--gold);
  color: #fff;
  display: grid; place-items: center;
  font-size: 14px; font-weight: 700;
  flex-shrink: 0;
}
.ev-pac-cta:hover .ev-pac-cta-plus { background: #fff; color: var(--gold2); }

/* === Pipeline kanban · estilo HubSpot/Salesforce === */
.kanban {
  display: grid;
  grid-template-columns: repeat(9, minmax(210px, 1fr));
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 12px;
  min-height: 60vh;
}
.kb-col {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  display: flex; flex-direction: column;
  min-height: 320px;
  transition: background .15s, border-color .15s;
}
.kb-col[data-key="ganho"], .kb-col[data-key="perdido"] { opacity: .92; }
.kb-col.drag-over {
  background: var(--gold-soft);
  border-color: var(--gold);
  opacity: 1;
}
.kb-col-h {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px 10px;
}
.kb-col-tt { font-size: 12px; font-weight: 600; color: var(--text); letter-spacing: .005em; }
.kb-col-sub { display: none; }
.kb-col-stats { display: flex; align-items: center; gap: 8px; }
.kb-n { background: transparent; padding: 0; font-size: 11.5px; font-weight: 600; color: var(--text3); }
.kb-v { display: inline; font-size: 10.5px; color: var(--text3); margin: 0; font-weight: 500; }
.kb-col-body {
  flex: 1;
  padding: 0 10px 10px;
  display: flex; flex-direction: column; gap: 6px;
  overflow-y: auto;
}

/* Card · clean & quiet */
.kb-card {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s;
  position: relative;
  user-select: none;
}
.kb-card:hover {
  border-color: var(--line2);
  box-shadow: 0 2px 8px -4px rgba(0,0,0,.1);
  transform: translateY(-1px);
}
.kb-card.dragging {
  opacity: .35;
  cursor: grabbing;
  transform: rotate(1.5deg) scale(1.02);
  box-shadow: 0 12px 28px -8px rgba(0,0,0,.25);
  z-index: 10;
}

/* Tom do card · estilo HubSpot/Linear · branco com detalhe lateral
   Sem gradientes saturados · só uma borda esquerda fina e um ESMALTE no canto top-left */

.kb-card.kb-tipo-oportunidade {
  background: var(--bg2);
  border-left: 3px solid var(--gold);
  padding-left: 11px;
}
.kb-card.kb-tipo-oportunidade::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 60%; height: 40%;
  background: radial-gradient(ellipse at top left, rgba(144, 58, 103, .06), transparent 70%);
  pointer-events: none;
  border-radius: 8px 0 0 0;
}
.kb-card.kb-tipo-oportunidade:hover { border-left-color: var(--gold2); }
.kb-card.kb-tipo-oportunidade .kb-card-row3 { color: var(--gold2); font-weight: 600; }

.kb-card.kb-tipo-atraso {
  background: var(--bg2);
  border-left: 3px solid var(--amber);
  padding-left: 11px;
}
.kb-card.kb-tipo-atraso::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 60%; height: 40%;
  background: radial-gradient(ellipse at top left, rgba(182, 132, 58, .05), transparent 70%);
  pointer-events: none;
  border-radius: 8px 0 0 0;
}
.kb-card.kb-tipo-atraso:hover { border-left-color: #8a5e1e; }
.kb-card.kb-tipo-atraso .kb-card-row3 { color: #8a5e1e; font-weight: 500; }

.kb-card.kb-tipo-critico {
  background: var(--bg2);
  border-left: 3px solid var(--red);
  padding-left: 11px;
}
.kb-card.kb-tipo-critico::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 60%; height: 40%;
  background: radial-gradient(ellipse at top left, rgba(184, 74, 59, .07), transparent 70%);
  pointer-events: none;
  border-radius: 8px 0 0 0;
}
.kb-card.kb-tipo-critico:hover { border-left-color: #8a3b2e; }
.kb-card.kb-tipo-critico .kb-card-row3 { color: var(--red); font-weight: 600; }

/* Neutro · branco puro, sem detalhe */
.kb-card.kb-tipo-neutro { background: var(--bg2); }

/* Linha 1 · emoji + nome + valor */
.kb-card-row1 {
  display: flex; align-items: center; gap: 7px;
  font-size: 13px; font-weight: 600; color: var(--text);
}
.kb-emoji {
  flex-shrink: 0;
  width: 14px;                        /* largura fixa = simetria entre cards com/sem emoji */
  font-size: 11px;
  line-height: 1;
  text-align: center;
  display: inline-block;
}
.kb-nome {
  flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.kb-valor {
  font-size: 12px; font-weight: 700; color: var(--text2);
  white-space: nowrap;
}
.kb-card.u-alta .kb-valor { color: var(--red); }

/* Linha 2 · contexto suave */
.kb-card-row2 {
  font-size: 11.5px; color: var(--text3);
  margin-top: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Linha 3 · sugestão IA */
.kb-card-row3 {
  display: flex; align-items: center; gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--gold2);
  letter-spacing: -.005em;
}
.kb-card-row3 .icon { width: 12px; height: 12px; flex-shrink: 0; }
.kb-card.u-alta  .kb-card-row3 { color: var(--red); }
.kb-card.u-media .kb-card-row3 { color: var(--amber); }

/* === Fase do script de atendimento (1-14) === */
.kb-fase {
  display: flex; align-items: center; gap: 8px;
  margin-top: 8px;
  font-size: 10.5px;
  color: var(--text3);
}
.kb-fase-bar {
  flex: 1;
  height: 3px;
  background: var(--bg3);
  border-radius: 2px;
  overflow: hidden;
}
.kb-fase-bar > div {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--gold2));
  border-radius: 2px;
  transition: width .3s;
}
.kb-fase-label {
  font-weight: 500;
  color: var(--text2);
  white-space: nowrap;
  letter-spacing: -.005em;
}
.kb-card.kb-tipo-critico .kb-fase-bar > div { background: linear-gradient(90deg, var(--red), #8a3b2e); }
.kb-card.kb-tipo-atraso  .kb-fase-bar > div { background: linear-gradient(90deg, var(--amber), #8a5e1e); }

/* Quick actions · só aparecem no hover */
.kb-quick {
  position: absolute;
  top: 8px; right: 8px;
  display: flex; gap: 4px;
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity .12s, transform .12s;
  pointer-events: none;
}
.kb-card:hover .kb-quick {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.kb-q-btn {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text2);
  cursor: pointer;
  transition: all .1s;
  text-decoration: none;
}
.kb-q-btn:hover {
  background: var(--gold-soft);
  border-color: var(--gold);
  color: var(--gold2);
}

/* Drop placeholder */
.kb-col.drag-over .kb-col-body::after {
  content: '';
  display: block;
  height: 60px;
  border: 2px dashed var(--gold);
  border-radius: 8px;
  background: rgba(144, 58, 103, .06);
  margin-top: 4px;
}

/* Cartões em colunas terminais ficam discretos sem afetar peso visual */
.kb-col[data-key="ganho"]   .kb-card .kb-dot { background: var(--green); }
.kb-col[data-key="perdido"] .kb-card { opacity: .65; }
.kb-col[data-key="perdido"] .kb-card .kb-card-row3 { display: none; }

.kb-empty {
  padding: 12px;
  text-align: center;
  font-size: 11px;
  color: var(--text3);
  font-style: normal;
}

@media (max-width: 1600px) {
  .kanban { grid-template-columns: repeat(9, 220px); }
}
@media (max-width: 1280px) {
  .kanban { grid-template-columns: repeat(9, 200px); }
}
@media (max-width: 760px) {
  .kanban { grid-template-columns: repeat(9, 180px); }
}

/* === Win overlay · celebração elegante (sentimento de vitória sem gritar) === */
.win-overlay {
  position: fixed; inset: 0;
  z-index: 9998;
  display: grid; place-items: center;
  pointer-events: none;
  background: rgba(254, 247, 241, .25);
  backdrop-filter: blur(5px) saturate(115%);
  -webkit-backdrop-filter: blur(5px) saturate(115%);
  animation: win-bg-fade .35s ease-out forwards;
}
@keyframes win-bg-fade {
  from { background: rgba(254, 247, 241, 0); backdrop-filter: blur(0px); -webkit-backdrop-filter: blur(0px); }
  to   { background: rgba(254, 247, 241, .25); backdrop-filter: blur(5px) saturate(115%); -webkit-backdrop-filter: blur(5px) saturate(115%); }
}
.win-overlay.fade-out {
  background: rgba(254, 247, 241, 0) !important;
  backdrop-filter: blur(0px) !important;
  -webkit-backdrop-filter: blur(0px) !important;
  transition: background .5s ease, backdrop-filter .5s ease;
}
.win-overlay[hidden] { display: none !important; }

.win-content {
  text-align: center;
  animation: win-pop .8s cubic-bezier(.2, 1.2, .35, 1) forwards;
  pointer-events: auto;
  padding: 24px;
}

.win-headline {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--text);
  margin-bottom: 4px;
}

.win-eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--gold2);
  margin-bottom: 10px;
}

.win-name {
  font-size: 64px;
  font-weight: 600;
  letter-spacing: -.025em;
  background: linear-gradient(105deg, #7a2e55 0%, #903a67 30%, #c46a99 50%, #903a67 70%, #7a2e55 100%);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 6px 30px rgba(144, 58, 103, .25);
  animation: win-shimmer 3s linear infinite;
  line-height: 1.1;
  max-width: 80vw;
}
@keyframes win-shimmer {
  0%   { background-position: 0% 50%; }
  100% { background-position: 220% 50%; }
}

.win-sub {
  margin-top: 12px;
  font-size: 14px;
  font-weight: 400;
  color: var(--text2);
  letter-spacing: .02em;
  font-style: italic;
  opacity: .8;
}

.win-close {
  margin-top: 28px;
  padding: 11px 28px !important;
  font-size: 13.5px !important;
  font-weight: 600 !important;
  letter-spacing: .02em;
  box-shadow: 0 8px 24px -8px rgba(144, 58, 103, .5);
  pointer-events: auto;
}
.win-close:hover { transform: translateY(-1px); box-shadow: 0 10px 28px -8px rgba(144, 58, 103, .55); }

@keyframes win-pop {
  0%   { transform: scale(.85) translateY(20px); opacity: 0; }
  60%  { transform: scale(1.04); opacity: 1; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

.win-overlay.fade-out .win-content {
  animation: win-out 1.2s ease-out forwards;
}
@keyframes win-out {
  0%   { transform: scale(1) translateY(0); opacity: 1; }
  100% { transform: scale(1.06) translateY(-20px); opacity: 0; }
}

/* === Toast global (fade in/out) === */
.toast-stack {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 9999;
  display: flex; flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  background: var(--text);
  color: var(--bg);
  padding: 11px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 10px 30px -8px rgba(0,0,0,.3);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .25s, transform .25s;
  pointer-events: auto;
  max-width: 360px;
  display: flex; align-items: center; gap: 9px;
}
.toast.on { opacity: 1; transform: translateY(0); }
.toast-success { background: var(--green); }
.toast-success::before { content: '✓'; font-weight: 700; font-size: 14px; }
.toast-error   { background: var(--red); }
.toast-error::before { content: '!'; font-weight: 700; font-size: 14px; }
.toast-info::before { content: 'ⓘ'; font-weight: 700; }
.toast b { font-weight: 700; }

/* === Top loading bar === */
.topbar-loading {
  position: fixed; top: 0; left: 0; right: 0;
  height: 2.5px;
  background: linear-gradient(90deg, transparent, var(--gold), var(--gold2), var(--gold), transparent);
  background-size: 50% 100%;
  z-index: 9999;
  animation: topload 1.4s linear infinite;
}
.topbar-loading[hidden] { display: none; }
@keyframes topload {
  0%   { background-position: -50% 0; }
  100% { background-position: 150% 0; }
}

/* === Modal genérico · usado pelo Ganho === */
.modal {
  position: fixed; inset: 0;
  z-index: 110;
  display: grid; place-items: center;
  padding: 20px;
}
.modal[hidden] { display: none !important; }
/* Sub-modais sobrepõem o main (sempre que abertos juntos) */
#cancel-modal,
#pac-novo-modal { z-index: 130; }
.modal-overlay {
  position: absolute; inset: 0;
  background: rgba(14, 12, 8, 0.38);
  backdrop-filter: blur(10px) saturate(130%);
  -webkit-backdrop-filter: blur(10px) saturate(130%);
  animation: m-fade .22s ease-out;
}
.modal-panel {
  position: relative;
  width: 488px; max-width: 100%;
  max-height: 88vh;
  display: flex; flex-direction: column;

  /* ── Liquid Glass ── */
  background: rgba(253, 251, 247, 0.76);
  backdrop-filter: blur(56px) saturate(180%) brightness(1.04);
  -webkit-backdrop-filter: blur(56px) saturate(180%) brightness(1.04);
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 22px;
  box-shadow:
    0 56px 96px -20px rgba(0, 0, 0, 0.28),
    0 20px 40px -10px rgba(0, 0, 0, 0.10),
    0 0 0 0.5px rgba(255, 255, 255, 0.30),
    inset 0 1.5px 0 rgba(255, 255, 255, 0.90),
    inset 0 -1px 0 rgba(0, 0, 0, 0.04);

  padding: 20px 22px;
  animation: m-pop .32s cubic-bezier(.34, 1.36, .64, 1);
  overflow: hidden;
}

/* Faixa especular no topo — simula borda de vidro iluminada */
.modal-panel::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg,
    rgba(255,255,255,0)    0%,
    rgba(255,255,255,0.95) 30%,
    rgba(255,255,255,1)    50%,
    rgba(255,255,255,0.95) 70%,
    rgba(255,255,255,0)    100%
  );
  border-radius: 22px 22px 0 0;
  pointer-events: none; z-index: 1;
}

/* Reflexo sutil de profundidade no topo do conteúdo */
.modal-panel::after {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 120px;
  background: linear-gradient(180deg, rgba(255,255,255,0.18) 0%, rgba(255,255,255,0) 100%);
  border-radius: 22px 22px 0 0;
  pointer-events: none; z-index: 0;
}

.modal-panel form { flex: 1; overflow-y: auto; min-height: 0; padding-right: 4px; margin-right: -4px; }
.modal-panel form .modal-actions {
  /* sem sticky — botões direto no fluxo */
}
@keyframes m-fade { from { opacity: 0 } to { opacity: 1 } }
@keyframes m-pop  {
  from { opacity: 0; transform: translateY(12px) scale(.95) }
  to   { opacity: 1; transform: none }
}

.modal-h { margin-bottom: 14px; position: relative; z-index: 2; }
.modal-h h3 {
  margin: 0 0 5px; font-size: 19px; font-weight: 650;
  letter-spacing: -.025em; color: var(--text);
}
.modal-h p { margin: 0; font-size: 13px; color: var(--text2); }

/* Garante que o form também fica acima dos pseudo-elementos de glass */
.modal-panel > form,
.modal-panel > .modal-h { position: relative; z-index: 2; }

.modal .field { margin-bottom: 10px; }
.modal .field label {
  display: block;
  font-size: 10.5px; color: var(--text3);
  text-transform: uppercase; letter-spacing: .06em;
  font-weight: 600; margin-bottom: 4px;
}
.modal .field input,
.modal .field select,
.modal .field textarea {
  width: 100%; padding: 7px 10px;
  border: 1px solid rgba(255,255,255,0.72);
  border-bottom-color: rgba(0,0,0,0.09);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.58);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: 13px;
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.04);
}
.modal .field input:focus,
.modal .field select:focus,
.modal .field textarea:focus {
  background: rgba(255, 255, 255, 0.80);
  border-color: rgba(144, 58, 103, 0.55);
  box-shadow: 0 0 0 3.5px rgba(144, 58, 103, 0.13), inset 0 1px 2px rgba(0,0,0,0.04);
}
.modal .field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-actions {
  display: flex; gap: 8px; justify-content: flex-start;
  margin-top: 18px; padding-top: 14px;
  border-top: 1px solid rgba(0, 0, 0, 0.07);
}

/* ── Modal size modifiers ────────────────────────────────────────────────── *
 * Uso: <div class="modal-panel modal-sm"> etc.                               *
 * Padrão (sem modificador) = 488px                                           */
.modal-panel.modal-sm  { width: 440px; }
.modal-panel.modal-md  { width: 520px; }
.modal-panel.modal-lg  { width: 660px; }
.modal-panel.modal-xl  { width: 780px; }
/* modal-tall: scroll interno em modais tipo editor */
.modal-panel.modal-tall { max-height: 90vh; }
/* modal-body: área de scroll quando não há <form> wrapper */
.modal-body { flex: 1; overflow-y: auto; min-height: 0; padding: 0 2px 0 0; }

/* ── Error/alert inline dentro de modais ────────────────────────────────── */
.field-error {
  display: none;
  background: #fde7e3; color: #9b2c2c;
  padding: 9px 12px; border-radius: 8px;
  font-size: 12.5px; margin-top: 6px;
}
.field-error.show { display: block; }

/* ── cmdk-back + cmdk-modal: herdam o visual Liquid Glass ────────────────── *
 * Posicionamento próprio mantido; apenas o estilo visual é unificado.        */
.cmdk-back {
  position: fixed; inset: 0;
  background: rgba(14, 12, 8, 0.38);
  backdrop-filter: blur(10px) saturate(130%);
  -webkit-backdrop-filter: blur(10px) saturate(130%);
  z-index: 200;
  animation: m-fade .22s ease-out;
}
.cmdk-modal {
  position: fixed; top: 12vh; left: 50%;
  transform: translateX(-50%);
  width: 92%; max-width: 580px;
  z-index: 201;
  overflow: hidden;
  display: flex; flex-direction: column;
  animation: m-pop .32s cubic-bezier(.34, 1.36, .64, 1);

  /* ── Liquid Glass ── */
  background: rgba(253, 251, 247, 0.82);
  backdrop-filter: blur(56px) saturate(180%) brightness(1.04);
  -webkit-backdrop-filter: blur(56px) saturate(180%) brightness(1.04);
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 22px;
  box-shadow:
    0 56px 96px -20px rgba(0, 0, 0, 0.28),
    0 20px 40px -10px rgba(0, 0, 0, 0.10),
    0 0 0 0.5px rgba(255, 255, 255, 0.30),
    inset 0 1.5px 0 rgba(255, 255, 255, 0.90),
    inset 0 -1px 0 rgba(0, 0, 0, 0.04);
}
/* Faixa especular no topo dos cmdk-modal */
.cmdk-modal::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg,
    rgba(255,255,255,0)    0%,
    rgba(255,255,255,0.95) 30%,
    rgba(255,255,255,1)    50%,
    rgba(255,255,255,0.95) 70%,
    rgba(255,255,255,0)    100%
  );
  border-radius: 22px 22px 0 0;
  pointer-events: none; z-index: 1;
}
/* Campos dentro de cmdk-modal herdam os estilos de .modal */
.cmdk-modal .field { margin-bottom: 10px; }
.cmdk-modal .field label {
  display: block;
  font-size: 10.5px; color: var(--text3);
  text-transform: uppercase; letter-spacing: .06em;
  font-weight: 600; margin-bottom: 4px;
}
.cmdk-modal .field input,
.cmdk-modal .field select,
.cmdk-modal .field textarea {
  width: 100%; padding: 7px 10px;
  border: 1px solid rgba(255,255,255,0.72);
  border-bottom-color: rgba(0,0,0,0.09);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.58);
  backdrop-filter: blur(10px);
  font-size: 13px; outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.04);
}
.cmdk-modal .field input:focus,
.cmdk-modal .field select:focus,
.cmdk-modal .field textarea:focus {
  background: rgba(255, 255, 255, 0.80);
  border-color: rgba(144, 58, 103, 0.55);
  box-shadow: 0 0 0 3.5px rgba(144, 58, 103, 0.13), inset 0 1px 2px rgba(0,0,0,0.04);
}

/* ── cst-modal-* legado (financeiro_custos) → substituído pela estrutura     *
 * padrão .modal + .modal-panel; regras mantidas apenas para campos internos. */
.cst-modal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .cst-modal-grid { grid-template-columns: 1fr; } }

/* === IA Drawer · análise pipeline / lead === */
.ia-drawer {
  position: fixed; inset: 0;
  z-index: 100;
}
.ia-drawer-overlay {
  position: absolute; inset: 0;
  background: rgba(29, 27, 23, .35);
  opacity: 0;
  transition: opacity .25s;
}
.ia-drawer.open .ia-drawer-overlay { opacity: 1; }
.ia-drawer-panel {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 480px; max-width: 100vw;
  background: var(--bg);
  box-shadow: -10px 0 40px rgba(0,0,0,.12);
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform .25s cubic-bezier(.4, 0, .2, 1);
  overflow: hidden;
}
.ia-drawer.open .ia-drawer-panel { transform: translateX(0); }
.ia-drawer-h {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--bg2);
}
.ia-drawer-h h3 {
  margin: 0; font-size: 14px; font-weight: 600;
  display: flex; align-items: center; gap: 8px; color: var(--text);
}
.ia-drawer-h h3 .icon { width: 16px; height: 16px; color: var(--gold2); }
.ia-drawer-h > div { flex: 1; }
.ia-drawer-h .tb-icon { background: var(--bg3); width: 30px; height: 30px; font-size: 18px; color: var(--text2); }
.ia-drawer-body { flex: 1; overflow-y: auto; padding: 16px 18px 24px; }

.ia-loading {
  display: flex; flex-direction: column; align-items: center;
  gap: 12px; padding: 60px 20px;
  color: var(--text3); font-size: 13px;
}
.ia-loading .icon {
  animation: ia-spin 1.6s ease-in-out infinite;
}
@keyframes ia-spin {
  0%, 100% { transform: rotate(0deg) scale(1); opacity: .6; }
  50% { transform: rotate(180deg) scale(1.15); opacity: 1; }
}

.ia-summary {
  margin-bottom: 18px;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--gold-soft), #fef7f1);
  border: 1px solid #f4d8c4;
  border-radius: 12px;
}
.ia-tldr { margin: 0; font-size: 13.5px; line-height: 1.55; color: var(--text); }
.ia-tldr b { font-weight: 600; }
.ia-tldr b.danger { color: var(--red); }

.ia-section {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 12px;
  overflow: hidden;
}
.ia-section-h {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px;
  font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  border-bottom: 1px solid var(--line);
}
.ia-section-h .icon { width: 14px; height: 14px; }
.ia-h-op  { background: linear-gradient(90deg, #fef7f1, var(--bg2)); color: var(--gold2); }
.ia-h-cr  { background: linear-gradient(90deg, #fbf0ec, var(--bg2)); color: var(--red); }
.ia-h-at  { background: linear-gradient(90deg, #f7f4f2, var(--bg2)); color: var(--text2); }
.ia-h-msg { background: linear-gradient(90deg, var(--bg3), var(--bg2)); color: var(--text); }
.ia-count {
  margin-left: auto;
  background: var(--bg3); padding: 1px 8px; border-radius: 999px;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0; text-transform: none;
  color: var(--text2);
}

.ia-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
}
.ia-row:last-child { border-bottom: 0; }
.ia-row:hover { background: var(--bg3); }
.ia-row-nome {
  font-size: 13px; font-weight: 600; color: var(--text);
  flex-shrink: 0;
}
.ia-row-nome:hover { color: var(--gold2); }
.ia-row-meta { flex: 1; font-size: 11.5px; color: var(--text2); }
.ia-row-actions { display: flex; gap: 4px; }

.ia-msg {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.ia-msg:last-child { border-bottom: 0; }
.ia-msg-tom {
  font-size: 10.5px; color: var(--gold2);
  text-transform: uppercase; letter-spacing: .06em;
  font-weight: 700; margin-bottom: 4px;
}
.ia-msg-txt {
  font-size: 13px; line-height: 1.5;
  background: var(--bg3); padding: 10px 12px;
  border-radius: 8px; color: var(--text);
  margin-bottom: 8px; white-space: pre-wrap;
}
.ia-msg-actions { display: flex; gap: 6px; }

.ia-empty {
  text-align: center; padding: 60px 20px;
  color: var(--text2);
}
.ia-empty p { margin: 12px 0 0; font-size: 13px; line-height: 1.5; }

.ia-footer {
  margin-top: 16px;
  padding: 12px 14px;
  background: var(--bg3);
  border-radius: 8px;
}
.ia-footer p { margin: 0; font-size: 11.5px; line-height: 1.5; color: var(--text3); }

/* === Termos & Consentimentos === */
.termos-list { display: flex; flex-direction: column; gap: 8px; }
.termo-item {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 14px; align-items: center;
  padding: 14px 16px;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  transition: all .15s;
}
.termo-item:hover { border-color: var(--line2); }
.termo-status-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  display: grid; place-items: center;
  background: var(--bg3); color: var(--text3);
}
.termo-aceito   { background: linear-gradient(90deg, #f3faf6 0%, var(--bg2) 30%); border-color: #cce5d6; }
.termo-aceito   .termo-status-icon { background: #dff1e6; color: var(--green); }
.termo-pendente .termo-status-icon { background: #f6ead0; color: var(--amber); }
.termo-expirado { background: linear-gradient(90deg, #fef5f3 0%, var(--bg2) 30%); border-color: #f1d4cd; }
.termo-expirado .termo-status-icon { background: #fde7e3; color: var(--red); }
.termo-recusado .termo-status-icon { background: var(--bg3); color: var(--text3); }

.termo-tt { font-size: 13.5px; font-weight: 600; color: var(--text); }
.termo-desc { font-size: 12px; color: var(--text2); margin-top: 2px; line-height: 1.4; }
.termo-meta {
  font-size: 11.5px; color: var(--text3); margin-top: 6px; line-height: 1.5;
  font-family: -apple-system, system-ui, sans-serif;
}
.termo-meta b { color: var(--text2); font-weight: 600; }
.termo-meta.muted { font-style: italic; }
.termo-hash {
  font-family: var(--font-mono);
  font-size: 10.5px;
  background: var(--bg3); padding: 1px 6px; border-radius: 4px;
  color: var(--text2);
}

.termo-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; min-width: 120px; }
.termo-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; font-size: 10.5px; font-weight: 600;
  border-radius: 999px;
}
.termo-badge.ok       { background: #dff1e6; color: var(--green); }
.termo-badge.warn     { background: #fde7e3; color: var(--red); }
.termo-badge.pendente { background: #f6ead0; color: var(--amber); }

/* === Central de Termos v2 · cards expansíveis com saúde + sparkline === */
.termo-filters {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.chip {
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg2);
  font-size: 12px;
  font-weight: 500;
  color: var(--text2);
  text-decoration: none;
  transition: all .12s;
}
.chip:hover { border-color: var(--line2); color: var(--text); }
.chip.on {
  background: var(--gold);
  border-color: var(--gold);
  color: #fff;
}

.termos-grid-v2 {
  display: flex; flex-direction: column;
  gap: 8px;
}

.termo-card-v2 {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color .15s;
}
.termo-card-v2:hover { border-color: var(--line2); }
.termo-card-v2[open] { border-color: var(--gold); }

/* Saúde: borda esquerda colorida sutil */
.termo-card-v2.saude-verde { border-left: 3px solid var(--green); }
.termo-card-v2.saude-amber { border-left: 3px solid var(--amber); }
.termo-card-v2.saude-red   { border-left: 3px solid var(--red); }
.termo-card-v2.saude-nunca { border-left: 3px solid var(--line2); opacity: .82; }

.termo-summary {
  display: grid;
  grid-template-columns: 40px 1fr 110px 18px;
  gap: 14px;
  padding: 14px 18px;
  align-items: center;
  cursor: pointer;
  list-style: none;
}
.termo-summary::-webkit-details-marker { display: none; }
.termo-summary::marker { display: none; }
.termo-summary:hover { background: var(--bg3); }

.termo-icon-v2 {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: grid; place-items: center;
}
.saude-verde .termo-icon-v2 { background: #dff1e6; color: var(--green); }
.saude-amber .termo-icon-v2 { background: #f6ead0; color: var(--amber); }
.saude-red   .termo-icon-v2 { background: #fde7e3; color: var(--red); }
.saude-nunca .termo-icon-v2 { background: var(--bg3); color: var(--text3); }

.termo-tt-v2 {
  font-size: 13.5px; font-weight: 600; color: var(--text);
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px;
}
.termo-desc-v2 { font-size: 12px; color: var(--text2); margin-top: 3px; }
.termo-stats-v2 {
  font-size: 11.5px; color: var(--text3);
  margin-top: 6px;
  display: flex; flex-wrap: wrap; gap: 4px;
}
.termo-stats-v2 b { font-weight: 700; color: var(--text2); }
.termo-stats-v2 .danger { color: var(--red); }
.termo-stats-v2 .warn { color: var(--amber); }
.termo-stats-v2 .muted { color: var(--text3); font-style: italic; }
.cobertura-verde { color: var(--green); font-weight: 600; }
.cobertura-amber { color: var(--amber); font-weight: 600; }
.cobertura-red   { color: var(--red); font-weight: 700; }

.termo-spark { color: var(--text3); width: 90px; }
.saude-verde .termo-spark { color: var(--green); }
.saude-amber .termo-spark { color: var(--amber); }
.saude-red   .termo-spark { color: var(--red); }

.termo-chev {
  color: var(--text3);
  font-size: 18px;
  transition: transform .2s;
  width: 18px;
  text-align: center;
}
.termo-card-v2[open] .termo-chev { transform: rotate(90deg); }

.termo-expand {
  border-top: 1px solid var(--line);
  padding: 10px 18px 16px;
  background: var(--bg);
}
.termo-aceites-h {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text3);
  font-weight: 700;
  margin: 8px 0 6px;
}
.termo-aceite-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 6px;
  border-radius: 6px;
  text-decoration: none; color: var(--text);
  transition: background .12s;
}
.termo-aceite-item:hover { background: var(--bg3); }
.termo-actions-row {
  display: flex; gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}

/* Pendências críticas com avatar */
.pend-h {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 0 4px;
  font-size: 12.5px;
}
.pend-h b { font-weight: 700; color: var(--text); }
.pend-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.pend-item:last-of-type { border-bottom: 0; }

/* === Showcase do sistema === */
.sc-bloco { margin-bottom: 24px; }
.sc-bloco-h {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 6px;
}
.sc-bloco-h h2 {
  margin: 0; font-size: 16px; font-weight: 600;
  letter-spacing: -.005em; color: var(--text);
}
.sc-status {
  width: 8px; height: 8px; border-radius: 50%;
  flex-shrink: 0;
}
.sc-status-verde { background: var(--green); box-shadow: 0 0 0 3px rgba(63, 131, 97, .2); }
.sc-status-amber { background: var(--amber); box-shadow: 0 0 0 3px rgba(182, 132, 58, .2); }
.sc-status-red   { background: var(--red);   box-shadow: 0 0 0 3px rgba(184, 74, 59, .2); }
.sc-bloco-desc { font-size: 12.5px; color: var(--text2); margin: 0 0 12px; }

.sc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 10px;
}
.sc-card {
  display: block;
  padding: 14px 16px;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
  transition: all .15s;
}
.sc-card:hover {
  border-color: var(--gold);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px -8px rgba(144, 58, 103, .25);
}
.sc-card-tt { font-size: 13.5px; font-weight: 600; color: var(--text); }
.sc-card-desc {
  font-size: 11.5px; color: var(--text2);
  margin-top: 4px; line-height: 1.4;
}
.sc-card-url {
  font-size: 10.5px; color: var(--text3);
  margin-top: 8px;
  font-family: var(--font-mono);
  background: var(--bg3);
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-block;
}

/* === Reativação · cards priorizados === */
.reat-list { display: flex; flex-direction: column; gap: 8px; }
.reat-card {
  display: grid;
  grid-template-columns: 46px 1fr auto auto;
  gap: 14px;
  padding: 14px 18px;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 12px;
  align-items: center;
  transition: all .15s;
}
.reat-card:hover { border-color: var(--line2); transform: translateY(-1px); box-shadow: 0 4px 12px -6px rgba(0,0,0,.08); }
.reat-tt {
  font-size: 14px; font-weight: 600; color: var(--text);
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.reat-tt a:hover { color: var(--gold2); }
.reat-meta {
  font-size: 11.5px; color: var(--text3);
  margin-top: 3px;
}
.reat-meta b { color: var(--text2); font-weight: 600; }
.reat-ctx {
  font-size: 11.5px;
  color: var(--text2);
  margin-top: 6px;
  font-style: italic;
  line-height: 1.45;
  max-width: 580px;
}
.reat-side {
  display: flex; flex-direction: column; align-items: flex-end;
  gap: 8px; min-width: 90px;
}
.reat-ltv-lbl {
  font-size: 9.5px; color: var(--text3);
  text-transform: uppercase; letter-spacing: .08em; font-weight: 700;
  text-align: right;
}
.reat-ltv-val { font-size: 16px; font-weight: 700; color: var(--gold2); text-align: right; }
.reat-score {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 700; color: #fff;
}
.reat-score.score-verde { background: var(--green); }
.reat-score.score-amber { background: var(--amber); }
.reat-score.score-red   { background: var(--red); }

.reat-actions {
  display: flex; flex-direction: column;
  align-items: flex-end;
  gap: 8px; min-width: 230px;
}
.reat-gancho {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 11px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
}
.reat-gancho .icon { width: 13px; height: 13px; }
.reat-gancho span { font-weight: 700; }
.reat-gancho small { font-weight: 400; opacity: .85; }
.gancho-gold  { background: var(--gold-soft); color: var(--gold2); }
.gancho-amber { background: #f6ead0; color: var(--amber); }
.gancho-red   { background: #fde7e3; color: var(--red); }
.gancho-blue  { background: #dde9ee; color: var(--blue); }

@media (max-width: 1080px) {
  .reat-card { grid-template-columns: 46px 1fr; gap: 10px; }
  .reat-side, .reat-actions { grid-column: 2; align-items: flex-start; }
}

/* === Central de Termos · catálogo grid (legado · removido) === */
.termos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 1px;
  background: var(--line);
}
.termo-cat-card {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 14px;
  padding: 16px 20px;
  background: var(--bg2);
  align-items: flex-start;
  cursor: pointer;
  transition: background .12s;
}
.termo-cat-card:hover { background: var(--bg3); }
.termo-cat-card.critico { border-left: 3px solid var(--red); padding-left: 17px; }
.termo-cat-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--gold-soft);
  display: grid; place-items: center;
  color: var(--gold2);
}
.termo-cat-card.critico .termo-cat-icon { background: #fde7e3; color: var(--red); }
.termo-cat-tt {
  font-size: 13.5px; font-weight: 600; color: var(--text);
  display: flex; align-items: center; flex-wrap: wrap;
}
.termo-cat-desc { font-size: 12px; color: var(--text2); margin-top: 3px; line-height: 1.4; }
.termo-cat-stats {
  font-size: 11.5px; color: var(--text3);
  margin-top: 8px;
  display: flex; gap: 14px; flex-wrap: wrap;
}
.termo-cat-stats b { font-weight: 700; }
.termo-cat-stats .ok { color: var(--green); }
.termo-cat-stats .warn { color: var(--amber); }
.termo-cat-stats .danger { color: var(--red); }
.termo-cat-key code {
  font-size: 10.5px;
  background: var(--bg3);
  padding: 2px 7px;
  border-radius: 4px;
  color: var(--text3);
  font-family: var(--font-mono);
}

/* Aceites recentes (linha) */
.aceite-row {
  display: grid; grid-template-columns: 26px 1fr auto; gap: 11px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  align-items: center;
  text-decoration: none; color: var(--text);
  transition: padding .1s;
}
.aceite-row:last-child { border-bottom: 0; }
.aceite-row:hover { padding-left: 4px; }
.aceite-icon {
  width: 26px; height: 26px;
  border-radius: 6px;
  background: #dff1e6;
  color: var(--green);
  display: grid; place-items: center;
}
.aceite-tt { font-size: 12.5px; font-weight: 500; }
.aceite-meta { font-size: 11px; color: var(--text3); margin-top: 1px; }
.aceite-meta b { color: var(--text2); font-weight: 600; }

/* === HERO Admin · variant (mais sóbrio, profissional) === */
.hero-aurora-adm {
  background:
    radial-gradient(ellipse at 20% 25%, #d4ddec 0%, transparent 45%),
    radial-gradient(ellipse at 75% 30%, #e8d6c4 0%, transparent 50%),
    radial-gradient(ellipse at 60% 80%, #ddd8d0 0%, transparent 55%),
    radial-gradient(ellipse at 30% 95%, #c4cbd6 0%, transparent 50%),
    linear-gradient(135deg, #ebe3d6 0%, #d4cdc0 35%, #c0c5cd 60%, #b6bcc6 100%);
}

/* === HERO Comercial · variant === */
.hero-aurora-sec {
  background:
    radial-gradient(ellipse at 25% 30%, #cbe4f0 0%, transparent 45%),
    radial-gradient(ellipse at 80% 25%, #f4d0a8 0%, transparent 50%),
    radial-gradient(ellipse at 55% 80%, #f9e2cf 0%, transparent 55%),
    radial-gradient(ellipse at 30% 95%, #d4dbe6 0%, transparent 50%),
    linear-gradient(135deg, #fef5e8 0%, #f4d4b8 35%, #ddd4d0 60%, #c8d3e0 100%);
}

/* === HERO Central de Ajuda · variant (gold + granate da marca) === */
.hero-aurora-ajuda {
  background:
    radial-gradient(ellipse at 22% 30%, #f5e0d0 0%, transparent 45%),
    radial-gradient(ellipse at 78% 22%, #e8c4b0 0%, transparent 50%),
    radial-gradient(ellipse at 55% 78%, #f0c8c0 0%, transparent 55%),
    radial-gradient(ellipse at 28% 92%, #e0c4d4 0%, transparent 50%),
    linear-gradient(135deg, #fbecd8 0%, #efc8a8 35%, #e0b8b0 60%, #c8a8b8 100%);
}

/* === HERO Marketing · variant (vibrante, gold + rosa) === */
.hero-aurora-mkt {
  background:
    radial-gradient(ellipse at 20% 30%, #f5e1ef 0%, transparent 45%),
    radial-gradient(ellipse at 80% 25%, #f4c4d4 0%, transparent 50%),
    radial-gradient(ellipse at 60% 80%, #e8b8c8 0%, transparent 55%),
    radial-gradient(ellipse at 30% 95%, #d8c4dc 0%, transparent 50%),
    linear-gradient(135deg, #fde7f0 0%, #f4c4d8 35%, #d8b4c4 60%, #b89dc0 100%);
}
.mission-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  background: rgba(255,255,255,.7);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.7);
  border-radius: 999px;
  font-size: 12px; font-weight: 600; color: var(--text);
  text-shadow: 0 1px 1px rgba(255,255,255,.5);
}

/* === Inbox de IA · Lista de prioridades === */
.widget-priorities { padding: 22px; }
.pri-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.pri-item {
  display: grid;
  grid-template-columns: 4px 32px 1fr auto;
  gap: 12px; align-items: center;
  padding: 12px 14px;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 10px;
  transition: all .15s;
}
.pri-item:hover { border-color: var(--line2); transform: translateX(2px); }
.pri-bar { height: 100%; border-radius: 2px; align-self: stretch; }
.pri-high .pri-bar { background: var(--red); }
.pri-med  .pri-bar { background: var(--amber); }
.pri-low  .pri-bar { background: var(--blue); }
.pri-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: grid; place-items: center;
}
.pri-high .pri-icon { background: #fde7e3; color: var(--red); }
.pri-med  .pri-icon { background: #f6ead0; color: var(--amber); }
.pri-low  .pri-icon { background: #dde9ee; color: var(--blue); }
.pri-tt { font-size: 13.5px; font-weight: 600; color: var(--text); }
.pri-desc { font-size: 12px; color: var(--text2); margin-top: 2px; line-height: 1.4; }

/* === Comissão extra === */
.comissao-meta { font-size: 11.5px; color: var(--text2); line-height: 1.5; margin-bottom: 6px; }
.comissao-meta b { color: var(--text); font-weight: 600; }
.comissao-next {
  font-size: 11.5px; color: var(--text2);
  padding: 8px 10px; background: var(--bg3);
  border-radius: 6px; margin-top: 4px;
}
.comissao-next b { color: var(--gold2); font-weight: 600; }
.comissao-next.ok { background: #dff1e6; color: var(--green); }
.comissao-next.ok b { color: var(--green); }

/* === Catálogo de SKUs · Bloco 5 Clínica === */
.sku-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.sku-card {
  display: block;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--cor, var(--gold));
  border-radius: var(--r-md);
  padding: 14px 16px;
  text-decoration: none;
  color: inherit;
  position: relative;
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
}
.sku-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(20, 14, 5, 0.06);
}
.sku-card-sel {
  box-shadow: 0 0 0 2px var(--cor, var(--gold)), 0 6px 24px rgba(20,14,5,.08);
  transform: translateY(-2px);
}
.sku-card-h {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-bottom: 8px;
}
.sku-cat {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10.5px; font-weight: 600; padding: 3px 8px;
  border-radius: 999px; letter-spacing: 0.2px;
}
.sku-cat .icon { width: 12px; height: 12px; }
.sku-code {
  font-family: var(--font-mono);
  font-size: 10.5px; color: var(--text3);
  background: var(--bg3); padding: 2px 7px;
  border-radius: 4px; letter-spacing: 0.3px;
}
.sku-nome {
  font-size: 14px; font-weight: 600; color: var(--text);
  line-height: 1.3; margin-bottom: 2px;
}
.sku-marca {
  font-size: 11.5px; color: var(--text3);
  margin-bottom: 6px;
}
.sku-preco {
  font-size: 17px; font-weight: 700; color: var(--text);
  margin: 6px 0 8px; display: flex; align-items: baseline; gap: 6px;
}
.sku-preco small { font-size: 11px; font-weight: 400; }
.sku-meta {
  display: flex; gap: 12px; flex-wrap: wrap;
  font-size: 11.5px; color: var(--text2);
  margin-bottom: 10px;
}
.sku-meta span { display: inline-flex; align-items: center; gap: 4px; }
.sku-meta .icon { width: 12px; height: 12px; color: var(--text3); }
.sku-icp {
  display: flex; gap: 7px; align-items: flex-start;
  background: var(--bg3); border-radius: 6px;
  padding: 8px 10px; font-size: 11.5px;
  color: var(--text2); line-height: 1.45;
  margin-bottom: 8px;
}
.sku-icp .icon { width: 13px; height: 13px; flex-shrink: 0; margin-top: 2px; }
.sku-areas { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.sku-area {
  font-size: 10.5px; padding: 2px 8px;
  background: var(--bg3); border-radius: 999px;
  color: var(--text2);
}
.sku-area-more {
  background: transparent; border: 1px dashed var(--line);
  color: var(--text3);
}
.sku-area-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text3);
}
.sku-meta-vendas {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; color: var(--text2);
  margin-top: 6px;
}
.sku-meta-vendas .icon { width: 12px; height: 12px; }

/* Drawer lateral · ficha completa */
.sku-drawer-back {
  position: fixed; inset: 0;
  background: rgba(20, 14, 5, 0.28);
  backdrop-filter: blur(2px);
  z-index: 110; cursor: pointer;
  animation: sku-fade-in .18s ease;
}
.sku-drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 460px; max-width: 92vw;
  background: var(--bg2);
  border-left: 4px solid var(--cor, var(--gold));
  z-index: 120;
  padding: 22px 26px 80px;
  overflow-y: auto;
  box-shadow: -10px 0 40px rgba(20, 14, 5, 0.1);
  animation: sku-slide-in .22s cubic-bezier(.2, .9, .2, 1);
}
@keyframes sku-fade-in { from { opacity: 0 } to { opacity: 1 } }
@keyframes sku-slide-in { from { transform: translateX(20px); opacity: 0 } to { transform: none; opacity: 1 } }
.sku-drawer-h {
  display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
}
.sku-drawer-close {
  margin-left: auto;
  font-size: 22px; line-height: 1;
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 8px; cursor: pointer;
  color: var(--text3); text-decoration: none;
  transition: background .12s, color .12s;
}
.sku-drawer-close:hover { background: var(--bg3); color: var(--text); }
.sku-drawer-tt {
  font-size: 22px; font-weight: 700;
  color: var(--text); line-height: 1.2;
  margin: 0 0 4px; letter-spacing: -0.2px;
}
.sku-drawer-preco {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 14px;
  background-color: color-mix(in srgb, var(--cor, var(--gold)) 8%, var(--bg2));
  padding: 14px 16px;
  border-radius: var(--r-md);
  margin: 14px 0 18px;
}
.sku-preco-lbl {
  font-size: 10.5px; color: var(--text3);
  text-transform: uppercase; letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.sku-preco-val {
  font-size: 19px; font-weight: 700; color: var(--text);
  line-height: 1.1;
}
.sku-preco-val small {
  font-size: 11.5px; font-weight: 400; color: var(--text3);
}
.sku-drawer-desc {
  font-size: 13px; color: var(--text2);
  line-height: 1.55; margin: 0 0 18px;
  padding: 12px 14px; background: var(--bg3);
  border-radius: 8px; border-left: 3px solid var(--line);
}
.sku-bloco {
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.sku-bloco:last-of-type { border-bottom: 0; }
.sku-bloco-h {
  display: flex; align-items: center; gap: 8px; margin-bottom: 10px;
}
.sku-bloco-h h3 {
  font-size: 13px; font-weight: 600;
  color: var(--text); margin: 0;
  letter-spacing: -0.1px;
}
.sku-bloco-row {
  font-size: 12.5px; color: var(--text2);
  line-height: 1.55; margin-bottom: 6px;
}
.sku-bloco-row b { color: var(--text); font-weight: 600; }
.sku-bloco-row:last-child { margin-bottom: 0; }
.sku-bloco-busca {
  font-family: var(--font-mono);
  font-size: 11.5px; padding: 8px 10px;
  background: var(--bg3); border-radius: 6px;
  color: var(--text3); margin-top: 6px;
}
.sku-bloco-warn {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 18px;
  border-bottom: 0;
}
.sku-bloco-warn .sku-bloco-h h3 { color: #b91c1c; }
.sku-combo { display: flex; flex-wrap: wrap; gap: 6px; }
.sku-combo-chip {
  font-family: var(--font-mono);
  font-size: 11px; padding: 5px 10px;
  background: var(--bg3); border: 1px solid var(--line);
  border-radius: 6px; color: var(--text);
  text-decoration: none;
  transition: background .12s, border-color .12s;
}
.sku-combo-chip:hover {
  background: var(--gold-soft);
  border-color: var(--gold);
}
.sku-proto-row {
  display: block;
  background: var(--bg3);
  border-left: 3px solid var(--cor, var(--gold));
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 8px;
  text-decoration: none;
  color: inherit;
  transition: transform .12s, background .12s;
}
.sku-proto-row:hover {
  background: var(--gold-soft);
  transform: translateX(2px);
}
.sku-proto-tt {
  font-size: 12.5px; font-weight: 600; color: var(--text);
}
.sku-proto-meta {
  font-size: 11px; color: var(--text2);
  margin-top: 3px; display: flex; align-items: center; gap: 6px;
}
.sku-proto-desc {
  background: var(--green); color: white;
  padding: 1px 6px; border-radius: 3px;
  font-size: 9.5px; font-weight: 600;
  letter-spacing: 0.3px;
}
.sku-drawer-actions {
  position: sticky; bottom: 0;
  background: var(--bg2); padding: 14px 0 0;
  margin: 16px -2px 0;
  border-top: 1px solid var(--line);
  display: flex; gap: 8px; flex-wrap: wrap;
}
.sku-drawer-actions .btn { flex: 1; min-width: 110px; justify-content: center; }

@media (max-width: 720px) {
  .sku-drawer { width: 100vw; padding: 18px 16px 60px; }
  .sku-drawer-preco { grid-template-columns: 1fr 1fr; gap: 10px; padding: 10px 12px; }
}

/* === Financeiro · faturamento mensal · Bloco 6 === */
.kpi .delta.ok   { color: var(--green); font-weight: 500; }
.kpi .delta.warn { color: var(--red);   font-weight: 500; }
.kpi .val.ok     { color: var(--green); }
.kpi .val.warn   { color: var(--amber); }

/* Lançamento de venda · form */
.lanc-grid {
  display: grid; grid-template-columns: 1.6fr 1fr;
  gap: 14px; align-items: start;
}
.lanc-side { position: sticky; top: 78px; display: flex; flex-direction: column; gap: 12px; }
.lanc-row { display: flex; gap: 10px; flex-wrap: wrap; }
.lanc-lbl {
  display: block; font-size: 10.5px;
  text-transform: uppercase; letter-spacing: 0.4px;
  color: var(--text3); margin-bottom: 4px; font-weight: 600;
}
.lanc-input {
  width: 100%; padding: 8px 11px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--bg2); font-size: 13px; color: var(--text);
  font-family: inherit;
  transition: border-color .12s, box-shadow .12s;
}
.lanc-input:focus {
  outline: 0; border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(180,140,90,.15);
}
textarea.lanc-input { resize: vertical; min-height: 60px; }

.lanc-search-results {
  position: absolute;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  box-shadow: 0 8px 24px rgba(20,14,5,.08);
  max-width: 360px; max-height: 240px; overflow-y: auto;
  z-index: 50; margin-top: 2px;
}
.lanc-search-item {
  padding: 8px 12px; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12.5px; gap: 12px;
  border-bottom: 1px solid var(--line);
}
.lanc-search-item:last-child { border-bottom: 0; }
.lanc-search-item:hover { background: var(--gold-soft); }
.lanc-search-item small { font-size: 11px; }

.lanc-item {
  background: var(--bg3);
  border-left: 3px solid var(--line);
  border-radius: var(--r-sm);
  padding: 10px 12px; margin-bottom: 8px;
  transition: border-color .15s;
}
.lanc-item:last-child { margin-bottom: 0; }
.lanc-item-row {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end;
}
.lanc-rm {
  border: 0; background: transparent;
  color: var(--text3); font-size: 18px; cursor: pointer;
  width: 28px; height: 32px;
  display: grid; place-items: center;
  border-radius: 6px;
  transition: background .12s, color .12s;
}
.lanc-rm:hover { background: #fde7e3; color: var(--red); }

.lanc-resumo .lanc-resumo-row {
  display: flex; justify-content: space-between;
  font-size: 12.5px; padding: 4px 0;
  color: var(--text2);
}
.lanc-resumo .lanc-resumo-row b { color: var(--text); font-weight: 500; }

@media (max-width: 1080px) {
  .lanc-grid { grid-template-columns: 1fr; }
  .lanc-side { position: static; }
}

/* === DRE · Demonstrativo de Resultado === */
.dre-grid {
  display: grid; grid-template-columns: 1.7fr 1fr;
  gap: 14px; align-items: start;
}
.dre-side { position: sticky; top: 78px; max-height: calc(100vh - 100px); overflow-y: auto; }

.dre-tbl {
  width: 100%; border-collapse: collapse;
  font-size: 12.5px;
}
.dre-tbl thead th {
  text-align: left; font-size: 10.5px;
  text-transform: uppercase; letter-spacing: 0.4px;
  color: var(--text3); font-weight: 600;
  padding: 8px 10px; border-bottom: 1px solid var(--line);
}
.dre-tbl td {
  padding: 7px 10px;
  border-bottom: 1px solid #f3ede5;
  vertical-align: middle;
}
.dre-row { transition: background .12s; }
.dre-row:not(.dre-blank):hover { background: var(--bg3); }
.dre-row-active {
  background: var(--gold-soft) !important;
  outline: 1px solid rgba(180,140,90,.3);
}
.dre-blank td {
  padding: 4px 10px; border-bottom: 0;
}

.dre-lbl {
  position: relative; padding-right: 14px;
  color: var(--text);
  white-space: nowrap;
}
.dre-drill-icon {
  margin-left: 6px; color: var(--text3);
  font-size: 13px; opacity: 0.6;
}
.dre-row:hover .dre-drill-icon { opacity: 1; color: var(--gold2); }

.dre-val {
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
  font-size: 12px; text-align: right;
  white-space: nowrap; padding-left: 0;
}
.dre-pct {
  font-variant-numeric: tabular-nums;
  font-size: 11px; text-align: right;
  white-space: nowrap;
  min-width: 50px;
}
.dre-delta {
  font-variant-numeric: tabular-nums;
  font-size: 11px; text-align: right;
  white-space: nowrap; font-weight: 500;
  min-width: 60px;
}
.dre-delta.ok   { color: var(--green); }
.dre-delta.warn { color: var(--red); }
.dre-delta.muted { color: var(--text3); font-weight: 400; }

.dre-bar-cell { width: 100px; padding: 0 8px !important; }
.dre-bar {
  height: 4px; background: var(--bg3);
  border-radius: 99px; overflow: hidden;
}
.dre-bar-fill {
  height: 100%; border-radius: 99px;
  transition: width .8s cubic-bezier(.2,.9,.2,1);
}

.dre-h .dre-lbl { font-weight: 600; font-size: 13px; }
.dre-h .dre-val { font-weight: 600; font-size: 13.5px; }

.dre-s .dre-lbl { color: var(--text2); font-size: 12px; }
.dre-s .dre-val { color: var(--text2); }

.dre-d .dre-lbl { color: #b45309; }
.dre-d .dre-val { color: #b45309; font-weight: 500; }

.dre-t {
  background: linear-gradient(to right, transparent, rgba(180,140,90,.04));
}
.dre-t .dre-lbl { font-weight: 700; font-size: 13px; color: var(--text); }
.dre-t .dre-val { font-weight: 700; font-size: 14px; color: var(--text); }
.dre-t td {
  border-top: 1px solid var(--gold);
  border-bottom: 1px solid var(--gold);
  padding-top: 9px; padding-bottom: 9px;
}

.dre-tot-final {
  background: linear-gradient(to right, transparent, rgba(16,185,129,.08));
}
.dre-tot-final .dre-lbl { font-weight: 700; font-size: 14.5px; color: #047857; }
.dre-tot-final .dre-val { font-weight: 700; font-size: 16px; color: #047857; }
.dre-tot-final td {
  border-top: 2px solid #10b981;
  border-bottom: 0;
  padding-top: 11px; padding-bottom: 11px;
}

.dre-pos-bold .dre-lbl { color: var(--text); font-weight: 600; }
.dre-neg .dre-val { color: #ea580c; }
.dre-neg-bold .dre-lbl { color: #b45309; font-weight: 600; }
.dre-neg-bold .dre-val { color: #b45309; font-weight: 600; }
.dre-subtot { background: rgba(180,140,90,.05); }

.dre-foot {
  display: flex; justify-content: space-between;
  padding: 12px 4px 4px;
  border-top: 1px dashed var(--line);
  margin-top: 10px;
}

.dre-drill-close {
  margin-left: auto;
  font-size: 22px; line-height: 1;
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: 6px;
  color: var(--text3); text-decoration: none;
  transition: background .12s, color .12s;
}
.dre-drill-close:hover { background: var(--bg3); color: var(--text); }

.dre-drill-list {
  display: flex; flex-direction: column;
  gap: 6px; max-height: 600px; overflow-y: auto;
}
.dre-drill-row {
  display: flex; justify-content: space-between;
  align-items: center; gap: 12px;
  padding: 8px 10px;
  background: var(--bg3); border-radius: 6px;
  border-left: 3px solid var(--gold);
}
.dre-drill-info { min-width: 0; flex: 1; }
.dre-drill-tt {
  font-size: 12px; font-weight: 500;
  color: var(--text); line-height: 1.3;
  white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis;
}
.dre-drill-meta {
  font-size: 10.5px; color: var(--text3);
  margin-top: 2px;
}
.dre-drill-val {
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
  font-size: 12px; font-weight: 600;
  color: var(--text); white-space: nowrap;
}

@media (max-width: 1280px) {
  .dre-bar-cell { display: none; }
}
@media (max-width: 1080px) {
  .dre-grid { grid-template-columns: 1fr; }
  .dre-side { position: static; max-height: none; }
  .dre-tbl thead th[colspan="2"]:not(:nth-child(2)),
  .dre-tbl tbody td:nth-child(5),
  .dre-tbl tbody td:nth-child(6) { display: none; }
}

/* === Notas Fiscais · Assistente de emissão === */
.nf-row-pend { background: rgba(254, 215, 170, 0.18); }
.nf-row-pend:hover { background: rgba(254, 215, 170, 0.30); }

.nf-drawer { width: 520px; max-width: 94vw; }

.nf-alerta {
  background: #fef3c7;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 18px;
  font-size: 12.5px;
  color: #92400e;
  line-height: 1.55;
}
.nf-alerta b { color: #78350f; }
.nf-alerta details summary { color: #b45309; }

.nf-roteiro {
  display: flex; flex-direction: column;
  gap: 6px;
}
.nf-roteiro-row {
  display: grid; grid-template-columns: 130px 1fr;
  gap: 10px; align-items: center;
  padding: 7px 10px;
  background: var(--bg3);
  border-radius: 6px;
  border-left: 2px solid var(--line);
  transition: border-color .15s, background .15s;
}
.nf-roteiro-row:hover {
  background: var(--gold-soft);
  border-left-color: var(--gold);
}
.nf-roteiro-row.nf-warn {
  background: #fef3c7;
  border-left-color: #f59e0b;
}
.nf-roteiro-lbl {
  font-size: 10.5px; color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.4px; font-weight: 600;
}
.nf-roteiro-val {
  display: flex; align-items: center; gap: 8px;
  min-width: 0;
}
.nf-roteiro-text {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text);
  flex: 1;
  word-break: break-word;
  line-height: 1.4;
}
.nf-warn .nf-roteiro-text { color: #92400e; }

.nf-copy {
  flex-shrink: 0;
  width: 26px; height: 26px;
  border: 0; background: var(--bg2);
  color: var(--text3);
  border-radius: 5px;
  cursor: pointer;
  display: grid; place-items: center;
  transition: background .15s, color .15s;
}
.nf-copy:hover { background: var(--gold-soft); color: var(--gold2); }
.nf-copy-ok {
  background: #d1fae5 !important;
  color: #047857 !important;
}
.nf-copy-ok::after {
  content: '✓';
  font-weight: 700;
}
.nf-copy-ok svg { display: none; }
.nf-copy svg { width: 12px; height: 12px; }

/* === Comissões · evolução 6 meses === */
.com-evolucao {
  display: flex; gap: 14px; align-items: flex-end;
  height: 140px; padding: 10px 0 0;
  border-bottom: 1px solid var(--line);
}
.com-evolucao-mes {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; height: 100%;
  position: relative;
}
.com-evolucao-bars {
  display: flex; align-items: flex-end;
  gap: 3px; width: 100%; max-width: 60px;
  height: 100%;
}
.com-bar {
  flex: 1; min-width: 8px;
  border-radius: 3px 3px 0 0;
  transition: opacity .15s, transform .15s;
}
.com-bar:hover { transform: scaleY(1.04); filter: brightness(1.1); cursor: pointer; }
.com-evolucao-lbl {
  position: absolute; bottom: -22px;
  font-size: 11px; color: var(--text3);
  white-space: nowrap;
}
.com-evolucao-lbl.is-active {
  color: var(--text); font-weight: 600;
}

/* === Cenários what-if === */
.cen-grid {
  display: grid; grid-template-columns: 1fr 1.2fr;
  gap: 14px; align-items: start;
}
.cen-side { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 78px; }

.cen-input {
  margin-bottom: 18px;
}
.cen-input label {
  display: flex; justify-content: space-between;
  font-size: 12.5px; color: var(--text2);
  margin-bottom: 6px; font-weight: 500;
}
.cen-input .cen-val {
  font-family: var(--font-mono);
  color: var(--gold2); font-weight: 700;
}
.cen-input input[type=range] {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: linear-gradient(90deg,#fed7aa 0%,#fed7aa 50%,#d1fae5 50%,#d1fae5 100%);
  border-radius: 99px;
  outline: none;
  cursor: pointer;
}
.cen-input input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px;
  background: var(--bg2);
  border: 2px solid var(--gold);
  border-radius: 50%; cursor: pointer;
  box-shadow: 0 2px 6px rgba(180,140,90,.35);
  transition: transform .12s;
}
.cen-input input[type=range]::-webkit-slider-thumb:hover { transform: scale(1.15); }
.cen-input input[type=range]::-moz-range-thumb {
  width: 18px; height: 18px;
  background: var(--bg2); border: 2px solid var(--gold);
  border-radius: 50%; cursor: pointer;
}
.cen-anchors {
  display: flex; justify-content: space-between;
  font-size: 10px; color: var(--text3);
  margin-top: 4px;
}

.cen-delta-badge {
  font-size: 11.5px; font-weight: 600;
  padding: 3px 8px; border-radius: 99px;
}
.cen-delta-badge.pos     { background: #d1fae5; color: #047857; }
.cen-delta-badge.neg     { background: #fecaca; color: #b91c1c; }
.cen-delta-badge.neutral { background: var(--bg3); color: var(--text3); }

.cen-tbl {
  width: 100%; border-collapse: collapse;
  font-size: 12px;
}
.cen-tbl thead th {
  text-align: left; font-size: 10.5px;
  text-transform: uppercase; letter-spacing: 0.4px;
  color: var(--text3); font-weight: 600;
  padding: 6px 8px; border-bottom: 1px solid var(--line);
}
.cen-tbl tbody td {
  padding: 6px 8px;
  border-bottom: 1px solid #f3ede5;
  font-variant-numeric: tabular-nums;
}
.cen-tbl tbody td:first-child {
  color: var(--text); font-weight: 500;
}
.cen-row-neg td:first-child { color: #b45309; font-size: 11.5px; padding-left: 16px; }
.cen-row-neg td:nth-child(2) { color: #ea580c; }
.cen-row-sub { background: rgba(180,140,90,.04); }
.cen-row-sub td { font-weight: 600; }
.cen-row-final {
  background: linear-gradient(to right, transparent, rgba(16,185,129,.08));
}
.cen-row-final td:first-child { color: #047857; font-weight: 700; font-size: 13px; }
.cen-row-final td:nth-child(2) { color: #047857; font-weight: 700; font-size: 14px; }
.cen-row-final td { padding-top: 9px; padding-bottom: 9px; border-top: 2px solid #10b981; border-bottom: 0; }
.cen-row-big td { font-weight: 600; font-size: 12.5px; }

.cen-tbl .ok    { color: var(--green); font-weight: 500; }
.cen-tbl .warn  { color: var(--red); font-weight: 500; }
.cen-tbl .muted { color: var(--text3); }

@media (max-width: 1080px) {
  .cen-grid { grid-template-columns: 1fr; }
  .cen-side { position: static; }
}

/* === ⌘K Command Palette === */
/* Força hidden funcionar mesmo com display: flex/block abaixo */
.cmdk-back[hidden], .cmdk-modal[hidden] { display: none !important; }
/* cmdk-back + cmdk-modal → estilos Liquid Glass unificados — ver seção modal acima */

.cmdk-input-wrap {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}
.cmdk-input-wrap .icon { width: 18px; height: 18px; color: var(--text3); }
#cmdk-input {
  flex: 1; border: 0; outline: 0; background: transparent;
  font-size: 16px; color: var(--text);
  font-family: inherit;
}
#cmdk-input::placeholder { color: var(--text3); }
.cmdk-input-wrap kbd {
  font-size: 10.5px; padding: 2px 6px;
  background: var(--bg3); border: 1px solid var(--line);
  border-radius: 4px; color: var(--text3);
  font-family: var(--font-mono);
}

.cmdk-results {
  max-height: 60vh; overflow-y: auto;
  padding: 6px 4px;
}
.cmdk-group-h {
  font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .5px; color: var(--text3);
  font-weight: 600; padding: 10px 16px 6px;
}

.cmdk-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 14px;
  margin: 0 4px; border-radius: 8px;
  cursor: pointer;
  transition: background .1s;
}
.cmdk-item.on { background: var(--gold-soft); }
.cmdk-item .icon {
  width: 16px; height: 16px;
  color: var(--text3); flex-shrink: 0;
}
.cmdk-item.on .icon { color: var(--gold2); }
.cmdk-text { flex: 1; min-width: 0; }
.cmdk-title {
  font-size: 13.5px; font-weight: 500;
  color: var(--text); line-height: 1.3;
  display: flex; align-items: center; gap: 7px;
}
.cmdk-title mark { background: rgba(180,140,90,.25); color: var(--text); border-radius: 2px; padding: 0 2px; }
.cmdk-grp {
  font-size: 10px; padding: 1px 6px;
  background: var(--bg3); color: var(--text3);
  border-radius: 99px; font-weight: 500;
  text-transform: uppercase; letter-spacing: .3px;
}
.cmdk-sub {
  font-size: 11.5px; color: var(--text3);
  margin-top: 2px;
}
.cmdk-arrow {
  font-size: 13px; color: var(--text3);
  font-family: var(--font-mono);
  opacity: 0; transition: opacity .12s;
}
.cmdk-item.on .cmdk-arrow { opacity: 1; color: var(--gold2); }

.cmdk-empty {
  padding: 30px;
  text-align: center; color: var(--text3);
  font-size: 13px;
}
.cmdk-foot {
  display: flex; justify-content: flex-end;
  gap: 16px; padding: 8px 16px;
  border-top: 1px solid var(--line);
  background: var(--bg);
  font-size: 10.5px; color: var(--text3);
}
.cmdk-foot kbd {
  font-size: 9.5px; padding: 1px 5px;
  background: var(--bg3); border: 1px solid var(--line);
  border-radius: 3px; color: var(--text2);
  font-family: var(--font-mono);
  margin-right: 4px;
}

/* topbar cmdk button (não era button antes) */
button.cmdk {
  border: 0; cursor: pointer; font-family: inherit;
}

/* === Copiloto Claude · insight do mês === */
.copilot-card {
  background: linear-gradient(135deg, rgba(124,58,237,0.04), rgba(180,140,90,0.04));
  border: 1px solid var(--line);
  border-left: 4px solid #7c3aed;
  border-radius: var(--r-md);
  padding: 14px 18px;
  transition: border-left-color .3s;
}
.copilot-h {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--text2);
  margin-bottom: 10px;
}
.copilot-h .icon { width: 16px; height: 16px; }
.copilot-content { font-size: 13px; }
.copilot-loading {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 0; color: var(--text3);
  font-size: 12.5px;
}
.copilot-spinner {
  width: 14px; height: 14px;
  border: 2px solid rgba(124,58,237,0.2);
  border-top-color: #7c3aed;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.copilot-tldr {
  font-size: 14px; font-weight: 500;
  color: var(--text); line-height: 1.45;
  margin: 0 0 14px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.5);
  border-radius: 7px;
}
.copilot-insights {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
}
.copilot-insight {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.65);
  border-radius: 7px;
  border-left: 3px solid #7c3aed;
}
.copilot-insight .icon {
  width: 18px; height: 18px;
  color: #7c3aed; flex-shrink: 0; margin-top: 2px;
}
.copilot-insight-tt {
  font-size: 12.5px; font-weight: 600;
  color: var(--text); line-height: 1.3;
  margin-bottom: 3px;
}
.copilot-insight-desc {
  font-size: 11.5px; color: var(--text2);
  line-height: 1.45; margin-bottom: 5px;
}
.copilot-insight-acao {
  font-size: 11px; color: #6d28d9;
  font-weight: 500; line-height: 1.4;
  font-style: italic;
}

@media (max-width: 720px) {
  .copilot-insights { grid-template-columns: 1fr; }
}

/* Bar chart diário */
.findb-bars {
  display: flex; align-items: flex-end;
  gap: 3px; height: 140px;
  padding: 8px 0 0;
  border-bottom: 1px solid var(--line);
  position: relative;
}
.findb-bar-wrap {
  flex: 1; min-width: 8px;
  height: 100%;
  display: flex; flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  position: relative;
  cursor: default;
}
.findb-bar {
  width: 100%;
  border-radius: 3px 3px 0 0;
  transition: opacity .15s, transform .15s;
  position: relative;
}
.findb-bar-wrap:hover .findb-bar {
  transform: scaleY(1.04);
  filter: brightness(1.08);
}
.findb-bar-today {
  outline: 2px solid var(--text);
  outline-offset: 1px;
}
.findb-bar-empty { opacity: .35; min-height: 2px !important; }
.findb-bar-lbl {
  position: absolute; bottom: -16px;
  font-size: 9.5px; color: var(--text3);
  white-space: nowrap;
}

/* Top SKUs */
.fin-sku-row {
  display: block; padding: 8px 10px;
  border-radius: 7px; border-left: 3px solid var(--cor, var(--gold));
  background: var(--bg3);
  text-decoration: none; color: inherit;
  transition: transform .12s, background .12s;
}
.fin-sku-row:hover {
  background: var(--gold-soft);
  transform: translateX(2px);
}
.fin-sku-tt {
  display: flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 500; color: var(--text);
  margin-bottom: 5px;
}
.fin-sku-rank {
  font-family: var(--font-mono);
  font-size: 10.5px; color: var(--cor, var(--gold2));
  font-weight: 700; letter-spacing: 0.3px;
  background: color-mix(in srgb, var(--cor, var(--gold)) 12%, transparent);
  padding: 1px 5px; border-radius: 3px;
}
.fin-sku-code {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 9.5px; color: var(--text3);
  letter-spacing: 0.3px;
}
.fin-sku-progress {
  height: 4px; background: rgba(0,0,0,0.05);
  border-radius: 99px; overflow: hidden;
  margin-bottom: 5px;
}
.fin-sku-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--cor, var(--gold)), color-mix(in srgb, var(--cor, var(--gold2)) 70%, white));
  border-radius: 99px;
  transition: width .8s cubic-bezier(.2,.9,.2,1);
}
.fin-sku-meta {
  display: flex; justify-content: space-between;
  font-size: 11px; color: var(--text2);
}

@media (max-width: 1280px) {
  .app { grid-template-columns: 220px 1fr 300px; }
  .widgets { grid-template-columns: 1fr 1fr; }
  .widget-priorities { grid-column: span 2; }
}
@media (max-width: 1080px) {
  .app, .app.no-cp { grid-template-columns: 200px 1fr; }
  .copilot { display: none; }
  .widgets { grid-template-columns: 1fr; }
}

/* ============================================================
   Modal genérico (<dialog>) — usado em estoque, vendas, etc
   ============================================================ */
dialog.m-dialog {
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 22px;
  padding: 0;
  width: 520px;
  max-width: 92vw;
  max-height: 90vh;
  background: rgba(253, 251, 247, 0.76);
  backdrop-filter: blur(56px) saturate(180%) brightness(1.04);
  -webkit-backdrop-filter: blur(56px) saturate(180%) brightness(1.04);
  box-shadow:
    0 56px 96px -20px rgba(0, 0, 0, 0.28),
    0 20px 40px -10px rgba(0, 0, 0, 0.10),
    0 0 0 0.5px rgba(255, 255, 255, 0.30),
    inset 0 1.5px 0 rgba(255, 255, 255, 0.90),
    inset 0 -1px 0 rgba(0, 0, 0, 0.04);
  overflow: hidden;
  animation: m-pop .32s cubic-bezier(.34, 1.36, .64, 1);
}
dialog.m-dialog::backdrop {
  background: rgba(14, 12, 8, 0.38);
  backdrop-filter: blur(10px) saturate(130%);
  -webkit-backdrop-filter: blur(10px) saturate(130%);
}
dialog.m-dialog .m-form { display: flex; flex-direction: column; max-height: 90vh; }
dialog.m-dialog .m-h {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid rgba(255,255,255,0.45);
  background: linear-gradient(180deg, rgba(255,255,255,0.22) 0%, rgba(255,255,255,0) 100%);
}
dialog.m-dialog .m-h h3 { margin: 0; font-size: 15px; font-weight: 650; letter-spacing: -.02em; }
dialog.m-dialog .m-x {
  background: transparent; border: 0; font-size: 22px; line-height: 1;
  color: var(--text3); cursor: pointer; padding: 4px 8px; border-radius: 6px;
}
dialog.m-dialog .m-x:hover { background: rgba(0,0,0,0.06); color: var(--text); }
dialog.m-dialog .m-body { padding: 18px 22px; overflow-y: auto; flex: 1; }
dialog.m-dialog .m-foot {
  display: flex; gap: 8px; justify-content: flex-end;
  padding: 14px 22px;
  border-top: 1px solid rgba(255,255,255,0.45);
  background: linear-gradient(to top, rgba(253,251,247,.95) 70%, rgba(253,251,247,0) 100%);
}
dialog.m-dialog .m-row { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
dialog.m-dialog .m-row label {
  font-size: 11px; font-weight: 600; color: var(--text2);
  text-transform: uppercase; letter-spacing: 0.04em;
}
dialog.m-dialog .m-row input[type="text"],
dialog.m-dialog .m-row input[type="number"],
dialog.m-dialog .m-row input[type="date"],
dialog.m-dialog .m-row input[type="datetime-local"],
dialog.m-dialog .m-row select,
dialog.m-dialog .m-row textarea {
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg);
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  outline: none;
}
dialog.m-dialog .m-row input:focus,
dialog.m-dialog .m-row select:focus,
dialog.m-dialog .m-row textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(144,58,103,.12);
}
dialog.m-dialog .m-row textarea { resize: vertical; min-height: 60px; }
dialog.m-dialog .m-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* === F1 · Modal "Próximo passo" após criar paciente ============ */
#pac-next-step { position: fixed; inset: 0; z-index: 9100; display: flex; align-items: center; justify-content: center; }
.pac-ns-back   { position: absolute; inset: 0; background: rgba(0,0,0,.35); }
.pac-ns-box    {
  position: relative; z-index: 1;
  background: var(--bg2); border-radius: var(--r-xl);
  padding: 32px 28px; max-width: 380px; width: 90%;
  box-shadow: var(--shadow);
  text-align: center; animation: pac-ns-in .18s ease;
}
@keyframes pac-ns-in { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
.pac-ns-icon  { font-size: 36px; margin-bottom: 8px; }
.pac-ns-title { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.pac-ns-sub   { font-size: 13px; color: var(--text2); margin-bottom: 20px; }
.pac-ns-btns  { display: flex; flex-direction: column; gap: 8px; }
.pac-ns-btns .btn { justify-content: center; padding: 10px; font-size: 13.5px; }

/* ==========================================================================
   R1 · Sidebar off-canvas mobile + hamburger
   --------------------------------------------------------------------------
   Breakpoint: <960px transforma sidebar em drawer off-canvas.
   Hamburger no topbar abre o drawer · backdrop fecha · auto-close em link click
   e em resize >=960px. Toque ≥44px no botão.
   ========================================================================== */

/* Hamburger no topbar — escondido em desktop */
.tb-hamburger {
  display: none;
  width: 44px; height: 44px;
  align-items: center; justify-content: center;
  border: 0; background: transparent;
  color: var(--text2); cursor: pointer;
  border-radius: var(--r-md);
  margin-left: -6px;
  transition: background .15s, color .15s;
}
.tb-hamburger:hover, .tb-hamburger:focus-visible { background: var(--bg3); color: var(--text); outline: none; }
.tb-hamburger .icon { width: 22px; height: 22px; }

/* Backdrop · só aparece quando drawer abre em mobile */
.sb-backdrop {
  position: fixed; inset: 0;
  background: rgba(14, 12, 8, 0.42);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 49;
  opacity: 0; pointer-events: none;
  transition: opacity .22s ease;
}
.app.sb-mobile-open .sb-backdrop { opacity: 1; pointer-events: auto; }

@media (max-width: 960px) {
  /* Mostra hamburger */
  .tb-hamburger { display: inline-flex; }

  /* Desktop sidebar toggle some no mobile (substituído pelo hamburger) */
  .sb-toggle { display: none !important; }

  /* App vira coluna única — sidebar sai do fluxo */
  .app,
  .app.no-cp,
  .app.sb-collapsed,
  .app.sb-collapsed.no-cp {
    grid-template-columns: 1fr !important;
  }

  /* Sidebar como drawer fixo */
  .sb {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: min(82vw, 300px);
    z-index: 60;
    padding: 14px 12px 24px;
    box-shadow: 0 12px 40px rgba(0,0,0,.18);
    transform: translateX(-100%);
    transition: transform .25s cubic-bezier(.4,0,.2,1);
    will-change: transform;
    border-right: 1px solid var(--line);
    background: var(--bg2);
  }
  .app.sb-mobile-open .sb { transform: translateX(0); }

  /* Sidebar drawer NUNCA usa modo collapsed visual no mobile */
  .sb-collapsed .sb { padding: 14px 12px 24px; }
  .sb-collapsed .sb-item { justify-content: flex-start; padding: 11px 10px; gap: 11px; }
  .sb-collapsed .sb-item .lbl,
  .sb-collapsed .sb-item .ct { opacity: 1; width: auto; padding: revert; margin: revert; pointer-events: auto; }
  .sb-collapsed .sb-section { opacity: 1; height: auto; font-size: 10px; padding: 0 8px; border-top: 0; }
  .sb-collapsed .persona-card { display: block; }
  .sb-collapsed .sb-item::after { content: none; }

  /* Touch targets ≥44px nos itens da sidebar mobile */
  .sb-item { min-height: 44px; padding: 11px 10px; font-size: 14px; }
  .sb-item .icon { width: 19px; height: 19px; }

  /* Topbar: persona switcher e cmdk encolhem */
  .ws { padding: 3px; gap: 2px; }
  .ws button { padding: 6px 8px; font-size: 11px; gap: 0; }
  .ws button .icon { width: 13px; height: 13px; }
  .ws button span:not(.icon) { display: none; }

  .cmdk { padding: 7px 10px; font-size: 12px; max-width: 44px; min-width: 44px; min-height: 44px; justify-content: center; }
  .cmdk span { display: none; }
  .cmdk kbd { display: none; }

  /* Logo encolhe um pouco */
  .logo { padding-right: 8px; margin-right: 2px; }
  .logo-img { height: 28px; }

  /* Avatar do usuário esconde nome em telas pequenas */
  .tb-user span { display: none; }
  .tb-user { padding: 4px; }

  /* Bell menu vira full-width */
  .bell-menu { width: calc(100vw - 24px); right: -8px; max-height: 70vh; }

  /* Main padding menor em mobile */
  .main { padding: 16px 14px; }
}

/* Telas muito pequenas — esconde persona switcher (ainda acessível via menu admin) */
@media (max-width: 560px) {
  .ws { display: none; }
}

/* Bloqueia scroll do body quando drawer aberto */
body.sb-locked { overflow: hidden; touch-action: none; }

/* Reduce motion · sidebar desliza sem transição */
@media (prefers-reduced-motion: reduce) {
  .sb, .sb-backdrop { transition: none; }
}

/* ==========================================================================
   R2 · Tabelas viram card view <720px
   --------------------------------------------------------------------------
   Aplica em qualquer .tbl e .al-table sem opt-in. Cada <tr> vira card.
   Cada <td> mostra label inferido do <th> via atributo data-label="..."
   (preenchido por JS no _layout.php no DOMContentLoaded).
   Pra desativar em tabela específica: adicionar classe .tbl-keep
   ========================================================================== */
@media (max-width: 720px) {
  .tbl:not(.tbl-keep),
  .al-table:not(.tbl-keep) {
    display: block; width: 100%;
  }
  .tbl:not(.tbl-keep) thead,
  .al-table:not(.tbl-keep) thead {
    /* esconde cabeçalho mas mantém acessível */
    position: absolute; left: -9999px; top: -9999px; width: 1px; height: 1px; overflow: hidden;
  }
  .tbl:not(.tbl-keep) tbody,
  .al-table:not(.tbl-keep) tbody { display: block; }

  .tbl:not(.tbl-keep) tbody tr,
  .al-table:not(.tbl-keep) tbody tr {
    display: block;
    background: var(--bg2);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: 14px 16px;
    margin-bottom: 10px;
    box-shadow: 0 1px 2px rgba(0,0,0,.03);
  }
  .tbl:not(.tbl-keep) tbody tr:hover,
  .al-table:not(.tbl-keep) tbody tr:hover {
    background: var(--bg2); /* desativa hover bg em mobile */
  }

  .tbl:not(.tbl-keep) tbody td,
  .al-table:not(.tbl-keep) tbody td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px dashed var(--line);
    text-align: left !important;
    min-height: 36px;
  }
  .tbl:not(.tbl-keep) tbody tr td:first-child,
  .al-table:not(.tbl-keep) tbody tr td:first-child {
    /* Primeira célula: título do card, sem label */
    border-bottom: 1px solid var(--line);
    padding-bottom: 12px;
    margin-bottom: 4px;
    font-weight: 600;
    font-size: 14.5px;
    flex-direction: column;
    align-items: stretch;
  }
  .tbl:not(.tbl-keep) tbody tr td:last-child,
  .al-table:not(.tbl-keep) tbody tr td:last-child {
    border-bottom: 0;
    padding-bottom: 0;
  }

  /* Label injetado por JS via data-label */
  .tbl:not(.tbl-keep) tbody td[data-label]::before,
  .al-table:not(.tbl-keep) tbody td[data-label]::before {
    content: attr(data-label);
    flex: 0 0 auto;
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text3);
    font-weight: 700;
    padding-top: 2px;
  }
  /* Primeira célula: não mostra label (é o título) */
  .tbl:not(.tbl-keep) tbody tr td:first-child[data-label]::before,
  .al-table:not(.tbl-keep) tbody tr td:first-child[data-label]::before {
    content: none;
  }
  /* Última célula: ações alinham à direita sem label */
  .tbl:not(.tbl-keep) tbody tr td:last-child[data-label=""]::before,
  .al-table:not(.tbl-keep) tbody tr td:last-child[data-label=""]::before {
    content: none;
  }
  .tbl:not(.tbl-keep) tbody td[data-label=""]::before,
  .al-table:not(.tbl-keep) tbody td[data-label=""]::before {
    content: none;
  }

  /* Linha sem hover/cursor especial em mobile */
  .tbl:not(.tbl-keep) tbody tr[onclick],
  .al-table:not(.tbl-keep) tbody tr[onclick] {
    position: relative;
  }

  /* Wrapper de tabela perde overflow scroll horizontal em mobile (cards já caem) */
  .al-table-wrap { overflow: visible; }
}

/* ==========================================================================
   R3 · Modais <dialog.m-dialog> viram bottom sheet em mobile <720px
   --------------------------------------------------------------------------
   Slide up from bottom · full width · rounded top corners · drag handle.
   Mantém glassmorphism mas reduz blur pra performance em mobile.
   ========================================================================== */
@media (max-width: 720px) {
  dialog.m-dialog {
    width: 100vw !important;
    max-width: 100vw !important;
    max-height: 92vh !important;
    margin: 0 !important;
    margin-top: auto !important;
    margin-bottom: 0 !important;
    border-radius: 18px 18px 0 0 !important;
    /* Posiciona no fundo da viewport */
    position: fixed !important;
    top: auto !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    inset: auto 0 0 0 !important;
    /* Reduz blur — caro em GPUs mobile */
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    animation: m-sheet-up .28s cubic-bezier(.4,0,.2,1) !important;
  }

  /* Drag handle visual no topo do sheet */
  dialog.m-dialog::before {
    content: '';
    position: absolute;
    top: 8px; left: 50%;
    transform: translateX(-50%);
    width: 36px; height: 4px;
    border-radius: 2px;
    background: rgba(120, 100, 80, 0.22);
    z-index: 2;
  }

  /* Form ocupa altura útil sem estourar */
  dialog.m-dialog .m-form { max-height: 92vh; }
  dialog.m-dialog .m-h    { padding: 22px 18px 14px; }
  dialog.m-dialog .m-body { padding: 14px 18px 18px; -webkit-overflow-scrolling: touch; }
  dialog.m-dialog .m-foot {
    padding: 14px 18px calc(14px + env(safe-area-inset-bottom)) 18px;
    /* Botões empilhados em mobile, primário em cima */
    flex-direction: column-reverse;
    gap: 8px;
  }
  dialog.m-dialog .m-foot .btn {
    width: 100%;
    min-height: 46px;
    justify-content: center;
    font-size: 14.5px;
  }

  /* Grid 2-col vira coluna única */
  dialog.m-dialog .m-grid-2 { grid-template-columns: 1fr; }

  /* Inputs com font-size ≥16px pra evitar zoom iOS */
  dialog.m-dialog .m-row input[type="text"],
  dialog.m-dialog .m-row input[type="number"],
  dialog.m-dialog .m-row input[type="date"],
  dialog.m-dialog .m-row input[type="datetime-local"],
  dialog.m-dialog .m-row input[type="email"],
  dialog.m-dialog .m-row input[type="tel"],
  dialog.m-dialog .m-row select,
  dialog.m-dialog .m-row textarea {
    font-size: 16px;
    padding: 11px 13px;
    min-height: 44px;
  }
  dialog.m-dialog .m-row textarea { min-height: 80px; }
}

@keyframes m-sheet-up {
  from { transform: translateY(100%); opacity: 0.4; }
  to   { transform: translateY(0);    opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  dialog.m-dialog { animation: none !important; }
}

/* ==========================================================================
   R6 · Touch targets ≥44px + tap highlight + smooth tap
   --------------------------------------------------------------------------
   Apple HIG e Material recomendam ≥44px. Aplicado só em mobile pra não
   inflar layout desktop. tap-highlight transparente + ação visual via :active
   ========================================================================== */
@media (max-width: 720px) {
  /* Botões — aumenta padding vertical + altura mínima */
  .btn { min-height: 44px; padding: 11px 16px; font-size: 13.5px; }
  .btn.sm { min-height: 38px; padding: 8px 12px; font-size: 12.5px; }
  .btn.lg { min-height: 50px; padding: 14px 22px; font-size: 15px; }

  /* Inputs · ≥16px pra prevenir zoom iOS · ≥44px altura */
  input[type="text"],
  input[type="number"],
  input[type="email"],
  input[type="tel"],
  input[type="date"],
  input[type="datetime-local"],
  input[type="search"],
  input[type="password"],
  input[type="url"],
  select,
  textarea {
    font-size: 16px;
    min-height: 44px;
  }
  textarea { min-height: 88px; }

  /* Toggle switches ficam maiores */
  input[type="checkbox"], input[type="radio"] {
    min-width: 22px; min-height: 22px;
  }

  /* Links que parecem botão (al-action) */
  .al-action, .al-link { min-height: 36px; padding: 8px 10px; display: inline-flex; align-items: center; }
}

/* Tap highlight + active feedback — todos viewports */
button, .btn, a.btn, [role="button"] {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
button:active, .btn:active {
  transform: scale(0.97);
  transition: transform .05s;
}
@media (prefers-reduced-motion: reduce) {
  button:active, .btn:active { transform: none; }
}

/* ==========================================================================
   R7 · Performance hints — content-visibility · lazy + smooth scroll
   ========================================================================== */
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* Listas longas: pinta só o que está perto da viewport */
.tbl tbody tr,
.al-table tbody tr,
.appt,
.bell-item {
  content-visibility: auto;
  contain-intrinsic-size: auto 64px;
}

/* Imagens lazy por padrão — fallback caso autor esqueça loading="lazy" */
img:not([loading]) { loading: lazy; }

/* ==========================================================================
   R5 · Container queries · cards adaptam ao espaço do pai, não da viewport
   --------------------------------------------------------------------------
   Funciona em qualquer contexto: card pequeno em coluna estreita compacta,
   mesmo card em coluna larga expande. Independente de breakpoint global.
   Suporte: Chrome 105+, Safari 16+, Firefox 110+.
   ========================================================================== */
.kpi, .appt, .card, .al-stat-card {
  container-type: inline-size;
  container-name: card;
}

/* KPI compacto quando container <240px */
@container card (max-width: 240px) {
  .kpi .val { font-size: 18px; }
  .kpi .lbl { font-size: 10px; }
  .kpi .delta { font-size: 11px; }
  .kpi .bar { margin-top: 6px; }
}

/* KPI expansivo quando container >=380px */
@container card (min-width: 380px) {
  .kpi .val { font-size: 28px; }
  .kpi .lbl { font-size: 12px; }
}

/* Appointment card adapta layout interno */
@container card (max-width: 420px) {
  .appt {
    grid-template-columns: 60px 1fr !important;
    gap: 10px;
    padding: 14px 16px;
  }
  .appt .av { display: none; } /* avatar escondido em coluna estreita */
  .appt .actions {
    grid-column: 1 / -1;
    flex-direction: row !important;
    justify-content: flex-end;
    margin-top: 6px;
  }
}

/* Grid principal das KPIs adapta ao container .grid (não viewport) */
.grid { container-type: inline-size; }
@container (max-width: 700px) {
  .grid.g4 { grid-template-columns: repeat(2, 1fr); }
  .grid.g3 { grid-template-columns: repeat(2, 1fr); }
}
@container (max-width: 420px) {
  .grid.g4, .grid.g3, .grid.g2 { grid-template-columns: 1fr; }
}

/* ==========================================================================
   R4 · Atendimento ao vivo · mobile-first
   --------------------------------------------------------------------------
   Foco em uso pela Dra com luva, durante procedimento, no celular.
   - Header sticky com nome do paciente sempre visível
   - Cronômetro hero (60px+) centralizado, fácil de ler de longe
   - Botão concluir grande no rodapé (FAB-like) sempre acessível
   - Cards de insumos viram lista vertical mais espaçada
   ========================================================================== */
@media (max-width: 720px) {
  /* Header com identificação do paciente fica sticky no topo */
  .al-header {
    position: sticky;
    top: 56px;       /* abaixo do topbar */
    z-index: 4;
    background: var(--bg2);
    margin: -16px -14px 16px -14px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .al-header-text { flex-direction: column; align-items: flex-start !important; gap: 8px !important; }
  .al-title { font-size: 17px !important; line-height: 1.2; }
  .al-meta  { font-size: 11.5px !important; line-height: 1.4; }
  .al-header-actions {
    display: flex;
    flex-direction: row;
    width: 100%;
    gap: 8px;
  }
  .al-header-actions .btn { flex: 1; min-height: 46px; }
  .al-header-actions .btn.primary { flex: 2; }    /* CTA principal mais largo */

  /* Crumb encolhe e fica menos visível em mobile */
  .crumb { font-size: 11px; padding: 0 0 8px; }

  /* Cronômetro vira hero — tempo enorme */
  .atend-cronometro {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 24px 18px;
    gap: 12px;
    margin: 0 -14px 18px -14px;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }
  .atend-crono-lbl { font-size: 11px; }
  .atend-crono-num { font-size: 60px; line-height: .95; letter-spacing: -.03em; }
  .atend-crono-status { align-items: center; text-align: center; }
  .atend-crono-status small { max-width: 100%; }
  #crono-pause-btn { min-width: 140px; min-height: 44px; font-size: 14px; }

  /* Cards de insumo · mais espaçamento, toque ≥44px */
  .atend-cards { grid-template-columns: 1fr; gap: 10px; }
  .atend-card { padding: 14px; min-height: 64px; }
  .atend-card-nome { font-size: 14.5px; }
  .atend-card-cta { min-height: 44px; align-items: center; display: inline-flex; padding: 0 12px; }

  /* Pills + status mais visíveis */
  .atend-pill { font-size: 12px; padding: 5px 11px; }

  /* Espaço pro footer FAB não cobrir conteúdo */
  body:has(.atend-cronometro) main { padding-bottom: 100px; }
}

/* Tela MUITO pequena (iPhone SE/mini) — cronômetro encolhe um pouco */
@media (max-width: 360px) {
  .atend-crono-num { font-size: 52px; }
  .al-title { font-size: 15.5px !important; }
}
