:root {
  --roxo: #6200a8;
  --roxo-escuro: #270049;
  --roxo-claro: #b9a3dc;
  --cinza-grid: #6d7582;
  --cinza-borda: #c6ccd7;
  --fundo: #f2f4f8;
  --texto: #46505a;
  --vermelho: #dc3545;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Noto Sans", sans-serif;
  font-size: 13px;
  color: var(--texto);
  background: #fff;
  padding-top: 80px;
}
a { color: var(--roxo); text-decoration: none; }

/* ---------- barra superior ---------- */
.topbar {
  position: fixed; inset: 0 0 auto 0; height: 40px; z-index: 1030;
  display: flex; align-items: center; gap: 12px; padding: 0 16px;
  background: var(--roxo);
}
.brand { color: #fff; font-weight: 700; font-size: 26px; letter-spacing: -0.5px; font-style: italic; }
.menu-search { position: relative; display: flex; align-items: center; background: var(--roxo-escuro); border-radius: 14px; height: 28px; padding: 0 12px; color: #fff; width: 160px; }
.menu-search input { background: transparent; border: 0; outline: 0; color: #fff; width: 100%; margin-left: 8px; font-size: 13px; }
.menu-search input::placeholder { color: #fff; }
.menu-search-results { position: absolute; top: 32px; left: 0; width: 320px; max-height: 60vh; overflow: auto; background: #fff; border-radius: 6px; box-shadow: 0 6px 20px rgba(0,0,0,.2); display: none; }
.menu-search-results.open { display: block; }
.menu-search-results a { display: block; padding: 6px 12px; color: var(--texto); }
.menu-search-results a:hover { background: var(--fundo); }
.menu-search-results small { color: #999; }

.main-menu { list-style: none; display: flex; margin: 0 auto; padding: 0; gap: 4px; }
.main-menu > li { position: relative; }
.main-menu > li > a { color: #fff; font-weight: 600; padding: 10px 14px; display: block; white-space: nowrap; }
.main-menu > li > a i:first-child { margin-right: 6px; }
.main-menu > li > a .fa-caret-down { margin-left: 6px; font-size: 11px; }

.dd { list-style: none; margin: 0; padding: 6px 0; position: absolute; top: 100%; left: 0; min-width: 240px; background: #fff; border-radius: 4px; box-shadow: 0 6px 18px rgba(0,0,0,.18); display: none; z-index: 1040; }
.dd-right { left: auto; right: 0; }
li:hover > .dd, .dropdown-host:hover > .dd { display: block; }
.dd li { position: relative; }
.dd a { display: flex; justify-content: space-between; align-items: center; padding: 6px 16px; color: #212529; white-space: nowrap; }
.dd a:hover { background: #ede3f6; color: var(--roxo); }
.dd .dd { top: 0; left: 100%; }
.dd .divider { border-top: 1px solid #e5e5e5; margin: 4px 0; }

.top-icons { display: flex; align-items: center; gap: 14px; color: #fff; font-size: 18px; }
.top-icons .ico { color: #fff; position: relative; cursor: pointer; display: flex; align-items: center; }
.top-icons .caret { font-size: 10px; margin-left: 3px; }
.badge-dot { position: absolute; top: -8px; right: -8px; background: #e74c3c; color: #fff; font-size: 10px; border-radius: 10px; padding: 0 5px; }
.dropdown-host { position: relative; }
.user-pill { background: var(--roxo-escuro); border-radius: 16px; padding: 2px 4px 2px 12px; font-size: 13px; font-weight: 700; display: flex; gap: 8px; align-items: center; cursor: pointer; }
.avatar { background: #fff; color: var(--roxo-escuro); border-radius: 50%; width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; }

/* ---------- barra do cliente ---------- */
.clientbar { position: fixed; top: 40px; left: 0; right: 0; height: 40px; z-index: 1020; background: #f5f5f5; display: flex; align-items: center; gap: 14px; padding: 0 24px; box-shadow: 0 2px 4px rgba(0,0,0,.08); }
.client-logo { width: 36px; height: 28px; background: #fff; border: 1px solid #ddd; color: var(--roxo); font-weight: 700; display: flex; align-items: center; justify-content: center; font-size: 11px; }
.client-info { display: flex; flex-direction: column; line-height: 1.2; }
.client-info strong { font-size: 12px; }
.client-info small { font-size: 11px; color: #555; }
.auth-warn { margin-left: auto; color: var(--vermelho); font-weight: 600; display: flex; align-items: center; gap: 2px; font-size: 14px; }
.auth-warn .material-symbols-outlined { font-size: 18px; }

.help-tab { position: fixed; right: 0; top: 42%; writing-mode: vertical-rl; transform: rotate(180deg); background: var(--roxo); color: #fff; padding: 14px 8px; border-radius: 0 6px 6px 0; font-size: 14px; z-index: 1000; }

main { padding: 12px 12px 40px; }

/* ---------- Central (dashboard) ---------- */
.dash-tabs { display: flex; background: #eee; margin: 4px 12px 0; }
.dash-tabs button { flex: 1; border: 0; background: transparent; padding: 14px; font-size: 18px; color: var(--roxo); border-bottom: 3px solid transparent; }
.dash-tabs button.active { background: #fff; font-weight: 700; border-bottom-color: var(--roxo); }
.dash-tabs button i { margin-right: 8px; }
.dash-body { margin: 8px 20px; padding: 28px 36px; box-shadow: 0 0 10px rgba(0,0,0,.08); border-radius: 6px; }
.dash-line { border-top: 3px solid var(--roxo); margin-bottom: 20px; }
.kpis { display: flex; justify-content: space-around; margin-bottom: 40px; flex-wrap: wrap; gap: 16px; }
.kpi { border: 2px solid var(--roxo); border-radius: 20px; width: 160px; padding: 14px 10px; text-align: center; color: var(--roxo); background: #fff; cursor: pointer; }
.kpi.active { background: var(--roxo-claro); color: #fff; box-shadow: 0 2px 8px rgba(98,0,168,.35); }
.kpi small { display: block; font-weight: 700; font-size: 12px; }
.kpi strong { font-size: 20px; }
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 24px; padding: 0 30px; }
.chart-card { box-shadow: 0 2px 10px rgba(0,0,0,.1); border-radius: 6px; padding: 16px; background: #fff; }
.chart-card h5 { font-weight: 400; font-size: 19px; color: #555; padding-bottom: 14px; border-bottom: 2px solid var(--roxo); margin-bottom: 16px; }
.chart-card .canvas-wrap { position: relative; height: 320px; }
.dash-filter { display: flex; gap: 12px; align-items: flex-end; margin-bottom: 24px; flex-wrap: wrap; }
.dash-filter label { display: block; font-size: 12px; font-weight: 600; }
.fab { position: fixed; right: 70px; bottom: 30px; width: 64px; height: 64px; border-radius: 50%; background: var(--roxo); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 22px; box-shadow: 0 4px 12px rgba(0,0,0,.25); border: 0; }

/* ---------- telas de listagem ---------- */
.screen { display: flex; gap: 16px; align-items: flex-start; }
.screen-main { flex: 1; min-width: 0; }
.screen-toolbar { display: flex; align-items: flex-end; gap: 8px; border-bottom: 2px solid #eee; margin-bottom: 0; }
.screen-tab { padding: 6px 16px; border-radius: 10px 10px 0 0; color: var(--roxo); font-size: 13px; cursor: pointer; }
.screen-tab.active { background: var(--roxo); color: #fff; font-weight: 700; }
.toolbar-right { margin-left: auto; display: flex; gap: 10px; align-items: center; padding-bottom: 4px; }
.btn-soft { background: #eee; border: 0; border-radius: 6px; padding: 6px 14px; font-weight: 600; color: #333; font-size: 13px; }
.btn-soft i { margin-right: 6px; }
.info-ico { color: var(--roxo); font-size: 20px; margin-left: 12px; }

.grid-wrap { border: 1px solid var(--cinza-borda); overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.grid th { background: var(--cinza-grid); color: #fff; padding: 8px 6px; text-align: left; white-space: nowrap; font-weight: 700; border-right: 1px solid #fff; }
table.grid td { padding: 6px; border-right: 1px solid #e3e3e3; white-space: nowrap; }
table.grid tbody tr:nth-child(even) { background: #f4f4f6; }
table.grid tbody tr:hover { background: #ede3f6; cursor: pointer; }
table.grid tbody tr.sel { background: #d9c6ee; }
.clas { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
.pager { background: var(--cinza-grid); color: #fff; padding: 6px 8px; display: flex; gap: 8px; align-items: center; font-weight: 600; }
.pager select { border-radius: 12px; border: 0; padding: 1px 10px; }

.side { width: 208px; flex-shrink: 0; }
.side-box { border: 1px solid #ddd; border-radius: 10px; overflow: hidden; margin-bottom: 18px; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.side-box h6 { margin: 0; background: var(--cinza-grid); color: #fff; padding: 8px 12px; font-size: 12.5px; font-weight: 700; }
.side-box .body { padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.side-btn { display: block; border: 1px solid var(--cinza-borda); border-radius: 12px; padding: 4px; text-align: center; font-weight: 700; color: #333; background: #fff; font-size: 13px; }
.side-btn:hover { border-color: var(--roxo); color: var(--roxo); }
.side-btn.danger { border-color: var(--vermelho); color: var(--vermelho); }
.side-box label { font-size: 12.5px; color: #777; margin-top: 4px; }
.side-box input, .side-box select { border: 1px solid #bbb; border-radius: 12px; padding: 3px 10px; width: 100%; font-size: 12.5px; }
.btn-filtrar { align-self: flex-end; border: 1px solid var(--roxo); color: var(--roxo); background: #fff; border-radius: 10px; padding: 4px 14px; font-weight: 700; margin-top: 6px; }

/* ---------- telas de formulário ---------- */
.form-card { border: 1px solid #ddd; border-radius: 8px; padding: 0; box-shadow: 0 1px 6px rgba(0,0,0,.06); }
.form-card > h4 { margin: 0; padding: 12px 18px; font-size: 17px; color: var(--roxo); border-bottom: 2px solid var(--roxo); }
.form-card .body { padding: 16px 18px; }
.form-row { display: flex; gap: 14px; margin-bottom: 10px; flex-wrap: wrap; align-items: flex-end; }
.form-row .f { display: flex; flex-direction: column; min-width: 120px; }
.form-row .f.check { flex-direction: row; align-items: center; gap: 6px; }
.form-row label { font-size: 12.5px; font-weight: 600; color: #555; margin-bottom: 2px; }
.form-row input[type=text], .form-row input:not([type]), .form-row input[type=number], .form-row input[type=date], .form-row input[type=email], .form-row select, .form-row textarea { border: 1px solid #bbb; border-radius: 12px; padding: 4px 10px; font-size: 13px; }
.form-actions { display: flex; gap: 8px; padding: 12px 18px; border-top: 1px solid #eee; flex-wrap: wrap; }
.btn-roxo { background: var(--roxo); color: #fff; border: 0; border-radius: 10px; padding: 6px 16px; font-weight: 600; }
.btn-out { background: #fff; color: var(--roxo); border: 1px solid var(--roxo); border-radius: 10px; padding: 6px 16px; font-weight: 600; }
.section-title { color: var(--roxo); font-weight: 700; font-size: 14px; margin: 14px 0 8px; border-bottom: 1px solid #e0d4ef; padding-bottom: 4px; }

.rel-list { columns: 3 260px; }
.rel-list a { display: block; padding: 6px 10px; border-bottom: 1px solid #eee; break-inside: avoid; color: #333; }
.rel-list a:hover { background: #ede3f6; color: var(--roxo); }

.breadcrumb-lite { font-size: 12px; color: #888; margin: 0 0 8px 4px; }
.breadcrumb-lite b { color: var(--roxo); }
.toast-lite { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #333; color: #fff; padding: 10px 18px; border-radius: 6px; z-index: 2000; opacity: 0; transition: opacity .2s; }
.toast-lite.show { opacity: 1; }

/* ---------- login ---------- */
.login-page { position: fixed; inset: 0; background: linear-gradient(135deg, var(--roxo) 0%, var(--roxo-escuro) 100%); display: flex; align-items: center; justify-content: center; z-index: 3000; }
.login-box { background: #fff; border-radius: 12px; padding: 36px; width: 360px; box-shadow: 0 10px 40px rgba(0,0,0,.3); }
.login-box h1 { color: var(--roxo); font-style: italic; font-weight: 700; text-align: center; margin-bottom: 20px; }
.login-box input { width: 100%; border: 1px solid #bbb; border-radius: 20px; padding: 8px 14px; margin-bottom: 12px; }
.login-box button { width: 100%; }

@media (max-width: 1100px) {
  .main-menu > li > a { padding: 10px 8px; font-size: 12px; }
  .screen { flex-direction: column; }
  .side { width: 100%; }
}
@media (max-width: 760px) {
  .main-menu, .menu-search { display: none; }
  .charts { grid-template-columns: 1fr; padding: 0; }
  .dash-body { padding: 16px; margin: 8px 0; }
}
.form-row select { min-width: 170px; }

/* ---------- sistema funcional ---------- */
body.logged-out .topbar, body.logged-out .clientbar, body.logged-out .help-tab { display: none; }
body.menu-off .dd { display: none !important; }
.badge-dot[hidden] { display: none; }
.txt-red { color: var(--vermelho); }
.hint { color: #888; font-size: 12px; }
.text-muted { color: #888; }
.toast-lite.erro { background: #b3261e; }
.toast-lite.ok { background: #2e7d32; }
.erro-box { background: #fdecea; color: #8a1c14; border: 1px solid #f5c2bd; border-radius: 8px; padding: 14px; margin: 10px 0; }
.loading-grid { padding: 30px; text-align: center; color: #888; }
.chip-filtro { background: #ede3f6; color: var(--roxo); border-radius: 14px; padding: 4px 12px; display: inline-block; margin: 6px 0; font-size: 12.5px; }
.chip-filtro a { margin-left: 8px; font-weight: 700; }
.sem-dados { color: #999; text-align: center; padding-top: 120px; }
.ms-auto { margin-left: auto; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 14px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 14px; }
.d-flex { display: flex; } .align-items-center { align-items: center; } .gap-1 { gap: 4px; }

table.grid th.ck, table.grid td.ck { width: 28px; text-align: center; }
table.grid tr.vazio td { text-align: left; color: #666; background: #fff; cursor: default; }
table.grid input.nota { width: 64px; border: 1px solid #bbb; border-radius: 8px; padding: 2px 6px; text-align: center; }
table.grid input:not([type=checkbox]) { border: 1px solid #ccc; border-radius: 8px; padding: 2px 6px; }
.pager .ms-auto { font-weight: 700; }

.st { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11.5px; font-weight: 600; background: #eee; color: #444; }
.st-ativo, .st-vigente, .st-quitada, .st-aprovado, .st-resolvido, .st-devolvido, .st-entregue, .st-matriculado, .st-em-andamento, .st-atendida, .st-adimplente, .st-concluida { background: #e3f4e8; color: #1e6b34; }
.st-pendente, .st-em-curso, .st-a-iniciar, .st-prevista, .st-novo, .st-em-contato, .st-emprestado, .st-ativa { background: #fff4d6; color: #8a5a00; }
.st-cancelada, .st-cancelado, .st-inativo, .st-rescindido, .st-reprovado, .st-reprovado-por-falta, .st-perdido, .st-inadimplente, .st-encerrada { background: #fdecea; color: #a12a20; }
.st-trancado, .st-encerrado, .st-proposta, .st-visita-agendada, .st-interessado { background: #e8e3f6; color: #4b2a8a; }

.modal-lite { position: fixed; inset: 0; background: rgba(20, 0, 40, .45); z-index: 2500; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow: auto; }
.modal-box { background: #fff; border-radius: 10px; width: 100%; max-width: 560px; box-shadow: 0 12px 40px rgba(0,0,0,.3); }
.modal-box.wide { max-width: 900px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 18px; border-bottom: 2px solid var(--roxo); }
.modal-head h5 { margin: 0; color: var(--roxo); font-size: 16px; }
.modal-x { border: 0; background: transparent; font-size: 24px; line-height: 1; color: #666; cursor: pointer; }
.modal-body { padding: 16px 18px; max-height: 70vh; overflow: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid #eee; }
.btn-danger-out { background: #fff; color: var(--vermelho); border: 1px solid var(--vermelho); border-radius: 10px; padding: 6px 16px; font-weight: 600; }
.btn-sm { padding: 2px 10px; font-size: 12px; }
button:disabled { opacity: .6; cursor: wait; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px 14px; }
.form-grid .fg { display: flex; flex-direction: column; }
.form-grid .fg.full { grid-column: 1 / -1; }
.form-grid label { font-size: 12.5px; font-weight: 600; color: #555; margin-bottom: 3px; }
.form-grid .req { color: var(--vermelho); }
.form-grid input, .form-grid select, .form-grid textarea { border: 1px solid #bbb; border-radius: 10px; padding: 5px 10px; font-size: 13px; font-family: inherit; width: 100%; background: #fff; }
.form-grid input:disabled, .form-grid select:disabled, .form-grid textarea:disabled { background: #f3f3f3; color: #777; }
.form-grid input[type=color] { height: 32px; padding: 2px; }
.form-grid .ref-filter { margin-bottom: 4px; font-size: 12px; background: #faf7fd; }
.form-grid label.chk { display: flex; align-items: center; gap: 6px; font-weight: 600; margin-top: 18px; }
.form-grid label.chk input { width: auto; }
.form-info { background: #f4effa; border-left: 3px solid var(--roxo); padding: 8px 12px; border-radius: 4px; font-size: 13px; }
.form-select { width: 100%; border: 1px solid #bbb; border-radius: 10px; padding: 5px 10px; }
.form-card .body select, .form-card .body input[type=date], .form-card .body input[type=search], .form-card .body input:not([type]), .form-card .body input[type=file] { border: 1px solid #bbb; border-radius: 10px; padding: 4px 10px; font-size: 13px; }
.form-card .form-row .f select { min-width: 220px; }
.ref-filter { border: 1px solid #ccc; border-radius: 10px; padding: 3px 10px; margin-bottom: 4px; }

.side-box input[type=search], .side-box input[type=date] { border: 1px solid #bbb; border-radius: 12px; padding: 3px 10px; width: 100%; font-size: 12.5px; }

.rel-list a.indisp { color: #aaa; }
.hist-head { display: flex; align-items: center; gap: 8px; padding: 10px; background: #f4effa; border-radius: 8px; margin-bottom: 10px; flex-wrap: wrap; }

.kanban { display: grid; grid-template-columns: repeat(5, minmax(180px, 1fr)); gap: 12px; overflow-x: auto; }
.kcol { background: #f2f0f6; border-radius: 10px; padding: 8px; min-height: 300px; }
.kcol.over { outline: 2px dashed var(--roxo); }
.kcol h6 { color: var(--roxo); font-weight: 700; margin: 4px 4px 10px; display: flex; justify-content: space-between; }
.kcol h6 span { background: var(--roxo); color: #fff; border-radius: 10px; padding: 0 8px; font-size: 11px; }
.kcard { background: #fff; border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.12); cursor: grab; display: flex; flex-direction: column; gap: 2px; }
.kcard small { color: #777; }

.cal-nav { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; text-transform: capitalize; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-h { text-align: center; font-weight: 700; color: var(--roxo); padding: 4px; }
.cal-d { min-height: 90px; border: 1px solid #e3e3e3; border-radius: 6px; padding: 4px; cursor: pointer; font-size: 12px; }
.cal-d:hover { border-color: var(--roxo); }
.cal-d.vazio { border: 0; cursor: default; }
.cal-d.hoje { background: #f4effa; }
.cal-d > span { font-weight: 700; }
.cal-ev { background: var(--roxo); color: #fff; border-radius: 4px; padding: 1px 4px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.aviso-indisp { display: flex; gap: 14px; align-items: flex-start; background: #fff8e6; border: 1px solid #f3d38a; border-radius: 10px; padding: 16px; }
.aviso-indisp i { font-size: 28px; color: #b07a00; }
.aviso-indisp p { margin: 4px 0 0; }

.login-box { display: flex; flex-direction: column; }
.login-box .erro-login { min-height: 18px; margin: 8px 0 0; font-size: 12.5px; }
.login-sub { text-align: center; color: #777; margin: -14px 0 18px; }
