/* ══════════════════════════════════════════════════════════════════
   SISTEMA CARTORIAL — Tema Branco (CRC-style)
   ══════════════════════════════════════════════════════════════════ */

/* ── Tokens ──────────────────────────────────────────────────────── */
:root {
  --bg:        #f4f6f8;
  --card:      #ffffff;
  --sidebar:   #1d3557;        /* azul-marinho institucional        */
  --sidebar-h: #12253e;
  --sidebar-t: rgba(255,255,255,.72);
  --sidebar-a: #ffffff;
  --accent:    #4a7cbf;        /* azul CRC                          */
  --accent2:   #2e5fa3;
  --success:   #2e7d32;
  --danger:    #c62828;
  --txt:       #1a2535;
  --muted:     #5a6a7e;
  --bdr:       #d4dce8;
  --bdr2:      #c0cce0;
  --surf:      #eef2f7;
  --th-bg:     #dce6f0;
  --rs:        4px;
  --shadow:    0 1px 3px rgba(0,0,0,.10), 0 1px 8px rgba(0,0,0,.06);
}

/* ── Reset ───────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing:border-box; margin:0; padding:0; }
html, body { height:100%; }
body {
  font-family: 'Arial', sans-serif;
  font-size: 15px;
  color: var(--txt);
  background: var(--bg);
  display: flex;
  min-height: 100vh;
  line-height: 1.5;
}

/* ── Layout ──────────────────────────────────────────────────────── */
.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--sidebar);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: sticky;
  top: 0;
}
.main {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px 48px;
  min-width: 0;
}

/* ── Sidebar ─────────────────────────────────────────────────────── */
.sidebar-header {
  padding: 20px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}
.logo-ico {
  width: 31px;
  height: 31px;
  color: #a8d0f5;
  flex-shrink: 0;
}
.logo-title {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}
.logo-sub {
  font-size: 12px;
  color: var(--sidebar-t);
  margin-top: 1px;
}

.status-panel {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.status-panel.is-connected {
  background: linear-gradient(180deg, rgba(80, 181, 88, .14), rgba(80, 181, 88, .06));
  border-bottom-color: rgba(120, 212, 129, .28);
}
.status-panel.is-waiting {
  background: linear-gradient(180deg, rgba(33, 150, 243, .10), rgba(33, 150, 243, .04));
  border-bottom-color: rgba(168, 208, 245, .22);
}
.status-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  font-size: 13px;
}
.status-row-crc {
  align-items: center;
  justify-content: space-between;
}
.status-row-muted {
  padding-top: 7px;
  border-top: 1px solid rgba(255,255,255,.06);
  margin-top: 5px;
}
.sdot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #6b7a90;
  flex-shrink: 0;
}
.sdot.online  { background: #66bb6a; }
.sdot.warning { background: #ffca28; }
.sdot.error   { background: #ef5350; }
.slabel  { color: var(--sidebar-t); flex:1; }
.status-copy {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  flex: 1 1 auto;
  min-width: 0;
}
.status-detail {
  font-size: 11px;
  color: #a9bfd7;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sbadge  {
  align-self: center;
  font-size: 12px;
  color: #7a8fa8;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.08);
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}
.sbadge.is-connected {
  color: #dff7e1;
  background: rgba(102,187,106,.18);
  border-color: rgba(102,187,106,.32);
}
.sbadge.is-waiting {
  color: #d7ebff;
  background: rgba(33,150,243,.16);
  border-color: rgba(33,150,243,.28);
}
.sbadge.is-offline {
  color: #a6b7cb;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
}
.nav-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  background: transparent;
  border: none;
  color: var(--sidebar-t);
  font-size: 14.5px;
  font-weight: 400;
  cursor: pointer;
  transition: background .15s, color .15s;
  text-align: left;
  border-left: 3px solid transparent;
}
.nav-btn:hover {
  background: rgba(255,255,255,.07);
  color: #fff;
}
.nav-btn.active {
  background: rgba(255,255,255,.12);
  color: #fff;
  font-weight: 600;
  border-left-color: #a8d0f5;
}
.nav-ico {
  width: 19px;
  height: 19px;
  flex-shrink: 0;
  opacity: .8;
}
.nav-btn.active .nav-ico { opacity: 1; }

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.btn-close-all {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 7px 10px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--rs);
  color: var(--sidebar-t);
  font-size: 13px;
  cursor: pointer;
  transition: background .15s;
}
.btn-close-all:hover { background: rgba(255,255,255,.12); color:#fff; }

/* ── Tabs ────────────────────────────────────────────────────────── */
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Page Header ──────────────────────────────────────────────────── */
.page-header {
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--bdr);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.page-header-inner h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--txt);
}
.page-desc {
  font-size: 14px;
  color: var(--muted);
  margin-top: 2px;
}

/* ── Card ────────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--bdr);
  border-radius: var(--rs);
  padding: 16px 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.card-head {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--accent2);
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--bdr);
}
.card-head svg { color: var(--accent); }

/* ── Form ────────────────────────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 14px; /* Aumentado o gap vertical para 16px */
  margin-bottom: 12px;
}
/* Na coluna esquerda da averbação, usa coluna única para melhor aproveitamento */
.averb-left .form-grid {
  grid-template-columns: 1fr;
}
.averb-left > .card:last-child { margin-bottom: 0; }
.form-group { 
  display: flex; 
  flex-direction: column; 
  gap: 8px;             /* Mais espaço entre o rótulo e o input */
  margin-bottom: 18px;  /* Espaço entre um campo e o próximo */
}
.form-group:last-child { margin-bottom: 0; }
.form-group.full-width { grid-column: 1 / -1; }
label {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .3px;
}
#tab-averb,
#tab-averb .input,
#tab-averb .btn,
#tab-averb .type-btn,
#tab-averb .segmented-control label,
#tab-averb .card-head,
#tab-averb label,
#tab-averb select,
#tab-averb textarea {
  font-family: Arial, sans-serif;
}

#tab-averb .averb-card {
  padding: 12px 14px;
  margin-bottom: 8px;
}

#tab-averb .card-head {
  font-size: 15px;
  padding-bottom: 10px;
  margin-bottom: 10px;
}

#tab-averb .form-grid {
  gap: 8px 10px;
  margin-bottom: 6px;
}

#tab-averb .form-group {
  gap: 4px;
  margin-bottom: 6px;
}

#tab-averb .form-group label {
  font-size: 12.5px;
  color: var(--accent2);
}
.input {
  padding: 7px 10px;
  border: 1px solid var(--bdr2);
  border-radius: var(--rs);
  min-height: 34px;
  font-size: 14.5px;
  font-family: inherit;
  color: var(--txt);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
#tab-averb .input {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 14px;
}

#tab-averb .full-btn {
  min-height: 34px;
}
.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(74,124,191,.15);
}
select.input { cursor: pointer; }

/* ── Segmented Control ───────────────────────────────────────────── */
.segmented-control {
  display: flex;
  background: var(--surf);
  border: 1px solid var(--bdr2);
  border-radius: var(--rs);
  padding: 3px;
  gap: 4px;
}
.segmented-control input[type="radio"] {
  display: none;
}
.segmented-control label {
  flex: 1;
  text-align: center;
  padding: 6px 12px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  border-radius: calc(var(--rs) - 2px);
  transition: all .2s;
  text-transform: none;
  letter-spacing: normal;
}
.segmented-control input[type="radio"]:checked + label {
  background: #ffffff;
  color: var(--accent2);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

/* ── Buttons ─────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  border-radius: var(--rs);
  border: 1px solid transparent;
  font-size: 14px;
  font-family: inherit;
  font-weight: 400;
  cursor: pointer;
  transition: background .15s, border-color .15s, opacity .15s;
  white-space: nowrap;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary  { background: var(--accent);  color: #fff; }
.btn-primary:hover:not(:disabled)  { background: var(--accent2); }
.btn-success  { background: var(--success); color: #fff; }
.btn-success:hover:not(:disabled)  { background: #1b5e20; }
.btn-ghost    { background: #fff; color: var(--muted); border-color: var(--bdr2); }
.btn-ghost:hover:not(:disabled)    { background: var(--surf); color: var(--txt); }
.btn-danger   { background: var(--danger);  color: #fff; }
.btn-sm       { padding: 4px 9px; font-size: 13px; }
.full-btn     { width: 100%; justify-content: center; }

.btn-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.mt12 { margin-top: 12px; }
.mt8  { margin-top: 8px; }

/* ── Msg box ─────────────────────────────────────────────────────── */
.msg-box {
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: var(--rs);
  font-size: 14px;
  border-left: 3px solid var(--accent);
  background: #eef5ff;
  color: var(--accent2);
}
.msg-box.ok  { border-color: var(--success); background: #e8f5e9; color: #1b5e20; }
.msg-box.err { border-color: var(--danger);  background: #fce4ec; color: var(--danger); }

/* ── Spinner ─────────────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 12px; height: 12px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Result: tabela estilo CRC ──────────────────────────────────── */
.result-header {
  font-size: 15px;
  font-weight: 600;
  color: var(--txt);
  margin-bottom: 10px;
}
.result-header strong { color: var(--accent2); }

.crc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
  border: 1px solid var(--bdr2);
}
.crc-table th {
  background: var(--th-bg);
  color: var(--accent2);
  font-weight: 600;
  font-size: 13.5px;
  padding: 7px 10px;
  text-align: left;
  border: 1px solid var(--bdr2);
  white-space: nowrap;
}
.crc-table td {
  padding: 7px 10px;
  border: 1px solid var(--bdr);
  color: var(--txt);
  background: #fff;
}
.crc-table tr:hover td { background: var(--surf); }
.crc-table td.cpf-cell {
  font-family: 'Arial', sans-serif;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: .5px;
}
.status-regular    { color: var(--success); font-weight: 600; }
.status-irregular  { color: var(--danger);  font-weight: 600; }
.status-suspenso   { color: #e65100; font-weight: 600; }
.status-notfound   { color: var(--muted); }

/* ── CPF badge (fallback) ──────────────────────────────────────── */
.cpf-box {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 10px 14px;
  border-radius: var(--rs);
  border-left: 4px solid var(--accent);
  background: var(--surf);
  margin-bottom: 10px;
}
.cpf-box.regular    { border-left-color: var(--success); background: #f1f8f1; }
.cpf-box.irregular  { border-left-color: var(--danger);  background: #fff0f0; }
.cpf-value  { font-family: 'Arial', sans-serif; font-size: 22px; font-weight: 700; letter-spacing: 2px; }
.cpf-status { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.cpf-box.regular  .cpf-status { color: var(--success); }
.cpf-box.irregular .cpf-status { color: var(--danger); }

/* ── Tipo / Template buttons ─────────────────────────────────── */
.type-sel { display: flex; gap: 8px; flex-wrap: wrap; }
.type-btn {
  padding: 6px 16px;
  border: 1px solid var(--bdr2);
  border-radius: var(--rs);
  background: #fff;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
}
.type-btn.active, .type-btn:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

#tab-averb .type-sel {
  gap: 6px;
}

#tab-averb .type-btn {
  min-width: 100px;
  min-height: 34px;
  padding: 4px 12px;
  font-size: 13.5px;
  line-height: 1.2;
  text-align: center;
}

#tab-averb .averb-type-card {
  padding-bottom: 8px;
}

#tab-averb .averb-topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 12px;
  align-items: end;
}

#tab-averb .averb-topbar-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#tab-averb .averb-topbar-group .card-head {
  margin-bottom: 6px;
  padding-bottom: 8px;
}

#tab-averb .averb-topbar-side {
  justify-content: flex-end;
}

#tab-averb .averb-topbar-toggle {
  gap: 0;
}

#tab-averb .averb-topbar-label {
  color: var(--accent2);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: uppercase;
}

#tab-averb .averb-topbar-control,
#tab-averb .averb-topbar-select {
  min-height: 34px;
}

#tab-averb .averb-topbar-control {
  width: auto;
}

#tab-averb .averb-topbar-select {
  width: 100%;
  min-width: 0;
  max-width: none;
}

.quick-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 6px; }
.qbtn {
  padding: 6px 8px;
  border: 1px solid var(--bdr2);
  border-radius: var(--rs);
  background: var(--surf);
  color: var(--txt);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  text-align: left;
  line-height: 1.3;
}
.qbtn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── Preview box ─────────────────────────────────────────────── */
.preview-card { flex: 1; }
.preview-box {
  background: #f9fbff;
  border: 1px solid var(--bdr2);
  border-radius: var(--rs);
  padding: 12px 14px;
  font-family: 'Arial', sans-serif;
  font-size: 14px;
  line-height: 1.8;
  min-height: 110px;
  white-space: pre-wrap;
  color: var(--txt);
}
.preview-box .ph { 
  color: #cad3dd; 
  font-family: 'Arial', sans-serif; 
  font-style: italic; 
  font-size: 15px;
  font-weight: 400;
  display: block;
  text-align: center;
  margin-top: 30px; 
}
.copy-ok {
  margin-top: 6px;
  font-size: 13.5px;
  color: var(--success);
  font-weight: 500;
}

/* ── Layouts ─────────────────────────────────────────────────── */
.averb-layout   { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.averb-left, .averb-right { display: flex; flex-direction: column; gap: 10px; }
.configs-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }

/* ── Num ctrl ─────────────────────────────────────────────────── */
.num-ctrl {
  display: inline-flex;
  align-items: stretch;
  gap: 0;
  width: fit-content;
  border: 1px solid var(--bdr2);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.75);
}

/* Oculta as setas nativas em inputs do tipo number (Chrome, Safari, Edge, Opera) */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Oculta as setas nativas no Firefox */
input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.num-ctrl .btn {
  border: 0;
  border-radius: 0;
  min-width: 32px;
  height: 32px;
  padding: 0 10px;
  background: #f8fbff;
  color: var(--accent2);
  box-shadow: none;
}

.num-ctrl .btn:hover:not(:disabled) {
  background: #edf4ff;
}

.num-ctrl .btn + .num-inp,
.num-ctrl .num-inp + .btn {
  border-left: 1px solid var(--bdr2);
}

.num-inp  {
  width: 58px;
  min-width: 58px;
  height: 32px;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  text-align: center !important;
  font-size: 15px;
  font-weight: 700;
  padding: 0 8px;
  background: #fff;
}

/* ── Autofill CPF ────────────────────────────────────────────── */
.input-autofilled {
  border-color: var(--success) !important;
  box-shadow: 0 0 0 3px rgba(46,125,50,.18) !important;
  transition: border-color .3s, box-shadow .3s;
}
.autofill-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--success);
  color: #fff;
  padding: 9px 20px;
  border-radius: 5px;
  font-size: 14.5px;
  font-weight: 500;
  box-shadow: 0 4px 16px rgba(0,0,0,.18);
  z-index: 9999;
  white-space: nowrap;
  animation: fadeInUp .25s ease;
}
@keyframes fadeInUp {
  from { opacity:0; transform: translateX(-50%) translateY(10px); }
  to   { opacity:1; transform: translateX(-50%) translateY(0); }
}

/* ── Toggle ──────────────────────────────────────────────────── */
.toggle-lbl {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  font-size: 14px;
  color: var(--muted);
  margin-top: 8px;
}

#tab-averb #p1GeneroCtrl {
  padding: 0;
  gap: 6px;
  background: transparent;
  border: none;
}

#tab-averb #p1GeneroCtrl label {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 100px;
  padding: 4px 12px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--bdr2);
  border-radius: var(--rs);
}

#tab-averb #p1GeneroCtrl input[type="radio"]:checked + label {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: none;
}

#tab-averb #p1Nome,
#tab-averb #sircNomes {
  text-transform: uppercase;
}

#tab-averb #p1Cpf,
#tab-averb #p2Cpf {
  max-width: 180px;
  letter-spacing: 0.2px;
}

#tab-averb #p1Card .form-grid,
#tab-averb #p2Card .form-grid {
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 6px 10px;
}

#tab-averb #p1NomeGroup,
#tab-averb #p2NomeGroup {
  grid-column: 1 / 2;
}

#tab-averb .averb-details-card .form-grid {
  grid-template-columns: 120px minmax(0, 1fr) minmax(240px, 1.4fr);
  align-items: start;
  gap: 6px 10px;
}

#tab-averb .averb-details-card .full-width {
  grid-column: 1 / -1;
}

#tab-averb .averb-details-card .form-group {
  margin-bottom: 0;
}

#tab-averb .averb-details-card .num-ctrl {
  gap: 0;
  align-self: start;
  margin-bottom: 0;
}

#tab-averb .averb-details-card .num-ctrl .btn {
  min-width: 28px;
  height: 30px;
  padding: 0 8px;
}

#tab-averb .averb-details-card .num-inp {
  width: 50px;
  min-width: 50px;
  height: 30px;
  padding-left: 8px;
  padding-right: 8px;
}

#tab-averb .averb-details-card .input,
#tab-averb .averb-details-card select.input {
  min-height: 30px;
  padding: 4px 8px;
}

#tab-averb .averb-details-card .btn-sm {
  padding: 0 10px;
}

#tab-averb .averb-details-card #btnGenAverb {
  margin-top: 10px;
}

#tab-averb .averb-sirc-card .form-grid {
  grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(110px, 1fr));
  align-items: end;
}

#tab-averb .averb-sirc-card #btnSaveSirc {
  margin-top: 10px !important;
  background: #eef2fa !important;
}

#tab-averb .averb-preview-card .preview-box {
  min-height: 96px;
  line-height: 1.65;
}

/* ── Flow steps (Config) ─────────────────────────────────────── */
.flow-steps { display: flex; flex-direction: column; gap: 10px; }
.fstep {
  display: flex;
  gap: 10px;
  padding: 10px;
  background: var(--surf);
  border-radius: var(--rs);
  border: 1px solid var(--bdr);
}
.fstep strong { font-size: 14.5px; color: var(--txt); }
.fstep p { font-size: 13.5px; color: var(--muted); margin-top: 2px; }
.fnum {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
  flex-shrink: 0;
}

/* ── Utilities ───────────────────────────────────────────────── */
.hidden { display: none !important; }
.mt4 { margin-top: 4px; }

.card-desc {
  font-size: 13.5px;
  color: var(--muted);
  margin-bottom: 10px;
  margin-top: -4px;
}

/* ── Escreventes List ──────────────────────────────────────────── */
.escreventes-list { display: flex; flex-direction: column; gap: 6px; }
.esc-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; background: #fff; border: 1px solid var(--bdr2);
  border-radius: var(--rs); transition: border-color .15s;
}
.esc-item:hover { border-color: var(--accent); }
.esc-lbl {
  display: flex; align-items: center; gap: 8px; margin: 0;
  color: var(--txt); font-size: 14.5px; font-weight: 500;
  cursor: pointer; text-transform: none; letter-spacing: 0; flex: 1;
}
.esc-lbl input { accent-color: var(--accent); width: 14px; height: 14px; cursor: pointer; margin: 0; }
.esc-lbl span { flex: 1; margin-top: 2px; }

/* ── Scrollbar ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--bdr2); border-radius: 3px; }

/* ── Responsive ──────────────────────────────────────────────── */
@media(max-width:960px) {
  .averb-layout   { grid-template-columns: 1fr; }
  .configs-layout { grid-template-columns: 1fr; }
  #tab-averb .averb-topbar {
    grid-template-columns: 1fr;
  }
  #tab-averb #p1Card .form-grid,
  #tab-averb #p2Card .form-grid,
  #tab-averb .averb-details-card .form-grid,
  #tab-averb .averb-sirc-card .form-grid {
    grid-template-columns: 1fr;
  }
}
@media(max-width:640px) {
  .sidebar { width: 180px; }
  .main    { padding: 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .quick-grid { grid-template-columns: repeat(2,1fr); }
  #tab-averb .type-btn {
    flex: 1 1 0;
    min-width: 0;
  }
  #tab-averb .averb-topbar-select {
    min-width: 0;
    max-width: none;
  }
  #tab-averb #p1Cpf,
  #tab-averb #p2Cpf {
    max-width: none;
  }
}

/* ── Print SIRC ─────────────────────────────────────────────────── */
@media print {
  body { background: white; margin: 0; padding: 0; font-family: 'Arial', sans-serif; }
  .sidebar, .print-hide, .page-header { display: none !important; }
  .main { margin-left: 0 !important; max-width: none !important; padding: 0 !important; background: white; }
  .tab-content { display: none; }
  #tab-sirc { display: block; }
  .sirc-print-area { display: block; width: 100%; border: none !important; box-shadow: none !important; padding:0 !important; margin:0 !important; }
}

/* ── Communications Module ───────────────────────────────────────── */
#tab-comms {
  min-height: calc(100vh - 48px);
}
.page-header h1 {
  font-size: 26px;
  font-weight: 700;
  color: var(--accent2);
  margin: 0 0 4px;
  letter-spacing: -0.5px;
}
.page-desc {
  font-size: 15px;
  color: var(--muted);
  font-weight: 400;
  margin: 0;
}
.comms-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.comms-card {
  border: 1px solid #E2E8F0;
  border-radius: 2px;
  box-shadow: none;
  padding: 0;
  overflow: hidden;
}
.comms-table-container {
  overflow-x: auto;
}
.comms-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}
.comms-table th {
  background: #F8FAFC;
  color: #475569;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 13px;
  letter-spacing: 0.5px;
  padding: 14px 16px;
  border-bottom: 1px solid #E2E8F0;
  text-align: left;
}
.comms-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #F1F5F9;
  color: #1E293B;
  font-weight: 400;
}
.comms-table tr:last-child td {
  border-bottom: none;
}
.comms-table tr:hover td {
  background: #F8FAFC;
}
.comms-footer {
  padding: 16px;
  background: #F8FAFC;
  border-top: 1px solid #E2E8F0;
}
.comms-btn-sync {
  background: #1E293B;
  border-radius: 2px;
  padding: 10px 20px;
  font-weight: 600;
}
.comms-btn-action {
  border-radius: 2px;
  padding: 10px 24px;
  font-size: 15px;
  font-weight: 600;
}
.comms-table input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: #1E293B;
}

/* ── Communications Module: Minimalist Corporate UI ────────────────── */
.comms-sections-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 0 24px;
}

.comms-section {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 2px;
  overflow: hidden;
  padding-bottom: 16px;
}

.comms-section-header {
  padding: 16px 18px 8px !important;
  border-bottom: none !important;
  margin-bottom: 0 !important;
}

.comms-select-wrapper {
  padding: 0 18px 12px;
  display: flex;
  justify-content: flex-end;
}

.comms-select-all {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  text-transform: uppercase;
}

.comms-section .card-desc {
  padding: 0 18px;
  margin-top: 4px;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  display: block;
}

.comms-section-content {
  max-height: 2000px; /* Suficiente para tabelas grandes */
  overflow: hidden;
  transition: max-height 0.3s ease-out, opacity 0.2s;
  opacity: 1;
}

.comms-section.collapsed .comms-section-content {
  max-height: 0;
  opacity: 0;
  pointer-events: none;
}

.comms-section.collapsed .chevron-ico {
  transform: rotate(-90deg);
}

.comms-table {
  width: 100%;
  border-collapse: collapse;
}

.comms-table th {
  background: var(--th-bg);
  color: var(--accent2);
  font-size: 13.5px;
  font-weight: 600;
  text-transform: uppercase;
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--bdr2);
  font-family: inherit;
}

.comms-floating-sync {
  position: fixed;
  right: 32px;
  bottom: 28px;
  z-index: 40;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 16px;
  border-radius: 999px;
  box-shadow: 0 12px 28px rgba(17, 24, 39, .18);
}

.comms-floating-sync svg {
  flex-shrink: 0;
}

.comms-top-actions {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.comms-top-actions .comms-floating-sync {
  position: static;
  right: auto;
  bottom: auto;
}

.comms-top-actions #btnClearProcessedCommsStatus {
  background: #fff;
  color: #475569;
  border: 1px solid #cbd5e1;
}

.comms-sync-summary {
  margin: 6px 0 14px;
  padding: 10px 12px;
  border: 1px solid #dbe3ee;
  border-radius: 4px;
  background: #f8fafc;
  color: #334155;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px;
  line-height: 1.35;
}

@media (max-width: 960px) {
  .comms-top-actions {
    margin-left: 0;
    width: 100%;
    justify-content: flex-end;
    align-items: stretch;
  }

  .comms-top-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .comms-top-actions .comms-floating-sync {
    padding: 10px 14px;
  }
}

.comms-table td {
  padding: 10px 12px;
  font-size: 14.5px;
  color: var(--txt);
  border-bottom: 1px solid var(--bdr);
  font-family: inherit;
}

.comms-table tr:last-child td {
  border-bottom: none;
}

.comms-table tr:hover {
  background: var(--surf);
}

/* Ações por Linha: Hierarquia e Padronização */
.row-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn-comm-secondary {
  height: 32px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: var(--rs);
  border: 1px solid var(--bdr2);
  background: #fff;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  transition: all 0.15s;
  font-family: inherit;
}

.btn-comm-secondary:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}

.btn-comm-primary {
  height: 32px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: var(--rs);
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
  transition: all 0.15s;
  font-family: inherit;
}

.btn-comm-success { background: var(--accent); }
.btn-comm-success:hover { background: var(--accent2); transform: translateY(-1px); }

.btn-comm-danger { background: #ef4444; }
.btn-comm-danger:hover { background: #dc2626; transform: translateY(-1px); }

.comm-link {
  color: #2563eb;
  text-decoration: none;
  font-weight: 500;
}
.comm-link:hover {
  text-decoration: underline;
}
.comm-origin-cell {
  align-items: center;
  display: inline-flex;
  gap: 6px;
  min-width: 0;
}
.comm-view-icon {
  align-items: center;
  display: inline-flex;
  flex: 0 0 auto;
  height: 18px;
  justify-content: center;
  width: 18px;
}
.comm-view-icon svg {
  display: block;
  height: 14px;
  width: 14px;
}
.comm-view-icon.is-open {
  color: #16a34a;
  background: #dcfce7;
  border: 1px solid #86efac;
  border-radius: 999px;
}
.comm-view-icon.is-closed {
  color: #94a3b8;
}
.row-rejeitado {
  background-color: #fff5f5 !important;
}
.row-rejeitado td {
  color: #b91c1c;
}

/* Barra Flutuante Minimalista (Batch Actions) */
.batch-action-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200; /* Acima do header principal se necessário */
  background: #ffffff;
  border-bottom: 2px solid var(--accent);
  padding: 12px 60px; /* Mais padding para alinhar com o conteúdo centralizado */
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  animation: slideDownFade 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes slideDownFade {
  from { transform: translateY(-100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.batch-info {
  font-family: 'Arial', sans-serif;
  font-size: 15px;
  color: var(--txt);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}
.batch-info span {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surf);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 800;
  font-size: 14px;
}
.batch-btns {
  display: flex;
  gap: 12px;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 32px 20px;
  background:
    radial-gradient(circle at 18% 18%, rgba(74,124,191,.10), transparent 30%),
    linear-gradient(135deg, #f7f9fc 0%, #edf2f8 100%);
}

.login-screen.hidden {
  display: none;
}

.login-card {
  width: min(468px, 100%);
  background: #fff;
  border: 1px solid #d8e1ed;
  border-radius: 10px;
  box-shadow: 0 24px 60px rgba(25, 38, 60, .16), 0 2px 8px rgba(25, 38, 60, .06);
  padding: 34px 36px 28px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
}

.login-mark {
  width: 62px;
  height: 62px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: #f7fafc;
  border: 1px solid #dbe5f0;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.85);
  overflow: hidden;
  flex-shrink: 0;
}

.login-mark img {
  width: 42px;
  height: 46px;
  display: block;
  object-fit: contain;
}

.login-brand h1 {
  margin: 0;
  font-size: 26px;
  line-height: 1.1;
  color: #1f2f43;
  letter-spacing: 0;
  font-weight: 500 !important;
}

.login-brand p {
  margin: 7px 0 0;
  color: #5d6d82;
  font-size: 13.5px;
  font-weight: 400;
}

.login-kicker {
  margin: 0 0 24px;
  padding: 10px 12px;
  border: 1px solid #e1e8f1;
  border-radius: 8px;
  background: #f8fafd;
  color: #35679f;
  font-size: 12.5px;
  font-weight: 500 !important;
  text-align: center;
}

.login-field {
  display: block;
  margin-bottom: 16px;
}

.login-field span {
  display: block;
  font-size: 13px;
  font-weight: 500 !important;
  color: #52647a;
  margin-bottom: 8px;
  text-transform: none;
  letter-spacing: 0;
}

.login-card .input {
  width: 100%;
  min-height: 44px;
  padding: 10px 13px;
  border-color: #c9d5e5;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 400 !important;
  background: #fff;
}

.login-card .input::placeholder {
  color: #9aa8b8;
}

.login-card .input:focus {
  border-color: #3f76b7;
  box-shadow: 0 0 0 3px rgba(74,124,191,.18);
}

.login-password-wrap {
  position: relative;
}

.login-password-wrap .input {
  padding-right: 48px;
}

.login-password-toggle {
  position: absolute;
  right: 9px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #5d6f84;
  cursor: pointer;
  transition: background .15s, color .15s;
}

.login-password-toggle:hover {
  background: #eef3f8;
  color: #1d3557;
}

.login-password-toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.login-card .full-btn {
  min-height: 46px;
  margin-top: 4px;
  border-radius: 8px;
  font-size: 14.5px;
  font-weight: 500 !important;
  background: #2e5fa3;
  box-shadow: 0 8px 18px rgba(46,95,163,.22);
  transition: background .15s, box-shadow .15s, transform .15s, opacity .15s;
}

.login-card .full-btn:hover:not(:disabled) {
  background: #244f89;
  box-shadow: 0 10px 22px rgba(46,95,163,.27);
}

.login-card .full-btn:disabled {
  opacity: .72;
  box-shadow: none;
  transform: none;
}

.login-card .full-btn:disabled:hover {
  background: #2e5fa3;
  transform: none;
}

#loginMsg {
  margin: 0 0 18px;
  border-left: 0;
  border-radius: 8px;
  font-size: 13.5px;
}

#loginMsg.err {
  border: 1px solid #efc6c6;
  background: #fff5f5;
  color: #a52727;
}

.login-footer {
  margin-top: 18px;
  color: #758397;
  font-size: 12px;
  font-weight: 400;
  text-align: center;
}

@media(max-width:520px) {
  .login-screen {
    padding: 18px 14px;
  }

  .login-card {
    padding: 28px 22px 24px;
    border-radius: 9px;
  }

  .login-brand {
    align-items: flex-start;
  }

  .login-brand h1 {
    font-size: 24px;
  }
}

.crc-session-note {
  margin: -4px 0 12px;
  color: #66758a;
  font-size: 13px;
}

.btn-logout {
  margin-top: 8px;
  background: #eef2f7;
  color: #27364a;
}

.users-table-wrap {
  border: 1px solid #e1e7f0;
  border-radius: 4px;
  overflow-x: auto;
}

.users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  background: #fff;
}

.users-table th,
.users-table td {
  padding: 12px 12px;
  border-bottom: 1px solid #e5ebf3;
  text-align: left;
  vertical-align: middle;
}

.users-table th {
  background: #f6f8fb;
  color: #5b6b82;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.users-table tbody tr {
  transition: background .15s;
}

.users-table tbody tr:hover {
  background: #f8fafc;
}

.users-table tbody tr:last-child td {
  border-bottom: 0;
}

.cartorios-summary-card {
  margin-bottom: 16px;
}

.cartorio-active-summary {
  align-items: center;
  background: #f7f9fc;
  border: 1px solid #e1e7f0;
  border-radius: 4px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
}

.cartorio-active-summary strong,
.cartorio-name-cell strong {
  color: #1f2d3d;
  display: block;
  font-size: 14px;
  font-weight: 700;
}

.cartorio-active-summary span,
.cartorio-name-cell span {
  color: #66758a;
  display: block;
  font-size: 13px;
  margin-top: 3px;
}

.cartorio-active-meta {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.cartorios-table {
  min-width: 1120px;
  table-layout: fixed;
}

.cartorios-table th:nth-child(1),
.cartorios-table td:nth-child(1) {
  width: 26%;
}

.cartorios-table th:nth-child(2),
.cartorios-table td:nth-child(2) {
  width: 14%;
}

.cartorios-table th:nth-child(3),
.cartorios-table td:nth-child(3) {
  width: 10%;
}

.cartorios-table th:nth-child(4),
.cartorios-table td:nth-child(4) {
  width: 10%;
}

.cartorios-table th:nth-child(5),
.cartorios-table td:nth-child(5) {
  width: 10%;
}

.cartorios-table th:nth-child(6),
.cartorios-table td:nth-child(6) {
  width: 14%;
}

.cartorios-table th:nth-child(7),
.cartorios-table td:nth-child(7) {
  width: 26%;
}

.cartorios-actions-cell {
  min-width: 280px;
}

.cartorio-modules-count {
  align-items: center;
  background: #eef2f7;
  border: 1px solid #d8e0ea;
  border-radius: 4px;
  color: #344258;
  display: inline-flex;
  font-size: 12px;
  font-weight: 700;
  justify-content: center;
  min-width: 34px;
  padding: 3px 8px;
}

.cartorio-admin-note {
  background: #f6f8fb;
  border: 1px solid #e1e7f0;
  border-radius: 4px;
  color: #52647a;
  font-size: 13px;
  line-height: 1.45;
  margin-top: 12px;
  padding: 10px 12px;
}

.cartorio-modal {
  max-width: 920px;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
}

.cartorio-modal .modal-header {
  align-items: flex-start;
  border-bottom: 1px solid #e1e7f0;
  flex: 0 0 auto;
  padding: 16px 20px 14px;
}

.cartorio-modal .modal-header h3 {
  margin-bottom: 4px;
}

.modal-subtitle {
  color: #5b6b82;
  font-size: 13px;
  line-height: 1.35;
  margin: 0;
}

.cartorio-modal .modal-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px 20px;
}

.cartorio-form-section {
  background: #fff;
  border: 1px solid #e1e7f0;
  border-radius: 6px;
  margin-bottom: 14px;
  padding: 14px;
}

.cartorio-form-section:last-of-type {
  margin-bottom: 0;
}

.cartorio-form-section .card-head {
  border-bottom: 1px solid #e6ecf3;
  margin-bottom: 12px;
  padding-bottom: 10px;
}

.cartorio-form-section .card-head span {
  color: #1f4f9b;
  font-size: 15px;
  font-weight: 600;
}

.cartorio-form-section .card-head small {
  color: #5b6b82;
  display: block;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.35;
  margin-top: 3px;
}

.cartorio-form-grid {
  grid-template-columns: minmax(0, 1.35fr) minmax(160px, .75fr) minmax(130px, .55fr);
  gap: 12px;
  margin-top: 0;
}

.cartorio-form-grid .form-group {
  margin-bottom: 0;
}

.cartorio-form-grid label,
.cartorio-module-group h4 {
  color: #51627a;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.cartorio-form-grid .input {
  min-height: 34px;
}

.cartorio-field-name {
  grid-column: span 2;
}

.cartorio-field-description {
  grid-column: span 2;
}

.cartorio-field-uf {
  max-width: 92px;
}

#cartorioUf {
  text-align: center;
  text-transform: uppercase;
}

.cartorio-field-wide {
  grid-column: 1 / -1;
}

.cartorio-modules-groups {
  display: grid;
  gap: 12px;
}

.cartorio-module-group {
  background: #fbfcfe;
  border: 1px solid #e6ecf3;
  border-radius: 5px;
  padding: 10px;
}

.cartorio-module-group h4 {
  margin: 0 0 8px;
}

.cartorio-modules-grid {
  display: grid;
  gap: 7px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.cartorio-module-option {
  align-items: center;
  background: #f8fafc;
  border: 1px solid #e1e7f0;
  border-radius: 4px;
  color: #344258;
  display: flex;
  gap: 8px;
  min-height: 32px;
  padding: 6px 9px;
}

.cartorio-module-option input {
  flex: 0 0 auto;
}

.cartorio-module-option span {
  font-size: 13px;
  line-height: 1.2;
}

.cartorio-crc-box {
  background: #fbfcfe;
  border: 1px solid #e1e7f0;
  border-radius: 4px;
  display: grid;
  gap: 11px 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 0;
  padding: 12px;
}

.cartorio-crc-box label {
  color: #5b6b82;
  display: block;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.cartorio-crc-box code {
  background: #eef2f7;
  border: 1px solid #d8e0ea;
  border-radius: 4px;
  color: #344258;
  display: inline-block;
  font-size: 12px;
  padding: 4px 6px;
  word-break: break-all;
}

.cartorio-modal-actions {
  background: #fff;
  border-top: 1px solid #e1e7f0;
  flex: 0 0 auto;
  justify-content: flex-end;
  margin-top: 0;
  padding: 12px 20px;
}

.cartorio-modal-actions .btn {
  min-height: 34px;
  padding: 0 14px;
}

.audit-filter-card {
  margin-bottom: 16px;
}

.audit-filter-grid {
  grid-template-columns: repeat(4, minmax(180px, 1fr));
}

.audit-table {
  min-width: 1180px;
}

.audit-table th,
.audit-table td {
  line-height: 1.35;
}

.audit-table th:nth-child(1),
.audit-table td:nth-child(1) {
  width: 138px;
}

.audit-table th:nth-child(2),
.audit-table td:nth-child(2) {
  width: 170px;
}

.audit-table th:nth-child(7),
.audit-table td:nth-child(7) {
  min-width: 260px;
}

.audit-actions-cell {
  white-space: nowrap;
}

.audit-details-modal {
  max-width: 860px;
}

.audit-details-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.audit-detail-item {
  background: #f8fafc;
  border: 1px solid #e1e7f0;
  border-radius: 4px;
  padding: 10px 12px;
}

.audit-detail-item span {
  color: #5b6b82;
  display: block;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 5px;
  text-transform: uppercase;
}

.audit-detail-item strong {
  color: #1f2d3d;
  display: block;
  font-size: 14px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.audit-metadata-box {
  border-top: 1px solid #e1e7f0;
  margin-top: 16px;
  padding-top: 14px;
}

.audit-metadata-box h4 {
  color: #1f4f9b;
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 10px;
}

.audit-metadata-list {
  display: grid;
  gap: 8px;
  margin: 0;
}

.audit-metadata-list div {
  background: #f8fafc;
  border: 1px solid #e1e7f0;
  border-radius: 4px;
  padding: 8px 10px;
}

.audit-metadata-list dt {
  color: #5b6b82;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 4px;
}

.audit-metadata-list dd {
  color: #1f2d3d;
  font-size: 13px;
  margin: 0;
  overflow-wrap: anywhere;
}

.audit-status {
  display: inline-flex;
  align-items: center;
  min-width: 74px;
  justify-content: center;
  border-radius: 4px;
  padding: 3px 7px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.audit-success { background: #e8f5e9; color: #1b5e20; }
.audit-error { background: #ffebee; color: #b71c1c; }
.audit-denied { background: #fff3e0; color: #bf360c; }
.audit-cancelled { background: #eceff1; color: #37474f; }
.audit-pending { background: #e3f2fd; color: #0d47a1; }

@media (max-width: 980px) {
  .cartorio-form-grid,
  .cartorio-modules-grid,
  .cartorio-crc-box,
  .audit-filter-grid,
  .audit-details-grid {
    grid-template-columns: 1fr;
  }

  .cartorio-field-name,
  .cartorio-field-description {
    grid-column: 1;
  }

  .cartorio-field-uf {
    max-width: none;
  }
}

.batch-list-controls,
.batch-list-controls * {
  font-family: Arial, Helvetica, sans-serif !important;
  font-weight: 400 !important;
}

.batch-list-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding: 12px 20px;
  background: #fafafa;
  border: 1px solid #eef2fa;
  border-radius: 6px;
}

.batch-select-all {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: #1e293b;
  cursor: pointer;
  user-select: none;
  text-transform: uppercase;
  font-size: 14px;
  line-height: 1;
  text-align: center;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.batch-select-all:hover {
  background: #f1f5f9;
  border-color: #dbe3ef;
}

.batch-select-all.is-selected {
  background: #e8f0fe;
  border-color: #93c5fd;
  color: #1d4ed8;
}

.batch-select-all input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  cursor: pointer;
  accent-color: #2563eb;
}

#commsBatchBar {
  display: none;
  margin-left: auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 16px;
}

#commsBatchBar .batch-info {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 36px !important;
  padding: 0 14px !important;
  border-radius: 6px !important;
  color: #475569 !important;
  background: #f8fafc !important;
  border: 1px solid #dbe3ef !important;
  font-size: 14px !important;
  line-height: 1 !important;
  text-align: center;
}

#commsBatchBar .batch-info span {
  color: #475569 !important;
  background: transparent !important;
  padding: 0 !important;
  font-size: 14px !important;
  font-weight: 400 !important;
}

#commsBatchBar .batch-btns {
  display: flex;
  align-items: center;
  gap: 8px !important;
  flex-wrap: wrap;
}

#commsBatchBar .btn {
  min-width: 136px !important;
  height: 38px !important;
  padding: 0 14px !important;
  border-radius: 6px !important;
  font-size: 14px !important;
  line-height: 1 !important;
  text-transform: none !important;
  box-shadow: none !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  text-align: center !important;
}

#btnBatchCertificar,
#btnBatchEtiquetas,
#btnBatchPrint {
  background: #eef2f7 !important;
  color: #334155 !important;
  border: 1px solid #cbd5e1 !important;
}

#btnBatchClear {
  background: #fff !important;
  color: #475569 !important;
  border: 1px solid #cbd5e1 !important;
  min-width: 92px !important;
}

#commsBatchBar .btn:hover {
  background: #e2e8f0 !important;
  color: #1f2937 !important;
  transform: none !important;
}
.btn-success { background: var(--success); color: #fff; border: none; }
.btn-success:hover { background: #1b5e20; transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: #fff; border: none; }
.btn-primary:hover { background: var(--accent2); transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--bdr2); }
.btn-ghost:hover { background: var(--surf); color: var(--txt); }

/* Modais: Base e Overlay */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(2px);
  display: none; /* Oculto por padrão */
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeIn 0.2s ease-out;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: #ffffff;
  width: 100%;
  max-width: 500px;
  border-radius: 2px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  overflow: hidden;
}

.modal-lote-confirm {
  max-width: 360px;
  padding: 28px 24px 24px;
  border-radius: 8px;
  text-align: center;
  font-family: Arial, Helvetica, sans-serif;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
}

.modal-lote-confirm,
.modal-lote-confirm * {
  font-family: Arial, Helvetica, sans-serif !important;
  font-weight: 400 !important;
}

.modal-lote-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #edfdf5;
  color: #0f9f6e;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
}

.modal-lote-confirm h2 {
  color: #1f2937;
  font-size: 18px;
  line-height: 1.25;
  margin: 0 0 10px;
}

.modal-lote-confirm p {
  color: #5f718a;
  font-size: 14px;
  line-height: 1.45;
  max-width: 290px;
  margin: 0 auto 24px;
}

.modal-lote-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-items: center;
  justify-content: center;
}

.modal-lote-actions .btn {
  width: 100%;
  height: 36px;
  justify-content: center;
  border-radius: 6px;
  font-size: 14px;
  line-height: 1;
  padding: 0 14px;
  box-shadow: none;
  text-transform: none;
}

.modal-lote-actions .btn-ghost {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #64748b;
}

.modal-lote-actions .btn-primary {
  background: #4a7cbf;
  border: 1px solid #4a7cbf;
  color: #ffffff;
}

.modal-lote-actions .btn:hover {
  transform: none;
}

.modal-content.modal-lg {
  max-width: 800px;
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  text-transform: uppercase;
  margin: 0;
}

.close-modal {
  background: transparent;
  border: none;
  font-size: 26px;
  color: #64748b;
  cursor: pointer;
  line-height: 1;
}

.close-modal:hover {
  color: #0f172a;
}

.modal-body {
  padding: 24px;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Detalhes Grid (Usado no Ver Comunicação) */
.details-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.details-item {
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 8px;
}

.details-label {
  font-size: 13px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.details-value {
  font-size: 16px;
  color: #1e293b;
  font-weight: 500;
}

.details-value.highlight {
  color: #2563eb;
  font-weight: 700;
}

#commsSearchWrapper {
  padding: 0 24px;
  margin-top: 10px;
}

/* Input de Busca */
.comms-search-input {
  width: 100%;
  max-width: 500px;
  padding: 7px 10px;
  font-size: 14.5px;
  border: 1px solid var(--bdr2);
  border-radius: var(--rs);
  background: #ffffff;
  margin-bottom: 16px;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

.comms-search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(74, 124, 191, 0.15);
}

.editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.editor-title h2 {
  font-size: 16px;
  font-weight: 700;
  color: #1e293b;
  margin: 0;
  letter-spacing: 0.5px;
}

.editor-title p {
  font-size: 14px;
  color: #64748b;
  margin: 4px 0 0 0;
}

.btn-blue {
  background: #2563eb;
  color: white;
  padding: 10px 20px;
  font-weight: 600;
  border-radius: 2px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-blue:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
}

.grid-etiquetas {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
  gap: 20px;
}

.models-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
  gap: 24px;
}

.model-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 2px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.model-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.model-card-title {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  text-transform: uppercase;
}

.btn-copy {
  background: #f1f5f9;
  border: none;
  padding: 4px 10px;
  font-size: 13px;
  font-weight: 600;
  color: #475569;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-copy:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.btn-copy.success {
  background: #2563eb;
  color: #ffffff;
}

.model-card-body textarea {
  width: 100%;
  height: 120px;
  border: 1px solid #f1f5f9;
  background: #f8fafc;
  padding: 12px;
  font-size: 15px;
  font-family: inherit;
  resize: none;
  border-radius: 2px;
  color: #475569;
}

.etiqueta-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 2px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.etiqueta-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 8px;
  border-bottom: 1px solid #f1f5f9;
}

.etiqueta-label {
  font-size: 13px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
}

.tpl-select {
  padding: 4px 8px;
  font-size: 13px;
  border: 1px solid #e2e8f0;
  border-radius: 2px;
  background: #fff;
  color: #0f172a;
  outline: none;
  cursor: pointer;
}

.tpl-select:focus {
  border-color: #2563eb;
}

.etiqueta-editor {
  width: 100%;
  height: 180px;
  border: 1px solid #f1f5f9;
  background: #f8fafc;
  padding: 12px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  border-radius: 2px;
  color: #1e293b;
  line-height: 1.5;
}

.etiqueta-label {
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  margin-bottom: 12px;
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 8px;
}

.etiqueta-editor {
  width: 100%;
  height: 140px;
  border: none;
  background: #ffffff;
  color: #1e293b;
  font-size: 17px;
  font-family: inherit;
  line-height: 1.5;
  resize: none;
  outline: none;
}

/* ── Regras de Impressão (Print) ────────────────── */
@media print {
  /* Força o tamanho exato da Zebra no navegador */
  @page {
    size: 50mm 80mm;
    margin: 0 !important;
  }

  body * {
    visibility: hidden;
  }
  
  .etiqueta-print-container, .etiqueta-print-container * {
    visibility: visible;
  }
  
  .etiqueta-print-container {
    position: absolute;
    left: 0;
    top: 0;
    width: 50mm !important;
    height: 80mm !important;
    
    /* O SEGREDO ESTÁ AQUI: Impede que o padding esprema a largura */
    box-sizing: border-box !important; 
    padding: 2.8mm 3.6mm !important;
    margin: 0 !important;
    
    font-family: Arial, Helvetica, sans-serif !important;
    font-size: var(--print-font-size-pt, 8.5pt) !important;
    font-weight: 400 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  .etiqueta-print-container #lexicalEditor {
    font-size: var(--print-font-size-pt, 8.5pt) !important;
    line-height: 1.18 !important;
    font-weight: 400 !important;
  }
  .etiqueta-print-container {
    line-height: 1.18 !important;
    color: #000000 !important;
    
    /* Formatação de documento cartorário */
    text-align: justify !important; 
    text-justify: inter-word !important;
    hyphens: auto !important;
    overflow-wrap: break-word !important;
    word-break: normal !important;
    line-break: auto !important;
    page-break-after: always;
    overflow: hidden; /* Evita que o texto vaze da página */
  }

  /* Isole o rodapé para ele ficar sempre preso no fundo e não atropelar o texto */
  .etiqueta-rodape-print {
    position: absolute;
    bottom: 3mm;
    left: 4mm;
    right: 4mm;
    font-size: 6.5pt !important;
    border-top: 1px solid #000;
    padding-top: 2px;
    text-align: center !important;
    font-weight: 400;
    color: #000 !important;
    background-color: white; 
    z-index: 10;
    visibility: visible !important;
  }
  .etiqueta-print-container strong {
    font-weight: 700 !important;
  }
}

.etiqueta-rodape-print {
  display: none;
}

/* ── Split Layout para Editor ────────────────────────────────────── */
.editor-split-layout {
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: stretch;
}
.editor-side-panel {
  background: var(--card);
  border: 1px solid var(--bdr2);
  border-radius: var(--rs);
  overflow: hidden;
}
.side-panel-header {
  padding: 12px 16px;
  background: #fcfcfc;
  border-bottom: 1px solid var(--bdr2);
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 13px;
  color: var(--accent2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.side-panel-content {
  padding: 16px;
  font-size: 15px;
  color: var(--text);
}
.summary-item {
  margin-bottom: 12px;
}
.summary-label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 2px;
}
.summary-value {
  font-weight: 500;
  word-break: break-all;
}
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
  font-style: italic;
}

/* ── Lexical Editor & Search Modal ───────────────────────────────── */
.lexical-wrapper {
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--bdr2);
  background: #fff;
  min-height: 320px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 20px rgba(0,0,0,0.05);
}
.lexical-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px;
  background: #f8f9fa;
  border-bottom: 1px solid var(--bdr2);
}
.toolbar-item {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 4px;
  color: #444;
  transition: all 0.15s;
}
.toolbar-item:hover {
  background: #e9ecef;
  color: var(--accent);
}
.toolbar-item:disabled,
.toolbar-item[aria-disabled="true"] {
  cursor: default;
  opacity: 0.45;
}
.toolbar-item:disabled:hover,
.toolbar-item[aria-disabled="true"]:hover {
  background: transparent;
  color: #444;
}
.toolbar-item.active {
  background: #eef5ff;
  color: var(--accent);
}
.lexical-toolbar .divider {
  width: 1px;
  height: 20px;
  background: var(--bdr2);
  margin: 0 4px;
}
#lexicalEditor {
  flex: 1 1 auto;
  min-height: 240px;
  padding: 28px 32px;
  outline: none;
  font-family: Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: #333;
  overflow-y: auto;
}
.texto-anotacao,
#lexicalEditor,
#lexicalEditor * {
  font-family: Arial, sans-serif;
}
.texto-anotacao .lexical-paragraph {
  margin: 0 0 8px;
}
.texto-anotacao .lexical-text-bold,
#lexicalEditor .lexical-text-bold,
#lexicalEditor strong {
  font-weight: 700 !important;
}
.lexical-text-bold { font-weight: 700 !important; }
.lexical-text-italic { font-style: italic; }
.lexical-text-underline { text-decoration: underline; }
.lexical-text-strikethrough { text-decoration: line-through; }
.lexical-list-ol { list-style-type: decimal; padding-left: 24px; }
.lexical-list-ul { list-style-type: disc; padding-left: 24px; }
.lexical-h1 { font-size: 26px; font-weight: bold; margin: 10px 0; color: var(--accent); }
.lexical-h2 { font-size: 22px; font-weight: bold; margin: 8px 0; color: var(--accent); }
.lexical-quote { border-left: 4px solid var(--accent); padding-left: 16px; font-style: italic; color: #666; margin: 10px 0; }

.modal-lg {
  max-width: 800px;
  width: 95%;
}
#btnOpenSearchArchived:hover, #btnOpenLexicalEditor:hover {
  background: #eef5ff;
  border-color: var(--accent);
  color: var(--accent);
}
.mt20 { margin-top: 20px; }

/* ── Editor Split Layout ─────────────────────────────────────────── */
.editor-etiquetas-container {
  padding: 0 24px 60px;
}
.editor-split-layout {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 15px;
}
.editor-side-panel {
  background: #fff;
  border: 1px solid var(--bdr2);
  border-radius: var(--rs);
  width: 100%;
}
.side-panel-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--bdr2);
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 15px;
  color: var(--accent);
  background: #fafafa;
}
.side-panel-content {
  padding: 16px;
  overflow-y: auto;
}

/* ── Process Form ────────────────────────────────────────────────── */
.process-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.process-form .form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.process-form label {
  font-size: 13px;
  font-weight: 700;
  color: #888;
  text-transform: uppercase;
}
.process-form input, .process-form textarea {
  padding: 8px 0;
  border: none;
  border-bottom: 1px solid #eee;
  font-family: Arial, sans-serif;
  font-size: 15px;
  color: #333;
  background: transparent;
  outline: none;
  transition: border-color 0.2s;
}
.process-form input:focus, .process-form textarea:focus {
  border-bottom-color: var(--accent);
}
.process-form .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.process-form .form-actions {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed #eee;
}

/* ── Lexical Toolbar Refinement ──────────────────────────────────── */
.lexical-toolbar {
  padding: 6px 10px;
  background: #fff;
  border-bottom: 1px solid #f0f0f0;
}
.toolbar-item svg {
  color: #666;
}
.toolbar-item:hover {
  background: #f5f5f5;
  color: var(--accent);
}
.toolbar-item:disabled:hover,
.toolbar-item[aria-disabled="true"]:hover {
  background: transparent;
  color: #666;
}
.toolbar-item.active {
  background: #eff6ff;
  color: var(--accent);
  border-color: #bfdbfe;
}
.divider {
  width: 1px;
  background-color: #e2e8f0;
  margin: 0 4px;
  height: 20px;
}
#lexicalEditor {
  padding: 28px 32px;
  background: #fff;
  transition: font-size 0.2s ease;
}

.etiqueta-print-container {
  width: min(100%, 980px);
  margin: 0 auto;
  padding: 16px 20px 12px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  background: #ffffff;
}

.etiqueta-print-container #lexicalEditor {
  flex: 0 0 auto;
  min-height: 190px;
  padding: 14px 18px 10px;
  overflow-y: visible;
  line-height: 1.45;
}

.etiqueta-print-container .texto-anotacao .lexical-paragraph {
  margin-bottom: 6px;
}
#previewBox {
  transition: font-size 0.2s ease;
}

/* ── Toast Notifications ────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 10000;
}

.toast-notification {
  min-width: 280px;
  padding: 12px 16px;
  background: #ffffff;
  border: 1px solid #f1f5f9;
  border-radius: 8px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: Arial, sans-serif;
  font-size: 15px;
  color: #374151;
  animation: toast-in 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  pointer-events: auto;
}

.toast-notification svg {
  flex-shrink: 0;
}

.toast-notification.success svg { color: #3b82f6; } /* Azul do sistema conforme pedido */
.toast-notification.error svg { color: #ef4444; }
.toast-notification.warn svg { color: #f59e0b; }
.toast-notification.info svg { color: #3b82f6; }

.toast-notification.fade-out {
  animation: toast-out 0.3s ease-in forwards;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(-12px) scale(0.98); }
}

/* ── Editor Actions Premium ───────────────────────────────────────── */
.btn-action-premium {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 4px;
  font-family: Arial, sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid #d1d5db;
  text-transform: none;
}

.btn-draft {
  background: #ffffff;
  color: #374151;
}
.btn-draft:hover {
  background: #f9fafb;
  border-color: #9ca3af;
}

.btn-batch {
  background: #ffffff;
  color: #374151;
}
.btn-batch:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
}

.btn-express {
  background: #fff5f5;
  border-color: #feb2b2;
  color: #c53030;
}
.btn-express:hover {
  background: #fee2e2;
  border-color: #fc8181;
}

.btn-reject {
  display: none !important; /* Removido conforme solicitação */
}

.btn-action-premium svg {
  flex-shrink: 0;
}
/* Layout Minimalista Dados CRC */
.crc-summary-container {
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.crc-item label {
  letter-spacing: 0.05em;
}
.crc-item span, .crc-item div {
  font-family: Arial, sans-serif;
}
#sujeitoTermSelect:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

/* Preview da Comunicação Bruta */
#editorRawComm {
  font-family: Arial, sans-serif;
  font-size: 13px;
  line-height: 1.6;
  color: #334155;
  background: #fdfdfd;
  padding: 10px;
  white-space: pre-wrap;
}
.raw-comm-preview svg {
  color: var(--accent);
}

/* ── Toast Notifications ────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 32px;
  right: 32px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 10000;
}
.toast-notification {
  min-width: 300px;
  padding: 14px 20px;
  background: #f9fafb; /* bg-gray-50 */
  border: 1px solid #e5e7eb; /* border-gray-200 */
  border-radius: var(--rs);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: Arial, sans-serif;
  font-size: 15.5px;
  color: #374151; /* text-gray-700 */
  animation: toast-in 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.toast-notification.fade-out {
  animation: toast-out 0.3s ease-in forwards;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toast-out {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(-10px) scale(0.98); }
}


.separator-v {
  width: 1px;
  height: 24px;
  background: #e2e8f0;
  margin: 0 10px;
}

/* ── Toast Notifications ─────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 9999;
}

.toast {
  background: #ffffff;
  color: #1e293b;
  padding: 12px 20px;
  border-radius: 8px;
  font-family: Arial, sans-serif;
  font-size: 16px;
  font-weight: 500;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  border-left: 4px solid #2563eb;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toast-in 0.3s ease forwards;
  min-width: 250px;
}

.toast.success { border-left-color: #16a34a; }
.toast.warn { border-left-color: #d97706; }
.toast.error { border-left-color: #dc2626; }

@keyframes toast-in {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast.fade-out {
  animation: toast-out 0.3s ease forwards;
}

@keyframes toast-out {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}

/* ── Minimalist Refinement (Arial & Weights) ─────────────────────────── */
body, button, input, select, textarea, .card-head, .btn, .toast, label, h1, h2, h3, h4, b, strong, .text-bold {
  font-family: Arial, Helvetica, sans-serif !important;
  letter-spacing: normal !important;
  font-weight: 400 !important;
}

.uppercase-none { text-transform: none !important; }

/* Internal Scrolling for Master-Detail (Removed for Editor as per guidelines) */

/* Master-Detail Layout Adjustment */
#tab-comms.active {
  display: flex;
  flex-direction: column;
}

#tab-comms .comms-header {
  order: 1;
  margin-bottom: clamp(22px, 2vw, 32px);
}

#tab-comms .comms-tabs-nav {
  order: 2;
  margin-bottom: clamp(22px, 2vw, 30px) !important;
  overflow-x: auto;
  padding-top: clamp(2px, 0.6vw, 8px);
}

#commsListContainer,
#commsEditorWrapper,
#commsOfflineWrapper,
#commsLoteWrapper,
#commsArchivedWrapper {
  order: 3;
  min-width: 0;
}

#commsOfflineWrapper,
#commsLoteWrapper,
#commsArchivedWrapper {
  margin-top: clamp(4px, 0.8vw, 12px) !important;
}

.editor-main-header {
  margin-bottom: 15px;
}

.editor-main-header .page-desc {
  margin: 10px 0 0;
}

#commsLoteWrapper .lote-grid {
  display: grid !important;
  grid-template-columns: 320px 1fr !important;
  gap: clamp(18px, 1.8vw, 24px) !important;
  height: calc(100vh - 120px);
  min-height: clamp(440px, 58vh, 620px);
}

.lote-fila-card {
  transition: all 0.2s ease;
  border: 1px solid #e2e8f0;
  cursor: pointer;
}
.lote-fila-card.active {
  border-color: #2563eb;
  background: #eff6ff;
  box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.1);
}

.lote-fila-card:hover:not(.active) {
  border-color: #cbd5e1;
  background: #f8fafc;
}

/* ── Lote Notifications Animations ─────────────────────────────── */
@keyframes slideInRight {
  from { transform: translateX(120%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOutRight {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(120%); opacity: 0; }
}

#loteFilaList {
  gap: 10px !important;
}

.lote-item {
  border: 1px solid #dbe3ef !important;
  border-radius: 6px !important;
  cursor: pointer !important;
  margin-bottom: 0 !important;
  overflow: visible !important;
  padding: 12px 12px 13px !important;
  position: relative !important;
  transition: background 0.15s, border-color 0.15s !important;
}

.lote-item.active {
  border-color: #9db7d8 !important;
}

.lote-item:hover {
  background: #f8fafc !important;
}

.lote-item > div {
  font-family: Arial, Helvetica, sans-serif !important;
  font-weight: 400 !important;
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
}

.lote-item-head {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 8px;
}

.lote-item-code,
.lote-item-status {
  font-size: 12px;
  color: #475569;
  line-height: 1.25;
}

.lote-item-code {
  overflow-wrap: anywhere;
}

.lote-item-status {
  flex: 0 0 auto;
  text-transform: uppercase;
  text-align: right;
}

.lote-item-name {
  color: #1e293b;
  font-size: 13.5px;
  font-weight: 700 !important;
  line-height: 1.32;
  margin-bottom: 5px;
  overflow-wrap: anywhere !important;
}

.lote-item-type {
  color: #64748b;
  font-size: 12px;
  line-height: 1.35;
  margin-bottom: 2px;
}

.lote-item-meta {
  color: #64748b;
  font-size: 12px;
  line-height: 1.4;
  overflow-wrap: anywhere !important;
}

.users-section-card {
  font-family: Arial, Helvetica, sans-serif;
  padding: 18px 20px;
}

.users-create-card .form-grid,
.users-filter-grid {
  align-items: end;
  gap: 16px 14px;
}

.users-create-card .form-group,
.users-list-card .form-group {
  margin-bottom: 0;
}

.users-create-card .btn-row {
  margin-top: 4px;
}

.users-card-head {
  align-items: flex-start;
  flex-direction: column;
  gap: 2px;
}

.users-card-head small {
  color: #66758a;
  font-size: 13px;
  font-weight: 400;
  text-transform: none;
}

.users-filter-grid {
  grid-template-columns: minmax(260px, 1.4fr) minmax(180px, .8fr) minmax(180px, .8fr);
  margin-bottom: 16px;
}

.users-actions-cell {
  min-width: 210px;
}

.users-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-start;
}

.users-actions .btn {
  min-height: 28px;
}

.user-status {
  align-items: center;
  border: 1px solid #d8e0ea;
  border-radius: 4px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 700;
  justify-content: center;
  min-width: 64px;
  padding: 3px 8px;
  text-transform: uppercase;
}

.user-status.is-active {
  background: #eef7f0;
  border-color: #c8dfce;
  color: #2f6f3b;
}

.user-status.is-inactive {
  background: #f4f5f7;
  border-color: #d9dee7;
  color: #647083;
}

.permissions-card {
  background: #fbfcfe;
}

.permissions-panel-head {
  align-items: flex-start;
  border-bottom: 1px solid #dde5ef;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 16px;
}

.permissions-panel-title {
  min-width: 0;
}

.permissions-title {
  border: 0;
  color: #2e5fa3;
  font-size: 15px;
  margin: 0;
  padding: 0;
}

.permissions-subtitle {
  color: #66758a;
  font-size: 13.5px;
  margin-top: 4px;
}

.permissions-user-summary {
  background: #fff;
  border: 1px solid #dbe3ee;
  border-radius: 4px;
  margin-top: 12px;
  padding: 12px 14px;
}

.permissions-user-title {
  color: #1e293b;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.25;
}

.permissions-user-meta {
  color: #64748b;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px;
  margin-top: 5px;
}

.permissions-actions {
  justify-content: flex-end;
  margin-top: 0;
}

.permissions-actions .btn {
  min-height: 32px;
}

.permissions-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.permissions-group {
  background: #fff;
  border: 1px solid #e0e7f0;
  border-radius: 4px;
  padding: 14px;
}

.permissions-group h3 {
  border-bottom: 1px solid #edf1f6;
  color: #334155;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px;
  font-weight: 700;
  margin: 0 0 8px;
  padding-bottom: 8px;
  text-transform: uppercase;
}

.permission-check {
  align-items: flex-start;
  border-radius: 4px;
  display: flex;
  gap: 10px;
  padding: 8px 4px;
}

.permission-check:hover {
  background: #f8fafc;
}

.permission-check input {
  margin-top: 2px;
}

.permission-check span {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.permission-check strong {
  color: #1e293b;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px;
  font-weight: 600;
}

.permission-check small {
  color: #64748b;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 11px;
}

.permission-critical strong {
  color: #7f1d1d;
}

.permission-disabled {
  opacity: .58;
}

.permission-disabled:hover {
  background: transparent;
}

.offline-import-card {
  margin-bottom: clamp(18px, 1.8vw, 28px);
  padding: clamp(18px, 1.8vw, 24px);
}

.offline-warning {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-left: 4px solid #f97316;
  border-radius: 4px;
  color: #7c2d12;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px;
  line-height: 1.45;
  margin: clamp(14px, 1.4vw, 20px) 0;
  padding: clamp(12px, 1.2vw, 16px) clamp(14px, 1.4vw, 18px);
}

.offline-warning p {
  margin: 0 0 6px;
}

.offline-warning p:last-child {
  margin-bottom: 0;
}

.offline-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: clamp(14px, 1.4vw, 20px);
}

.offline-status-text {
  color: #64748b;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px;
}

.offline-status-text.status-available {
  color: #15803d;
}

.offline-status-text.status-unstable {
  color: #b91c1c;
}

.offline-import-result {
  align-items: center;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  color: #334155;
  display: flex;
  flex-wrap: wrap;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px;
  gap: 10px;
  margin-top: clamp(14px, 1.4vw, 20px);
  padding: 10px 12px;
}

.offline-preview {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-family: Arial, Helvetica, sans-serif;
  margin-top: clamp(14px, 1.4vw, 20px);
  padding: clamp(12px, 1.4vw, 18px);
}

.offline-preview-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.offline-preview-head strong {
  color: #0f172a;
  display: block;
  font-size: 14px;
}

.offline-preview-head span {
  color: #64748b;
  display: block;
  font-size: 12px;
  margin-top: 2px;
}

.offline-preview-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.offline-preview-summary span {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  color: #334155;
  font-size: 12px;
  padding: 5px 9px;
}

.offline-preview-note {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-left: 3px solid #94a3b8;
  border-radius: 4px;
  color: #334155;
  font-size: 12px;
  margin: 8px 0;
  padding: 8px 10px;
}

.offline-preview-note ul {
  margin: 6px 0 0 18px;
  padding: 0;
}

.offline-preview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.offline-preview-table-wrap {
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  max-height: 320px;
  overflow: auto;
}

.offline-preview-table {
  border-collapse: collapse;
  min-width: 760px;
  width: 100%;
}

.offline-preview-table th,
.offline-preview-table td {
  border-bottom: 1px solid #eef2f7;
  color: #334155;
  font-size: 12px;
  padding: 8px;
  text-align: left;
  vertical-align: top;
}

.offline-preview-table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 700;
  position: sticky;
  top: 0;
  z-index: 1;
}

.offline-preview-check {
  width: 34px;
}

.offline-preview-badge {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  color: #334155;
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 7px;
  white-space: nowrap;
}

.offline-preview-badge.is-new {
  background: #ecfdf5;
  border-color: #bbf7d0;
  color: #166534;
}

.offline-preview-badge.is-duplicate,
.offline-preview-badge.is-file-duplicate {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

.offline-preview-badge.is-error {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.offline-mini-badge {
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  border-radius: 999px;
  color: #3730a3;
  display: inline-block;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 10px;
  font-weight: 700;
  margin-left: 8px;
  padding: 2px 6px;
  text-transform: uppercase;
}

.offline-mini-badge.is-crc {
  background: #ecfdf5;
  border-color: #bbf7d0;
  color: #047857;
}

.archived-results-container {
  overflow-x: auto;
}

.archived-results-table {
  font-family: Arial, Helvetica, sans-serif;
  table-layout: auto;
}

.archived-results-table th {
  background: #f1f5f9;
  color: #334155;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 12px;
  font-weight: 700 !important;
  letter-spacing: normal;
  line-height: 1.2;
  padding: 10px 12px;
  text-transform: uppercase;
  white-space: nowrap;
}

.archived-results-table td {
  color: #1f2937;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px;
  line-height: 1.3;
  padding: 10px 12px;
  vertical-align: middle;
}

.archived-type-cell {
  min-width: 130px;
  text-transform: none;
}

.archived-status-badge {
  background: #eef2f7;
  border: 1px solid #d7dee8;
  border-radius: 4px;
  color: #334155;
  display: inline-flex;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 12px;
  line-height: 1;
  padding: 5px 7px;
  white-space: nowrap;
}

.archived-row-actions {
  flex-wrap: nowrap;
  gap: 6px;
  justify-content: flex-start;
}

.archived-action-btn {
  border-color: #cbd5e1;
  border-radius: 4px;
  color: #334155;
  font-family: Arial, Helvetica, sans-serif !important;
  font-size: 12px;
  font-weight: 400 !important;
  height: 30px;
  line-height: 1.1;
  min-width: 74px;
  padding: 0 9px;
  white-space: normal;
}

.archived-action-btn:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #0f172a;
}

.archived-preview-meta {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px;
  color: #475569;
  margin-bottom: 10px;
}

.archived-preview-text {
  white-space: pre-wrap;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  color: #1e293b;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 12px;
  max-height: 420px;
  overflow: auto;
}

.comms-empty-state {
  align-items: center;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  font-family: Arial, Helvetica, sans-serif;
  gap: 6px;
  padding: 40px 20px;
  text-align: center;
}

.comms-empty-state strong {
  color: #1e293b;
  font-size: 16px;
  font-weight: 700;
}

.comms-empty-state span,
.comms-empty-state small {
  font-size: 14px;
}

.label-scribe-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -8px 0 12px;
}

.label-scribe-row label {
  color: #475569;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 12px;
  font-weight: 400;
}

.label-scribe-row select {
  height: 32px;
  max-width: 320px;
  min-width: 240px;
  padding: 0 8px;
}

.label-scribe-warning {
  color: #92400e;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 12px;
}

@media (max-width: 860px) {
  #tab-comms .comms-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  #tab-comms .comms-tabs-nav {
    margin-bottom: 18px !important;
    padding-bottom: 2px;
  }

  #commsLoteWrapper .lote-grid {
    grid-template-columns: 1fr !important;
    height: auto !important;
    min-height: 0;
  }

  #loteDetailEditor {
    min-height: 420px;
  }

  .offline-actions {
    align-items: stretch;
  }

  .offline-actions .btn {
    justify-content: center;
  }

  .users-create-card .form-grid,
  .users-filter-grid {
    grid-template-columns: 1fr;
  }

  .permissions-panel-head {
    flex-direction: column;
  }

  .permissions-actions {
    width: 100%;
  }
}
