/* Paleta extraída da logo Mosaic */
:root {
  --navy: #1a0b8f;
  --navy-deep: #0f0766;
  --blue: #1e5aae;
  --sky: #4fa3de;
  --teal: #2fbf9b;
  --mint: #7fe0c8;
  --graphite: #262626;
  --silver: #9aa3ae;

  --bg: #f3f5fa;
  --card: #ffffff;
  --ink: #1b1d2a;
  --ink-2: #4b5165;
  --muted: #7c8397;
  --line: #e4e8f1;
  --good: #1fa981;
  --bad: #e5484d;
  --warn: #e8a317;

  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 24, 60, .05), 0 6px 22px rgba(20, 24, 60, .06);
  --font: 'Plus Jakarta Sans', 'Segoe UI', system-ui, sans-serif;
  --font-num: 'Sora', 'Plus Jakarta Sans', 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--ink); font-size: 14px; display: flex; -webkit-font-smoothing: antialiased; }
a { color: var(--blue); cursor: pointer; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -.01em; }

/* Sidebar */
.sidebar { width: 250px; flex: 0 0 250px; height: 100vh; position: sticky; top: 0; display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--navy-deep) 0%, var(--navy) 55%, #1b2f9c 100%); color: #dfe3ff; overflow-y: auto; }
.brand { background: #fff; margin: 14px; border-radius: 12px; padding: 10px 12px; }
.brand img { width: 100%; display: block; }
nav { padding: 4px 10px 16px; flex: 1; }
.nav-label { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--mint); opacity: .8; margin: 16px 10px 6px; font-weight: 700; }
nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; color: #dfe3ff; text-decoration: none; font-weight: 500; margin: 2px 0; transition: background .15s; }
nav a:hover { background: rgba(255, 255, 255, .08); }
nav a.active { background: linear-gradient(90deg, var(--teal), #27a6a0); color: #fff; box-shadow: 0 4px 14px rgba(47, 191, 155, .35); }
nav .ico { width: 20px; text-align: center; font-size: 15px; }
.sidebar-foot { font-size: 11px; opacity: .6; padding: 12px 20px 18px; }

/* Main */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 16px; padding: 16px 28px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; flex-wrap: wrap; }
.topbar-title { flex: 1; min-width: 200px; }
.topbar-title h1 { font-size: 21px; }
.topbar-title .sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.topbar-controls { display: flex; gap: 12px; flex-wrap: wrap; }
.ctl { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
select, input, textarea { font-family: var(--font); font-size: 13.5px; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; outline: none; }
select:focus, input:focus { border-color: var(--sky); box-shadow: 0 0 0 3px rgba(79, 163, 222, .18); }
.ctl select { min-width: 190px; }
.view { padding: 22px 28px 60px; }

/* Buttons */
.btn { font-family: var(--font); display: inline-flex; align-items: center; gap: 8px; border: 0; border-radius: 10px; padding: 9px 16px; font-weight: 600; font-size: 13.5px; cursor: pointer; background: var(--navy); color: #fff; transition: transform .08s, box-shadow .15s, background .15s; }
.btn:hover { box-shadow: 0 6px 16px rgba(26, 11, 143, .25); }
.btn:active { transform: translateY(1px); }
.btn.teal { background: var(--teal); }
.btn.blue { background: var(--blue); }
.btn.ghost { background: transparent; color: var(--navy); border: 1px solid var(--line); }
.btn.ghost:hover { background: #f4f6fd; box-shadow: none; }
.btn.danger { background: var(--bad); }
.btn.sm { padding: 6px 11px; font-size: 12.5px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn[hidden] { display: none; }
.btn-icon { background: transparent; border: 0; font-size: 18px; cursor: pointer; color: var(--ink-2); padding: 6px; border-radius: 8px; }
.btn-icon:hover { background: #eef1f8; }
.only-mobile { display: none; }

/* Cards, grid */
.grid { display: grid; gap: 16px; }
.g-kpi { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; min-width: 0; border: 1px solid rgba(228, 232, 241, .6); }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h3 { font-size: 15.5px; }
.card-head .hint { color: var(--muted); font-size: 12px; margin-top: 3px; font-weight: 500; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-2); margin: 26px 0 12px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.section-title::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.mt { margin-top: 16px; }

/* KPI */
.kpi { position: relative; overflow: hidden; }
.kpi::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--accent, var(--blue)); }
.kpi .lbl { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.kpi .val { font-family: var(--font-num); font-size: 24px; font-weight: 600; margin: 8px 0 6px; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .val small { font-size: 13px; color: var(--muted); font-weight: 500; }
.kpi .cmp { display: flex; gap: 10px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); }
.kpi .foot { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.chip { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; font-size: 11.5px; padding: 2px 7px; border-radius: 99px; background: #eef1f8; color: var(--ink-2); }
.chip.up { background: rgba(31, 169, 129, .12); color: var(--good); }
.chip.down { background: rgba(229, 72, 77, .1); color: var(--bad); }
.chip.warn { background: rgba(232, 163, 23, .14); color: #a86f00; }
.chip.blue { background: rgba(30, 90, 174, .1); color: var(--blue); }
.chip.navy { background: rgba(26, 11, 143, .08); color: var(--navy); }

/* Chart containers */
.chart { position: relative; height: 300px; }
.chart.tall { height: 380px; }
.chart.short { height: 240px; }

/* Tables */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #fafbfe; position: sticky; top: 0; }
table.t td { padding: 8px 10px; border-bottom: 1px solid #f0f2f7; vertical-align: middle; }
table.t tr:hover td { background: #f8f9fd; }
table.t .n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.t tfoot td { font-weight: 700; background: #f6f8fc; border-top: 1px solid var(--line); }
table.t tr.grp td { background: #eef3fb; font-weight: 700; color: var(--navy); }
.bar-inline { height: 6px; border-radius: 99px; background: #eef1f8; overflow: hidden; min-width: 70px; }
.bar-inline > i { display: block; height: 100%; background: linear-gradient(90deg, var(--blue), var(--teal)); }
.scroll-400 { max-height: 440px; overflow: auto; }

/* Status */
.st { display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 6px; white-space: nowrap; }
.st.ok, .st.dentro { background: rgba(31, 169, 129, .12); color: var(--good); }
.st.bad, .st.fora, .st.divergente { background: rgba(229, 72, 77, .1); color: var(--bad); }
.st.warn, .st.so-xml, .st.so-relatorio, .st.sem-medicao { background: rgba(232, 163, 23, .14); color: #a86f00; }
.st.muted, .st.cancelada, .st.cancelada-no-relatorio { background: #eef1f8; color: var(--muted); }

/* Import */
.drop { border: 2px dashed #cfd6e6; border-radius: 14px; padding: 22px; text-align: center; background: #fbfcff; transition: border-color .15s, background .15s; }
.drop.over { border-color: var(--teal); background: rgba(47, 191, 155, .06); }
.drop h4 { font-size: 15px; margin-bottom: 4px; }
.drop p { color: var(--muted); margin: 0 0 14px; font-size: 12.5px; }
.drop .actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.imp-card .icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; color: #fff; margin-bottom: 10px; }
.progress { font-size: 12.5px; color: var(--ink-2); margin-top: 10px; min-height: 18px; }
.rel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.rel-item { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: #fff; display: flex; flex-direction: column; gap: 8px; }
.rel-item h4 { font-size: 14px; }
.rel-item p { margin: 0; color: var(--muted); font-size: 12px; flex: 1; }
.xpert-id { display: flex; gap: 10px; align-items: center; background: #f1f3fc; border: 1px solid #dfe3f6; border-radius: 10px; padding: 8px 10px; font-size: 12px; color: var(--ink-2); line-height: 1.35; }
.xpert-id b { color: var(--navy); }
.xpert-num { flex: 0 0 auto; min-width: 46px; height: 34px; border-radius: 8px; background: var(--navy); color: #fff; display: grid; place-items: center; font-family: var(--font-num); font-weight: 700; font-size: 13.5px; padding: 0 6px; }
select.alterado { border-color: var(--teal); background: rgba(47, 191, 155, .08); font-weight: 600; }
.conf-ok { color: var(--good); font-weight: 700; } .conf-bad { color: var(--bad); font-weight: 700; }

/* Alerts / audit */
.alert { display: flex; gap: 12px; padding: 12px 14px; border-radius: 12px; background: #fff; border: 1px solid var(--line); margin-bottom: 10px; align-items: flex-start; }
.alert .dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; flex: 0 0 10px; }
.alert.alto .dot { background: var(--bad); } .alert.medio .dot { background: var(--warn); } .alert.info .dot { background: var(--sky); }
.alert h4 { font-size: 13.5px; margin-bottom: 3px; }
.alert p { margin: 0; color: var(--ink-2); font-size: 12.5px; line-height: 1.5; }
.alert .v { margin-left: auto; font-family: var(--font-num); font-weight: 600; white-space: nowrap; font-size: 13px; }
.empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty h3 { color: var(--ink); margin-bottom: 8px; }
.note { font-size: 12px; color: var(--muted); line-height: 1.5; }
.note b { color: var(--ink-2); }
.pill-tabs { display: inline-flex; background: #eef1f8; padding: 3px; border-radius: 10px; gap: 2px; flex-wrap: wrap; }
.pill-tabs button { font-family: var(--font); border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; font-weight: 600; font-size: 12.5px; color: var(--ink-2); cursor: pointer; }
.pill-tabs button.on { background: #fff; color: var(--navy); box-shadow: 0 1px 4px rgba(20, 24, 60, .1); }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.filters label { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; }
.legend-status { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); margin-top: 8px; }
.legend-status i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* Modal / toast */
.modal { position: fixed; inset: 0; background: rgba(15, 7, 102, .35); backdrop-filter: blur(2px); z-index: 100; display: grid; place-items: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal-card { background: #fff; border-radius: 16px; width: min(980px, 100%); max-height: 92vh; display: flex; flex-direction: column; box-shadow: 0 30px 80px rgba(15, 7, 102, .3); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 18px 20px; overflow: auto; }
.modal-foot { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin-bottom: 14px; }
.map-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.map-grid label b { color: var(--bad); }
.toast { position: fixed; bottom: 22px; right: 22px; background: var(--graphite); color: #fff; padding: 12px 18px; border-radius: 12px; z-index: 200; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); max-width: 420px; font-size: 13px; }
.toast.ok { background: var(--good); } .toast.err { background: var(--bad); }

@media (max-width: 1100px) { .g3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 860px) {
  body { display: block; }
  .sidebar { position: fixed; left: -270px; z-index: 50; transition: left .2s; }
  .sidebar.open { left: 0; }
  .only-mobile { display: inline-block; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .topbar, .view { padding-left: 16px; padding-right: 16px; }
  .ctl select { min-width: 150px; }
}
@media print { .sidebar, .topbar { display: none; } .view { padding: 0; } }
.st.blue { background: rgba(30, 90, 174, .1); color: var(--blue); }

/* Sugestões: um bloco por sugestão */
.card.sug { margin-bottom: 14px; border-left: 4px solid var(--silver); }
.card.sug.sug-bad { border-left-color: var(--bad); } .card.sug.sug-warn { border-left-color: var(--warn); } .card.sug.sug-blue { border-left-color: var(--sky); }
.sug-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.sug-head h3 { font-size: 15px; }
.sug-area { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.sug-resumo { margin: 0 0 10px; color: var(--ink-2); font-size: 13px; line-height: 1.5; }
.sug-acao { margin-top: 10px; background: rgba(47, 191, 155, .08); border-left: 3px solid var(--teal); border-radius: 8px; padding: 9px 12px; font-size: 13px; color: var(--ink); line-height: 1.5; }.card.sug.sug-ok { border-left-color: var(--good); }
.sug-valor { margin-left: auto; font-family: var(--font-num); font-weight: 600; font-size: 14px; white-space: nowrap; }

/* Apresentação ao cliente */
.slide { background: var(--card); border-radius: 16px; box-shadow: var(--shadow); padding: 26px 30px; margin-bottom: 20px; border-top: 5px solid var(--navy); }
.slide-capa { text-align: center; padding: 50px 30px; background: linear-gradient(135deg, var(--navy-deep), var(--navy) 60%, var(--blue)); color: #fff; border-top-color: var(--teal); }
.slide-capa img { width: 340px; max-width: 80%; background: #fff; border-radius: 14px; padding: 12px 18px; }
.slide-capa h1 { font-size: 34px; margin-top: 26px; } .slide-capa h2 { font-size: 20px; font-weight: 600; margin-top: 8px; color: var(--mint); } .slide-capa p { font-size: 16px; opacity: .85; }
.slide-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.slide-head h2 { font-size: 24px; color: var(--navy); }
.slide-num { width: 38px; height: 38px; border-radius: 10px; background: var(--teal); color: #fff; display: grid; place-items: center; font-family: var(--font-num); font-weight: 700; }
.slide-manchete { font-size: 18px; font-weight: 600; line-height: 1.45; padding: 14px 18px; border-radius: 12px; margin-bottom: 16px; background: #f1f3fc; border-left: 5px solid var(--navy); }
.slide-manchete.tom-bad { background: rgba(229, 72, 77, .07); border-left-color: var(--bad); } .slide-manchete.tom-good { background: rgba(31, 169, 129, .08); border-left-color: var(--good); }
.slide-pontos { margin: 16px 0 6px; padding-left: 22px; font-size: 14.5px; line-height: 1.7; color: var(--ink-2); }
.slide-resumo { display: grid; gap: 10px; }
.res-item { display: grid; grid-template-columns: 200px 1fr; gap: 14px; padding: 12px 16px; border-radius: 10px; background: #f7f8fc; border-left: 4px solid var(--navy); font-size: 14.5px; line-height: 1.5; }
.res-item.tom-bad { border-left-color: var(--bad); } .res-item.tom-good { border-left-color: var(--good); }
.res-item b { color: var(--navy); }
/* ===== Licenciamento: tela de liberação ===== */
body.lic-bloqueado > .sidebar, body.lic-bloqueado > .main, body.lic-bloqueado > .modal, body.lic-bloqueado > .toast { display: none !important; }
#licTela { flex: 1; min-height: 100vh; display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px;
  background: linear-gradient(160deg, var(--navy-deep) 0%, var(--navy) 50%, #1b2f9c 100%); }
.lic-card { width: 100%; max-width: 720px; background: var(--card); border-radius: 18px; box-shadow: 0 20px 60px rgba(8, 6, 60, .35); padding: 28px 32px 22px; }
.lic-logo { display: flex; justify-content: center; margin-bottom: 14px; }
.lic-logo img { width: 230px; max-width: 70%; }
.lic-card h1 { text-align: center; font-size: 22px; color: var(--navy); }
.lic-msg { text-align: center; color: var(--ink-2); margin: 6px 0 18px; }
.lic-msg.alerta { color: var(--bad); font-weight: 600; }
.lic-passos { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 18px; }
.lic-passos li { padding-left: 4px; color: var(--ink-2); }
.lic-passos li b { color: var(--ink); }
.lic-passos li::marker { color: var(--teal); font-weight: 800; }
.lic-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin-top: 10px; }
.lic-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.lic-grid .lic-span2 { grid-column: span 2; }
.lic-passos textarea { width: 100%; margin-top: 8px; font-family: Consolas, 'Courier New', monospace; font-size: 12px; resize: vertical; word-break: break-all; }
.lic-acoes { display: flex; align-items: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.lic-acoes a.btn { text-decoration: none; }
.lic-res { font-size: 13px; font-weight: 600; color: var(--muted); }
.lic-res.ok { color: var(--good); }
.lic-res.erro { color: var(--bad); }
.lic-rod { text-align: center; font-size: 11.5px; color: var(--muted); margin-top: 22px; border-top: 1px solid var(--line); padding-top: 12px; }
.lic-foot { margin-bottom: 6px; opacity: 1; color: #fff; }
@media (max-width: 640px) { .lic-grid { grid-template-columns: 1fr; } .lic-grid .lic-span2 { grid-column: auto; } .lic-card { padding: 22px 18px; } }
