/* Painel Pjuris — tokens do manual de marca */
:root {
  --bg: #FBF7F1;
  --bg-2: #F3ECE3;
  --card: #FFFFFF;
  --ink: #231E20;
  --ink-2: #4A4044;
  --muted: #6B5E52;
  --line: #E7DDD0;
  --toga: #231E20;
  --on-toga: #F4EDE3;
  --caramelo: #9A5424;
  --caramelo-hover: #843F14;
  --pluma: #F3E3CF;
  --bico: #F29A2E;
  --tinta: #2456A6;
  --tinta-soft: #E6EEFA;
  --ok: #276B43;
  --ok-soft: #E3F2E8;
  --alerta: #B3261E;
  --alerta-soft: #FBE6E4;
  --shadow: 0 1px 2px rgba(35,30,32,0.06), 0 8px 24px rgba(35,30,32,0.06);
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.55 var(--sans); -webkit-font-smoothing: antialiased;
}
a { color: var(--tinta); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select { font: inherit; color: inherit; }
.mono { font-family: var(--mono); font-size: .93em; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--tinta); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- Botões e campos ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 12px; border: 0; cursor: pointer;
  font-weight: 600; font-size: 14px; white-space: nowrap;
  transition: background .2s, box-shadow .2s;
}
.btn-primary { background: var(--caramelo); color: #fff; }
.btn-primary:hover { background: var(--caramelo-hover); }
.btn-ghost { background: var(--card); box-shadow: inset 0 0 0 1px var(--line); color: var(--ink); }
.btn-ghost:hover { box-shadow: inset 0 0 0 1px #CDBFAE; }
.btn-danger { background: transparent; color: var(--alerta); box-shadow: inset 0 0 0 1px #EBC6C2; }
.btn-danger:hover { background: var(--alerta-soft); }
.btn-block { width: 100%; height: 46px; }

.field { display: grid; gap: 6px; }
.field > span { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.input {
  height: 44px; width: 100%; padding: 0 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card); outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.input:focus { border-color: var(--tinta); box-shadow: 0 0 0 3px var(--tinta-soft); }
.input.mono { font-size: 14px; }
.input.invalid { border-color: var(--alerta); box-shadow: 0 0 0 3px var(--alerta-soft); }
.hint { font-size: 12.5px; color: var(--muted); }
.hint.error { color: var(--alerta); }

/* ---------- Login ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-side {
  background: var(--toga); color: var(--on-toga); padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden;
}
.auth-side .brand { color: var(--on-toga); }
.auth-side h1 { font-size: clamp(30px, 3.2vw, 44px); line-height: 1.08; letter-spacing: -.035em; margin: 0 0 14px; max-width: 14ch; }
.auth-side p { color: #B8AB9C; max-width: 40ch; margin: 0; }
.auth-side img.juri { width: 220px; align-self: flex-end; margin-top: 24px; filter: drop-shadow(0 20px 30px rgba(0,0,0,.4)); }
.auth-main { display: grid; place-items: center; padding: 48px 24px; }
.auth-card { width: min(400px, 100%); display: grid; gap: 18px; }
.auth-card h2 { font-size: 26px; letter-spacing: -.03em; margin: 0; }
.auth-card .sub { margin: -10px 0 4px; color: var(--muted); }
.auth-foot { font-size: 13.5px; color: var(--muted); text-align: center; }
.auth-foot button { background: none; border: 0; color: var(--tinta); cursor: pointer; padding: 0; font-weight: 500; }
.proto { font-size: 12px; color: var(--muted); background: var(--pluma); border-radius: 8px; padding: 8px 10px; }

.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 700; font-size: 18px; letter-spacing: -.04em; color: var(--ink); }
.brand img { width: 28px; height: 28px; border-radius: 8px; }
.brand:hover { text-decoration: none; }

/* ---------- Estrutura do painel ---------- */
.shell { min-height: 100vh; display: grid; grid-template-columns: 232px 1fr; }
.side {
  background: var(--card); border-right: 1px solid var(--line); padding: 20px 14px;
  display: flex; flex-direction: column; gap: 22px; position: sticky; top: 0; height: 100vh;
}
.side .brand { padding: 0 8px; }
.menu { display: grid; gap: 2px; }
.menu a {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px;
  color: var(--ink-2); font-weight: 500;
}
.menu a:hover { background: var(--bg); text-decoration: none; }
.menu a[aria-current="page"] { background: var(--bg-2); color: var(--ink); font-weight: 600; }
.menu svg { width: 18px; height: 18px; flex: none; }
.menu .count { margin-left: auto; font-size: 12px; font-weight: 600; background: var(--pluma); color: var(--caramelo); padding: 1px 7px; border-radius: 999px; }
.side-foot { margin-top: auto; display: grid; gap: 10px; }
.me { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; background: var(--bg); }
.me .avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--pluma); color: var(--caramelo); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.me div { min-width: 0; }
.me strong { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me span { display: block; font-size: 12px; color: var(--muted); }
.logout { background: none; border: 0; color: var(--muted); cursor: pointer; text-align: left; padding: 4px 10px; font-size: 13.5px; }
.logout:hover { color: var(--ink); }

.main { padding: 28px 36px 64px; min-width: 0; }
.top { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.top h1 { font-size: 28px; letter-spacing: -.03em; margin: 0; line-height: 1.15; }
.top p { margin: 4px 0 0; color: var(--muted); }
.top-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.proto-bar { font-size: 12.5px; color: var(--muted); margin-bottom: 18px; display: flex; align-items: center; gap: 8px; }
.proto-bar i { width: 6px; height: 6px; border-radius: 50%; background: var(--bico); display: inline-block; }

/* ---------- Resumo ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px; }
.stat {
  background: var(--card); border-radius: 16px; padding: 16px 18px; box-shadow: var(--shadow);
  border: 0; text-align: left; cursor: pointer; display: grid; gap: 2px;
}
.stat b { font-size: 26px; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.stat span { font-size: 13px; color: var(--muted); }
.stat.warn b { color: var(--alerta); }
.stat.new b { color: var(--tinta); }

/* ---------- Filtros e lista ---------- */
.tools { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-f { height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); cursor: pointer; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.chip-f[aria-pressed="true"] { background: var(--toga); border-color: var(--toga); color: var(--on-toga); }
.search { margin-left: auto; width: min(280px, 100%); height: 36px; }

.list { background: var(--card); border-radius: 20px; box-shadow: var(--shadow); overflow: hidden; }
.row {
  display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.6fr) 150px 20px; gap: 18px; align-items: center;
  padding: 16px 20px; border-top: 1px solid var(--line); color: inherit; position: relative;
}
.row:first-child { border-top: 0; }
.row:hover { background: #FDFAF6; text-decoration: none; }
.row .who b { display: block; font-size: 14.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .who .mono { font-size: 12.5px; color: var(--muted); }
.row .what { min-width: 0; }
.row .what b { display: block; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .what span { font-size: 12.5px; color: var(--muted); }
.row .chev { color: #CDBFAE; }
.row.is-new::before { content: ""; position: absolute; left: 8px; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: var(--tinta); }
.list-head { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.6fr) 150px 20px; gap: 18px; padding: 12px 20px; font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--line); background: #FDFAF6; }
.empty { padding: 48px 20px; text-align: center; color: var(--muted); display: grid; justify-items: center; gap: 8px; }
.empty img { width: 110px; }

.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; padding: 4px 10px; border-radius: 6px; white-space: nowrap; justify-self: start; }
.badge.alerta { background: var(--alerta-soft); color: var(--alerta); }
.badge.atencao { background: var(--pluma); color: var(--caramelo); }
.badge.info { background: var(--tinta-soft); color: var(--tinta); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.neutro { background: var(--bg-2); color: var(--muted); }

/* ---------- Detalhe do processo ---------- */
.back { display: inline-flex; gap: 6px; align-items: center; font-size: 13.5px; color: var(--muted); margin-bottom: 14px; }
.detail { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.card { background: var(--card); border-radius: 20px; box-shadow: var(--shadow); padding: 24px; }
.card h2 { font-size: 16px; margin: 0 0 16px; letter-spacing: -.01em; }
.facts { display: grid; gap: 12px; margin: 0; }
.facts div { display: grid; gap: 2px; }
.facts dt { font-size: 12px; color: var(--muted); }
.facts dd { margin: 0; font-weight: 500; }
.prazo-box { border-radius: 16px; padding: 18px; display: grid; gap: 4px; margin-bottom: 16px; }
.prazo-box.alerta { background: var(--alerta-soft); color: var(--alerta); }
.prazo-box.atencao { background: var(--pluma); color: var(--caramelo); }
.prazo-box.info { background: var(--tinta-soft); color: var(--tinta); }
.prazo-box.neutro { background: var(--bg-2); color: var(--muted); }
.prazo-box b { font-size: 22px; letter-spacing: -.02em; }
.prazo-box span { font-size: 13px; }
.side-stack { display: grid; gap: 16px; }
.notify-line { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; }
.notify-line:first-of-type { border-top: 0; }

.tl { list-style: none; margin: 0; padding: 0; position: relative; }
.tl::before { content: ""; position: absolute; left: 6px; top: 8px; bottom: 8px; width: 1px; background: var(--line); }
.tl li { position: relative; padding: 0 0 22px 30px; }
.tl li:last-child { padding-bottom: 0; }
.tl li::before { content: ""; position: absolute; left: 0; top: 5px; width: 13px; height: 13px; border-radius: 50%; background: var(--card); border: 1.5px solid #CDBFAE; }
.tl li.is-new::before { background: var(--tinta); border-color: var(--tinta); box-shadow: 0 0 0 5px var(--tinta-soft); }
.tl time { display: block; font-size: 12.5px; color: var(--muted); }
.tl b { display: block; font-weight: 600; margin-top: 1px; }
.tl p { margin: 4px 0 0; color: var(--ink-2); font-size: 14px; max-width: 62ch; }
.tl .badge { margin-top: 8px; }

/* ---------- Avisos ---------- */
.settings { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.channel { display: grid; gap: 14px; padding: 20px 0; border-top: 1px solid var(--line); }
.channel:first-of-type { border-top: 0; padding-top: 0; }
.channel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.channel-head b { font-size: 15px; }
.channel-head span { display: block; font-size: 13px; color: var(--muted); }
.switch { position: relative; width: 44px; height: 26px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: #DCCFBF; transition: background .2s; pointer-events: none; }
.switch i::after { content: ""; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .2s; }
.switch input:checked + i { background: var(--ok); }
.switch input:checked + i::after { transform: translateX(18px); }
.switch input:focus-visible + i { outline: 2px solid var(--tinta); outline-offset: 2px; }
.radios { display: grid; gap: 8px; }
.radio { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.radio input { margin-top: 3px; accent-color: var(--caramelo); }
.radio b { display: block; font-size: 14px; font-weight: 600; }
.radio span { font-size: 13px; color: var(--muted); }
.radio:has(input:checked) { border-color: var(--caramelo); background: #FFFBF6; }
.checks { display: grid; gap: 8px; }
.checks label { display: flex; gap: 10px; align-items: center; font-size: 14px; cursor: pointer; }
.checks input { accent-color: var(--caramelo); width: 16px; height: 16px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }

.wa-preview { background: #EFE9E1; border-radius: 20px; padding: 16px; }
.wa-top { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; }
.wa-top img { width: 34px; height: 34px; border-radius: 50%; }
.wa-top b { display: block; font-size: 14px; }
.wa-top span { font-size: 12px; color: var(--muted); }
.wa-bubble { background: #fff; border-radius: 4px 14px 14px 14px; padding: 10px 12px 20px; font-size: 13.5px; position: relative; box-shadow: 0 1px 1px rgba(0,0,0,.06); }
.wa-bubble p { margin: 4px 0 0; }
.wa-bubble .t { position: absolute; right: 10px; bottom: 5px; font-size: 11px; color: var(--muted); }

/* ---------- API ---------- */
.key { display: flex; gap: 8px; align-items: center; }
.key .input { font-family: var(--mono); font-size: 13.5px; }
.code { background: var(--toga); color: var(--on-toga); border-radius: 14px; padding: 18px; font: 13px/1.7 var(--mono); overflow-x: auto; white-space: pre; margin: 0; }
.code .k { color: var(--bico); } .code .s { color: var(--pluma); } .code .c { color: #8C7F74; }
.usage { display: grid; gap: 8px; }
.meter { height: 8px; border-radius: 999px; background: var(--bg-2); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--tinta); border-radius: inherit; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.stack { display: grid; gap: 20px; }

/* ---------- Modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(35,30,32,.45); display: grid; place-items: center; padding: 16px; z-index: 40; animation: fade .15s ease; }
.modal { width: min(460px, 100%); background: var(--card); border-radius: 20px; padding: 24px; display: grid; gap: 16px; box-shadow: 0 30px 80px rgba(35,30,32,.3); }
.modal h2 { margin: 0; font-size: 20px; letter-spacing: -.02em; }
.modal p.sub { margin: -8px 0 0; color: var(--muted); font-size: 14px; }
@keyframes fade { from { opacity: 0; } }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--toga); color: var(--on-toga); padding: 12px 18px; border-radius: 12px; font-size: 14px; font-weight: 500;
  transition: opacity .2s, transform .2s; z-index: 50; max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Responsivo ---------- */
@media (max-width: 1080px) {
  .detail, .settings, .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .auth-side { padding: 28px 20px; }
  .auth-side img.juri, .auth-side .auth-copy p { display: none; }
  .shell { grid-template-columns: 1fr; }
  .side { position: sticky; top: 0; height: auto; flex-direction: row; align-items: center; padding: 10px 12px; gap: 12px; border-right: 0; border-bottom: 1px solid var(--line); z-index: 10; overflow-x: auto; }
  .side .brand span { display: none; }
  .menu { display: flex; gap: 2px; }
  .menu a { padding: 8px 10px; }
  .menu a .label, .menu .count { display: none; }
  .side-foot { margin: 0 0 0 auto; display: flex; }
  .me { display: none; }
  .main { padding: 20px 16px 48px; }
  .list-head { display: none; }
  .row { grid-template-columns: minmax(0, 1fr) 20px; gap: 6px 12px; }
  .row .who { grid-column: 1; }
  .row .what { grid-column: 1; grid-row: 2; }
  .row .badge { grid-column: 1; grid-row: 3; }
  .row .chev { grid-column: 2; grid-row: 1 / 4; }
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .stat { padding: 12px; }
  .stat b { font-size: 22px; }
  .stat span { font-size: 11.5px; line-height: 1.3; overflow-wrap: anywhere; }
  .search { margin-left: 0; width: 100%; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- Consulta real ---------- */
.tag-ex { display: inline-block; vertical-align: 2px; margin-left: 6px; font-size: 10.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); background: var(--bg-2); padding: 1px 6px; border-radius: 5px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.refresh { display: flex; align-items: center; gap: 10px; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn[disabled] { opacity: .6; cursor: default; }
.alert { background: var(--alerta-soft); color: var(--alerta); border-radius: 12px; padding: 12px 14px; font-size: 14px; margin-bottom: 16px; }
