:root {
  --navy: #0f263b; --navy-2: #173652; --purple: #6e279c; --purple-soft: #c39be0; --gold: #b8862f; --off: #f2f2f2;
  --bg: #f4f5f8; --panel: #ffffff; --line: #e3e6ec; --fg: #0f263b; --muted: #5b6b7c;
  --ok: #1f8a5b; --bad: #c4373d; --warn: #b8862f; --r: 14px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: "Nunito Sans", "Avenir Next", "Segoe UI", sans-serif; font-size: 15px; }
button, input, select { font: inherit; }
.loading { padding: 60px; text-align: center; color: var(--muted); }
.wrap { max-width: 1180px; margin: 0 auto; padding: 24px 20px 60px; display: flex; flex-direction: column; gap: 28px; }
.muted { color: var(--muted); font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }
.good { color: var(--ok); } .bad { color: var(--bad); } .warn { color: var(--warn); }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(circle at 85% 10%, rgba(110,39,156,.55), transparent 45%), var(--navy); }
.login-card { background: #fff; border-radius: 20px; padding: 36px 32px; width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.wordmark { font-weight: 900; font-size: 30px; letter-spacing: -.02em; color: var(--navy); line-height: 1; }
.wordmark span { color: var(--purple); }
.head .wordmark { color: #fff; } .head .wordmark span { color: var(--purple-soft); }
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 700; font-size: 13px; }
.field input, .field select, .field textarea { padding: 11px 14px; border: 1.5px solid var(--line); border-radius: 10px; font-weight: 400; font-size: 15px; background: #fff; color: var(--fg); font-family: inherit; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--purple); box-shadow: 0 0 0 3px rgba(110,39,156,.15); }
.btn { border: 0; border-radius: 999px; padding: 11px 20px; font-weight: 800; cursor: pointer; background: var(--purple); color: #fff; }
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--navy); border: 1.5px solid var(--line); }
.btn.small { padding: 6px 14px; font-size: 13px; }
.btn.light { background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.35); color: #fff; }
.erro { color: var(--bad); font-size: 13px; min-height: 18px; }

/* cabeçalho */
.head { background: var(--navy); color: #fff; border-radius: 22px; padding: 26px 28px; position: relative; overflow: hidden; display: flex; flex-wrap: wrap; gap: 20px; justify-content: space-between; align-items: center; }
.head::after { content: ""; position: absolute; right: -70px; top: -70px; width: 260px; height: 260px; border-radius: 50%; background: var(--purple); opacity: .4; }
.head > * { position: relative; z-index: 1; }
.head-left { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.head-title { font-size: 23px; font-weight: 800; line-height: 1.2; }
.head-sub { color: rgba(255,255,255,.75); font-size: 13px; }
.head-right { display: flex; flex-direction: column; gap: 12px; align-items: flex-end; }
.pharma-logo { max-height: 64px; max-width: 170px; background: #fff; border-radius: 10px; padding: 6px 10px; }
.pharma-name { font-weight: 800; font-size: 15px; background: rgba(255,255,255,.1); padding: 8px 14px; border-radius: 10px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.toolbar select { background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.35); border-radius: 999px; padding: 6px 12px; font-weight: 700; font-size: 13px; }
.toolbar select option { color: var(--fg); }

/* seções e cartões */
.sec { display: flex; flex-direction: column; gap: 14px; }
.h2 { font-size: 21px; font-weight: 900; margin: 0; display: flex; align-items: center; gap: 10px; }
.h2::before { content: ""; width: 6px; height: 1.05em; border-radius: 3px; background: var(--purple); }
.h3 { font-size: 15px; font-weight: 800; margin: 0; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.hero { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.grid.six { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 18px; }
@media (max-width: 520px) { .two { grid-template-columns: 1fr; } .big { font-size: 38px !important; } }
.label { font-size: 12px; color: var(--muted); font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.big { font-size: 46px; font-weight: 900; line-height: 1.05; font-variant-numeric: tabular-nums; }
.mid { font-size: 30px; font-weight: 900; line-height: 1.1; font-variant-numeric: tabular-nums; }
.accent { border-top: 5px solid var(--purple); } .accent.gold { border-top-color: var(--gold); } .accent.navy { border-top-color: var(--navy); }
.bar { height: 10px; border-radius: 999px; background: var(--line); overflow: hidden; margin-top: 4px; }
.bar i { display: block; height: 100%; background: var(--purple); border-radius: 999px; }
.split { display: flex; flex-wrap: wrap; gap: 20px; margin-top: 4px; }
.split div { display: flex; flex-direction: column; }
.split b { font-size: 22px; font-weight: 900; font-variant-numeric: tabular-nums; }
.chip { align-self: flex-start; background: var(--purple); color: #fff; font-size: 11px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; padding: 3px 9px; border-radius: 999px; }
.chip.gold { background: var(--gold); }
.name { font-weight: 800; line-height: 1.3; }
.alert { border-left: 5px solid var(--gold); } .alert .mid { color: var(--gold); }
.click { cursor: pointer; transition: transform .15s ease, box-shadow .15s ease; }
.click:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(15,38,59,.12); }
.click::after { content: "Ver detalhes →"; margin-top: auto; padding-top: 6px; font-size: 12px; font-weight: 800; color: var(--purple); }
.flash { animation: flash 1.6s ease; }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 3px var(--purple); } 100% { box-shadow: 0 0 0 0 transparent; } }
.note { background: #fff8ec; border: 1px solid #f0dcb4; border-left: 5px solid var(--gold); border-radius: 12px; padding: 14px 18px; }
.note ul { margin: 6px 0 0; padding-left: 20px; line-height: 1.6; }
.nota-consultoria { background: #f6effb; border: 1px solid #e2d0ef; border-left: 5px solid var(--purple); border-radius: 12px; padding: 14px 18px; white-space: pre-wrap; line-height: 1.55; }
.plan { list-style: none; counter-reset: p; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.plan li { counter-increment: p; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 18px; display: flex; gap: 12px; line-height: 1.45; }
.plan li::before { content: counter(p); flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--purple); color: #fff; font-weight: 900; display: flex; align-items: center; justify-content: center; }
.divider { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: .1em; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--line); }

/* tabelas */
.tw { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13px; font-variant-numeric: tabular-nums; }
th { text-align: left; background: var(--navy); color: #fff; font-weight: 800; padding: 7px 9px; white-space: nowrap; }
th:first-child { border-top-left-radius: 8px; } th:last-child { border-top-right-radius: 8px; }
td { padding: 7px 9px; border-bottom: 1px solid var(--line); white-space: nowrap; }
tbody tr:nth-child(even) td { background: #faf7fc; }
th.r, td.r { text-align: right; }
td.pos { color: var(--purple); font-weight: 900; }
.empty { color: var(--muted); font-size: 13px; padding: 10px 0; }

/* busca */
.search { width: 100%; padding: 13px 20px; border-radius: 999px; border: 2px solid var(--purple); font-size: 16px; outline: none; }
.search:focus { box-shadow: 0 0 0 4px rgba(110,39,156,.18); }
.results tbody tr { cursor: pointer; }
.results tbody tr:hover td { background: #efe4f6; }
.results tbody tr.sel td { background: #e6d4f2; font-weight: 800; }
.tag { display: inline-block; font-size: 11px; font-weight: 800; padding: 2px 9px; border-radius: 999px; color: #fff; background: var(--navy); }
.tag.t-bad { background: var(--bad); } .tag.t-warn { background: var(--gold); } .tag.t-good { background: var(--ok); }
.ficha-head { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: baseline; }
.ficha-name { font-size: 21px; font-weight: 900; }
.foot { color: var(--muted); font-size: 12px; border-top: 1px solid var(--line); padding-top: 14px; }

/* admin */
.admin-table td { white-space: normal; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.modal-bg { position: fixed; inset: 0; background: rgba(15,38,59,.55); display: grid; place-items: center; padding: 20px; z-index: 10; }
.modal { background: #fff; border-radius: 18px; padding: 24px; width: 100%; max-width: 520px; display: flex; flex-direction: column; gap: 14px; max-height: 90vh; overflow: auto; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 13px; }
@media print { .toolbar, .btn, .search, #busca { display: none !important; } body { background: #fff; } .head { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }

/* anotações */
.notas { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
.nota { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--purple); border-radius: 12px; padding: 12px 16px; display: flex; flex-direction: column; gap: 6px; line-height: 1.5; }
.nota-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: baseline; }
.nota-txt { white-space: pre-wrap; }
.nota-item { font-size: 14px; line-height: 1.5; border-top: 1px dashed var(--line); padding-top: 6px; }
.nota-item:first-of-type { border-top: 0; padding-top: 0; }
@media (max-width: 520px) { .notas { grid-template-columns: 1fr; } }

/* pedidos da semana */
.resumo-txt { background: var(--panel); border: 1px solid var(--line); border-left: 5px solid var(--purple); border-radius: var(--r); padding: 18px 22px; white-space: pre-wrap; line-height: 1.6; }
.ped-ctl { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.sel { padding: 9px 14px; border-radius: 999px; border: 1.5px solid var(--line); background: #fff; font-weight: 700; color: var(--fg); }
.chk { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; cursor: pointer; }
.semanas { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.sem { text-align: left; border: 1.5px solid var(--line); background: var(--panel); border-radius: 12px; padding: 10px 14px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; color: var(--fg); position: relative; }
.sem span { font-size: 12px; color: var(--muted); }
.sem .qt { font-weight: 800; color: var(--purple); font-size: 13px; }
.sem.on { border-color: var(--purple); background: #f6effb; box-shadow: 0 0 0 2px rgba(110,39,156,.15); }
.sem .agora { align-self: flex-start; margin-top: 4px; background: var(--gold); color: #fff; font-size: 10px; font-weight: 800; padding: 1px 7px; border-radius: 999px; text-transform: uppercase; }
@media print { .ped-ctl, .semanas { display: none; } }
