:root {
  --p: #1d4e89; --p2: #15395f; --acc: #c79a3e; --tx: #1b2733; --mu: #64748b; --bd: #e2e8f0;
  --bg: #f4f6fa; --ok: #15803d; --err: #b91c1c; --warn: #b45309; --r: 12px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: 'Public Sans', system-ui, sans-serif; font-size: 15px; color: var(--tx); background: var(--bg); }
a { color: var(--p); text-decoration: none; }
h1, h2, h3 { margin: 0 0 .6em; letter-spacing: -.01em; }
.ic { flex-shrink: 0; vertical-align: middle; }
.muted { color: var(--mu); } .small { font-size: 13px; } .center { text-align: center; }
.badge { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: linear-gradient(135deg, var(--p), var(--p2)); color: #fff; font-weight: 800; box-shadow: inset 0 -3px 0 var(--acc); }

/* layout */
.has-side { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.side { background: #0f1b2d; color: rgba(255,255,255,.75); position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 18px 12px 30px; }
.side-brand { display: flex; align-items: center; gap: 12px; color: #fff; padding: 4px 8px 18px; border-bottom: 1px solid rgba(255,255,255,.08); margin-bottom: 10px; }
.side-brand strong { display: block; } .side-brand small { color: rgba(255,255,255,.55); font-size: 12px; }
.side nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 9px; color: rgba(255,255,255,.75); font-weight: 500; font-size: 14.5px; }
.side nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.side nav a.on { background: var(--p); color: #fff; }
.side h6 { margin: 18px 12px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .14em; color: rgba(255,255,255,.4); }
.count { margin-left: auto; background: var(--acc); color: #111; font-size: 11.5px; font-weight: 700; padding: 1px 8px; border-radius: 99px; }
.main { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 14px; background: #fff; border-bottom: 1px solid var(--bd); padding: 12px 28px; }
.topbar h1 { font-size: 20px; margin: 0; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.topbar-right form { margin: 0; }
.who { color: var(--mu); font-size: 14px; }
.menu-btn { display: none; background: none; border: 0; padding: 6px; color: var(--tx); }
.content { padding: 26px 28px 60px; max-width: 1280px; }

/* componentes */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 16px; border-radius: 10px; border: 1px solid var(--bd); background: #fff; color: var(--tx); font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; transition: background .15s, border-color .15s; white-space: nowrap; }
.btn:hover { border-color: #cbd5e1; background: #f8fafc; }
.btn.primary { background: var(--p); border-color: var(--p); color: #fff; }
.btn.primary:hover { background: var(--p2); }
.btn.danger { color: var(--err); border-color: #fecaca; }
.btn.danger:hover { background: #fef2f2; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 6px 10px; font-size: 13px; }
.btn.block { width: 100%; }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--bd); background: #fff; color: var(--mu); cursor: pointer; }
.icon-btn:hover { color: var(--p); border-color: var(--p); }
.icon-btn.danger:hover { color: var(--err); border-color: var(--err); }
.inline { display: inline; margin: 0; }
.panel { background: #fff; border: 1px solid var(--bd); border-radius: 14px; padding: 22px; margin-bottom: 20px; }
.panel > header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.panel h2 { font-size: 17px; margin: 0 0 14px; }
.panel > header h2 { margin: 0; }
.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-weight: 500; }
.flash.ok { background: #dcfce7; color: #14532d; }
.flash.error { background: #fee2e2; color: #7f1d1d; }
.flash.warn { background: #fef3c7; color: #78350f; }
.note { display: flex; gap: 8px; align-items: center; color: var(--mu); background: #eef2f7; padding: 10px 14px; border-radius: 10px; font-size: 14px; }
.note.warn { background: #fef3c7; color: #78350f; }
.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 99px; background: #f1f5f9; color: var(--mu); }
.pill.ok { background: #dcfce7; color: var(--ok); }
.crumb { margin-bottom: 14px; font-size: 14px; }

/* dashboard */
.hello { font-size: 17px; margin: 0 0 16px; }
.quick { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 22px; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.kpi { background: #fff; border: 1px solid var(--bd); border-radius: 14px; padding: 18px; color: var(--tx); display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 14px; align-items: center; }
.kpi:hover { border-color: var(--p); }
.kpi-ic { grid-row: span 2; width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: #e8eef7; color: var(--p); }
.kpi strong { font-size: 26px; line-height: 1; }
.kpi small { color: var(--mu); }
.dash-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.dash-grid .panel { margin: 0; }
.panel > header a { font-size: 13.5px; font-weight: 600; }
.line { display: block; padding: 10px 12px; border-radius: 10px; color: var(--tx); border-left: 3px solid transparent; }
.line:hover { background: #f8fafc; }
.line strong { display: block; font-weight: 600; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.line span { color: var(--mu); font-size: 13px; }
.line.unread { border-left-color: var(--acc); background: #fffbeb; }
.line.unread strong { font-weight: 800; }
.line.current { background: #e8eef7; }

/* listas */
.list-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.list-tools { display: flex; gap: 10px; flex-wrap: wrap; margin: 0; }
.search { display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--bd); border-radius: 10px; padding: 0 12px; color: var(--mu); }
.search input { border: 0; outline: 0; padding: 9px 0; font: inherit; min-width: 220px; }
.list-tools select { padding: 9px 12px; border-radius: 10px; border: 1px solid var(--bd); font: inherit; background: #fff; }
.table-wrap { padding: 0; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--mu); padding: 12px 16px; border-bottom: 1px solid var(--bd); background: #fafbfd; }
.table td { padding: 12px 16px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: #fafbfd; }
.table td.strong a { color: var(--tx); font-weight: 600; }
.table td.strong a:hover { color: var(--p); }
.right { text-align: right; } .nowrap { white-space: nowrap; }
.thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 50%; }
.file-link { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; font-size: 13px; }
.empty-cell { text-align: center; color: var(--mu); padding: 40px !important; }
.pagination { display: flex; gap: 6px; margin: 16px 0; }
.pagination a, .pagination span { min-width: 34px; height: 34px; display: grid; place-items: center; border-radius: 8px; border: 1px solid var(--bd); background: #fff; color: var(--tx); font-weight: 600; }
.pagination span { background: var(--p); color: #fff; border-color: var(--p); }

/* formulários */
.edit-form { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.edit-side .sticky { position: sticky; top: 80px; }
.f { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.f label { font-weight: 600; font-size: 14px; }
.f label em { color: var(--err); font-style: normal; }
.f input:not([type=checkbox]):not([type=radio]), .f select, .f textarea { font: inherit; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 10px; background: #fff; color: var(--tx); width: 100%; }
.f input:focus, .f select:focus, .f textarea:focus { outline: 0; border-color: var(--p); box-shadow: 0 0 0 3px rgba(29,78,137,.15); }
.f input[type=file] { padding: 8px; background: #f8fafc; }
.f.has-error input, .f.has-error textarea, .f.has-error select { border-color: var(--err); }
.help { color: var(--mu); font-size: 12.5px; }
.err { color: var(--err); font-size: 13px; font-weight: 600; }
.switch { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 14px; margin-bottom: 16px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; }
.slider { width: 40px; height: 22px; border-radius: 99px; background: #cbd5e1; position: relative; transition: background .2s; flex-shrink: 0; }
.slider::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + .slider { background: var(--ok); }
.switch input:checked + .slider::after { transform: translateX(18px); }
.switch input:focus-visible + .slider { outline: 3px solid var(--acc); }
.file-current { display: flex; align-items: center; gap: 12px; padding: 8px; border: 1px dashed var(--bd); border-radius: 10px; }
.file-current img { width: 80px; height: 60px; object-fit: cover; border-radius: 8px; background: #f1f5f9; }
.file-current a { display: inline-flex; gap: 6px; align-items: center; font-weight: 600; word-break: break-all; }
.mini { font-size: 13px; color: var(--mu); display: flex; align-items: center; gap: 5px; font-weight: 500 !important; margin-left: auto; }
.actions { display: grid; gap: 8px; margin-top: 8px; padding-top: 16px; border-top: 1px solid var(--bd); }
.actions.row { display: flex; flex-wrap: wrap; border: 0; }
.actions.row form { margin: 0; }
.icon-picker { display: flex; flex-wrap: wrap; gap: 4px; max-height: 128px; overflow-y: auto; padding: 6px; border: 1px solid var(--bd); border-radius: 10px; }
.icon-picker button { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 7px; border: 1px solid transparent; background: #f8fafc; color: var(--mu); cursor: pointer; }
.icon-picker button:hover { color: var(--p); }
.icon-picker button.on { background: var(--p); color: #fff; }
[data-icon-select] { display: none; }
.narrow-form { max-width: 560px; }
.narrow-form h3 { margin-top: 24px; font-size: 16px; }

/* editor */
.rte { border: 1px solid #cbd5e1; border-radius: 10px; overflow: hidden; background: #fff; }
.rte .ql-toolbar.ql-snow { border: 0; border-bottom: 1px solid var(--bd); background: #f8fafc; font-family: inherit; }
.rte .ql-container.ql-snow { border: 0; font-family: inherit; font-size: 15.5px; }
.rte .ql-editor { min-height: 320px; line-height: 1.65; }
.rte .ql-editor img { max-width: 100%; }

/* definições */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.span2 { grid-column: span 2; }
.theme-pick { display: flex; gap: 14px; flex-wrap: wrap; }
.theme-pick label { display: flex; flex-direction: column; align-items: center; gap: 6px; font-weight: 500; font-size: 13px; cursor: pointer; }
.theme-pick input { position: absolute; opacity: 0; }
.theme-pick span { width: 54px; height: 38px; border-radius: 10px; background: linear-gradient(135deg, var(--a) 60%, var(--b) 60%); border: 3px solid transparent; }
.theme-pick input:checked + span { border-color: var(--tx); }
.sticky-save { position: sticky; bottom: 0; padding: 14px 0; background: linear-gradient(transparent, var(--bg) 40%); }

/* mensagens */
.msg-layout { display: grid; grid-template-columns: 360px 1fr; gap: 20px; align-items: start; }
.msg-list header form { margin: 0; }
.msg-view .meta { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 14px; margin: 0 0 18px; }
.msg-view dt { color: var(--mu); }
.msg-view dd { margin: 0; }
.msg-body { background: #f8fafc; padding: 18px; border-radius: 10px; line-height: 1.65; margin-bottom: 16px; white-space: normal; }

/* login */
.bare { min-height: 100vh; background: radial-gradient(800px 400px at 80% 0%, rgba(199,154,62,.25), transparent 60%), linear-gradient(135deg, #15395f, #1d4e89); }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: 100%; max-width: 400px; background: #fff; border-radius: 18px; padding: 32px; box-shadow: 0 30px 60px -20px rgba(0,0,0,.5); }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.login-brand strong { display: block; font-size: 18px; }
.login-brand small { color: var(--mu); }
.login-back { display: inline-flex; align-items: center; gap: 6px; margin-top: 16px; font-size: 14px; color: var(--mu); }

/* responsivo */
.hide-sm {}
@media (max-width: 1100px) { .dash-grid { grid-template-columns: 1fr 1fr; } .kpis { grid-template-columns: 1fr 1fr; } }
@media (max-width: 900px) {
  .has-side { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; z-index: 30; width: 270px; transform: translateX(-100%); transition: transform .25s; box-shadow: 0 0 40px rgba(0,0,0,.4); }
  .side.open { transform: none; }
  .menu-btn { display: inline-grid; }
  .edit-form, .msg-layout, .dash-grid { grid-template-columns: 1fr; }
  .content { padding: 18px 16px 60px; }
  .topbar { padding: 10px 16px; }
  .grid2 { grid-template-columns: 1fr; } .span2 { grid-column: auto; }
}
@media (max-width: 640px) {
  .hide-sm { display: none; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { padding: 10px 6px; border-bottom: 1px solid var(--bd); }
  .table td { border: 0; padding: 4px 12px; }
  .table td[data-label]:not(.strong)::before { content: attr(data-label) ": "; color: var(--mu); font-size: 12.5px; }
  .table td.right { text-align: left; }
  .search input { min-width: 0; }
}
.table .right { text-align: right; }

/* árvore do menu */
.tree { padding: 8px; }
.tree-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: 10px; border-bottom: 1px solid #f1f5f9; }
.tree-row:hover { background: #fafbfd; }
.tree-row.lvl0 { background: #f8fafc; margin-top: 8px; border: 1px solid var(--bd); }
.tree-row.lvl0:first-child { margin-top: 0; }
.tree-row.lvl1 { margin-left: 34px; }
.tree-row.lvl2 { margin-left: 68px; }
.tree-row.off { opacity: .55; }
.tree-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.tree-main > div { min-width: 0; }
.tree-title { font-weight: 700; color: var(--tx); }
.lvl0 .tree-title { font-size: 15.5px; }
.tree-main small { display: block; color: var(--mu); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tree-type { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; background: #e8eef7; color: var(--p); flex-shrink: 0; }
.tree-type.t-coluna { background: #fef3c7; color: var(--warn); }
.tree-type.t-paginas, .tree-type.t-documentos { background: #dcfce7; color: var(--ok); }
.tree-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.tree-actions form { display: inline-flex; gap: 6px; }
.icon-btn[disabled] { opacity: .35; cursor: default; }
.ic.flip { transform: rotate(180deg); }
@media (max-width: 760px) {
  .tree-row { flex-direction: column; align-items: flex-start; }
  .tree-row.lvl1 { margin-left: 16px; } .tree-row.lvl2 { margin-left: 32px; }
}
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--bd); margin-bottom: 18px; flex-wrap: wrap; }
.tabs a { padding: 10px 16px; font-weight: 600; color: var(--mu); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.on { color: var(--p); border-bottom-color: var(--p); }

/* pedidos do Balcão Digital */
.pedido-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.pedido-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; border-bottom: 1px solid var(--bd); padding-bottom: 14px; margin-bottom: 8px; }
.pedido-head h2 { font-size: 21px; margin: 8px 0 4px; }
.pedido-head p { margin: 0; }
.pedido-doc h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .12em; color: var(--mu); margin: 22px 0 10px; }
.dl { display: grid; grid-template-columns: 200px 1fr; gap: 8px 16px; margin: 0; font-size: 14.5px; }
.dl dt { color: var(--mu); }
.dl dd { margin: 0; font-weight: 500; }
.anexos { display: grid; gap: 8px; }
.anexo { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border: 1px solid var(--bd); border-radius: 10px; color: var(--tx); }
.anexo:hover { border-color: var(--p); }
.anexo small { display: block; color: var(--mu); font-size: 12.5px; }
.row-new td { background: #fffbeb; }
.dash-grid { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 900px) { .pedido-layout { grid-template-columns: 1fr; } .dl { grid-template-columns: 1fr; gap: 2px; } .dl dd { margin-bottom: 8px; } }
@media print {
  .side, .topbar, .no-print, .flash { display: none !important; }
  .has-side { display: block; } body { background: #fff; }
  .content { padding: 0; } .panel { border: 0; padding: 0; }
  .pedido-layout { display: block; }
}

/* cores */
.custom-swatch { background: conic-gradient(#e11d48, #f59e0b, #16a34a, #0ea5e9, #7c3aed, #e11d48) !important; }
.color-field { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.color-field input[type=color] { width: 54px !important; flex: none; height: 40px; padding: 2px; border: 1px solid #cbd5e1; border-radius: 10px; background: #fff; cursor: pointer; }
.color-field input[type=color]:disabled { opacity: .6; cursor: default; }
.color-field code { font-size: 13px; color: var(--mu); }
.color-field .mini { margin-left: 0; }
.cor-preview { margin-top: 14px; border-radius: 12px; overflow: hidden; border: 1px solid var(--bd); font-size: 13px; }
.pv-top { background: var(--s); color: #fff; padding: 8px 14px; }
.pv-body { display: flex; gap: 14px; align-items: center; padding: 14px; background: #fff; }
.pv-btn { background: var(--p); color: #fff; padding: 6px 14px; border-radius: 99px; font-weight: 600; }
.pv-link { color: var(--p); font-weight: 600; text-decoration: underline; }
.pv-acc { color: var(--a); font-weight: 700; letter-spacing: .14em; font-size: 11px; }
.pv-foot { background: var(--f); color: rgba(255,255,255,.8); padding: 12px 14px; }
.pv-foot strong { color: #fff; }
.cor-preview.foot-claro .pv-foot { color: rgba(15,23,42,.78); }
.cor-preview.foot-claro .pv-foot strong { color: #0f172a; }

/* lista de caixas de seleção */
.checks { display: grid; gap: 6px; padding: 10px 12px; border: 1px solid var(--bd); border-radius: 10px; background: #fafbfd; }
.checks.cols { grid-template-columns: 1fr 1fr; max-height: 320px; overflow-y: auto; }
.mini-check { display: flex; align-items: flex-start; gap: 8px; font-weight: 500 !important; font-size: 13.5px; }
.mini-check input { margin-top: 3px; }
@media (max-width: 900px) { .checks.cols { grid-template-columns: 1fr; } }
