/* ==========================================================================
   RMC | Sistema de Fechamento de Folhas — estilos principais
   ========================================================================== */

:root {
  --navy-950: #0a1615;
  --navy-900: #142423;
  --navy-800: #1c322f;
  --navy-700: #26433f;
  --orange-600: #d8540f;
  --orange-500: #f16325;
  --orange-100: #fde3d4;
  --teal-600: #d8540f;   /* alias legado: agora aponta para o laranja da marca */
  --teal-500: #f16325;   /* alias legado: idem */
  --teal-100: #fde3d4;   /* alias legado: idem */
  --amber-500: #e8a33d;
  --amber-100: #fdf1de;
  --red-500: #d9534f;
  --red-100: #fbe4e3;
  --green-500: #3f9f5e;
  --green-100: #e2f4e7;
  --slate-50: #f5f7f9;
  --slate-100: #eef1f4;
  --slate-200: #e2e7ec;
  --slate-300: #cdd5dd;
  --slate-400: #9aa7b3;
  --slate-500: #6d7a87;
  --slate-600: #4d5964;
  --slate-800: #26313b;
  --white: #ffffff;

  --radius: 8px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(20, 36, 35, 0.06);
  --shadow-md: 0 4px 16px rgba(20, 36, 35, 0.10);
  --shadow-lg: 0 12px 32px rgba(20, 36, 35, 0.16);

  --font-display: 'Sora', 'Manrope', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
  color: var(--slate-800);
  background: var(--slate-50);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: var(--font-display); color: var(--navy-900); margin: 0; }

a { color: var(--teal-600); }

button { font-family: var(--font-body); cursor: pointer; }

::selection { background: var(--teal-100); }

/* ---------------------------------------------------------------------- */
/* LOGIN                                                                   */
/* ---------------------------------------------------------------------- */

.login-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
}

@media (max-width: 860px) {
  .login-wrap { grid-template-columns: 1fr; }
  .login-aside { display: none; }
}

.login-aside {
  background:
    linear-gradient(160deg, var(--navy-950), var(--navy-800) 65%, var(--teal-600) 150%);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 56px;
  color: var(--white);
}

.login-aside .brand-block {
  z-index: 1;
  align-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 18px;
}

.login-aside .brand-titulo {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 34px;
  letter-spacing: 0.01em;
  color: var(--white);
}

.login-aside .login-logo {
  max-width: 220px;
  height: auto;
  display: block;
}

.login-aside .aside-quote {
  z-index: 1;
  max-width: 420px;
  margin-top: 48px;
}

.login-aside .aside-quote h2 {
  color: var(--white);
  font-size: 32px;
  line-height: 1.25;
  margin-bottom: 14px;
}

.login-aside .aside-quote p {
  color: rgba(255, 255, 255, 0.7);
  font-size: 15px;
  line-height: 1.6;
}

.login-aside .aside-foot {
  z-index: 1;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.5);
}

.login-main {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

@media (max-width: 420px) {
  .login-main { padding: 20px 16px; }
  .login-card h1 { font-size: 22px; }
}

.login-card {
  width: 100%;
  max-width: 380px;
}

.login-card h1 {
  font-size: 26px;
  margin-bottom: 6px;
}

.login-card .sub {
  color: var(--slate-500);
  font-size: 14px;
  margin-bottom: 32px;
}

.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--slate-600);
  margin-bottom: 6px;
}

.field input, .field select, .field textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1.5px solid var(--slate-200);
  border-radius: var(--radius);
  font-size: 14.5px;
  font-family: var(--font-body);
  color: var(--slate-800);
  background: var(--white);
  transition: border-color 0.15s;
}

.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--teal-500);
  box-shadow: 0 0 0 3px var(--teal-100);
}

.field-error {
  color: var(--red-500);
  font-size: 12.5px;
  margin-top: 5px;
  display: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: var(--radius);
  border: none;
  font-size: 14.5px;
  font-weight: 600;
  transition: all 0.15s;
}

.btn-primary { background: var(--navy-900); color: var(--white); }
.btn-primary:hover { background: var(--navy-800); }

.btn-teal { background: var(--teal-600); color: var(--white); }
.btn-teal:hover { background: var(--teal-500); }

.btn-outline { background: var(--white); color: var(--slate-600); border: 1.5px solid var(--slate-200); }
.btn-outline:hover { border-color: var(--slate-400); color: var(--slate-800); }

.btn-danger { background: var(--red-500); color: var(--white); }
.btn-danger:hover { background: #c24541; }

.btn-block { width: 100%; }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.login-help {
  margin-top: 22px;
  font-size: 12.5px;
  color: var(--slate-400);
  background: var(--slate-100);
  border-radius: var(--radius);
  padding: 12px 14px;
  line-height: 1.6;
}

/* ---------------------------------------------------------------------- */
/* APP SHELL                                                              */
/* ---------------------------------------------------------------------- */

.app-shell {
  display: grid;
  grid-template-columns: 236px 1fr;
  min-height: 100vh;
}

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .sidebar.aberta {
    display: flex;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 268px;
    max-width: 82vw;
    height: 100vh;
    z-index: 60;
    box-shadow: 4px 0 24px rgba(0,0,0,0.25);
  }
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 22, 21, 0.5);
  z-index: 55;
}
.sidebar-backdrop.aberto { display: block; }

.sidebar {
  background: var(--navy-950);
  color: var(--white);
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar .brand {
  padding: 6px 10px 22px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 14px;
}

.sidebar .brand-logo {
  max-width: 100%;
  height: auto;
  display: block;
}

.sidebar .brand span { color: var(--teal-500); }

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: rgba(255, 255, 255, 0.68);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}

.nav-link:hover { background: rgba(255, 255, 255, 0.06); color: var(--white); }
.nav-link.ativo { background: var(--teal-600); color: var(--white); }

.nav-sep { height: 1px; background: rgba(255,255,255,0.08); margin: 14px 4px; }

.sidebar-foot {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 12.5px;
  color: rgba(255,255,255,0.45);
}

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  height: 64px;
  background: var(--white);
  border-bottom: 1px solid var(--slate-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar .titulo-pagina {
  font-size: 17px;
  font-weight: 700;
  color: var(--navy-900);
  font-family: var(--font-display);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.topbar-right { display: flex; align-items: center; gap: 14px; }

.menu-toggle { display: none; background: none; border: none; font-size: 20px; flex-shrink: 0; }
@media (max-width: 900px) { .menu-toggle { display: block; } }

@media (max-width: 720px) {
  .topbar { padding: 0 14px; gap: 8px; }
  .topbar-right { gap: 8px; }
  .titulo-pagina { font-size: 15px; max-width: 40vw; }
}

@media (max-width: 560px) {
  .user-chip-nome, .badge-nivel { display: none; }
  .user-chip { padding: 5px; gap: 0; }
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 12px 6px 6px;
  border-radius: 999px;
  background: var(--slate-100);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--slate-800);
}

.user-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--teal-600);
  color: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}

.badge-nivel {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--amber-100);
  color: #92660e;
  padding: 2px 7px;
  border-radius: 999px;
  font-weight: 700;
}

.content {
  padding: 26px;
  flex: 1;
  min-width: 0;
}

@media (max-width: 720px) {
  .content { padding: 16px; }
}
@media (max-width: 480px) {
  .content { padding: 12px; }
}

/* ---------------------------------------------------------------------- */
/* NOTIFICATIONS WIDGET                                                   */
/* ---------------------------------------------------------------------- */

.notif-wrap { position: relative; }

.icon-btn {
  position: relative;
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1.5px solid var(--slate-200);
  background: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
}
.icon-btn:hover { background: var(--slate-100); }

.notif-badge {
  position: absolute;
  top: -4px; right: -4px;
  background: var(--red-500);
  color: white;
  font-size: 10px;
  font-weight: 700;
  min-width: 17px; height: 17px;
  border-radius: 999px;
  display: none;
  align-items: center; justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--white);
}

.notif-painel {
  position: absolute;
  top: 48px; right: 0;
  width: 340px;
  max-width: calc(100vw - 24px);
  max-height: 420px;
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--slate-200);
  display: none;
  overflow: hidden;
  flex-direction: column;
}

@media (max-width: 480px) {
  .notif-painel { position: fixed; top: 62px; left: 12px; right: 12px; width: auto; }
}

.notif-painel.aberto { display: flex; }

.notif-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--slate-100);
  font-weight: 700;
  font-size: 14px;
  color: var(--navy-900);
}

.link-btn {
  background: none; border: none; color: var(--teal-600);
  font-size: 12px; font-weight: 600;
}

.notif-lista { overflow-y: auto; }

.notif-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--slate-100);
  cursor: pointer;
}
.notif-item:hover { background: var(--slate-50); }
.notif-item.nao-lida { background: var(--teal-100); }
.notif-item.nao-lida:hover { background: #cdeeea; }

.notif-msg { font-size: 13px; color: var(--slate-800); line-height: 1.4; }
.notif-data { font-size: 11.5px; color: var(--slate-400); margin-top: 4px; }
.notif-vazio { padding: 30px 16px; text-align: center; color: var(--slate-400); font-size: 13px; }

/* ---------------------------------------------------------------------- */
/* CARDS / KPIs                                                           */
/* ---------------------------------------------------------------------- */

.grid-kpi {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.kpi-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  border: 1px solid var(--slate-200);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  cursor: default;
  transition: box-shadow 0.15s, transform 0.15s;
}

.kpi-card.clicavel { cursor: pointer; }
.kpi-card.clicavel:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.kpi-card .kpi-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--slate-500);
  position: relative;
}

.kpi-card .kpi-value {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  color: var(--navy-900);
  margin-top: 8px;
  position: relative;
}

.kpi-card .kpi-sub {
  font-size: 12px;
  color: var(--slate-400);
  margin-top: 4px;
  position: relative;
}

.kpi-card.accent-teal { border-top: 3px solid var(--teal-600); }
.kpi-card.accent-amber { border-top: 3px solid var(--amber-500); }
.kpi-card.accent-red { border-top: 3px solid var(--red-500); }
.kpi-card.accent-green { border-top: 3px solid var(--green-500); }
.kpi-card.accent-navy { border-top: 3px solid var(--navy-800); }

.panel {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--slate-200);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  margin-bottom: 20px;
}

@media (max-width: 480px) {
  .panel { padding: 14px; border-radius: var(--radius); }
}

.panel-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}

.panel-header h3 { font-size: 16px; }

/* ---------------------------------------------------------------------- */
/* TABLE                                                                  */
/* ---------------------------------------------------------------------- */

.table-scroll { overflow-x: auto; }

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  min-width: 720px;
}

table.data-table thead th {
  text-align: left;
  padding: 9px 10px;
  background: var(--slate-50);
  color: var(--slate-600);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  border-bottom: 2px solid var(--slate-200);
  white-space: nowrap;
  position: sticky;
  top: 0;
}

table.data-table tbody td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--slate-100);
  color: var(--slate-800);
  vertical-align: middle;
}

.tabela-fechamento tbody td { padding: 13px 10px; }

/* Em telas menores (ex: notebook, ~1400px ou menos), esconde as colunas
   menos essenciais pro dia a dia (Contato e Forma de Envio já aparecem no
   cadastro da empresa e no resumo do modal) pra caber sem depender de
   rolagem horizontal. */
@media (max-width: 1400px) {
  .tabela-fechamento th:nth-child(4), .tabela-fechamento td:nth-child(4),
  .tabela-fechamento th:nth-child(5), .tabela-fechamento td:nth-child(5) {
    display: none;
  }
  .tabela-fechamento { min-width: 620px; }
}

/* Em telas ainda menores, também poupa a coluna "Dia" (fica no cadastro) */
@media (max-width: 1150px) {
  .tabela-fechamento th:nth-child(6), .tabela-fechamento td:nth-child(6) {
    display: none;
  }
  .tabela-fechamento { min-width: 560px; }
  .tabela-fechamento .checklist-mini { max-width: 210px; min-width: 180px; }
}

table.data-table tbody tr:hover { background: var(--slate-50); }
table.data-table tbody tr.linha-clicavel { cursor: pointer; }
table.data-table tbody tr.linha-clicavel:hover { background: var(--slate-100); }

.cell-muted { color: var(--slate-400); font-size: 12.5px; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.pill-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* Status somente-leitura na tabela de Fechamento também quebra linha, pra
   manter a coluna estreita como no dropdown editável */
.tabela-fechamento .pill {
  white-space: normal;
  text-align: center;
  max-width: 92px;
  line-height: 1.2;
}

/* Dropdown de status customizado (permite quebra de linha, algo que um
   <select> nativo não permite) */
.status-dropdown { position: relative; display: inline-block; }

.status-trigger-btn {
  border: 1.5px solid;
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.2;
  white-space: normal;
  text-align: center;
  max-width: 92px;
  min-width: 76px;
  cursor: pointer;
}

.status-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  z-index: 30;
  min-width: 210px;
  max-height: 280px;
  overflow-y: auto;
  padding: 5px;
}
.status-dropdown.aberto .status-menu { display: block; }

.status-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: none;
  background: none;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--slate-700);
  cursor: pointer;
}
.status-menu-item:hover { background: var(--slate-100); }
.status-menu-item.ativo { background: var(--slate-100); font-weight: 800; color: var(--navy-900); }
.status-menu-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

.checklist-mini { display: flex; gap: 4px; flex-wrap: wrap; max-width: 250px; min-width: 210px; }
.chk-dot {
  min-width: 34px; height: 22px;
  padding: 0 4px;
  border-radius: 5px;
  border: 1.5px solid var(--slate-300);
  display: flex; align-items: center; justify-content: center;
  gap: 2px;
  font-size: 9px;
  color: var(--slate-400);
  cursor: default;
  font-weight: 800;
  background: var(--white);
  flex-shrink: 0;
  white-space: nowrap;
}
.chk-dot.on { background: var(--green-100); border-color: var(--green-500); color: #276b3d; }
.chk-dot.dispensado { background: var(--red-100); border-color: var(--red-500); color: #a33430; }

.filters-bar {
  display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; align-items: flex-end;
}

.filters-bar .field { margin-bottom: 0; min-width: 150px; }
.filters-bar .field.grow { flex: 1; min-width: 200px; }

.empty-state {
  text-align: center;
  padding: 50px 20px;
  color: var(--slate-400);
}
.empty-state .icon { font-size: 34px; margin-bottom: 10px; }

/* ---------------------------------------------------------------------- */
/* MODAL                                                                  */
/* ---------------------------------------------------------------------- */

.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(11, 28, 44, 0.55);
  display: none;
  align-items: center; justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-backdrop.aberto { display: flex; }
@media (max-width: 480px) {
  .modal-backdrop { padding: 10px; align-items: flex-end; }
  .modal { max-height: 94vh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
}

.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal.modal-lg { max-width: 780px; }
.modal.modal-xl { max-width: 980px; }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--slate-100);
  position: sticky; top: 0; background: var(--white); z-index: 2;
}

.modal-header h3 { font-size: 17px; }

.modal-close {
  background: none; border: none; font-size: 20px; color: var(--slate-400);
  width: 30px; height: 30px; border-radius: 50%;
}
.modal-close:hover { background: var(--slate-100); }

.modal-body { padding: 22px; }

.modal-footer {
  padding: 16px 22px;
  border-top: 1px solid var(--slate-100);
  display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap;
  position: sticky; bottom: 0; background: var(--white);
}

@media (max-width: 560px) {
  .modal-body { padding: 16px; }
  .modal-header { padding: 14px 16px; }
  .modal-footer { padding: 12px 16px; flex-direction: column-reverse; }
  .modal-footer .btn { width: 100%; }
}

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; }
.form-grid .span-2 { grid-column: span 2; }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } .form-grid .span-2 { grid-column: span 1; } }

.check-row {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 0;
  font-size: 14px;
}
.check-row input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--teal-600); }

/* ---------------------------------------------------------------------- */
/* CHECKLIST GRID (tela de fechamento)                                    */
/* ---------------------------------------------------------------------- */

.doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
}

.doc-item {
  border: 1.5px solid var(--slate-200);
  border-radius: var(--radius);
  padding: 12px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
}

.doc-item .doc-label { font-size: 13px; font-weight: 600; color: var(--slate-800); }

.doc-toggle-group { display: flex; gap: 4px; }
.doc-toggle-group button {
  border: 1.5px solid var(--slate-200);
  background: var(--white);
  font-size: 11px;
  font-weight: 700;
  padding: 5px 8px;
  border-radius: 6px;
  color: var(--slate-500);
}
.doc-toggle-group button.emitido.ativo { background: var(--green-100); border-color: var(--green-500); color: #276b3d; }
.doc-toggle-group button.dispensado.ativo { background: var(--red-100); border-color: var(--red-500); color: #a33430; }

@media (max-width: 480px) {
  .doc-grid { grid-template-columns: 1fr; }
  .doc-item { flex-direction: column; align-items: flex-start; gap: 10px; }
  .doc-toggle-group { width: 100%; }
  .doc-toggle-group button { flex: 1; }
}

/* ---------------------------------------------------------------------- */
/* TOASTS                                                                 */
/* ---------------------------------------------------------------------- */

#toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 200;
}

.toast {
  background: var(--navy-950);
  color: var(--white);
  padding: 13px 18px;
  border-radius: var(--radius);
  font-size: 13.5px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.25s;
  max-width: 320px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { background: #1c5c37; }
.toast-error { background: #7c2a27; }
.toast-info { background: var(--navy-950); }

/* ---------------------------------------------------------------------- */
/* PROTOCOLO DE ENTREGA (impressão)                                       */
/* ---------------------------------------------------------------------- */

.protocolo-preview {
  background: var(--slate-100);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  padding: 30px;
  font-size: 13.5px;
}

.folha-protocolo {
  background: var(--white);
  width: 100%;
  max-width: 794px;
  margin: 0 auto;
  padding: 22px 26px;
  box-shadow: var(--shadow-md);
}

.folha-protocolo.duas-vias { display: flex; flex-direction: column; gap: 0; }

.linha-corte {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
  color: var(--slate-400);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.linha-corte::before, .linha-corte::after {
  content: '';
  flex: 1;
  border-top: 1.5px dashed var(--slate-300);
}
.linha-corte .icone-tesoura { flex-shrink: 0; }

.protocolo-doc {
  max-width: 100%;
  margin: 0 auto;
  padding: 6px 0;
  min-height: 134mm;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

.protocolo-doc .cabecalho {
  display: flex; justify-content: space-between; align-items: center;
  gap: 14px;
  border-bottom: 3px solid var(--orange-600);
  padding-bottom: 12px; margin-bottom: 16px;
}
.protocolo-doc .cabecalho .logo-area { display: flex; align-items: center; gap: 10px; }
.protocolo-doc .cabecalho .logo-mark {
  width: 40px; height: 40px; border-radius: 8px;
  background: linear-gradient(135deg, var(--navy-900), var(--navy-700));
  color: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 800; font-size: 15px;
  flex-shrink: 0;
}
.protocolo-doc .cabecalho .logo-texto .nome-escritorio { font-family: var(--font-display); font-weight: 800; font-size: 15px; color: var(--navy-900); line-height: 1.2; }
.protocolo-doc .cabecalho .logo-texto .sub-escritorio { font-size: 10.5px; color: var(--slate-500); }
.protocolo-doc .cabecalho .meta { text-align: right; font-size: 11px; color: var(--slate-500); line-height: 1.6; }
.protocolo-doc .cabecalho .meta b { color: var(--navy-900); font-size: 12.5px; }

.protocolo-doc .faixa-titulo {
  background: var(--navy-900); color: var(--white);
  text-align: center; padding: 7px 10px; border-radius: 6px;
  font-size: 12.5px; font-weight: 700; letter-spacing: 0.04em;
  margin-bottom: 14px;
}

.protocolo-doc .info-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px 20px;
  margin-bottom: 14px; font-size: 12px;
}
.protocolo-doc .info-linha b { color: var(--navy-900); }

.protocolo-doc .doc-list {
  margin: 12px 0;
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  overflow: hidden;
}
.protocolo-doc .doc-list-item {
  display: flex; align-items: center; gap: 9px; padding: 5px 10px; font-size: 11.5px;
  border-bottom: 1px solid var(--slate-100);
}
.protocolo-doc .doc-list-item:last-child { border-bottom: none; }
.protocolo-doc .doc-list-item:nth-child(even) { background: var(--slate-50); }
.protocolo-doc .checkbox-box {
  width: 14px; height: 14px; border: 1.5px solid var(--orange-600); border-radius: 3px;
  background: var(--orange-100);
  display: inline-flex; align-items: center; justify-content: center; font-size: 10px; color: var(--orange-600); flex-shrink: 0;
}
.protocolo-doc .declaracao { margin: 12px 0; font-size: 11.5px; line-height: 1.5; color: var(--slate-600); }
.protocolo-doc .assinatura-area { margin-top: auto; padding-top: 20px; display: flex; justify-content: space-between; gap: 24px; }
.protocolo-doc .assinatura-box { flex: 1; text-align: center; }
.protocolo-doc .campo-assinatura { border-bottom: 1.3px solid var(--slate-800); height: 34px; }
.protocolo-doc .linha-assinatura { margin-top: 4px; font-size: 10px; color: var(--slate-500); text-transform: uppercase; letter-spacing: 0.03em; }
.protocolo-doc .campo-data-linha { display: flex; align-items: flex-end; justify-content: center; height: 34px; font-size: 13px; color: var(--slate-800); letter-spacing: 0.08em; }
.protocolo-doc .via-tag {
  display: inline-block; font-size: 9px; font-weight: 800; letter-spacing: 0.06em;
  color: var(--orange-600); background: var(--orange-100); padding: 2px 8px; border-radius: 999px;
  margin-bottom: 6px; text-transform: uppercase;
}

#print-mount { display: none; }

@media print {
  #layout-root, #toast-container, .modal-backdrop { display: none !important; }
  #print-mount { display: block !important; }
  .folha-protocolo { box-shadow: none; max-width: 100%; padding: 10mm 12mm; }
  @page { size: A4; margin: 0; }
}

/* ---------------------------------------------------------------------- */
/* MISC                                                                   */
/* ---------------------------------------------------------------------- */

.text-muted { color: var(--slate-500); }
.mt-0 { margin-top: 0; }
.flex { display: flex; }
.flex-gap { display: flex; gap: 10px; flex-wrap: wrap; }
.between { justify-content: space-between; }
.items-center { align-items: center; }

.tag-resp {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--slate-100); padding: 3px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; color: var(--slate-600);
}

.avatar-mini {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--teal-600); color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 800;
}

hr.sep { border: none; border-top: 1px solid var(--slate-200); margin: 18px 0; }

.badge-count {
  background: var(--navy-900); color: white; font-size: 11px; font-weight: 700;
  padding: 1px 8px; border-radius: 999px;
}

.perm-locked {
  opacity: 0.5;
  pointer-events: none;
}

.help-text { font-size: 12px; color: var(--slate-400); margin-top: 4px; }

textarea { resize: vertical; min-height: 60px; }

.competencia-switch {
  display: flex; align-items: center; gap: 8px;
  background: var(--white); border: 1.5px solid var(--slate-200); border-radius: var(--radius);
  padding: 6px 8px;
}
.competencia-switch select { border: none; font-weight: 700; color: var(--navy-900); font-size: 14px; }
.competencia-switch select:focus { outline: none; }
