/* ============================================================
   CRM Dr. Diogo Cerqueira — Identidade visual
   Pegada: sistema clínico profissional (denso, legível, firme).
   Marca: branco quente · bege · dourado champagne · marrom carvão.
   Tipografia: Montserrat (todo o sistema) + Cormorant só no logo.
   ============================================================ */

:root {
  /* Tema escuro (dark glass) */
  --branco:        #1B1812;
  --bege:          #272219;
  --bege-escuro:   #322B20;
  --dourado:       #D8B259;
  --dourado-claro: #E7CE90;
  --dourado-fundo: #2E2718;
  --carvao:        #F2ECDF;   /* texto principal (agora claro) */
  --carvao-claro:  #D3CBBA;
  --texto-suave:   #9E9586;
  --branco-puro:   #221F18;   /* superfície sólida (modais, papel) */

  --st-ativo-bg:   #29382A;  --st-ativo-tx:   #A6CE94;
  --st-aval-bg:    #3A3019;  --st-aval-tx:    #E2BE6E;
  --st-naofech-bg: #3B2A20;  --st-naofech-tx: #E0A07C;
  --st-acomp-bg:   #28323E;  --st-acomp-tx:   #A8C2DC;

  --linha:         rgba(255,255,255,.10);
  --linha-forte:   rgba(255,255,255,.18);
  --sombra-suave:  0 1px 3px rgba(0, 0, 0, .35);
  --raio:          9px;
  --raio-sm:       7px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: 'Montserrat', system-ui, -apple-system, sans-serif;
  background:
    radial-gradient(1100px 640px at 86% -10%, rgba(216,178,89,.20), transparent 58%),
    radial-gradient(820px 520px at 2% 110%, rgba(150,110,70,.16), transparent 60%),
    linear-gradient(158deg, #221E16 0%, #1A1710 55%, #14110B 100%);
  background-attachment: fixed;
  color: var(--carvao);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: inherit; font-weight: 700; letter-spacing: -.2px; color: var(--carvao); }
.wordmark { font-family: 'Cormorant Garamond', Georgia, serif; }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ---------- Utilidades ---------- */
.gold { color: var(--dourado); }
.muted { color: var(--texto-suave); }
.eyebrow {
  font-size: 12px; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--dourado); font-weight: 700;
}

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 10px 18px; border: none; border-radius: var(--raio-sm);
  font-size: 13px; font-weight: 600; letter-spacing: .2px;
  transition: background .15s ease, box-shadow .2s ease, border-color .15s;
}
.btn-gold { background: var(--dourado); color: #fff; }
.btn-gold:hover { background: #A07E2F; }
.btn-ghost { background: var(--branco-puro); color: var(--carvao); border: 1px solid var(--linha-forte); }
.btn-ghost:hover { border-color: var(--dourado); color: var(--dourado); }
.btn-sm { padding: 7px 12px; font-size: 12px; }

/* ---------- Badges de status ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 12px; border-radius: 999px;
  font-size: 12.5px; font-weight: 700; white-space: nowrap;
  border: 1px solid transparent; letter-spacing: .2px;
}
.badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.ativo    { background: var(--st-ativo-bg);   color: var(--st-ativo-tx);   border-color: #C6D6BB; }
.badge.aval     { background: var(--st-aval-bg);    color: var(--st-aval-tx);    border-color: #E3CD9C; }
.badge.naofech  { background: var(--st-naofech-bg); color: var(--st-naofech-tx); border-color: #E0BCA4; }
.badge.acomp    { background: var(--st-acomp-bg);   color: var(--st-acomp-tx);   border-color: #BCC9D8; }

/* ============================================================
   LOGIN
   ============================================================ */
.login-wrap { display: flex; min-height: 100vh; }
.login-art {
  flex: 1; position: relative; overflow: hidden;
  background: linear-gradient(155deg, var(--bege) 0%, var(--bege-escuro) 100%);
  display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center;
  gap: 30px; padding: 48px 52px;
}
.login-art::after {
  content: ''; position: absolute; right: -140px; bottom: -140px;
  width: 420px; height: 420px; border-radius: 50%;
  border: 1px solid rgba(184, 146, 62, .3);
}
.login-art .mark { font-family: 'Cormorant Garamond', serif; font-size: 22px; letter-spacing: .5px; }
.login-art .mark b { font-weight: 600; }
.login-logo { width: 280px; max-width: 70%; position: relative; z-index: 1; filter: drop-shadow(0 8px 26px rgba(216,178,89,.18)); }
.login-logo-sm { display: none; width: 160px; margin: 0 auto 20px; }
.login-art .pitch { max-width: 400px; position: relative; z-index: 1; }
.login-art .pitch h1 { font-size: 34px; line-height: 1.2; font-weight: 700; margin-top: 8px; }
.login-art .pitch p { margin-top: 14px; font-size: 15px; color: var(--carvao-claro); }
.login-art .foot { font-size: 12px; color: var(--carvao-claro); position: absolute; bottom: 26px; left: 0; right: 0; }

.login-form { flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px; }
.login-card { width: 100%; max-width: 380px; }
.login-card h2 { font-size: 26px; margin: 8px 0 4px; }
.login-card .sub { color: var(--texto-suave); margin-bottom: 28px; font-size: 14px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 7px; color: var(--carvao); }
.field input {
  width: 100%; padding: 12px 14px; font-size: 15px; font-family: inherit;
  background: var(--branco-puro); border: 1px solid var(--linha-forte);
  border-radius: var(--raio-sm); color: var(--carvao); transition: border .15s, box-shadow .15s;
}
.field input:focus { outline: none; border-color: var(--dourado); box-shadow: 0 0 0 3px rgba(184,146,62,.14); }
.login-card .btn-gold { width: 100%; justify-content: center; margin-top: 6px; padding: 13px; font-size: 14px; }
.login-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 7px; }
.login-row a { font-size: 13px; color: var(--dourado); font-weight: 600; }
.login-note { margin-top: 20px; text-align: center; font-size: 12px; color: var(--texto-suave); }

/* ============================================================
   APP — Shell
   ============================================================ */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; gap: 16px; padding: 16px; }

.sidebar {
  background: rgba(255,255,255,.05);
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  border: 1px solid rgba(255,255,255,.11);
  border-radius: 20px;
  box-shadow: 0 16px 44px rgba(0,0,0,.38);
  color: var(--carvao);
  display: flex; flex-direction: column; padding: 18px 14px;
  position: sticky; top: 16px; height: calc(100vh - 32px);
}
.sidebar .brand { padding: 6px 10px 16px; border-bottom: 1px solid var(--linha); }
.sidebar .brand .dr { font-family: 'Cormorant Garamond', serif; font-size: 20px; color: var(--carvao); }
.sidebar .brand .dr b { color: var(--dourado); font-weight: 600; }
.sidebar .brand .sub { font-size: 10px; letter-spacing: 2px; text-transform: uppercase; color: var(--texto-suave); margin-top: 3px; }

.nav { margin-top: 10px; display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav .group-label { font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--texto-suave); padding: 12px 10px 4px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 10px 10px;
  border-radius: 10px; color: var(--carvao-claro); font-size: 14.5px; font-weight: 500;
  border-left: 2px solid transparent; transition: background .12s, color .12s;
}
.nav-item .ic { width: 19px; display: inline-flex; align-items: center; justify-content: center; opacity: .8; flex: none; }
.nav-item .ic svg { width: 18px; height: 18px; }
.nav-item:hover { background: rgba(255,255,255,.07); color: var(--carvao); }
.nav-item.active { background: rgba(216,178,89,.18); color: var(--carvao); border-left-color: var(--dourado); font-weight: 600; }
.nav-item.active .ic { opacity: 1; color: var(--dourado); }
.search .ic svg { width: 16px; height: 16px; }
.lockmsg svg { width: 17px; height: 17px; flex: none; }
.proto-note svg { width: 16px; height: 16px; flex: none; }
.btn svg { width: 15px; height: 15px; flex: none; }

/* ---------- Efeito neon no hover (elementos clicáveis) ---------- */
.nav-item, .setor-card, .btn, .back-link, .thumb, .est-btn,
.fin-seg button, .appt, .panel-head a, .topbar .pill[href], .chip-filter {
  transition: box-shadow .18s ease, border-color .18s ease, transform .12s ease, color .15s ease, background .15s ease;
}
.setor-card:hover, .btn:hover, .back-link:hover, .thumb:hover,
.est-btn:hover, .fin-seg button:hover, .appt:hover, .panel-head a:hover,
.topbar .pill[href]:hover {
  box-shadow: 0 0 0 1px rgba(231,206,144,.65), 0 0 18px rgba(216,178,89,.5) !important;
  border-color: rgba(216,178,89,.85) !important;
}
/* Menu lateral: brilho suave no hover, sem a linha dura "neon" */
.nav-item:hover { background: rgba(216,178,89,.10); box-shadow: 0 0 14px rgba(216,178,89,.16); }
.panel-head a:hover, .back-link:hover { text-shadow: 0 0 10px rgba(216,178,89,.55); }
/* linhas de paciente clicáveis: realce dourado suave */
.tbl tbody tr[data-pac] { cursor: pointer; transition: background .15s ease; }
.tbl tbody tr[data-pac]:hover { background: rgba(216,178,89,.10); }
.nav-item .soon { margin-left: auto; font-size: 9px; background: rgba(255,255,255,.08); color: var(--texto-suave); padding: 2px 6px; border-radius: 5px; text-transform: uppercase; }
.sidebar .who { margin-top: 8px; display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1); }
.sidebar .who .av { width: 32px; height: 32px; flex-shrink: 0; border-radius: 9px; background: var(--dourado); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 12px; }
.sidebar .who > div:last-child { min-width: 0; }
.sidebar .who .nm { font-size: 12.5px; color: var(--carvao); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar .who .rl { font-size: 10px; color: var(--texto-suave); }

/* ---------- Main ---------- */
.main { overflow-x: hidden; }
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 11px 18px;
  background: rgba(255,255,255,.05);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid rgba(255,255,255,.11);
  border-radius: 16px;
  box-shadow: 0 10px 32px rgba(0,0,0,.32);
  position: sticky; top: 16px; z-index: 5; margin-bottom: 6px;
}
.search { flex: 1; max-width: 440px; display: flex; align-items: center; gap: 9px;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.11); border-radius: 11px; padding: 8px 14px; }
.search { position: relative; }
.search input { border: none; outline: none; background: transparent; flex: 1; font-family: inherit; font-size: 14.5px; color: var(--carvao); }
.busca-results { position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 40; display: none;
  background: rgba(28,25,18,.98); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,.14); border-radius: 13px; box-shadow: 0 14px 36px rgba(0,0,0,.5);
  overflow: hidden; max-height: 340px; overflow-y: auto; }
.busca-results.show { display: block; }
.busca-item { display: flex; flex-direction: column; gap: 2px; padding: 11px 15px; cursor: pointer; border-bottom: 1px solid rgba(255,255,255,.06); }
.busca-item:last-child { border-bottom: none; }
.busca-item:hover { background: rgba(216,178,89,.14); }
.busca-item .bn { font-weight: 600; font-size: 14px; color: var(--carvao); }
.busca-item .bt { font-size: 12px; color: var(--texto-suave); }
.busca-empty { padding: 13px 15px; font-size: 13px; color: var(--texto-suave); }
.search input::placeholder { color: var(--texto-suave); }
.search .ic { color: var(--texto-suave); }
.topbar .spacer { flex: 1; }
.topbar .pill { display: flex; align-items: center; gap: 7px; font-size: 13.5px; color: var(--carvao-claro); background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.11); padding: 8px 14px; border-radius: 999px; font-weight: 500; }
.topbar .pill svg { width: 15px; height: 15px; flex: none; }

.view { padding: 22px 32px 40px; max-width: none; width: 100%; }
.view-head { margin-bottom: 18px; }
.view-head h1 { font-size: 27px; line-height: 1.2; }
.view-head .lead { color: var(--texto-suave); font-size: 14.5px; margin-top: 3px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* ---------- Stats ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.stat { background: rgba(255,255,255,.05); backdrop-filter: blur(16px) saturate(130%); -webkit-backdrop-filter: blur(16px) saturate(130%);
  border: 1px solid rgba(255,255,255,.11); border-radius: 16px; padding: 18px 20px; box-shadow: 0 8px 28px rgba(0,0,0,.30); }
.stat .lbl { font-size: 12px; letter-spacing: .5px; text-transform: uppercase; color: var(--texto-suave); font-weight: 600; }
.stat .num { font-size: 38px; font-weight: 700; line-height: 1.05; margin: 8px 0 4px; letter-spacing: -1px; }
.stat .delta { font-size: 13px; color: var(--st-ativo-tx); font-weight: 600; }
.stat .delta.warn { color: var(--st-naofech-tx); }

.panel { background: rgba(255,255,255,.05); backdrop-filter: blur(16px) saturate(130%); -webkit-backdrop-filter: blur(16px) saturate(130%);
  border: 1px solid rgba(255,255,255,.11); border-radius: 16px; box-shadow: 0 8px 28px rgba(0,0,0,.30); }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid rgba(255,255,255,.08); }
.panel-head h3 { font-size: 17px; font-weight: 700; }
.panel-head a { font-size: 13px; color: var(--dourado); font-weight: 600; }
.panel-head .ph-l { display: flex; align-items: center; gap: 10px; }
.panel-head .p-ic { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; flex: none; }
.panel-head .p-ic svg { width: 16px; height: 16px; }

/* identidade de setor nos painéis (mesmas cores dos cartões da ficha) */
.panel.sec-agenda     { border-top: 3px solid #8F6B85; } .panel.sec-agenda .p-ic     { background: #EEE6EF; color: #6E4A66; }
.panel.sec-followup   { border-top: 3px solid #5E8C81; } .panel.sec-followup .p-ic   { background: #E2EEEB; color: #3F6B61; }
.panel.sec-clinico    { border-top: 3px solid #7C8E58; } .panel.sec-clinico .p-ic    { background: #EDF1E4; color: #5F7140; }
.panel.sec-financeiro { border-top: 3px solid #B8923E; } .panel.sec-financeiro .p-ic { background: #F4EBD2; color: #8A6A1E; }

.cols-2 { display: grid; grid-template-columns: 1.5fr 1fr; gap: 14px; align-items: start; }

/* ---------- Linhas (agenda / followup) ---------- */
.line { display: flex; align-items: center; gap: 13px; padding: 13px 20px; border-bottom: 1px solid var(--linha); }
.line:last-child { border-bottom: none; }
.line .time { font-size: 15px; font-weight: 700; color: var(--dourado); min-width: 50px; white-space: nowrap; }
.line .time small { display: block; font-weight: 600; font-size: 11px; color: var(--texto-suave); margin-top: 1px; }
.line .who2 { flex: 1; }
.line .who2 .n { font-weight: 600; font-size: 15px; }
.line .who2 .t { font-size: 13px; color: var(--texto-suave); }

/* ---------- Avatar ---------- */
.av-ini { width: 36px; height: 36px; border-radius: 8px; flex-shrink: 0; display: grid; place-items: center; font-weight: 700; font-size: 13px; background: var(--dourado-fundo); color: var(--dourado); border: 1px solid var(--bege-escuro); }
.av-ini.lg { width: 60px; height: 60px; font-size: 20px; border-radius: 12px; }

/* ---------- Tabela ---------- */
.tbl { width: 100%; border-collapse: collapse; }
.tbl thead th { text-align: left; font-size: 12px; letter-spacing: .6px; text-transform: uppercase; color: var(--texto-suave); font-weight: 700; padding: 13px 20px; border-bottom: 1px solid var(--linha-forte); background: var(--branco); }
.tbl tbody td { padding: 14px 20px; border-bottom: 1px solid var(--linha); font-size: 15px; vertical-align: middle; }
.tbl tbody tr { cursor: pointer; transition: background .1s; }
.tbl tbody tr:hover { background: var(--dourado-fundo); }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl .pac { display: flex; align-items: center; gap: 11px; }
.tbl .pac .nm { font-weight: 600; }
.tbl .pac .em { font-size: 13px; color: var(--texto-suave); }

/* ---------- Ficha ---------- */
.back-link { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--carvao-claro);
  background: var(--branco-puro); border: 1px solid var(--linha); border-radius: 999px; padding: 7px 16px 7px 12px;
  margin-bottom: 16px; box-shadow: var(--sombra-suave); cursor: pointer; transition: color .15s ease, border-color .15s ease, box-shadow .15s ease; }
.back-link svg { width: 15px; height: 15px; flex: none; transition: transform .15s ease; }
.back-link:hover { color: var(--dourado); border-color: var(--dourado-claro); box-shadow: 0 3px 10px rgba(46, 43, 38, .08); }
.back-link:hover svg { transform: translateX(-3px); }
.pac-header { display: flex; align-items: center; gap: 16px; margin-bottom: 10px; }
.pac-header .meta h1 { font-size: 26px; line-height: 1.15; }
.pac-header .meta .contact { display: flex; gap: 16px; color: var(--texto-suave); font-size: 14px; margin-top: 6px; flex-wrap: wrap; }
.pac-header .acts { margin-left: auto; display: flex; gap: 9px; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--linha-forte); margin: 18px 0 18px; }
.tab { padding: 11px 18px; font-size: 15px; font-weight: 600; color: var(--texto-suave); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab.active { color: var(--carvao); border-bottom-color: var(--dourado); }
.tab:hover { color: var(--carvao); }

.info-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--linha); border: 1px solid var(--linha); border-radius: var(--raio); overflow: hidden; }
.info-grid .cell { background: var(--branco-puro); padding: 15px 18px; }
.info-grid .cell .k { font-size: 12px; letter-spacing: .5px; text-transform: uppercase; color: var(--texto-suave); font-weight: 600; }
.info-grid .cell .v { font-size: 16px; margin-top: 5px; font-weight: 600; }

.ficha-cols { display: grid; grid-template-columns: 1.3fr 1fr; gap: 14px; margin-top: 16px; align-items: start; }

/* ---------- Setores da paciente (cartões) ---------- */
.sec-label { font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--texto-suave); font-weight: 700; margin: 24px 0 12px; }
.setores-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.setor-card { position: relative; display: block; background: var(--branco-puro); border: 1px solid var(--linha); border-left: 3px solid var(--linha);
  border-radius: var(--raio); padding: 16px 16px 16px 18px; cursor: pointer; box-shadow: var(--sombra-suave);
  transition: transform .12s ease, box-shadow .12s ease; }
.setor-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(46, 43, 38, .10); }
.setor-card .setor-ic { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; }
.setor-card .setor-ic svg { width: 20px; height: 20px; }
.setor-card .setor-tit { font-weight: 700; font-size: 15.5px; margin-top: 10px; }
.setor-card .setor-sub { font-size: 13px; color: var(--texto-suave); margin-top: 3px; line-height: 1.4; }
.setor-card .soon { position: absolute; top: 12px; right: 12px; font-size: 9px; background: var(--bege); color: var(--carvao-claro);
  padding: 3px 7px; border-radius: 5px; text-transform: uppercase; letter-spacing: .5px; font-weight: 700; }

/* identidade de cor por setor (tons suaves da paleta) */
.setor-card.s-anamnese   { border-left-color: #7C8E58; } .setor-card.s-anamnese .setor-ic   { background: #EDF1E4; color: #5F7140; }
.setor-card.s-fotos      { border-left-color: #B5754F; } .setor-card.s-fotos .setor-ic      { background: #F4E7DD; color: #9A5736; }
.setor-card.s-contratos  { border-left-color: #6D7E94; } .setor-card.s-contratos .setor-ic  { background: #E7EBF1; color: #4A5A6E; }
.setor-card.s-financeiro { border-left-color: #B8923E; } .setor-card.s-financeiro .setor-ic { background: #F4EBD2; color: #8A6A1E; }
.setor-card.s-agenda     { border-left-color: #8F6B85; } .setor-card.s-agenda .setor-ic     { background: #EEE6EF; color: #6E4A66; }
.setor-card.s-followup   { border-left-color: #5E8C81; } .setor-card.s-followup .setor-ic   { background: #E2EEEB; color: #3F6B61; }
.mini-list .line { padding: 10px 18px; }
.note-box { padding: 14px 18px; }
.note-box .k { font-size: 12px; letter-spacing: .5px; text-transform: uppercase; color: var(--texto-suave); font-weight: 600; margin-bottom: 8px; }
.note-box .lockmsg { font-size: 14px; color: var(--carvao-claro); display: flex; gap: 8px; align-items: flex-start; line-height: 1.5; }

/* ---------- View "em construção" ---------- */
.soon-view { padding: 60px 28px; }
.soon-view .inner { max-width: 520px; }
.soon-view .badge-soon { display: inline-block; margin-bottom: 12px; }
.soon-view h1 { font-size: 26px; margin-bottom: 8px; }
.soon-view p { color: var(--texto-suave); font-size: 14px; }

/* ---------- Aviso de protótipo ---------- */
.proto-note {
  display: flex; align-items: center; gap: 9px;
  background: var(--dourado-fundo); border: 1px solid var(--bege-escuro);
  border-radius: var(--raio-sm); padding: 10px 16px; margin-bottom: 18px;
  font-size: 13px; color: var(--carvao-claro);
}
.proto-note b { color: var(--dourado); }

/* ---------- Formulário (Anamnese) ---------- */
.form-section { padding: 18px 20px; border-bottom: 1px solid var(--linha); }
.form-section:last-child { border-bottom: none; }
.form-section h4 { font-size: 15px; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.form-section h4 .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--dourado); }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 18px; }
.form-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.form-field.full { grid-column: 1 / -1; }
.form-field label { font-size: 13px; font-weight: 600; color: var(--carvao-claro); }
.form-field input, .form-field select, .form-field textarea {
  font-family: inherit; font-size: 15px; padding: 10px 13px; color: var(--carvao);
  background: var(--branco-puro); border: 1px solid var(--linha-forte); border-radius: var(--raio-sm);
  width: 100%; min-width: 0; max-width: 100%;
}
.form-field textarea { resize: vertical; min-height: 70px; }
.form-field input:focus, .form-field select:focus, .form-field textarea:focus { outline: none; border-color: var(--dourado); box-shadow: 0 0 0 3px rgba(184,146,62,.13); }
.seg { display: inline-flex; border: 1px solid var(--linha-forte); border-radius: var(--raio-sm); overflow: hidden; width: fit-content; }
.seg button { padding: 9px 18px; font-size: 14px; font-weight: 600; background: var(--branco-puro); border: none; color: var(--texto-suave); border-right: 1px solid var(--linha); }
.seg button:last-child { border-right: none; }
.seg button.on { background: var(--dourado); color: #fff; }
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { background: var(--st-naofech-bg); color: var(--st-naofech-tx); padding: 5px 12px; border-radius: 6px; font-size: 13px; font-weight: 600; }

/* ---------- Anamnese (perguntas Sim/Não + detalhe) ---------- */
.anm-item { margin-bottom: 14px; }
.anm-item:last-child { margin-bottom: 0; }
.anm-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.anm-row .seg { flex: none; }
.anm-det { flex: 1; min-width: 200px; }
.anm-alerta { background: var(--st-naofech-bg); border: 1px solid rgba(214, 99, 99, .4); border-radius: var(--raio-sm); padding: 12px 16px; margin-bottom: 16px; }
.anm-alerta-tit { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--st-naofech-tx); margin-bottom: 6px; }
.anm-alerta-tit svg { width: 18px; height: 18px; }
.anm-alerta ul { margin: 0; padding-left: 28px; font-size: 13px; color: var(--carvao-claro); }
.anm-alerta li { margin: 2px 0; }
@media (max-width: 560px) { .anm-det { width: 100%; min-width: 0; } }

/* ---------- Campo de moeda reutilizável (R$ + máscara) ---------- */
.money-wrap { display: flex; align-items: center; gap: 6px; border: 1px solid var(--linha); border-radius: var(--raio-sm); padding: 0 12px; background: rgba(255,255,255,.05); }
.money-wrap:focus-within { border-color: var(--dourado); }
.money-wrap .rs { color: var(--texto-suave); font-size: 13px; flex: none; }
.money-wrap input { flex: 1; border: none; background: transparent; padding: 10px 0; text-align: left; }
.money-wrap input:focus { outline: none; box-shadow: none; }

/* ---------- Modal Novo Contrato (assistente) ---------- */
/* barra de passos */
.wiz-steps { display: flex; gap: 8px; margin: 0 0 18px; }
.wiz-step { flex: 1; display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--linha); border-radius: var(--raio-sm); font-size: 13px; font-weight: 600; color: var(--texto-suave); }
.wiz-step .n { width: 22px; height: 22px; flex: none; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--linha); color: var(--texto-suave); font-size: 12px; }
.wiz-step.is-on { border-color: var(--dourado); color: var(--texto); }
.wiz-step.is-on .n { background: var(--dourado); color: #1a1a1a; }
.wiz-step.is-done { color: var(--texto); }
.wiz-step.is-done .n { background: var(--dourado); color: #1a1a1a; }
@media (max-width: 560px) { .wiz-step .t { display: none; } .wiz-step { flex: none; padding: 8px; } }

/* passo 2 — linhas de procedimento */
#ctrLinhas { display: flex; flex-direction: column; gap: 8px; }
.ctr-row { display: flex; align-items: center; gap: 8px; }
.ctr-row .ctr-termo { width: 150px; flex: none; }
.ctr-row .ctr-proc { flex: 1; }
.ctr-valwrap { display: flex; align-items: center; gap: 4px; width: 130px; flex: none; }
.ctr-valwrap .ctr-rs { color: var(--texto-suave); font-size: 13px; }
.ctr-valwrap .ctr-valor { width: 100%; text-align: right; }
.ctr-del { flex: none; width: 30px; height: 30px; border: 1px solid var(--linha); border-radius: var(--raio-sm); background: transparent; color: var(--texto-suave); font-size: 18px; line-height: 1; cursor: pointer; }
.ctr-del:hover { border-color: #c0392b; color: #c0392b; }
@media (max-width: 560px) {
  .ctr-row { flex-wrap: wrap; }
  .ctr-row .ctr-termo, .ctr-row .ctr-proc { width: 100%; flex: 1 1 100%; }
  .ctr-valwrap { width: auto; flex: 1; }
}

/* passo 3 — conferência */
.ctr-resumo { display: flex; flex-direction: column; gap: 12px; }
.ctr-res-pac { font-size: 15px; }
.ctr-res-grupo { border: 1px solid var(--linha); border-radius: var(--raio-sm); padding: 10px 12px; }
.ctr-res-termo { font-weight: 700; font-size: 13px; color: var(--dourado); margin-bottom: 6px; }
.ctr-res-linha { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; font-size: 14px; }
.ctr-res-linha .val { font-weight: 600; white-space: nowrap; }
.ctr-res-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 6px; border-top: 1px solid var(--linha); }
.ctr-res-total { font-size: 16px; font-weight: 700; }

/* ---------- Pasta de fotos (Evolução) ---------- */
.photo-bank { display: flex; flex-direction: column; gap: 26px; }
.photo-day-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 11px; padding-bottom: 8px; border-bottom: 1px solid var(--linha); }
.photo-day-head .pd-date { font-weight: 700; font-size: 15px; }
.photo-day-head .pd-count { font-size: 12.5px; color: var(--texto-suave); }
.photo-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.thumb { aspect-ratio: 3/4; border-radius: var(--raio); border: 1px solid var(--linha); position: relative; overflow: hidden; box-shadow: var(--sombra-suave); cursor: pointer;
  background: linear-gradient(150deg, #EFEAE2, #D9D2C6); transition: transform .12s ease; }
.thumb:hover { transform: translateY(-2px); }
.thumb .cam { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); font-size: 26px; opacity: .35; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
button.thumb { padding: 0; font: inherit; }

/* ---------- Popup de foto (lightbox) ---------- */
.lightbox { position: fixed; inset: 0; z-index: 300; display: none; align-items: center; justify-content: center;
  background: rgba(30, 27, 22, .93); }
.lightbox.show { display: flex; }
.lightbox img { max-width: 88vw; max-height: 86vh; border-radius: 10px; box-shadow: 0 12px 48px rgba(0, 0, 0, .55); }
.lb-close { position: absolute; top: 18px; right: 20px; width: 40px; height: 40px; border: none; border-radius: 50%;
  background: rgba(255, 255, 255, .12); color: #F5F1E8; display: grid; place-items: center; cursor: pointer; transition: background .15s ease; }
.lb-close svg { width: 18px; height: 18px; }
.lb-close:hover { background: rgba(255, 255, 255, .24); }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 46px; height: 46px; border: none; border-radius: 50%;
  background: rgba(255, 255, 255, .12); color: #F5F1E8; display: grid; place-items: center; cursor: pointer; transition: background .15s ease; }
.lb-nav svg { width: 20px; height: 20px; }
.lb-nav:hover { background: rgba(255, 255, 255, .24); }
.lb-prev { left: 18px; }
.lb-next { right: 18px; }
.lb-meta { position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); color: #E8E2D6; font-size: 13px;
  background: rgba(0, 0, 0, .35); padding: 6px 14px; border-radius: 999px; }

/* ---------- Financeiro: período e filtros ---------- */
.fin-add { display: flex; gap: 8px; }
.fin-add .btn svg { width: 15px; height: 15px; }

.fin-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 16px;
  background: rgba(255,255,255,.05); backdrop-filter: blur(16px) saturate(130%); -webkit-backdrop-filter: blur(16px) saturate(130%);
  border: 1px solid rgba(255,255,255,.11); border-radius: 14px; padding: 12px 16px; }

.fin-seg { display: inline-flex; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.10); border-radius: 999px; padding: 3px; gap: 2px; }
.fin-seg button { border: none; background: transparent; color: var(--carvao-claro); font-family: inherit; font-size: 13px; font-weight: 600;
  padding: 7px 15px; border-radius: 999px; cursor: pointer; transition: background .12s, color .12s; }
.fin-seg button:hover { color: var(--carvao); }
.fin-seg button.on { background: var(--dourado); color: #2a2208; }

.fin-dates { display: inline-flex; align-items: center; gap: 10px; }
.fin-dates label { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--texto-suave); font-weight: 600; }
.fin-dates input { font-family: inherit; font-size: 13px; color: var(--carvao); background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12); border-radius: 8px; padding: 6px 10px; color-scheme: dark; }
.fin-dates[hidden] { display: none; }
.fin-vs { font-size: 12px; font-weight: 700; color: var(--dourado); }

.fin-check { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--carvao-claro); font-weight: 600; cursor: pointer; }
.fin-check input { accent-color: var(--dourado); width: 15px; height: 15px; }

/* ---------- Agenda ---------- */
.agenda-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.agenda-toolbar .day { font-size: 16px; font-weight: 700; }
.chip-filter { display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px; border-radius: var(--raio-sm); border: 1px solid var(--linha-forte); background: var(--branco-puro); font-size: 13px; font-weight: 600; color: var(--carvao-claro); }
.chip-filter .sw { width: 10px; height: 10px; border-radius: 3px; }

/* Pill "Hoje" clicável no topo */
.topbar .pill-btn { cursor: pointer; font-family: inherit; }
.topbar .pill-btn:hover { background: rgba(216,178,89,.16); border-color: var(--dourado); box-shadow: 0 0 0 3px rgba(216,178,89,.12); }

/* Alternador Dia / Mês */
.ag-toggle { display: inline-flex; border: 1px solid var(--linha-forte); border-radius: var(--raio-sm); overflow: hidden; }
.ag-toggle button { padding: 8px 16px; font-size: 13px; font-weight: 600; background: var(--branco-puro); border: none; color: var(--texto-suave); cursor: pointer; font-family: inherit; }
.ag-toggle button + button { border-left: 1px solid var(--linha); }
.ag-toggle button.on { background: var(--dourado); color: #fff; }

/* Calendário do mês */
.agenda-mes { background: rgba(255,255,255,.05); backdrop-filter: blur(16px) saturate(130%); -webkit-backdrop-filter: blur(16px) saturate(130%);
  border: 1px solid rgba(255,255,255,.11); border-radius: 16px; box-shadow: 0 8px 28px rgba(0,0,0,.30); padding: 16px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.cal-wd { text-align: center; font-size: 12px; font-weight: 700; color: var(--texto-suave); padding: 4px 0; }
.cal-cell { position: relative; min-height: 78px; border-radius: 10px; border: 1px solid rgba(255,255,255,.09); background: rgba(255,255,255,.03);
  padding: 8px; text-align: left; cursor: pointer; font-family: inherit; color: var(--carvao-claro); transition: border-color .12s ease, transform .12s ease; display: flex; flex-direction: column; gap: 4px; }
.cal-cell.vazia { background: transparent; border: none; cursor: default; min-height: 0; }
.cal-cell:not(.vazia):hover { border-color: var(--dourado); transform: translateY(-2px); }
.cal-cell .cal-num { font-size: 14px; font-weight: 600; }
.cal-cell.tem { background: rgba(216,178,89,.10); border-color: rgba(216,178,89,.35); }
.cal-cell.hoje { box-shadow: 0 0 0 2px var(--dourado) inset; }
.cal-cnt { font-size: 18px; font-weight: 800; color: var(--dourado); line-height: 1; }
.cal-dots { display: flex; gap: 4px; flex-wrap: wrap; margin-top: auto; }
.cal-dot { width: 8px; height: 8px; border-radius: 50%; }
.cal-livre { font-size: 11px; font-weight: 600; color: #6fcf97; }
.cal-livre.cheio { color: #e08a8a; }
.cal-cell.cheio { background: rgba(214,99,99,.12); border-color: rgba(214,99,99,.4); }
.cal-legenda { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }

/* Horários livres na visão Dia */
.ag-livres { margin-top: 10px; padding: 10px 12px; border-top: 1px dashed rgba(255,255,255,.12); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ag-livres.cheio { color: #e08a8a; font-size: 12.5px; font-weight: 600; }
.ag-livres-tit { width: 100%; font-size: 12px; font-weight: 700; color: #6fcf97; margin-bottom: 2px; }
.ag-slot { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: rgba(111,207,151,.12); color: #8fdcae; border: 1px solid rgba(111,207,151,.25); }
@media (max-width: 560px) {
  .cal-grid { gap: 4px; }
  .cal-cell { min-height: 58px; padding: 5px; }
  .cal-cell .cal-num { font-size: 12px; }
  .cal-cnt { font-size: 14px; }
  .cal-wd { font-size: 10px; }
}
.agenda-grid { display: grid; grid-template-columns: 64px 1fr 1fr; background: var(--branco-puro); border: 1px solid var(--linha); border-radius: var(--raio); overflow: hidden; }
.agenda-grid .colhead { padding: 12px; font-weight: 700; font-size: 14px; border-bottom: 1px solid var(--linha-forte); border-left: 1px solid var(--linha); display: flex; align-items: center; gap: 8px; }
.agenda-grid .colhead.time-h { border-left: none; }
.agenda-grid .colhead .sw { width: 10px; height: 10px; border-radius: 3px; }
.agenda-grid .tcell { padding: 10px; font-size: 13px; color: var(--texto-suave); font-weight: 600; border-top: 1px solid var(--linha); min-height: 58px; }
.agenda-grid .acell { border-top: 1px solid var(--linha); border-left: 1px solid var(--linha); padding: 6px; min-height: 58px; }
.appt { border-radius: 8px; padding: 9px 11px; font-size: 13px; }
.appt .n { font-weight: 700; }
.appt .t { font-size: 12px; opacity: .85; }
.appt.diogo { background: var(--st-aval-bg); color: var(--st-aval-tx); border-left: 3px solid var(--st-aval-tx); }
.appt.everton { background: var(--st-acomp-bg); color: var(--st-acomp-tx); border-left: 3px solid var(--st-acomp-tx); }

/* Agenda dinâmica: colunas por profissional */
.agenda-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.ag-col { background: rgba(255,255,255,.05); backdrop-filter: blur(16px) saturate(130%); -webkit-backdrop-filter: blur(16px) saturate(130%);
  border: 1px solid rgba(255,255,255,.11); border-radius: 16px; box-shadow: 0 8px 28px rgba(0,0,0,.30); overflow: hidden; }
.ag-col-head { display: flex; align-items: center; gap: 9px; padding: 13px 16px; font-weight: 700; font-size: 15px; border-bottom: 1px solid rgba(255,255,255,.08); }
.ag-col-head .sw { width: 11px; height: 11px; border-radius: 3px; }
.ag-col-head .cnt { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--texto-suave); }
.ag-col-body { padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.ag-empty { color: var(--texto-suave); font-size: 13px; padding: 14px 4px; text-align: center; }
.appt-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.appt-hora { font-weight: 800; font-size: 13.5px; }
.appt .badge { cursor: pointer; }
.appt-del { background: transparent; border: none; color: currentColor; opacity: .5; cursor: pointer; font-size: 15px; line-height: 1; padding: 0 2px; }
.appt-del:hover { opacity: 1; }

/* ---------- Financeiro ---------- */
.amount { font-weight: 700; font-variant-numeric: tabular-nums; }
.amount.in { color: var(--st-ativo-tx); }
.amount.out { color: var(--st-naofech-tx); }
.pay-tag { font-size: 12.5px; font-weight: 600; color: var(--carvao-claro); background: var(--bege); padding: 3px 10px; border-radius: 6px; }

/* ---------- Contratos ---------- */
.doc-layout { display: grid; grid-template-columns: 1fr 1.3fr; gap: 16px; align-items: start; }
.doc-preview { background: var(--branco-puro); border: 1px solid var(--linha); border-radius: var(--raio); padding: 32px 36px; box-shadow: var(--sombra-suave); }
.doc-actions { display: flex; justify-content: flex-end; gap: 8px; margin-bottom: 18px; padding-bottom: 16px; border-bottom: 1px dashed var(--linha); }
.doc-actions .btn svg { width: 15px; height: 15px; }
.doc-preview .doc-h { text-align: center; border-bottom: 1px solid var(--linha); padding-bottom: 16px; margin-bottom: 18px; }
.doc-preview .doc-h .wordmark { font-size: 22px; }
.doc-preview .doc-h .sub { font-size: 12px; color: var(--texto-suave); letter-spacing: 1px; text-transform: uppercase; }
.doc-preview h3 { font-size: 16px; margin: 18px 0 8px; }
.doc-preview p { font-size: 13.5px; color: var(--carvao-claro); line-height: 1.6; margin-bottom: 10px; }
.consent-box { background: var(--dourado-fundo); border: 1px solid var(--bege-escuro); border-radius: var(--raio-sm); padding: 14px 16px; margin: 14px 0; font-size: 13px; display: flex; gap: 10px; }
.consent-box input { margin-top: 3px; }
.doc-sign { display: flex; justify-content: space-between; margin-top: 28px; gap: 20px; }
.doc-sign .line-sign { flex: 1; border-top: 1px solid var(--carvao); padding-top: 6px; font-size: 12px; color: var(--texto-suave); text-align: center; }

/* ---------- Follow-up ---------- */
.fu-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.fu-card { display: flex; align-items: center; gap: 13px; padding: 14px 18px; border-bottom: 1px solid var(--linha); }
.fu-card:last-child { border-bottom: none; }
.fu-card .who2 { flex: 1; }
.fu-card .who2 .n { font-weight: 600; font-size: 15px; }
.fu-card .who2 .t { font-size: 13px; color: var(--texto-suave); }
.fu-card.done { opacity: .55; }
.fu-card.done .who2 .n { text-decoration: line-through; }
.fu-empty { color: var(--texto-suave); font-size: 13.5px; padding: 18px; text-align: center; }

/* ---------- WhatsApp ---------- */
.btn-wpp { background: rgba(37,211,102,.14); color: #4fce8d; border: 1px solid rgba(37,211,102,.45); }
.btn-wpp:hover { background: rgba(37,211,102,.24); color: #6fe0a5; }
.btn-wpp svg { width: 16px; height: 16px; }
.wpp-mini { display: inline-grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 50%;
  background: rgba(37,211,102,.14); color: #4fce8d; border: 1px solid rgba(37,211,102,.45); transition: background .15s ease, transform .12s ease; }
.wpp-mini svg { width: 17px; height: 17px; }
.wpp-mini:hover { background: rgba(37,211,102,.28); color: #6fe0a5; transform: translateY(-1px); }

/* ---------- Estoque ---------- */
.est-alerta { background: var(--st-naofech-bg); color: var(--st-naofech-tx); border: 1px solid var(--st-naofech-tx);
  border-radius: 12px; padding: 12px 16px; margin-bottom: 16px; font-size: 13.5px; font-weight: 600; }
.est-ok   { color: var(--st-ativo-tx); font-weight: 700; font-size: 12.5px; }
.est-baixo { color: var(--st-naofech-tx); font-weight: 700; font-size: 12.5px; }
tr.est-row-baixo td { background: rgba(224,160,124,.08); }
.est-acoes { display: flex; gap: 6px; justify-content: flex-end; }
.est-btn { border: 1px solid var(--linha-forte); background: rgba(255,255,255,.05); color: var(--carvao-claro);
  border-radius: 7px; padding: 4px 9px; font-size: 12px; font-weight: 600; cursor: pointer; font-family: inherit; }
.est-btn:hover { color: var(--carvao); border-color: var(--dourado); }

/* ---------- Modal ---------- */
.modal-bg {
  display: none; position: fixed; inset: 0; z-index: 80;
  background: rgba(46,43,38,.5); align-items: flex-start; justify-content: center;
  padding: 40px 16px; overflow-y: auto;
}
.modal-bg.show { display: flex; }
.modal {
  background: var(--branco-puro); border-radius: var(--raio); width: 100%; max-width: 560px;
  box-shadow: 0 20px 60px rgba(46,43,38,.3); animation: fade .2s ease;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--linha); }
.modal-head h3 { font-size: 19px; }
.modal-x { background: transparent; border: none; font-size: 26px; line-height: 1; color: var(--texto-suave); padding: 0 4px; }
.modal-x:hover { color: var(--carvao); }
.modal-body { padding: 20px 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--linha); }

/* ---------- Visibilidade ---------- */
[data-view-panel] { display: none; }
[data-view-panel].show { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

/* ---------- Mobile: hambúrguer, overlay, scroll ---------- */
.hamb { display: none; background: var(--branco-puro); border: 1px solid var(--linha-forte);
  border-radius: var(--raio-sm); font-size: 18px; line-height: 1; padding: 8px 12px; color: var(--carvao); }
.overlay { display: none; }
.hscroll { width: 100%; }

@media (max-width: 860px) {
  /* shell vira coluna única; sidebar vira gaveta */
  .app { grid-template-columns: 1fr; gap: 12px; padding: 12px; }
  .hamb { display: inline-flex; align-items: center; }
  .sidebar {
    position: fixed; top: 0; left: 0; height: 100dvh; width: 268px; border-radius: 0;
    background: rgba(24,21,16,.94); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    transform: translateX(-100%); transition: transform .25s ease; z-index: 60;
    box-shadow: 0 0 50px rgba(46,43,38,.4);
  }
  /* blur mais leve no celular (performance) */
  .panel, .stat, .topbar { backdrop-filter: blur(10px) saturate(125%); -webkit-backdrop-filter: blur(10px) saturate(125%); }
  .sidebar.open { transform: none; }
  .overlay {
    display: block; position: fixed; inset: 0; background: rgba(46,43,38,.5);
    opacity: 0; visibility: hidden; transition: opacity .25s; z-index: 55;
  }
  .overlay.show { opacity: 1; visibility: visible; }

  .topbar { padding: 10px 16px; gap: 10px; }
  .topbar .pill:not([href]) { display: none; } /* esconde "Hoje" pra caber */
  .view { padding: 18px 16px 40px; }
  .view-head h1 { font-size: 23px; }

  /* grids empilham */
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .cols-2, .ficha-cols, .fu-cols, .doc-layout { grid-template-columns: 1fr; }
  .setores-grid { grid-template-columns: repeat(2, 1fr); }
  .gallery-grid { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .login-logo-sm { display: block; }

  /* agenda e tabelas largas: rolagem horizontal */
  .hscroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .agenda-grid { min-width: 600px; }

  /* tabela em modo cartão (pacientes) */
  .tbl-cards thead { display: none; }
  .tbl-cards, .tbl-cards tbody, .tbl-cards tr, .tbl-cards td { display: block; width: 100%; }
  .tbl-cards tr { padding: 14px 16px; border-bottom: 1px solid var(--linha); }
  .tbl-cards tr:hover { background: transparent; }
  .tbl-cards td { padding: 5px 0; border: none; display: flex; justify-content: space-between; align-items: center; gap: 14px; }
  .tbl-cards td:first-child { padding-bottom: 10px; }
  .tbl-cards td[data-label]::before {
    content: attr(data-label); font-size: 12px; font-weight: 700; letter-spacing: .4px;
    text-transform: uppercase; color: var(--texto-suave);
  }

  /* botões de ação em largura cheia onde fizer sentido */
  .pac-header { flex-wrap: wrap; }
  .pac-header .acts { margin-left: 0; width: 100%; }
  .pac-header .acts .btn { flex: 1; justify-content: center; }
  .agenda-toolbar .day { font-size: 15px; }
}

@media (max-width: 560px) {
  /* App compacto: aproveita a tela, cards e textos menores */
  .app { padding: 8px; gap: 8px; }
  .topbar { padding: 9px 12px; gap: 8px; border-radius: 13px; }
  .view { padding: 14px 12px 80px; }
  .view-head { margin-bottom: 14px; }
  .view-head h1 { font-size: 20px; }
  .view-head .lead { font-size: 13px; }
  .eyebrow { font-size: 10.5px; }
  .topbar .spacer { display: none; }      /* libera espaço pro Sair */
  .search { max-width: none; min-width: 0; flex: 1; padding: 7px 12px; }
  .search input { font-size: 14px; min-width: 0; }
  .topbar .pill[href] { flex: none; padding: 8px 11px; }

  /* Cartões de número: 2 colunas, compactos */
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 12px; }
  .stat { padding: 12px 13px; border-radius: 13px; }
  .stat .lbl { font-size: 10px; }
  .stat .num { font-size: 24px; margin: 5px 0 2px; letter-spacing: -.5px; }
  .stat .delta { font-size: 11px; }

  /* Painéis e listas mais justos */
  .cols-2 { gap: 10px; }
  .cols-2[style] { margin-top: 10px !important; }
  .panel { border-radius: 14px; }
  .panel-head { padding: 12px 14px; }
  .panel-head h3 { font-size: 15px; }
  .line { padding: 11px 14px; }
  .line .n, .who2 .n { font-size: 14px; }
  .line .t, .who2 .t { font-size: 12px; }

  /* Cartões de setor: 2 colunas compactas */
  .setores-grid { grid-template-columns: repeat(2, 1fr); gap: 9px; }
  .setor-card { padding: 13px; }
  .setor-card .setor-ic { width: 32px; height: 32px; }
  .setor-card .setor-tit { font-size: 14px; margin-top: 7px; }
  .setor-card .setor-sub { font-size: 11.5px; }

  /* Botões e barras: largura cheia, quebram bem */
  .view-head.row-between { gap: 10px; }
  .view-head .btn, .fin-add { width: 100%; }
  .fin-add { display: flex; }
  .fin-add .btn { flex: 1; justify-content: center; }
  .fin-bar { padding: 10px 12px; gap: 10px; }
  .fin-seg { flex-wrap: wrap; }

  .doc-preview { padding: 20px 16px; }
  .doc-actions { flex-wrap: wrap; }
  .modal { max-width: none; }

  /* Formulários: 1 coluna e campos que não vazam */
  .form-grid { grid-template-columns: 1fr !important; gap: 12px; }
  .form-field input, .form-field select, .form-field textarea { width: 100%; min-width: 0; }

  /* Barra de período / abas: viram "chips" que quebram bem */
  .fin-seg { background: transparent; border: none; padding: 0; gap: 7px; flex-wrap: wrap; }
  .fin-seg button { border: 1px solid rgba(255,255,255,.16); border-radius: 999px; padding: 8px 14px; }
  .fin-dates { flex-wrap: wrap; gap: 8px; }
  .fin-dates input { flex: 1; min-width: 0; }
}

/* trava geral contra rolagem horizontal no celular */
@media (max-width: 560px) {
  html, body { overflow-x: hidden; }
  .main { overflow-x: hidden; }
  .hscroll { overflow-x: auto; }
}

/* ---------- Impressão: só o papel do contrato ---------- */
@media print {
  body * { visibility: hidden; }
  #docContrato, #docContrato * { visibility: visible; }
  #docContrato { position: absolute; left: 0; top: 0; width: 100%; padding: 0; box-shadow: none; border: none; }
  @page { margin: 18mm; }
}

/* Aviso de falha de sincronizacao com o Google Agenda */
.sync-erro { color:#b91c1c; font-size:11px; margin-left:6px; font-weight:600; }

/* ---------- Ranking de pacientes ---------- */
.rk-pos { font-weight: 700; font-size: 17px; text-align: center; }
.rk-medal svg { width: 22px; height: 22px; vertical-align: middle; }
.rk-top1 { background: linear-gradient(90deg, rgba(184,134,11,.16), transparent); }
.rk-top2 { background: linear-gradient(90deg, rgba(170,170,170,.14), transparent); }
.rk-top3 { background: linear-gradient(90deg, rgba(176,108,52,.14), transparent); }
.rk-top1 .rk-medal { color: #d4af37; }
.rk-top2 .rk-medal { color: #9aa0a6; }
.rk-top3 .rk-medal { color: #b06c34; }
.rk-total { font-weight: 700; }
.rk-link { color: inherit; font-weight: 600; text-decoration: none; }
.rk-link:hover { color: var(--dourado); text-decoration: underline; }
.rk-aviso { display: flex; gap: 10px; align-items: flex-start; border: 1px solid rgba(220,170,40,.4); background: rgba(220,170,40,.08); border-radius: 12px; padding: 12px 14px; margin-top: 14px; font-size: 13.5px; }
.rk-aviso .rk-aviso-ic { color: #d4a428; flex: none; }
.rk-aviso a { color: var(--dourado); font-weight: 600; }
.rk-empty { padding: 26px 20px; text-align: center; color: var(--texto-suave); }

/* ---------- Aniversariantes (painel) ---------- */
.aniv-grid { display: flex; gap: 12px; flex-wrap: wrap; }
.aniv-card { border: 1px solid var(--linha-forte); border-radius: 14px; padding: 12px 14px; min-width: 200px; display: flex; flex-direction: column; gap: 6px; }
.aniv-hoje { border-color: rgba(184,134,11,.55); background: linear-gradient(180deg, rgba(184,134,11,.12), transparent); }
.aniv-nome { font-weight: 700; display: flex; align-items: center; gap: 7px; }
.aniv-quando { font-size: 12.5px; color: var(--texto-suave); }
.aniv-tel { font-size: 13px; display: flex; align-items: center; gap: 6px; }
.ic-svg { width: 17px; height: 17px; flex: none; vertical-align: middle; }
.btn-wpp { align-self: flex-start; background: #25d366; color: #fff; border: none; padding: 7px 14px; font-size: 13px; border-radius: 999px; font-weight: 600; display: inline-flex; align-items: center; gap: 7px; cursor: pointer; text-decoration: none; }
.btn-wpp:hover { filter: brightness(1.06); }
.btn-wpp svg { width: 15px; height: 15px; flex: none; }

/* ---------- Agenda: horário livre (atalhos + aviso) ---------- */
.hora-extra { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.hora-hint { font-size: 12px; color: var(--texto-suave); }
.hora-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.hora-chips button { border: 1px solid var(--linha-forte); background: transparent; color: var(--texto-suave); border-radius: 999px; padding: 4px 10px; font-size: 12px; cursor: pointer; font-weight: 600; font-family: inherit; }
.hora-chips button:hover { border-color: var(--dourado); color: var(--dourado); }
.hora-chips button.sel { border-color: var(--dourado); color: #fff; background: rgba(184,134,11,.22); }
.hora-chips button.ocupado { opacity: .45; }
.ja-marcados { margin-top: 7px; font-size: 12px; color: var(--texto-suave); }
.ja-marcados b { color: #cdbfa6; font-weight: 600; }
.hora-aviso { margin-top: 8px; font-size: 12.5px; color: #e0b341; display: flex; align-items: flex-start; gap: 7px; background: rgba(220,170,40,.08); border: 1px solid rgba(220,170,40,.35); border-radius: 10px; padding: 8px 10px; }
.hora-aviso svg { width: 16px; height: 16px; flex: none; margin-top: 1px; }
