* { box-sizing: border-box; }
:root {
  --bg: #f7f5f2; --surface: #fff; --surface2: #efeae2; --line: #e2ddd3;
  --ink: #1c1917; --muted: #6e675e; --accent: #e05a1e; --accent-soft: #fbe9e0;
  --green: #1a7f4e; --green-soft: #e3f2ea; --amber: #9a6a10; --amber-soft: #f7efdd; --red: #c93a2e; --red-soft: #fbe6e3;
  /* sidebar clara — identidade SAT-Dashboard (sidebar #fff, ativo surface-3 #ece7df) */
  --side: #ffffff; --side-ink: #6e675e; --side-muted: #9c948a; --side-active: #ece7df; --side-line: #efebe4;
}
body { font-family: "Segoe UI", system-ui, -apple-system, sans-serif; color: var(--ink); background: var(--bg); margin: 0; font-size: 14px; line-height: 1.55; }
.mono { font-family: "JetBrains Mono", ui-monospace, Consolas, monospace; font-variant-numeric: tabular-nums; }

table { border-collapse: collapse; width: 100%; }
th, td { border: 1px solid #ddd; padding: .4rem .6rem; text-align: left; }
th { background: #f5f5f5; }
label { display: block; margin: .5rem 0; }
input, select { padding: .35rem; width: 100%; max-width: 24rem; }
button { padding: .45rem .9rem; cursor: pointer; }
.error { color: #b3391f; }
.status { padding: .1rem .5rem; border-radius: .6rem; background: #eee; }
.badge { display: inline-block; padding: .1rem .5rem; border-radius: .6rem; font-size: .85rem; font-weight: 600; }
.verdict-ok { background: #e6f4ea; color: #137333; }
.verdict-nc { background: #fce8e6; color: #b3391f; }
.verdict-nv { background: #eee; color: #555; }
.verdict-approved { background: #e6f4ea; color: #137333; }
.verdict-rejected { background: #fce8e6; color: #b3391f; }
.verdict-approved_with_reservations { background: #fef7e0; color: #9a6700; }

/* AUTH (no sidebar, e.g. login) */
main.content.auth { max-width: 24rem; margin: 4rem auto; padding: 1rem; }

/* SHELL + SIDEBAR */
.nav-toggle, .scrim, .hamburger { display: none; }
.shell { display: flex; min-height: 100vh; }
.side { width: 224px; flex: none; background: var(--side); color: var(--side-ink); border-right: 1px solid var(--side-line); display: flex; flex-direction: column; padding: 18px 10px; }
.side .brand { padding: 0 10px 14px; }
.side .brand .brand-logo { height: 36px; width: auto; display: block; }
.side nav { flex: 1; }
.side nav .group { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--side-muted); padding: 14px 10px 6px; }
.side a { display: block; padding: 7px 10px; border-radius: 8px; color: var(--side-ink); text-decoration: none; font-size: 13.5px; font-weight: 500; margin: 1px 0; }
.side a:hover { color: var(--ink); background: #f3f0eb; }
.side a.active { background: var(--side-active); color: var(--ink); }
.side a .badge { float: right; background: var(--accent); color: #fff; font-size: 10.5px; padding: 1px 7px; border-radius: 9px; }
.side .user { border-top: 1px solid var(--side-line); margin-top: 8px; padding: 14px 10px 2px; font-size: 12px; }
.side .user .who { color: var(--ink); font-weight: 600; }
.side .user .role { color: var(--side-muted); font-size: 11px; text-transform: capitalize; }

/* MAIN */
.main { flex: 1; min-width: 0; }
.top { display: flex; align-items: center; gap: 16px; padding: 16px 30px; border-bottom: 1px solid var(--line); background: var(--surface); }
.top h1 { font-size: 18px; margin: 0; }
.top form { margin-left: auto; }
main.content { padding: 24px 30px 50px; max-width: 1100px; }

/* DASHBOARD */
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; color: var(--accent); margin-bottom: 8px; }
.headline { font-size: 27px; line-height: 1.15; font-weight: 700; letter-spacing: -.02em; max-width: 26ch; margin-bottom: 8px; }
.headline.ok { color: var(--green); } .headline.bad { color: var(--red); } .headline.warn { color: var(--amber); }
.sub { color: var(--muted); max-width: 66ch; margin-bottom: 20px; }
.banner { background: var(--red-soft); color: var(--red); border-radius: 8px; padding: 10px 16px; margin-bottom: 20px; font-size: 13px; }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 26px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.kpi .label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.kpi .val { font-size: 25px; font-weight: 650; margin-top: 4px; }
.kpi .val.bad { color: var(--red); } .kpi .val.warn { color: var(--amber); } .kpi .val.ok { color: var(--green); }
.kpi .delta { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

.chapter { font-size: 12px; font-weight: 700; letter-spacing: .04em; color: var(--accent); margin: 26px 0 4px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin-bottom: 8px; }
.card .ch { display: flex; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.card .ch h3 { font-size: 14px; margin: 0; }
.card table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.card th { text-align: left; padding: 9px 16px; background: var(--surface2); color: var(--muted); font-weight: 600; font-size: 11px; letter-spacing: .02em; border: none; }
.card td { padding: 9px 16px; border: none; border-top: 1px solid var(--line); vertical-align: middle; }
.card td.num, .card th.num { text-align: right; }
.card td.bad { color: var(--red); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.muted { color: var(--muted); }

.pill { display: inline-block; padding: 1px 8px; border-radius: 9px; font-size: 10.5px; font-weight: 600; }
.pill.plan { background: var(--amber-soft); color: var(--amber); }
.pill.done { background: var(--green-soft); color: var(--green); }
.pill.late { background: var(--red-soft); color: var(--red); }
.pill.todo { background: var(--accent-soft); color: var(--accent); }

/* INBOX: month nav + calendar/list toggle */
.month-nav { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; font-size: 14px; }
.month-nav .link { color: var(--accent); text-decoration: none; font-weight: 600; }

.view-toggle-input { display: none; }
.view-cal-panel, .view-list-panel { display: none; }
#view-cal:checked ~ .view-cal-panel { display: block; }
#view-list:checked ~ .view-list-panel { display: block; }
.view-tabs { display: flex; gap: 6px; margin-bottom: 16px; }
.view-tab { padding: 6px 14px; border-radius: 8px; background: var(--surface2); color: var(--muted); font-size: 12.5px; font-weight: 600; cursor: pointer; }
#view-cal:checked ~ .view-tabs .tab-cal,
#view-list:checked ~ .view-tabs .tab-list { background: var(--accent); color: #fff; }

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 20px; }
.cal-grid .dow { font-size: 10.5px; font-weight: 700; text-transform: uppercase; color: var(--muted); text-align: center; padding: 4px 0; }
.cal-day { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; min-height: 92px; padding: 6px 7px; }
.cal-day.out { background: var(--surface2); border-color: transparent; }
.cal-day .num { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.cal-day .pill.chip { display: block; margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.designar-form { display: flex; gap: 6px; align-items: center; flex-wrap: nowrap; }
.designar-form select, .designar-form input { width: auto; padding: .25rem .35rem; font-size: 12px; }
.designar-form button { padding: .25rem .6rem; font-size: 12px; }

.barwrap { display: block; height: 4px; background: var(--surface2); border-radius: 3px; margin-top: 4px; overflow: hidden; }
.barwrap .bar { display: block; height: 100%; background: var(--accent); border-radius: 3px; }

.filters-form { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; margin-bottom: 20px; }
.filters-form label { margin: 0; font-size: 11px; color: var(--muted); }
.filters-form input { width: auto; max-width: 11rem; }
.filters-form button { align-self: stretch; }

@media (max-width: 860px) {
  .hamburger { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; cursor: pointer; font-size: 18px; }
  .side { position: fixed; top: 0; left: 0; bottom: 0; z-index: 30; transform: translateX(-100%); transition: transform .2s ease; }
  .nav-toggle:checked ~ .shell .side { transform: translateX(0); }
  .nav-toggle:checked ~ .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 25; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .two, .three { grid-template-columns: 1fr; }
}

.bib-bar { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.bib-search { flex: 1; min-width: 220px; padding: 7px 10px; }
.bib-clear { color: var(--muted); font-size: 12px; }
.bib-upload { margin-bottom: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; }
.bib-upform { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.bib-group { margin-bottom: 18px; }
.bib-group h2 { font-size: 14px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.bib-count { background: var(--surface2); border-radius: 8px; padding: 0 7px; font-size: 12px; }
.bib-doc { display: flex; justify-content: space-between; align-items: center; padding: 8px 4px; border-bottom: 1px solid var(--line); gap: 12px; }
.bib-doc-main { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bib-badge { font-size: 10.5px; padding: 1px 7px; border-radius: 9px; }
.bib-badge-sop { background: var(--accent-soft); color: var(--accent); }
.bib-badge-outro { background: var(--surface2); color: var(--muted); }
.bib-idx { font-size: 11px; color: var(--muted); }
.bib-idx-err { color: var(--red); }
.bib-doc-meta { display: flex; align-items: center; gap: 10px; }
.bib-file { font-size: 11px; color: var(--muted); }
.bib-inline { display: inline; }
.bib-link { background: none; border: none; color: var(--accent); cursor: pointer; font-size: 12px; padding: 0; }
.bib-danger { color: var(--red); }
.bib-empty { color: var(--muted); padding: 20px 0; }
.notice-err { background: var(--red-soft); color: var(--red); padding: 8px 12px; border-radius: 6px; margin-bottom: 12px; }

/* INBOX v2: command bar */
.cmdbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.sentinel { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 7px 12px; font-size: 12.5px; }
.sentinel .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.sentinel button { padding: .2rem .6rem; font-size: 12px; }
#busca-sat { flex: 1; min-width: 200px; max-width: 340px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.chips .chip { display: inline-flex; align-items: center; gap: 7px; padding: 6px 13px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; font-size: 12.5px; font-weight: 600; }
.chips .chip b { font-weight: 650; }
.chips .chip.on { border-color: var(--accent); color: var(--accent); }
.chips .chip.c-late b { color: var(--red); } .chips .chip.c-done b { color: var(--green); } .chips .chip.c-plan b { color: var(--amber); }
.filterbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filterbar select { width: auto; max-width: 170px; padding: .35rem .5rem; font-size: 12.5px; }
.filterbar button { padding: .35rem .8rem; font-size: 12.5px; }

/* CERTIFICATIONS (scoped .cert-*) */
.cert-row { cursor: pointer; }
.cert-row:hover { background: var(--surface2); }
.cert-header { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.cert-header h2 { font-size: 18px; margin: 0; }
.cert-form textarea { width: 100%; max-width: 24rem; padding: .35rem; font-family: inherit; resize: vertical; }

/* CERTIFICAÇÕES */
.cert-flag { display: inline-block; padding: 0 6px; border-radius: 6px; font-size: 9.5px; font-weight: 700; background: var(--red); color: #fff; margin-left: 4px; letter-spacing: .04em; }

/* PÓS-VENDA (scoped .pv-*) */
.pv-overdue { color: var(--red); font-weight: 600; }
.pv-form textarea { width: 100%; max-width: 32rem; padding: .35rem; font-family: inherit; resize: vertical; }
.pv-note { padding: 8px 0; border-bottom: 1px solid var(--line); }
.pv-note:last-of-type { border-bottom: none; }

/* EQUIPE (scoped .eq-*) */
.eq-deficit { color: var(--red); font-weight: 700; }

/* RNC — Fila de Ataque (Pós-Venda v2) */
.rnc-subnav { display: flex; gap: 4px; margin: 8px 0 16px; }
.rnc-subnav a { padding: 6px 14px; border-radius: 8px; font-size: 12.5px; font-weight: 600; color: var(--muted); text-decoration: none; }
.rnc-subnav a.on { background: var(--accent); color: #fff; }
.rnc-subnav a:not(.on):hover { background: var(--surface2); }
.rnc-country { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }
.rnc-chip-flag { border-color: var(--red); }
.rnc-chip-flag.on { background: var(--red); color: #fff; }
.rnc-row-flagged { background: var(--red-soft); }
.rnc-flag { display: inline-block; padding: 0 6px; border-radius: 6px; font-size: 9.5px; font-weight: 700; background: var(--red); color: #fff; letter-spacing: .03em; }
.pill.rnc-s-b1, .pill.rnc-s-b2 { background: var(--amber-soft); color: var(--amber); }
.pill.rnc-s-b3, .pill.rnc-s-b4 { background: #e3effb; color: #2b6cb0; }
.pill.rnc-s-b5 { background: var(--green-soft); color: var(--green); }
.pill.rnc-s-b6 { background: var(--surface2); color: var(--muted); }

.rnc-boardtoggle { display: inline-flex; gap: 2px; margin: 8px 0; border: 1px solid var(--line, #e5e7eb); border-radius: 8px; overflow: hidden; }
.rnc-boardtoggle a { padding: 5px 12px; font-size: 12.5px; text-decoration: none; color: inherit; }
.rnc-boardtoggle a.on { background: var(--rnc, #C0742E); color: #fff; }

/* RNC — Kanban / Aging */
.rnc-kanban { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.rnc-kcol { background: var(--surface2); border-radius: 12px; padding: 10px; }
.rnc-khead { font-size: 12px; font-weight: 700; color: var(--ink); padding: 4px 6px 10px; display: flex; align-items: center; gap: 6px; }
.rnc-khead b { margin-left: auto; }
.rnc-kcard { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 6px; text-decoration: none; color: var(--ink); }
.rnc-kcard:hover { border-color: var(--accent); }
.rnc-kc-top { display: flex; justify-content: space-between; font-weight: 650; font-size: 12.5px; }
.rnc-kc-meta { font-size: 11px; color: var(--muted); margin-top: 3px; }
.rnc-aging-row { display: flex; align-items: center; gap: 10px; margin: 7px 0; }
.rnc-aging-label { width: 68px; font-size: 12px; color: var(--muted); flex: none; }
.rnc-aging-row .barwrap { flex: 1; height: 10px; }
.rnc-aging-val { width: 80px; text-align: right; font-size: 12px; flex: none; }

/* Painel Gerencial (R-6) */
.painel-kpis { grid-template-columns: repeat(3, 1fr); }
.painel-kpi-grey .val { color: var(--muted); }
.painel-delta.up { color: var(--red); } /* mais RNC/custo = pior, então "sobe" em vermelho */
.painel-delta.down { color: var(--green); }
.painel-chart { width: 100%; height: auto; display: block; }
.painel-bar { fill: var(--accent-soft); }
.painel-line { fill: none; stroke: var(--accent); stroke-width: 2; }
.painel-dot { fill: var(--accent); }
.painel-axis-label { font-size: 9px; fill: var(--muted); }
.painel-legend { padding: 8px 16px 12px; font-size: 11px; color: var(--muted); display: flex; gap: 16px; }
.painel-legend-item { display: inline-flex; align-items: center; gap: 5px; }
.painel-dot-legend { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); display: inline-block; }
.painel-bar-legend { width: 8px; height: 8px; background: var(--accent-soft); display: inline-block; }
.painel-swatch { display: inline-block; width: 9px; height: 9px; border-radius: 50%; vertical-align: middle; margin-right: 4px; }
.painel-barlist { padding: 10px 16px; }
.painel-barrow { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.painel-barrow-label { width: 110px; font-size: 12px; color: var(--muted); flex: none; }
.painel-barrow .barwrap { flex: 1; height: 12px; }
.painel-barrow-value { width: 130px; text-align: right; font-size: 12px; flex: none; }
@media (max-width: 900px) { .painel-kpis { grid-template-columns: repeat(2, 1fr); } }

.painel-ytd{margin:18px 0}
.painel-ytd-h{font-size:14px;margin:0 0 10px}
.painel-ytd-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:12px}
.painel-ytd-card{border:1px solid #e5e7eb;border-radius:12px;padding:14px;background:#fff}
.painel-ytd-card .l{font-size:11px;text-transform:uppercase;letter-spacing:.05em;color:#6b7280;font-weight:700}
.painel-ytd-card .v{font-size:22px;font-weight:750;margin-top:4px}
.painel-ytd-card .s{font-size:11.5px;color:#9aa4b2;margin-top:2px}
.painel-ytd-card.ok .v{color:#2E9E6B}.painel-ytd-card.open .v{color:#C99A2E}.painel-ytd-card.lost .v{color:#C0392B}

.home-full{min-height:100vh}
.home{max-width:720px;margin:8vh auto;text-align:center;padding:0 20px}
.home-logo{width:52px;height:52px;border-radius:13px;margin:0 auto 14px;display:grid;place-items:center;color:#fff;font-weight:800;background:linear-gradient(135deg,#2E8FA8,#C0742E)}
.home-h1{font-size:26px;margin:0 0 4px}
.home-sub{color:#6b7280;margin:0 0 26px}
.home-areas{display:grid;grid-template-columns:1fr 1fr;gap:18px}
.home-card{position:relative;text-align:left;border:1px solid #e5e7eb;border-radius:12px;padding:22px;text-decoration:none;color:inherit;background:#fff;transition:.16s}
.home-card:hover{transform:translateY(-2px);box-shadow:0 8px 24px rgba(0,0,0,.08)}
.home-rail{position:absolute;left:0;top:0;bottom:0;width:4px;border-radius:12px 0 0 12px}
.home-inspecoes .home-rail{background:#2E8FA8}.home-rnc .home-rail{background:#C0742E}
.home-card h3{margin:0 0 10px;font-size:17px}
.home-mods{display:flex;flex-wrap:wrap;gap:6px}
.home-mods span{font-size:11.5px;color:#6b7280;background:#f3f4f6;border:1px solid #e5e7eb;padding:2px 8px;border-radius:6px}
.side-area{display:flex;align-items:center;gap:8px;margin:0 0 10px;padding:8px 10px;border-radius:9px;background:rgba(255,255,255,.06);font-size:12px;font-weight:700}
.side-area .dot{width:8px;height:8px;border-radius:50%}
.side-inspecoes .dot{background:#4FB6CE}.side-inspecoes .side-area-l{color:#4FB6CE}
.side-rnc .dot{background:#DB9455}.side-rnc .side-area-l{color:#DB9455}
.side-swap{margin-left:auto;font-size:10.5px;color:#9aa4b2;text-decoration:none;border:1px solid rgba(255,255,255,.12);padding:2px 7px;border-radius:6px}
@media (max-width:720px){.home-areas{grid-template-columns:1fr}}
