/*
 * Estilos globais para o aplicativo web.
 */

:root {
  --primary-color: #2563eb;  /* azul principal */
  --primary-hover: #1e40af;
  --success-color: #16a34a; /* verde */
  --success-hover: #15803d;
  --warning-color: #f59e0b; /* amarelo */
  --warning-hover: #d97706;
  --background-gray: #f3f4f6; /* cinza claro */
  --font-color: #374151; /* cinza escuro */
  --border-color: #d1d5db;
  --error-background: #fee2e2;
  --error-color: #b91c1c;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background-color: var(--background-gray);
  color: var(--font-color);
}

/* ---------- Página de Login ---------- */

.login-wrapper {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: var(--background-gray);
  padding: 20px;
}

.login-card {
  display: flex;
  flex-wrap: wrap;
  width: 100%;
  max-width: 900px;
  background-color: #ffffff;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  overflow: hidden;
}

.image-section {
  flex: 1 1 50%;
  background-color: #f8fafc;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 30px;
  box-sizing: border-box;
  text-align: center;
}

.image-section .illustration {
  max-width: 80%;
  height: auto;
}

.image-section .subtitle {
  margin-top: 20px;
  font-size: 1.2rem;
  line-height: 1.4;
  color: var(--font-color);
  font-weight: 600;
}

.form-section {
  flex: 1 1 50%;
  padding: 40px 30px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.form-title {
  font-size: 1.6rem;
  margin-bottom: 20px;
  text-align: center;
  color: var(--font-color);
  font-weight: 700;
}

.error-message {
  background-color: var(--error-background);
  color: var(--error-color);
  padding: 10px 15px;
  border-radius: 4px;
  margin-bottom: 15px;
  font-size: 0.9rem;
}

.login-form {
  display: flex;
  flex-direction: column;
}

.login-form label {
  margin-top: 10px;
  margin-bottom: 4px;
  font-weight: 600;
  color: var(--font-color);
}

.login-form input {
  padding: 10px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 1rem;
  box-sizing: border-box;
}

.btn-primary {
  margin-top: 20px;
  padding: 12px;
  background-color: var(--primary-color);
  color: #ffffff;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
}

/* ---------- Cabeçalho comum ---------- */

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 30px;
  background-color: #ffffff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.app-header h1 {
  font-size: 1.5rem;
  margin: 0;
  color: var(--font-color);
  font-weight: 700;
}

.header-icons .icon-link {
  margin-left: 15px;
  color: var(--font-color);
  display: inline-flex;
}

.header-icons .icon-link svg {
  vertical-align: middle;
}

/* Imagens de ícones no cabeçalho */
.icon-img {
  width: 22px;
  height: 22px;
  display: inline-block;
}

/* Navegação de abas na página de configurações */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tab-btn {
  display: inline-block;
  padding: 8px 14px;
  background-color: var(--primary-color);
  color: #fff;
  border-radius: 4px;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.2s ease;
}
.tab-btn:hover {
  background-color: var(--primary-hover);
}
.tab-btn.active {
  background-color: var(--primary-hover);
}

/* Seção em cartão para formulários de configurações */
.card-section {
  background-color: #ffffff;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  padding: 20px;
  margin-bottom: 20px;
}

/* ---------- Conteúdo principal ---------- */

.main-content {
  padding: 20px 30px;
}

.page-title {
  font-size: 1.6rem;
  margin: 0 0 15px;
  font-weight: 700;
  color: var(--font-color);
}

/* Centraliza o título dentro da seção de filtro */
.filter-section .page-title {
  width: 100%;
  text-align: center;
}

/* Filtro */
.filter-section {
  background-color: #ffffff;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  margin-bottom: 20px;
}

.filter-form {
  display: flex;
  flex-wrap: wrap;
  /* Reduz o espaçamento entre os elementos da barra de filtros para acomodar mais botões em uma única linha */
  gap: 10px;
  align-items: flex-end;
}

.filter-form .form-group {
  display: flex;
  flex-direction: column;
  flex: 1 1 200px;
}

.filter-form label {
  margin-bottom: 4px;
  font-weight: 600;
  color: var(--font-color);
}

.filter-form input,
.filter-form select {
  padding: 8px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 0.95rem;
}

.btn-secondary,
.btn-success,
.btn-warning {
  display: inline-block;
  padding: 10px 16px;
  border-radius: 4px;
  font-weight: 600;
  text-decoration: none;
  color: #ffffff;
  transition: background-color 0.2s ease;
  border: none;
  cursor: pointer;
}

/*
 * Botão personalizado para a lista “Com Dr. João”. Ele utiliza uma
 * cor vermelha semelhante ao botão de perigo, mas é separado para
 * evitar confusão com ações destrutivas. As letras são brancas
 * conforme solicitado. Dentro da barra de filtros utilizamos um
 * tamanho reduzido para que todos os botões caibam em uma única
 * linha, semelhante aos demais botões do formulário.
 */
.btn-dr-joao {
  display: inline-block;
  padding: 10px 16px;
  border-radius: 4px;
  background-color: #dc2626; /* vermelho */
  color: #ffffff;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.2s ease;
  border: none;
  cursor: pointer;
}
.btn-dr-joao:hover {
  background-color: #b91c1c;
}

/* Versão compacta do botão “Com Dr. João” no formulário de filtros */
.filter-form .btn-dr-joao {
  padding: 8px 12px;
  font-size: 0.9rem;
}

/*
 * Ajustes específicos para os botões da barra de filtros. A aplicação possui agora
 * quatro botões (Filtrar, Novo Protocolo, Com Dr. João, Arquivados). Para que
 * todos caibam em uma única linha mesmo em telas estreitas, reduzimos o
 * padding e tamanho de fonte destes botões quando estiverem dentro do
 * formulário de filtros.
 */
.filter-form .btn-secondary,
.filter-form .btn-success,
.filter-form .btn-warning,
.filter-form .btn-danger {
  padding: 8px 12px;
  font-size: 0.9rem;
}

.btn-secondary {
  background-color: var(--primary-color);
}

.btn-secondary:hover {
  background-color: var(--primary-hover);
}

.btn-success {
  background-color: var(--success-color);
}

.btn-success:hover {
  background-color: var(--success-hover);
}

.btn-warning {
  background-color: var(--warning-color);
}

.btn-warning:hover {
  background-color: var(--warning-hover);
}

/* Botão de contorno para ações adicionais */
.btn-outline {
  display: inline-block;
  padding: 8px 14px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background-color: #ffffff;
  color: var(--font-color);
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.2s ease;
}
.btn-outline:hover {
  background-color: #f3f4f6;
}

/* Botão de exclusão (vermelho) */
.btn-danger {
  display: inline-block;
  padding: 10px 16px;
  border-radius: 4px;
  background-color: #dc2626;
  color: #ffffff;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.2s ease;
}

/* Botão cinza utilizado para ações neutras (ex. Desarquivar) */
.btn-gray {
  display: inline-block;
  padding: 10px 16px;
  border-radius: 4px;
  background-color: #6b7280;
  color: #ffffff;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.2s ease;
  border: none;
  cursor: pointer;
}
.btn-gray:hover {
  background-color: #4b5563;
}
.btn-danger:hover {
  background-color: #b91c1c;
}

/* Tabela de dados */
.table-section {
  background-color: #ffffff;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  overflow-x: auto;
}

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

.data-table th,
.data-table td {
  padding: 12px 10px;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
  font-size: 0.95rem;
}

.data-table th {
  background-color: #f9fafb;
  color: var(--font-color);
  font-weight: 600;
}

.data-table tr:hover {
  background-color: #f3f4f6;
}

/* Tabela de certidões: cabeçalhos centralizados */
.certidao-table th {
  text-align: center;
}

.link-protocol {
  color: #7e22ce;
  text-decoration: none;
  font-weight: 600;
}

.link-protocol:hover {
  text-decoration: underline;
}

.no-data {
  text-align: center;
  padding: 20px 0;
  color: #6b7280;
  font-style: italic;
}

/* Formulário de novo protocolo */
.protocol-form {
  max-width: 600px;
  margin: 0 auto;
  background-color: #ffffff;
  padding: 25px;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
}

.protocol-form .form-group {
  margin-bottom: 15px;
  display: flex;
  flex-direction: column;
}

.protocol-form label {
  margin-bottom: 5px;
  font-weight: 600;
  color: var(--font-color);
}

.protocol-form input,
.protocol-form textarea {
  padding: 8px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 0.95rem;
  resize: vertical;
}

.protocol-form button,
.protocol-form .btn-secondary {
  margin-top: 10px;
  align-self: flex-start;
}

/* Alinha títulos principais ao centro */
.center-title {
  text-align: center;
  width: 100%;
}

/* Ações do formulário em linha e alinhadas à direita */
.form-actions {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
}

/* Botão cancelar cinza para formulários */
.btn-cancel {
  display: inline-block;
  padding: 10px 16px;
  background-color: #6b7280;
  color: #fff;
  border-radius: 4px;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.2s ease;
}
.btn-cancel:hover {
  background-color: #4b5563;
}

/* Detalhes do protocolo */
.protocol-details {
  max-width: 600px;
  margin: 0 auto;
  background-color: #ffffff;
  padding: 25px;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.protocol-details p {
  margin-bottom: 12px;
  font-size: 1rem;
}

/* Modal para criação de novos protocolos */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal .modal-content {
  background-color: #ffffff;
  border-radius: 8px;
  padding: 25px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
  width: 100%;
  max-width: 480px;
}

/* ---------- Versao 2.0 ---------- */

:root {
  --v2-bg: #eef2f7;
  --v2-surface: #ffffff;
  --v2-surface-soft: #f8fafc;
  --v2-text: #182230;
  --v2-muted: #667085;
  --v2-border: #d9e2ec;
  --v2-blue: #2563eb;
  --v2-green: #12805c;
  --v2-red: #c2410c;
  --v2-yellow: #b7791f;
  --v2-purple: #7c3aed;
}

.v2-shell {
  background:
    linear-gradient(180deg, #f8fafc 0%, var(--v2-bg) 360px);
  color: var(--v2-text);
}

.v2-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--v2-border);
  box-shadow: 0 10px 30px rgba(24, 34, 48, 0.06);
}

.v2-header h1 {
  margin-top: 4px;
  color: var(--v2-text);
}

.eyebrow {
  display: inline-block;
  color: var(--v2-muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.v2-main {
  max-width: 1280px;
  margin: 0 auto;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(140px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.metric-card {
  min-height: 96px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--v2-surface);
  border: 1px solid var(--v2-border);
  border-left: 5px solid var(--v2-blue);
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 12px 28px rgba(24, 34, 48, 0.06);
}

.metric-card span {
  color: var(--v2-muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.metric-card strong {
  color: var(--v2-text);
  font-size: 2rem;
  line-height: 1;
}

.metric-danger { border-left-color: #dc2626; }
.metric-today { border-left-color: #2563eb; }
.metric-warning { border-left-color: #f59e0b; }
.metric-dr { border-left-color: #7c3aed; }
.metric-muted { border-left-color: #64748b; }

.v2-panel {
  border: 1px solid var(--v2-border);
  box-shadow: 0 14px 36px rgba(24, 34, 48, 0.07);
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-heading .page-title {
  margin: 2px 0 0;
  text-align: left;
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.v2-filter {
  display: grid;
  grid-template-columns: minmax(260px, 2fr) minmax(180px, 1fr) minmax(150px, 0.7fr) auto auto;
  align-items: end;
}

.v2-filter .form-group {
  min-width: 0;
}

.v2-filter input,
.v2-filter select {
  min-height: 40px;
  background: var(--v2-surface-soft);
}

.v2-table th {
  color: var(--v2-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
}

.v2-table td {
  vertical-align: middle;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 800;
  white-space: nowrap;
}

.badge-danger {
  background: #fee2e2;
  color: #991b1b;
}

.badge-today {
  background: #dbeafe;
  color: #1d4ed8;
}

.badge-warning {
  background: #fef3c7;
  color: #92400e;
}

.badge-success {
  background: #dcfce7;
  color: #166534;
}

.badge-muted {
  background: #e5e7eb;
  color: #374151;
}

.protocol-timeline {
  background: var(--v2-surface);
  border-radius: 8px;
  padding: 22px;
  margin: 20px auto;
  max-width: 860px;
}

.timeline-list {
  position: relative;
  display: grid;
  gap: 14px;
}

.timeline-list::before {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 11px;
  width: 2px;
  background: var(--v2-border);
}

.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 14px;
}

.timeline-dot {
  position: relative;
  z-index: 1;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--v2-blue);
  border: 4px solid #fff;
  box-shadow: 0 0 0 1px var(--v2-border);
}

.timeline-observacao .timeline-dot {
  background: var(--v2-green);
}

.timeline-status .timeline-dot {
  background: var(--v2-purple);
}

.timeline-content {
  background: var(--v2-surface-soft);
  border: 1px solid var(--v2-border);
  border-radius: 8px;
  padding: 12px 14px;
}

.timeline-content time {
  display: block;
  color: var(--v2-muted);
  font-size: 0.8rem;
  margin-bottom: 4px;
}

.timeline-content strong {
  color: var(--v2-text);
}

.timeline-content p {
  margin: 6px 0 0;
  color: var(--v2-text);
  line-height: 1.45;
}

.btn-mini {
  margin-top: 10px;
  padding: 5px 9px;
  font-size: 0.75rem;
}

@media (max-width: 1100px) {
  .dashboard-grid {
    grid-template-columns: repeat(3, minmax(160px, 1fr));
  }

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

@media (max-width: 720px) {
  .app-header,
  .section-heading {
    flex-direction: column;
    align-items: stretch;
  }

  .dashboard-grid,
  .v2-filter {
    grid-template-columns: 1fr;
  }

  .main-content {
    padding: 16px;
  }

  .quick-actions {
    justify-content: flex-start;
  }
}

/* ---------- Modern App Layout 2.2 ---------- */

.modern-app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  background: #f4f7fb;
  color: #172033;
  font-family: Inter, "Segoe UI", Arial, Helvetica, sans-serif;
}

.modern-app svg {
  width: 18px;
  height: 18px;
  display: block;
  fill: currentColor;
}

.modern-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: #111827;
  color: #e5e7eb;
  padding: 22px 16px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  text-decoration: none;
  padding: 4px 6px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #2563eb;
  border-radius: 8px;
  font-weight: 900;
}

.brand-block strong,
.brand-block small {
  display: block;
  line-height: 1.15;
}

.brand-block small {
  margin-top: 3px;
  color: #9ca3af;
  font-size: 0.78rem;
}

.side-nav {
  display: grid;
  gap: 6px;
}

.side-nav a {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #cbd5e1;
  text-decoration: none;
  padding: 0 12px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.92rem;
}

.side-nav a:hover,
.side-nav a.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.09);
}

.modern-page {
  min-width: 0;
}

.modern-topbar {
  min-height: 86px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 28px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid #e3e8ef;
  box-shadow: 0 10px 24px rgba(17, 24, 39, 0.05);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(10px);
}

.modern-topbar h1 {
  margin: 3px 0 0;
  font-size: 1.45rem;
  line-height: 1.1;
  color: #172033;
}

.kicker {
  color: #64748b;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

.topbar-actions,
.panel-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
}

.modern-content {
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: 28px;
  box-sizing: border-box;
}

.modern-button,
.icon-button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  box-sizing: border-box;
}

.modern-button {
  padding: 0 15px;
  font-size: 0.92rem;
}

.icon-button {
  width: 40px;
  color: #475467;
  background: #fff;
  border-color: #d0d7e2;
}

.modern-button.primary {
  color: #fff;
  background: #2563eb;
}

.modern-button.danger {
  color: #fff;
  background: #dc2626;
}

.modern-button.warning {
  color: #fff;
  background: #d97706;
}

.modern-button.ghost {
  color: #344054;
  background: #fff;
  border-color: #cbd5e1;
}

.modern-button:hover,
.icon-button:hover {
  filter: brightness(0.96);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.modern-metric {
  min-height: 116px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  background: #fff;
  border: 1px solid #e3e8ef;
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 14px 30px rgba(17, 24, 39, 0.06);
  color: inherit;
  text-decoration: none;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.modern-metric:hover {
  transform: translateY(-2px);
  border-color: #b9c8dc;
  box-shadow: 0 18px 38px rgba(17, 24, 39, 0.1);
}

.modern-metric.is-active {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12), 0 14px 30px rgba(17, 24, 39, 0.06);
}

.modern-metric small {
  display: block;
  color: #667085;
  font-size: 0.84rem;
  font-weight: 800;
}

.modern-metric strong {
  display: block;
  margin-top: 12px;
  color: #101828;
  font-size: 2.15rem;
  line-height: 1;
}

.metric-icon {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  flex: 0 0 auto;
}

.metric-blue .metric-icon { color: #1d4ed8; background: #dbeafe; }
.metric-red .metric-icon { color: #b91c1c; background: #fee2e2; }
.metric-indigo .metric-icon { color: #4338ca; background: #e0e7ff; }
.metric-amber .metric-icon { color: #a16207; background: #fef3c7; }
.metric-violet .metric-icon { color: #6d28d9; background: #ede9fe; }
.metric-slate .metric-icon { color: #475569; background: #e2e8f0; }

.modern-panel {
  background: #fff;
  border: 1px solid #e3e8ef;
  border-radius: 8px;
  box-shadow: 0 14px 30px rgba(17, 24, 39, 0.06);
}

.filter-panel {
  padding: 18px;
  margin-bottom: 18px;
}

.panel-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 16px;
}

.panel-title-row h2 {
  margin: 3px 0 0;
  color: #172033;
  font-size: 1.25rem;
}

.modern-filter {
  display: grid;
  grid-template-columns: minmax(300px, 2fr) minmax(190px, 1fr) minmax(160px, 0.8fr) auto auto;
  gap: 10px;
  align-items: end;
}

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.field span {
  color: #475467;
  font-size: 0.82rem;
  font-weight: 800;
}

.field input,
.field select {
  width: 100%;
  min-height: 40px;
  padding: 0 11px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  color: #172033;
  background: #f8fafc;
  font-size: 0.95rem;
  box-sizing: border-box;
}

.field input:focus,
.field select:focus {
  outline: 2px solid rgba(37, 99, 235, 0.22);
  border-color: #2563eb;
  background: #fff;
}

.table-panel {
  padding: 0;
  overflow: auto;
}

.modern-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.modern-table th,
.modern-table td {
  padding: 14px 16px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
}

.modern-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
  color: #475467;
  font-size: 0.77rem;
  text-transform: uppercase;
  font-weight: 900;
}

.modern-table td {
  color: #172033;
  font-size: 0.94rem;
  vertical-align: top;
}

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

.protocol-link {
  color: #2563eb;
  font-weight: 900;
  text-decoration: none;
}

.protocol-link:hover {
  text-decoration: underline;
}

.note-cell {
  max-width: 680px;
  line-height: 1.35;
}

.status-pill {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 900;
  white-space: nowrap;
}

.pill-danger { color: #991b1b; background: #fee2e2; }
.pill-today { color: #1d4ed8; background: #dbeafe; }
.pill-warning { color: #92400e; background: #fef3c7; }
.pill-success { color: #166534; background: #dcfce7; }
.pill-muted { color: #475569; background: #e2e8f0; }
.pill-archived-canceled { color: #111827; background: #ef4444; }
.pill-archived-finished { color: #fff; background: #2563eb; }

.empty-state {
  color: #667085;
  text-align: center;
  padding: 34px 16px;
}

@media (max-width: 1180px) {
  .modern-app {
    grid-template-columns: 1fr;
  }

  .modern-sidebar {
    position: static;
    height: auto;
    padding: 12px 16px;
  }

  .brand-block {
    display: none;
  }

  .side-nav {
    display: flex;
    overflow-x: auto;
    gap: 8px;
  }

  .side-nav a {
    flex: 0 0 auto;
  }

  .metric-grid {
    grid-template-columns: repeat(3, minmax(180px, 1fr));
  }

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

@media (max-width: 720px) {
  .modern-topbar,
  .panel-title-row {
    align-items: stretch;
    flex-direction: column;
  }

  .modern-content {
    padding: 16px;
  }

  .metric-grid,
  .modern-filter {
    grid-template-columns: 1fr;
  }

  .topbar-actions,
  .panel-actions {
    width: 100%;
  }

  .modern-button {
    flex: 1 1 auto;
  }
}

/* ---------- Detail View 2.2 ---------- */

.detail-modern {
  min-height: 100vh;
  background: #f4f7fb;
  color: #172033;
  font-family: Inter, "Segoe UI", Arial, Helvetica, sans-serif;
}

.detail-modern svg {
  width: 18px;
  height: 18px;
  display: block;
  fill: currentColor;
}

.detail-topbar {
  min-height: 74px;
}

.detail-content {
  width: min(1320px, 100%);
}

.record-hero {
  padding: 22px;
  margin-bottom: 18px;
}

.record-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.record-title-row h2 {
  margin: 3px 0 0;
  color: #172033;
  font-size: 1.55rem;
}

.record-meta-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.record-meta {
  min-height: 78px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid #e3e8ef;
  border-radius: 8px;
  background: #f8fafc;
  box-sizing: border-box;
}

.record-meta.wide {
  grid-column: span 1;
}

.meta-icon {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  color: #1d4ed8;
  background: #dbeafe;
  border-radius: 8px;
}

.record-meta small {
  display: block;
  margin-bottom: 4px;
  color: #667085;
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.record-meta strong {
  color: #172033;
  font-size: 1rem;
}

.modern-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #172033;
  font-weight: 800;
}

.modern-check input {
  width: 18px;
  height: 18px;
}

.record-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  padding-top: 16px;
  border-top: 1px solid #e3e8ef;
}

.detail-modern .protocol-timeline {
  width: 100%;
  max-width: none;
  box-sizing: border-box;
  margin: 0 0 18px;
  padding: 22px;
  background: #fff;
  border: 1px solid #e3e8ef;
  border-radius: 8px;
  box-shadow: 0 14px 30px rgba(17, 24, 39, 0.06);
}

.detail-modern .section-heading {
  margin-bottom: 16px;
}

.detail-modern .section-heading .page-title {
  color: #172033;
  font-size: 1.25rem;
}

.detail-modern .timeline-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.detail-modern .timeline-list::before {
  display: none;
}

.detail-modern .timeline-item {
  grid-template-columns: 10px 1fr;
  gap: 12px;
}

.detail-modern .timeline-dot {
  width: 10px;
  height: 100%;
  min-height: 78px;
  border: 0;
  border-radius: 999px;
  box-shadow: none;
}

.detail-modern .timeline-content {
  min-height: 78px;
  border-radius: 8px;
  background: #f8fafc;
}

.detail-modern .timeline-content time {
  font-weight: 800;
}

.detail-modern .btn-mini {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  margin-top: 10px;
  border-radius: 8px;
}

.detail-modern .table-section {
  border: 1px solid #e3e8ef;
  box-shadow: 0 14px 30px rgba(17, 24, 39, 0.06);
}

.detail-modern h3.center-title {
  color: #172033;
  justify-content: space-between !important;
  max-width: 1320px;
  margin-left: auto;
  margin-right: auto;
  padding: 0 4px;
}

@media (max-width: 980px) {
  .record-meta-grid,
  .detail-modern .timeline-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .record-title-row {
    flex-direction: column;
  }

  .record-actions .modern-button {
    width: 100%;
  }
}

/* ---------- Modernized Legacy Pages 2.3 ---------- */

.settings-modern .tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px !important;
  padding: 8px;
  background: #fff;
  border: 1px solid #e3e8ef;
  border-radius: 8px;
  box-shadow: 0 14px 30px rgba(17, 24, 39, 0.06);
}

.settings-modern .tab-btn {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  border-radius: 8px;
  background: transparent;
  color: #475467;
  font-size: 0.9rem;
}

.settings-modern .tab-btn:hover,
.settings-modern .tab-btn.active {
  background: #2563eb;
  color: #fff;
}

.settings-modern .card-section {
  border: 1px solid #e3e8ef;
  border-radius: 8px;
  box-shadow: 0 14px 30px rgba(17, 24, 39, 0.06);
}

.settings-modern .card-section .center-title {
  color: #172033;
  text-align: left;
  margin-top: 0;
}

.settings-modern .protocol-form,
.form-modern .protocol-form {
  max-width: none;
  box-shadow: none;
  padding: 0;
}

.settings-modern .protocol-form input,
.settings-modern .protocol-form textarea,
.settings-modern .protocol-form select,
.form-modern .protocol-form input,
.form-modern .protocol-form textarea,
.form-modern .protocol-form select {
  min-height: 40px;
  border-radius: 8px;
  border-color: #cbd5e1;
  background: #f8fafc;
}

.settings-modern .data-table {
  border-collapse: separate;
  border-spacing: 0;
}

.settings-modern .data-table th {
  background: #f8fafc;
  color: #475467;
  font-size: 0.77rem;
  text-transform: uppercase;
  font-weight: 900;
}

.settings-modern .data-table th,
.settings-modern .data-table td {
  border-bottom: 1px solid #e5e7eb;
}

.settings-modern .btn-primary,
.settings-modern .btn-secondary,
.settings-modern .btn-danger,
.settings-modern .btn-warning,
.settings-modern .btn-success {
  border-radius: 8px;
}

.form-panel {
  width: min(760px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.modern-form label {
  color: #475467;
  font-size: 0.86rem;
  font-weight: 900;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #344054;
  font-weight: 800;
}

.audit-table .note-cell {
  max-width: 760px;
}

.report-filter {
  grid-template-columns: repeat(4, minmax(150px, 1fr)) minmax(210px, 1fr) auto auto;
}

.archived-filter {
  grid-template-columns: minmax(240px, 1.2fr) minmax(180px, 0.8fr) minmax(240px, 1fr) auto auto;
}

.report-sheet {
  padding: 24px;
}

.report-header {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 16px;
  margin-bottom: 18px;
  text-align: center;
}

.report-header h2 {
  margin: 3px 0 0;
  color: #172033;
  font-size: 1.35rem;
  text-align: center;
  text-transform: uppercase;
}

.report-group {
  margin-top: 22px;
}

.report-group h3 {
  margin: 0 0 10px;
  color: #172033;
  font-size: 1.05rem;
  text-align: center;
  text-transform: uppercase;
}

.report-table th,
.report-table td {
  font-size: 0.9rem;
}

.report-table {
  table-layout: fixed;
}

.report-col-protocol { width: 20%; }
.report-col-person { width: 30%; }
.report-col-status { width: 27%; }
.report-col-last { width: 23%; }

.last-movement-heading {
  text-align: center;
  white-space: normal;
  line-height: 1.15;
  vertical-align: middle;
}

.report-check-field .modern-check {
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  box-sizing: border-box;
}

.report-totals {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid #e3e8ef;
  text-align: center;
  break-inside: avoid;
  page-break-inside: avoid;
}

.report-totals h3 {
  margin: 0 0 12px;
  color: #172033;
  font-size: 1rem;
}

.report-total-grid {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
}

.report-total-grid span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: #f8fafc;
  border: 1px solid #e3e8ef;
  color: #172033;
}

.report-totals p {
  margin: 14px 0 0;
  color: #172033;
  font-weight: 900;
}

@media (max-width: 1180px) {
  .report-filter {
    grid-template-columns: repeat(2, minmax(170px, 1fr));
  }
}

@media print {
  @page {
    size: A4 portrait;
    margin: 12mm;
  }

  body {
    background: #fff !important;
    color: #111827 !important;
    font-size: 11px;
  }

  .modern-sidebar,
  .modern-topbar,
  .no-print {
    display: none !important;
  }

  .modern-app {
    display: block;
    background: #fff;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .modern-page {
    display: block;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .modern-content {
    padding: 0 !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
  }

  .report-sheet {
    border: 0;
    box-shadow: none;
    padding: 0 !important;
    width: 100% !important;
    margin: 0 !important;
  }

  .report-header {
    margin-bottom: 12px;
  }

  .report-header h2 {
    font-size: 16px;
  }

  .report-group {
    margin-top: 16px;
    break-inside: auto;
    page-break-inside: auto;
  }

  .report-group h3 {
    margin-bottom: 8px;
    font-size: 13px;
    break-after: avoid;
    page-break-after: avoid;
  }

  .report-header,
  .report-header h2,
  .report-group h3 {
    text-align: center !important;
    text-transform: uppercase;
  }

  .modern-table th,
  .modern-table td {
    padding: 4px 6px;
  }

  .report-table {
    width: 100% !important;
    table-layout: fixed;
    border-collapse: collapse;
  }

  .report-table th,
  .report-table td {
    font-size: 10px;
    line-height: 1.3;
    word-break: normal;
    overflow-wrap: break-word;
    vertical-align: top;
  }

  .report-table th {
    font-size: 10px;
    position: static;
    background: #f8fafc !important;
  }

  .report-table tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .report-col-protocol { width: 22%; }
  .report-col-person { width: 28%; }
  .report-col-status { width: 37%; }
  .report-col-last { width: 13%; }

  .last-movement-heading {
    text-align: center !important;
    white-space: normal !important;
    line-height: 1.3;
    font-size: 10px !important;
    vertical-align: middle !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  .report-table th:nth-child(4),
  .report-table td:nth-child(4) {
    text-align: center;
  }

  .report-totals {
    break-inside: avoid !important;
    page-break-inside: avoid !important;
    break-before: auto;
    page-break-before: auto;
    margin-top: 28px;
    padding-top: 16px;
  }

  .report-total-grid,
  .report-totals h3,
  .report-totals p {
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }

  .report-total-grid span {
    border: 0;
    background: transparent;
    min-height: auto;
    padding: 0 8px;
  }
}
