/* ════════════════════════════════════════════════════════════════════════
   Precificação · Dra. Dandara Ruana
   Identidade Dandara: off-white + lilás, lilás orquídea no primário, verde oliva
   no texto e nos status, cantos bem arredondados.
   Regra de ouro: os NOMES de tokens e classes são contrato (o app.js usa
   var(--gold), .card, .input etc. em centenas de lugares). Aqui muda o VALOR
   e o visual, nunca os nomes.
   ════════════════════════════════════════════════════════════════════════ */

:root {
  /* Marca. --gold é o primário (lilás orquídea), mantido por compatibilidade. */
  --gold: #A67CC1;
  --gold-light: #C9A9DD;
  --gold-dark: #8A62A6;

  /* Acento (lilás claro), usado no shell (sidebar/realces). */
  --accent: #C9A9DD;
  --accent-soft: rgba(166,124,193,0.20);

  /* Superfícies e texto (nunca preto puro: verde escurecido) */
  --bg: #FAF8F6;                 /* canvas do workspace (off-white, a pedido) */
  --surface: #FFFFFF;            /* cartões / painéis */
  --ink: #4E5A50;               /* texto primário */
  --text: #5E6B60;              /* texto secundário */
  --muted: #8E978F;             /* texto terciário / placeholder */

  /* Cartões / bordas */
  --card-bg: #FFFFFF;
  --card-border: #ECE9E5;
  --card-border-strong: #DEDAD5;
  --segmented-bg: #F3F1EF;       /* barras de abas: um tom abaixo do fundo #FAF8F6 */

  /* Sidebar (clara, creme) */
  --side-bg: #FFFFFF;
  --side-bg-2: #F1EAF6;
  --side-line: #ECE9E5;
  --side-text: #5E6B60;
  --side-text-strong: #8A62A6;
  --side-muted: #8E978F;

  /* Inputs */
  --input-bg: #FFFFFF;
  --input-border: #E3DFDA;
  --input-focus: #A67CC1;

  /* Status (verde = verde oliva da marca) */
  --green: #4F6B55; --green-bg: #E9EFE8; --green-border: #C7D5C9;
  --amber: #A2701A; --amber-bg: #FBF1DE; --amber-border: #EED9AE;
  --red: #B5473F;   --red-bg: #FAEAE8;   --red-border: #EFC9C3;

  /* Tipografia (mesmas fontes da Precificação da Dra. Mychelle) */
  --serif: 'EB Garamond', Georgia, serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --poppins: 'Poppins', -apple-system, sans-serif;
  --destaque: 'Cormorant Garamond', Georgia, serif;

  /* Raio e sombra (sombra tingida de verde, não azul) */
  --radius-sm: 10px; --radius: 14px; --radius-lg: 22px;
  --shadow-card: 0 1px 2px rgba(78,90,80,0.04), 0 6px 20px rgba(78,90,80,0.06);
  --shadow-gold: 0 12px 34px rgba(78,90,80,0.16);
  --shadow-pop: 0 18px 48px rgba(78,90,80,0.22);

  --sidebar-w: 264px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { background: rgba(166,124,193,0.14); }
a { color: inherit; }

/* Elemento legado — neutralizado no layout novo. */
.bg-glow { display: none; }

/* ── Shell: sidebar + main ─────────────────────────────────────────────── */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
/* `.app{display:grid}` venceria o [hidden] do navegador → o #app (sidebar navy)
   pintava antes do JS e dava um "flash azul" no F5. Isto faz o hidden valer. */
.app[hidden] { display: none !important; }
.sidebar-scrim { display: none; }   /* só existe como overlay no mobile */

.sidebar {
  position: sticky; top: 0; align-self: start;
  height: 100vh; overflow-y: auto;
  background: linear-gradient(180deg, var(--side-bg) 0%, var(--side-bg-2) 100%);
  border-right: 1px solid var(--card-border);
  display: flex; flex-direction: column;
  padding: 20px 14px 16px;
  z-index: 40;
}
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); border-radius: 999px; }

/* App-mode: sem sidebar (só o dia a dia, tela cheia) */
.app.no-side { grid-template-columns: 1fr; }
.app.no-side .sidebar { display: none; }

/* Cabeçalho da sidebar de Configurações (voltar + título) */
.side-config-head { padding: 2px 6px 8px; }
.side-back {
  display: flex; align-items: center; gap: 8px; width: 100%;
  background: none; border: none; cursor: pointer; color: var(--side-text);
  font-family: var(--sans); font-size: 13px; font-weight: 500; padding: 8px; border-radius: 8px;
  transition: background .15s ease, color .15s ease;
}
.side-back:hover { background: rgba(166,124,193,0.06); color: var(--side-text-strong); }
.side-back svg { width: 16px; height: 16px; }
.side-config-title { font-family: var(--serif); font-weight: 600; font-size: 21px; color: var(--side-text-strong); padding: 14px 8px 4px; }

/* Grupos de navegação */
.side-group { padding: 8px 8px 4px; }
.side-group-label { color: var(--side-muted); font-size: 10.5px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; padding: 0 8px 8px; }

.side-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 10px 12px; margin-bottom: 2px;
  background: none; border: none; cursor: pointer;
  border-radius: 10px; color: var(--side-text);
  font-family: var(--sans); font-size: 14px; font-weight: 500; text-align: left;
  position: relative; transition: background .16s ease, color .16s ease;
}
.side-item svg { width: 18px; height: 18px; opacity: .85; flex: none; }
.side-item:hover { background: rgba(166,124,193,0.06); color: var(--side-text-strong); }
.side-item.active { background: rgba(166,124,193,0.08); color: var(--side-text-strong); font-weight: 600; }
.side-item.active svg { opacity: 1; color: var(--accent); }
.side-item.active::before {
  content: ''; position: absolute; left: -14px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 22px; border-radius: 0 3px 3px 0; background: var(--accent);
}

.side-spacer { flex: 1 1 auto; }
.side-foot { padding-top: 10px; margin-top: 8px; border-top: 1px solid var(--side-line); }
.side-user { display: flex; align-items: center; gap: 10px; padding: 6px 10px 10px; color: var(--side-muted); font-size: 12px; }
.side-user .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(28,139,90,0.2); flex: none; }
.side-logout {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 10px 12px; border: none; cursor: pointer; border-radius: 10px;
  background: none; color: var(--side-text); font-family: var(--sans); font-size: 13.5px; font-weight: 500;
  transition: background .16s ease, color .16s ease;
}
.side-logout:hover { background: rgba(194,59,43,0.10); color: var(--red); }
.side-logout svg { width: 17px; height: 17px; }

/* Main / Topbar / Content */
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 16px;
  padding: 16px 34px; background: rgba(250,248,246,0.88);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--card-border);
}
.topbar .hamb { display: none; }
.topbar-titles { min-width: 0; }
.topbar h1 { font-family: var(--serif); font-weight: 600; font-size: 24px; color: var(--ink); line-height: 1.12; letter-spacing: .2px; }
.topbar p { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

/* Topbar do DIA A DIA: marca + engrenagem (linha 1), abas (linha 2). */
.topbar.topbar-app { flex-direction: column; align-items: stretch; gap: 0; padding-top: 16px; padding-bottom: 0; }
.topbar-app .topbar-row { display: flex; align-items: center; width: 100%; padding-bottom: 14px; border-bottom: 1px solid var(--card-border); }
.topbar-app .gear-btn { margin-left: auto; }
.brand-inline { display: flex; align-items: center; gap: 12px; }
.brand-inline .brand-logo { height: 42px; width: auto; display: block; flex: none; }
.brand-inline .name { display: flex; flex-direction: column; line-height: 1.12; }
.brand-inline .name b { font-family: var(--serif); font-weight: 600; font-size: 18px; color: var(--ink); letter-spacing: .2px; }
.brand-inline .name span { font-size: 10.5px; font-weight: 600; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); }
.main-tabs { display: flex; gap: 28px; justify-content: center; }
.main-tabs button {
  background: none; border: none; cursor: pointer; font-family: var(--poppins); font-size: 15.5px; font-weight: 600;
  color: var(--muted); padding: 12px 2px 14px; border-bottom: 2px solid transparent; transition: color .15s ease;
}
.main-tabs button:hover { color: var(--ink); }
.main-tabs button.active { color: var(--ink); border-bottom-color: var(--accent); }

.content { padding: 26px 34px 90px; max-width: 1180px; width: 100%; margin: 0 auto; }

/* ── Cartões e títulos ─────────────────────────────────────────────────── */
.card {
  background: var(--card-bg); border: 1px solid var(--card-border);
  border-radius: var(--radius-lg); padding: 22px; box-shadow: var(--shadow-card);
}
.card + .card { margin-top: 16px; }
/* Cabeçalho de card com botão de ação à direita, na mesma linha do título. */
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px 16px; margin-bottom: 10px; flex-wrap: wrap; }
.card-head > div:first-child { flex: 1 1 180px; }
.card-head h2 { margin-bottom: 2px; }
.card-head-right { display: flex; align-items: center; gap: 10px; flex: none; }
.head-busca { width: 220px; }
.head-busca:empty { display: none; }
.head-busca input { margin: 0; }
@media (max-width: 720px) {
  .card-head { flex-direction: column; align-items: stretch; }
  .card-head-right { width: 100%; flex-wrap: wrap; }
  .head-busca { flex: 1; min-width: 150px; width: auto; }
  .card-head-right .btn { flex: none; }
}
.card h2 { font-family: var(--serif); font-weight: 600; font-size: 21px; color: var(--ink); line-height: 1.15; margin-bottom: 2px; }
h2 { font-family: var(--serif); font-weight: 600; color: var(--ink); }
.sub { color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.org { color: var(--muted); font-size: 12px; }

/* ── Campos ────────────────────────────────────────────────────────────── */
.field { margin-bottom: 14px; }
.field-label { display: block; font-family: var(--poppins); font-size: 12px; font-weight: 600; color: var(--ink); margin-bottom: 6px; letter-spacing: .1px; }
.field-hint { font-size: 11.5px; color: var(--muted); margin-top: 5px; }

.input, select.input, textarea.input, input.input {
  width: 100%; font-family: var(--sans); font-size: 14px; color: var(--ink);
  background: var(--input-bg); border: 1px solid var(--input-border);
  border-radius: var(--radius); padding: 10px 13px; transition: border-color .15s ease, box-shadow .15s ease;
  appearance: none;
}
select.input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2398A1B0' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px;
}
.input::placeholder { color: var(--muted); }
.input:focus, select.input:focus, textarea.input:focus {
  outline: none; border-color: var(--input-focus);
  box-shadow: 0 0 0 3px rgba(166,124,193,0.12);
}
.input-wrap { position: relative; }
.input-wrap .affix { position: absolute; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 13px; pointer-events: none; }
.affix.left { left: 13px; } .affix.right { right: 13px; }
.input.has-left { padding-left: 30px; } .input.has-right { padding-right: 34px; }

/* ── Botões ────────────────────────────────────────────────────────────── */
.btn {
  font-family: var(--poppins); font-size: 13px; font-weight: 600; border-radius: var(--radius);
  padding: 10px 18px; cursor: pointer; border: 1px solid transparent; transition: all .15s ease;
  display: inline-flex; align-items: center; gap: 8px; line-height: 1;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--gold); color: #fff; box-shadow: 0 6px 16px rgba(166,124,193,0.20); }
.btn-primary:hover { background: var(--gold-dark); box-shadow: 0 8px 20px rgba(166,124,193,0.28); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--card-border-strong); }
.btn-ghost:hover { background: #F7F5F3; border-color: var(--muted); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { filter: brightness(0.94); }

.btn-icon {
  width: 36px; height: 36px; display: inline-grid; place-items: center; cursor: pointer;
  border: 1px solid var(--card-border); background: var(--surface); color: var(--text);
  border-radius: 10px; transition: all .15s ease;
}
.btn-icon:hover { color: var(--ink); border-color: var(--card-border-strong); background: #F7F5F3; }
.btn-icon svg { width: 16px; height: 16px; }
.btn-icon-danger:hover { color: var(--red); border-color: var(--red-border); background: var(--red-bg); }

/* ── Segmented (sub-abas modernas) ─────────────────────────────────────── */
.segmented {
  display: inline-flex; gap: 4px; padding: 4px; margin-bottom: 20px;
  background: var(--segmented-bg); border: 1px solid var(--card-border); border-radius: 12px;
  max-width: 100%; overflow-x: auto;
}
.segmented button {
  border: none; background: none; cursor: pointer; white-space: nowrap;
  font-family: var(--poppins); font-size: 13px; font-weight: 600; color: var(--text);
  padding: 8px 16px; border-radius: 9px; transition: all .15s ease;
}
.segmented button:hover { color: var(--ink); }
.segmented button.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(78,90,80,0.12); }

/* ── Pill tabs (níveis do cadastro — legado, .tab) ─────────────────────── */
.tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.tabs-config { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.tabs-config::-webkit-scrollbar { height: 6px; }
.tabs-config::-webkit-scrollbar-thumb { background: var(--card-border-strong); border-radius: 999px; }
.tab {
  font-family: var(--poppins); font-size: 12.5px; font-weight: 600; color: var(--text);
  background: var(--surface); border: 1px solid var(--card-border); border-radius: 999px;
  padding: 8px 15px; cursor: pointer; transition: all .15s ease; white-space: nowrap;
}
.tab:hover { border-color: var(--card-border-strong); color: var(--ink); }
.tab.active { background: var(--gold); color: #fff; border-color: var(--gold); box-shadow: 0 4px 12px rgba(166,124,193,0.22); }

/* ── Tabelas ───────────────────────────────────────────────────────────── */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.list { width: 100%; border-collapse: collapse; }
.list th { font-family: var(--poppins); font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--card-border); }
.list td { font-size: 13.5px; color: var(--text); padding: 12px; border-bottom: 1px solid var(--card-border); vertical-align: middle; }
.list tbody tr { transition: background .12s ease; }
.list tbody tr:hover { background: #F7F5F3; }
.list td b, .list td strong { color: var(--ink); font-weight: 600; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.empty { color: var(--muted); font-size: 13px; padding: 26px 4px; text-align: center; }

/* ── Selo de revisão (Dra. Dandara dá OK por item de cadastro) ─────────────── */
.col-revisao { width: 30px; text-align: center; padding-left: 8px !important; padding-right: 2px !important; }
.revisao-badge { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; padding: 0; border-radius: 999px; border: 1.5px solid #DCA94F; background: #fff; color: #fff; cursor: pointer; transition: background .14s ease, border-color .14s ease; }
.revisao-badge:hover { border-color: var(--gold, #A67CC1); background: #F1EAF6; }
.revisao-badge.ok { background: #647A68; border-color: #647A68; }
.revisao-badge.ok:hover { background: #546856; border-color: #546856; }
.revisao-badge svg { width: 13px; height: 13px; }
/* Só-leitura (contas que não são a Dra. Dandara): vê o estado, mas não clica. */
.revisao-badge.so-leitura { cursor: default; }
.revisao-badge.so-leitura:hover { background: #fff; border-color: #DCA94F; }
.revisao-badge.so-leitura.ok:hover { background: #647A68; border-color: #647A68; }
.revisao-resumo { display: inline-flex; align-items: center; gap: 6px; font-family: var(--poppins); font-size: 12px; font-weight: 600; color: #B7791F; margin: 0 0 10px; }
.revisao-resumo.ok { color: #647A68; }
.revisao-resumo svg { width: 13px; height: 13px; }
.revisao-dot { width: 8px; height: 8px; border-radius: 999px; background: #E0A94A; display: inline-block; }

/* ── Resultado / preço ─────────────────────────────────────────────────── */
.result { margin-top: 18px; padding: 22px; border-radius: var(--radius-lg); background: linear-gradient(140deg, rgba(166,124,193,0.06), rgba(166,124,193,0.02)); border: 1px solid var(--card-border-strong); }
.result-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; }
.result-row + .result-row { border-top: 1px dashed var(--card-border); }
.result-row .k { font-family: var(--poppins); font-size: 12.5px; color: var(--text); }
.result-row .v { font-family: var(--serif); font-weight: 600; font-size: 19px; color: var(--ink); }
.result-row.hero .v { font-size: 30px; color: var(--gold-dark); }
.result-row.hero .k { font-weight: 600; color: var(--ink); }
.result-row.sub .k { padding-left: 14px; color: var(--muted); } .result-row.sub .v { font-size: 15px; color: var(--text); }
.result .msg { color: var(--red); font-weight: 600; font-family: var(--poppins); font-size: 14px; }
.result.error { background: var(--red-bg); border-color: var(--red-border); }
.k { color: var(--text); } .v { color: var(--ink); }
.msg { color: var(--red); font-weight: 600; font-size: 13.5px; } .msg-sub { color: var(--muted); font-size: 12px; }

/* ── Badge ─────────────────────────────────────────────────────────────── */
.badge { display: inline-block; font-family: var(--poppins); font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--gold-dark); }

/* ── Grids ─────────────────────────────────────────────────────────────── */
.grid-1 { display: grid; grid-template-columns: 1fr; gap: 14px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.w3 { width: 33%; }

/* ── Avisos / alertas ──────────────────────────────────────────────────── */
.avisos { margin-top: 14px; padding: 14px 16px; border-radius: var(--radius); background: var(--amber-bg); border: 1px solid var(--amber-border); }
.avisos-titulo { font-family: var(--poppins); font-weight: 700; font-size: 12.5px; color: var(--amber); margin-bottom: 6px; }
.avisos-item { font-size: 12.5px; color: #7A5A0C; padding: 2px 0; }
.info { color: var(--text); } .error { color: var(--red); } .danger { color: var(--red); }

/* ── Modais ────────────────────────────────────────────────────────────── */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(46,54,48,0.55); backdrop-filter: blur(3px); }
.modal-card { position: relative; background: var(--surface); border: 1px solid var(--card-border); border-radius: var(--radius-lg); padding: 26px; width: min(92vw, 420px); box-shadow: var(--shadow-pop); }
.modal-card h3 { font-family: var(--serif); font-weight: 600; font-size: 21px; color: var(--ink); margin-bottom: 6px; }
.modal-card > p { color: var(--text); font-size: 13.5px; margin-bottom: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
/* Editor em pop-up: o form é um .card por dentro — achata pra não ficar cartão-dentro-de-cartão. */
.modal-editor .modal-card > .card { border: none !important; box-shadow: none !important; padding: 0 !important; margin: 0 !important; background: transparent !important; }
.modal-editor .modal-card > .card > h2:first-child { margin-top: 0; }

/* ── Toasts ────────────────────────────────────────────────────────────── */
.toast-wrap { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast { background: var(--ink); color: #fff; font-size: 13px; font-weight: 500; padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow-pop); max-width: 360px; animation: toast-in .22s ease; }
.toast.error { background: var(--red); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ── Login (clean/minimalista, igual ao Painel de Operação) ─────────────── */
.login-screen { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: var(--bg); }
.login-screen[hidden] { display: none; }
.login-card { width: 100%; max-width: 460px; text-align: center; padding: 40px; }
/* Login: mesma tipografia da Mychelle (Cormorant Garamond no nome), só o
   nome "Dra. Dandara Ruana" como marca, nas cores da Dandara. */
.login-logo { font-family: 'Cormorant Garamond', var(--serif); font-size: 34px; font-weight: 600; color: var(--gold); letter-spacing: -.005em; margin-bottom: 6px; }
.login-sub { color: var(--muted); font-size: 11px; letter-spacing: .22em; text-transform: uppercase; margin-bottom: 40px; }
.login-field { position: relative; margin-bottom: 16px; }
.login-field input {
  width: 100%; padding: 16px 20px; background: rgba(166,124,193,0.05); border: 1px solid var(--card-border);
  border-radius: 14px; color: var(--ink); font-family: inherit; font-size: 15px; outline: none;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.login-field input::placeholder { color: var(--muted); }
.login-field input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(166,124,193,0.16); }
.login-field input#login-senha { padding-right: 52px; }
.login-eye {
  position: absolute; top: 50%; right: 8px; transform: translateY(-50%);
  width: 38px; height: 38px; display: flex; align-items: center; justify-content: center;
  border: 0; background: transparent; color: var(--muted); cursor: pointer; border-radius: 8px;
  transition: color .15s ease, background .15s ease;
}
.login-eye:hover { color: var(--ink); background: rgba(166,124,193,0.06); }
.login-eye svg { width: 19px; height: 19px; }
.login-error { color: var(--red); font-size: 12px; margin: -6px 0 12px; }
.login-error[hidden] { display: none; }
.login-btn {
  width: 100%; padding: 15px; background: var(--gold); color: #fff; border: 0; border-radius: 999px;
  font-family: inherit; font-size: 13px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  cursor: pointer; transition: opacity .15s ease; box-shadow: 0 8px 20px rgba(166,124,193,0.22);
}
.login-btn:hover { opacity: .92; }

/* ── Savebar (pendências) ──────────────────────────────────────────────── */
#config-savebar .btn { padding: 12px 22px; }

/* ── Estoque (iframe do operacional) ───────────────────────────────────── */
.estoque-frame-wrap { position: relative; border: 1px solid var(--card-border); border-radius: var(--radius-lg); overflow: hidden; background: var(--surface); box-shadow: var(--shadow-card); min-height: 520px; }
.estoque-loading { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; color: var(--muted); font-size: 13.5px; }
.estoque-spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--card-border); border-top-color: var(--accent); animation: estoque-spin .8s linear infinite; }
@keyframes estoque-spin { to { transform: rotate(360deg); } }
.estoque-frame { position: relative; width: 100%; height: calc(100vh - 200px); min-height: 520px; border: 0; display: block; background: var(--surface); opacity: 0; transition: opacity .25s ease; }
.estoque-frame.carregado { opacity: 1; }

/* ── View helper ───────────────────────────────────────────────────────── */
.view { animation: view-in .2s ease; }
@keyframes view-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ── Responsivo ────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; width: 280px; max-width: 84vw;
    transform: translateX(-100%); transition: transform .24s ease; box-shadow: var(--shadow-pop);
  }
  .app.nav-open .sidebar { transform: none; }
  .sidebar-scrim { display: block; position: fixed; inset: 0; background: rgba(46,54,48,0.5); z-index: 39; opacity: 0; pointer-events: none; transition: opacity .24s ease; }
  .app.nav-open .sidebar-scrim { opacity: 1; pointer-events: auto; }
  .topbar { padding: 14px 18px; }
  .topbar .hamb { display: inline-grid; }
  .content { padding: 20px 18px 90px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  /* Abas do topo (Consultas/Cirurgias/...): rolam na horizontal em vez de estourar. */
  .main-tabs { justify-content: flex-start; gap: 20px; overflow-x: auto; -webkit-overflow-scrolling: touch; padding: 0 2px; scrollbar-width: none; }
  .main-tabs::-webkit-scrollbar { display: none; }
  .main-tabs button { font-size: 14.5px; white-space: nowrap; flex: none; }
}

/* ── Tabelas no mobile: cada linha vira um cartão rótulo:valor (sem vazar) ── */
@media (max-width: 640px) {
  .table-wrap { overflow-x: visible; }
  .list, .list tbody { display: block; width: 100%; }
  .list thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }  /* esconde o cabeçalho, mas mantém acessível */
  .list tr {
    display: block; background: var(--surface);
    border: 1px solid var(--card-border); border-radius: 12px;
    padding: 4px 14px; margin-bottom: 10px;
  }
  .list tbody tr:hover { background: var(--surface); }
  .list td {
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    padding: 9px 0; border-bottom: 1px solid var(--card-border); text-align: right;
  }
  .list tr td:last-child { border-bottom: 0; }
  .list td::before {
    content: attr(data-label); flex: none; text-align: left;
    font-family: var(--poppins); font-size: 10.5px; font-weight: 700;
    color: var(--muted); text-transform: uppercase; letter-spacing: .5px;
  }
  /* Células sem rótulo (ações, selo de revisão) não mostram o "::before". */
  .list td.col-acoes::before, .list td.col-revisao::before, .list td[data-label=""]::before { content: none; }
  .list td.col-acoes, .list td.col-revisao { justify-content: flex-end; }
  .list td.col-revisao { justify-content: flex-start; }
  .list .row-actions { justify-content: flex-end; }

  /* Editores/diálogos em pop-up: largura cheia, sem vazar, botões dividem a linha. */
  .modal { padding: 10px; align-items: start; }
  .modal-card { width: 100% !important; max-width: 100% !important; max-height: 94vh !important; padding: 18px !important; overflow-x: hidden; }
  .modal-card .input, .modal-card select.input, .modal-card textarea.input { min-width: 0; }
  /* Formularios de pop-up mais compactos no mobile: cabem sem precisar rolar. */
  .modal-card .grid-1, .modal-card .grid-2, .modal-card .grid-3 { gap: 6px 12px; }
  .modal-card .field { margin-bottom: 6px; }
  .modal-card h2 { font-size: 18px; margin-bottom: 6px; }
  .modal-card .input, .modal-card select.input { padding: 8px 12px; }
  .modal-actions { gap: 8px; margin-top: 12px; }
  .modal-actions .btn { flex: 1 1 0; justify-content: center; }
}

/* Linhas balanceadas — evita palavra orfa sozinha na ultima linha · text-wrap balance (pref. Bruna) */
h1,h2,h3,h4,h5,h6{text-wrap:balance}
p,li{text-wrap:pretty}

/* ── Acompanhamentos (rascunhos.js) ─────────────────────────────────────── */
.rascunho-bloco { padding: 4px 0 12px; border-bottom: 1px solid var(--card-border); }
.rascunho-bloco:last-child { border-bottom: none; }
.rascunho-acoes { display: flex; gap: 6px; }
.rascunho-acoes .btn-icon:disabled { opacity: .35; cursor: not-allowed; }
.rascunho-item { display: grid; grid-template-columns: minmax(0,3fr) 80px minmax(0,1.3fr) minmax(0,1.3fr) auto; gap: 10px; align-items: end; margin-top: 8px; }
/* Sub-itens: recuados sob o item, só texto. */
.rascunho-subs { margin: 8px 0 0 18px; padding-left: 12px; border-left: 2px solid var(--accent-soft); }
.rascunho-sub { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.rascunho-sub .input { flex: 1; min-width: 0; padding-top: 8px; padding-bottom: 8px; font-size: 13px; }
.rascunho-sub-marca { color: var(--gold); font-weight: 700; }
.rascunho-add-sub { margin-top: 6px; border: none; background: none; padding: 4px 0; cursor: pointer; font-family: var(--poppins); font-size: 12.5px; font-weight: 600; color: var(--gold); }
.rascunho-add-sub:hover { color: var(--gold-dark); text-decoration: underline; }
@media (max-width: 720px) {
  /* Celular: descrição em cima, números em duas colunas, lixeira no fim. */
  .rascunho-item { grid-template-columns: 1fr 1fr; }
  .rascunho-subs { margin-left: 4px; }
  .rascunho-item > :first-child { grid-column: 1 / -1; }
  .rascunho-item > :last-child { justify-self: end; }
}

/* ── Editores de Precificação no layout de Acompanhamentos (Dandara) ───── */
.editor-inline { scroll-margin-top: 110px; }
.editor-inline[hidden] { display: none; }
.editor-inline > .card { margin: 4px 0 18px !important; border: 1.5px solid var(--accent-soft); box-shadow: none; }
.editor-cab { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.editor-cab h2 { margin: 0; }
.editor-fechar { border: none; cursor: pointer; }
.editor-fechar:hover { background: var(--gold-light); color: #fff; }
.campo-leitura { display: flex; align-items: center; background: var(--segmented-bg); color: var(--text); }
.simulacao-box { padding: 6px 16px; margin-top: 14px; background: var(--segmented-bg); border: 1px solid var(--card-border); border-radius: var(--radius-lg); }
.simulacao-box .result-row { padding: 8px 0; }
.simulacao-box .result-row .v { font-size: 16px; }
.simulacao-box .result-row.result-sub { padding: 3px 0 3px 14px; border-top: none; }
.simulacao-box .result-row.result-sub .k { color: var(--muted); font-size: 12px; }
.simulacao-box .result-row.result-sub .v { font-family: var(--poppins); font-weight: 500; font-size: 12.5px; color: var(--text); }
.simulacao-box .result-row.result-total .k { font-weight: 700; color: var(--ink); }
.simulacao-box .result-row.result-total .v { font-size: 18px; }

/* Ação discreta no topo (ex.: "+ Novo acompanhamento"). */
.btn-novo-min { flex: none; border: 1px solid var(--accent-soft); background: transparent; color: var(--gold-dark); font-family: var(--poppins); font-size: 12.5px; font-weight: 600; padding: 7px 14px; border-radius: 999px; cursor: pointer; white-space: nowrap; transition: background .15s ease, color .15s ease; }
.btn-novo-min:hover { background: var(--gold); border-color: var(--gold); color: #fff; }
@media (max-width: 720px) { .btn-novo-min { padding: 6px 11px; font-size: 12px; } .btn-novo-min .so-largo { display: none; } }

/* Pagamento por produção: Nome · Como paga · Valor · lixeira */
.producao-linha { display: grid; grid-template-columns: minmax(0,2fr) minmax(0,1.4fr) minmax(0,1.2fr) auto; gap: 10px; align-items: end; margin-top: 10px; }
@media (max-width: 720px) {
  .producao-linha { grid-template-columns: 1fr 1fr; padding-bottom: 10px; border-bottom: 1px solid var(--card-border); }
  .producao-linha > :first-child { grid-column: 1 / -1; }
  .producao-linha > :last-child { justify-self: end; }
}
.prod-regra { display: flex; align-items: center; gap: 6px; flex-basis: 100%; padding-left: 26px; }
.prod-regra select.input { max-width: 280px; padding-top: 7px; padding-bottom: 7px; font-size: 13px; }

/* ── Menus suspensos (combobox com busca) · identidade Dandara ─────────── */
.combo { position: relative; min-width: 0; }
.combo-botao { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; text-align: left; cursor: pointer; }
.combo-botao:disabled { cursor: not-allowed; opacity: .55; }
.combo-txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.combo-txt.vazio { color: var(--muted); }
.combo-seta { flex: none; width: 8px; height: 8px; margin-right: 2px; border-right: 1.8px solid var(--gold); border-bottom: 1.8px solid var(--gold); transform: translateY(-2px) rotate(45deg); transition: transform .15s ease; }
.combo.aberto .combo-seta { transform: translateY(2px) rotate(-135deg); }
.combo.aberto .combo-botao { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(166,124,193,0.14); }
.combo-painel { display: none; position: absolute; top: calc(100% + 6px); left: 0; right: 0; min-width: 200px; z-index: 90; background: var(--surface); border: 1px solid var(--accent-soft); border-radius: var(--radius); box-shadow: var(--shadow-pop); padding: 8px; }
.combo.aberto .combo-painel { display: block; }
.combo-busca { position: relative; margin-bottom: 6px; }
.combo-busca::before { content: ""; position: absolute; left: 12px; top: 50%; width: 11px; height: 11px; border: 1.8px solid var(--muted); border-radius: 50%; transform: translateY(-60%); pointer-events: none; }
.combo-busca::after { content: ""; position: absolute; left: 22px; top: 50%; width: 6px; height: 1.8px; background: var(--muted); transform: translateY(5px) rotate(45deg); pointer-events: none; }
.combo-busca .input { padding-left: 34px; background: var(--segmented-bg); border-color: transparent; }
.combo-busca .input:focus { background: var(--surface); }
.combo-lista { max-height: 240px; overflow-y: auto; }
.combo-op { display: block; width: 100%; text-align: left; border: none; background: transparent; padding: 9px 10px; border-radius: var(--radius-sm); cursor: pointer; font-family: var(--sans); font-size: 14px; color: var(--ink); }
.combo-op:hover, .combo-op.foco { background: rgba(166,124,193,0.10); }
.combo-op.sel { background: rgba(166,124,193,0.18); color: var(--gold-dark); font-weight: 600; }
.combo-op.vazio { color: var(--muted); }
.combo-novo { background: var(--accent-soft); color: var(--gold-dark); font-weight: 600; }
.combo-nada { padding: 9px 10px; font-size: 13px; color: var(--muted); }
select.select-escondido { display: none !important; }
.combo-dica { margin-top: 6px; padding: 7px 10px 2px; border-top: 1px dashed var(--card-border); font-size: 12px; color: var(--muted); }
