:root {
  color-scheme: light dark;
  --primary: #0056b3;
  --primary-light: #e3f2fd;
  --border: rgba(0, 0, 0, 0.1);
  --text: #1f2933;
  --bg: #ffffff;
  --muted: #5f6c7b;
  font-family: 'Roboto', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

.container {
  max-width: 100%;
  margin: 0 auto;
  padding: 1.5rem;
}

/* NOVO: Estilo para o texto truncado (melhora a experiência de tooltip) */
.truncated-text {
  cursor: help;
  border-bottom: 1px dotted var(--muted);
}

.app-header {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.app-header__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  color: #fff;
  text-decoration: none;
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.15);
  font-weight: 700;
  letter-spacing: 0.5px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-title {
  font-weight: 600;
  font-size: 1.05rem;
}

.brand-subtitle {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.85);
}

.app-footer {
  background: #f5f7fa;
  color: var(--muted);
  text-align: center;
  padding: 1rem 0;
  font-size: 0.9rem;
  border-top: 1px solid var(--border);
}

.intro h2 {
  margin-top: 0;
}

.upload-panel {
  margin: 2rem 0;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--primary-light);
}

.upload-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.upload-form input[type="file"] {
  padding: 0.75rem;
  border: 1px dashed var(--primary);
  border-radius: 8px;
  background: #fff;
}

.upload-form button,
.button {
  align-self: flex-start;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  font-weight: 500;
}

.upload-form button:hover,
.button:hover {
  background: #003f82;
}

.button--danger {
  background: #c62828;
}

.button--danger:hover {
  background: #8e0000;
}

.samples .sample-list {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
}

.samples a {
  display: block;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  color: var(--primary);
  background: #fff;
  transition: background 0.2s ease;
}

.samples a:hover {
  background: var(--primary-light);
}

.routes-guide {
  margin: 2.5rem 0;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}

.routes-guide__intro {
  margin: 0.5rem 0 1.5rem;
  color: var(--muted);
  line-height: 1.6;
}

.routes-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

.routes-table th,
.routes-table td {
  border: 1px solid var(--border);
  padding: 0.75rem 1rem;
  text-align: left;
}

.routes-table th {
  background: var(--primary-light);
  font-weight: 600;
}

.routes-table code {
  font-size: 0.95rem;
}

.flash-container {
  margin-bottom: 1rem;
}

.flash {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 0.5rem;
}

.form-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-field input[type="text"],
.form-field input[type="number"],
.form-field input[type="password"] {
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.form-field--checkbox {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

.form-label {
  font-weight: 600;
}

.form-hint {
  color: var(--muted);
  font-size: 0.9rem;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
}

.page-header {
  margin-bottom: 1rem;
}

.page-header h2 {
  margin: 0 0 0.25rem;
}

.batch-import__storage,
.server-import-panel {
  margin: 1.5rem 0;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}

.batch-import__storage-options {
  display: flex;
  gap: 1rem;
  margin: 0.5rem 0;
}

.batch-import__storage-options label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.flash-error {
  background: #fdecea;
  color: #b61b1b;
  border: 1px solid rgba(182, 27, 27, 0.2);
}

.flash-success {
  background: #e6f4ea;
  color: #1e7a3d;
  border: 1px solid rgba(30, 122, 61, 0.2);
}

.summary {
  margin-top: 2rem;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.summary-grid--compact {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.summary-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  background: #fff;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.page-header h2 {
  margin: 0 0 0.35rem;
}

.page-header p {
  margin: 0;
  color: var(--muted);
}

.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
  margin-bottom: 1.75rem;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}

.table-wrapper {
  width: 100%;
  overflow-x: auto;
}

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

.clients-table th,
.clients-table td {
  border: 1px solid #e3e7ed;
  padding: 0.65rem 0.75rem;
  text-align: left;
  vertical-align: middle;
}

.clients-table thead {
  background: #f8f9fb;
}

.clients-table td.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.clients-table td.actions form {
  margin: 0;
}

.btn-primary,
.btn-secondary,
.btn-link {
  font-family: inherit;
  font-size: 0.95rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 0.55rem 1.25rem;
  border-radius: 6px;
  transition: background 0.2s ease;
}

.btn-primary:hover {
  background: #004494;
}

.btn-secondary {
  background: #f1f5f9;
  color: var(--text);
  border: 1px solid #d0d7e2;
  padding: 0.55rem 1.25rem;
  border-radius: 6px;
}

.btn-link {
  background: none;
  color: var(--primary);
  border: none;
  padding: 0;
  text-decoration: none;
}

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

.btn-link--danger {
  color: #c82333;
}

.btn-block {
  width: 100%;
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -40%) scale(0.95);
  width: min(520px, 92vw);
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.18);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 1001;
}

.modal.is-open {
  opacity: 1;
  pointer-events: all;
  transform: translate(-50%, -50%) scale(1);
}

.modal__dialog {
  padding: 1.5rem;
}

.modal__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.modal__close {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
}

.modal__footer {
  margin-top: 1.25rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 1000;
}

.modal-backdrop.is-open {
  opacity: 1;
  pointer-events: all;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
}

.form-row label {
  font-weight: 500;
}

.form-row input[type="text"],
.form-row input[type="email"],
.form-row input[type="password"],
.form-row textarea,
.form-row select {
  padding: 0.6rem 0.75rem;
  border: 1px solid #ccd4dd;
  border-radius: 6px;
  font-size: 0.95rem;
}

.form-row--inline {
  flex-direction: row;
  align-items: center;
  gap: 0.75rem;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.form-hint {
  font-size: 0.8rem;
  color: var(--muted);
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.45rem;
  background: #e0e7ff;
  color: #3730a3;
  border-radius: 999px;
  font-size: 0.75rem;
}

.app-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.app-nav {
  flex: 1;
  display: flex;
  justify-content: center;
}

.app-nav__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.app-nav__item {
  position: relative;
}

.app-nav__link {
  color: #fff;
  text-decoration: none;
  font-weight: 500;
  padding: 0.55rem 0.9rem;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: background 0.2s ease;
}

.app-nav__link:hover {
  background: rgba(255, 255, 255, 0.1);
}

.app-nav__item--has-children .app-nav__link::after {
  content: '▾';
  font-size: 0.7rem;
  opacity: 0.8;
}

.app-nav__submenu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 200px;
  background: #fff;
  color: #0f172a;
  padding: 0.6rem 0;
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
  display: none;
  z-index: 10;
}

.app-nav__submenu li {
  list-style: none;
}

.app-nav__submenu a {
  color: inherit;
  text-decoration: none;
  display: block;
  padding: 0.55rem 1rem;
  font-weight: 500;
}

.app-nav__submenu a:hover {
  background: #f3f4f6;
}

.app-nav__item--has-children:hover .app-nav__submenu,
.app-nav__item--has-children:focus-within .app-nav__submenu {
  display: block;
}

.app-header__logout:hover,
.app-header__login:hover {
  text-decoration: underline;
}

.app-header__user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.95rem;
}

.app-header__user-name {
  font-weight: 500;
}

.app-header__logout,
.app-header__login {
  color: #fff;
  text-decoration: none;
}

@media (max-width: 900px) {
  .app-header__inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .app-nav {
    width: 100%;
    justify-content: flex-start;
  }
}

.auth-body {
  background: linear-gradient(160deg, #0f172a, #1d4ed8);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-container {
  width: min(420px, 94vw);
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

.auth-card {
  background: #fff;
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 30px 60px rgba(15, 23, 42, 0.22);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: stretch;
  max-width: 100%;
}

.auth-card h2 {
  margin: 0 0 0.25rem;
  color: #0f172a;
  text-align: center;
  font-weight: 600;
}

.auth-subtitle {
  margin: 0 0 1rem;
  color: #475569;
  text-align: center;
  font-size: 0.95rem;
}

.auth-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.auth-form .form-row {
  margin-bottom: 0;
}

.auth-form .form-row label {
  display: block;
  margin-bottom: 0.35rem;
}

.auth-form .form-row input {
  width: 100%;
  box-sizing: border-box;
}

.auth-form .btn-block {
  margin-top: 0.5rem;
}

/* Smaller screens: ensure comfortable spacing */
@media (max-width: 420px) {
  .auth-card {
    padding: 1.25rem;
    border-radius: 10px;
  }

  .auth-card h2 {
    font-size: 1.25rem;
  }
}

.auth-hint {
  margin-top: 1rem;
  font-size: 0.85rem;
  color: #475569;
}

.auth-flash {
  margin-bottom: 1rem;
}

@media (max-width: 768px) {
  .app-header__inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .app-header__user {
    width: 100%;
    justify-content: space-between;
  }
}

.bi-section h3 {
  margin-top: 0;
}

.bi-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.6fr);
  gap: 1.5rem;
  align-items: start;
}

.bi-builder,
.bi-saved {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.bi-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
}

.bi-column {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
}

.bi-column label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.bi-column select {
  min-width: 120px;
}

.bi-filters {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.bi-filter-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr auto;
  gap: 0.75rem;
  align-items: center;
}

.bi-filter-remove {
  font-size: 0.85rem;
}

.bi-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.bi-saved__hint {
  margin: 0;
  color: var(--muted);
}

.bi-saved__list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 320px;
  overflow-y: auto;
}

.bi-saved__item {
  width: 100%;
  text-align: left;
  padding: 0.6rem 0.75rem;
  border: 1px solid #d0d7e2;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

.bi-saved__item:hover {
  border-color: var(--primary);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
}

.bi-saved__item strong {
  font-weight: 600;
  color: var(--text);
}

.bi-saved__item span {
  font-size: 0.85rem;
  color: var(--muted);
}

.bi-saved__row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.bi-saved__delete {
  font-size: 0.85rem;
  color: #b91c1c;
}

.bi-empty {
  margin: 0;
  color: var(--muted);
  font-style: italic;
}

.bi-result {
  margin-top: 1rem;
}

@media (max-width: 1024px) {
  .bi-grid {
    grid-template-columns: 1fr;
  }

  .bi-filter-row {
    grid-template-columns: repeat(3, 1fr) auto;
  }
}

@media (max-width: 640px) {
  .bi-filter-row {
    grid-template-columns: 1fr;
  }

  .bi-filter-remove {
    justify-self: flex-start;
  }
}

.summary-item .label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.summary-item .value {
  font-weight: 500;
}

.conteudo-section {
  margin-top: 2.5rem;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}

.table-section {
  margin-top: 2.5rem;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}

.table-section__intro {
  margin: 0.5rem 0 1.25rem;
  color: var(--muted);
  line-height: 1.6;
}

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

.table-section table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
}

.table-section th,
.table-section td {
  border: 1px solid var(--border);
  padding: 0.75rem 1rem;
  text-align: left;
  vertical-align: top;
}

.event-history {
  margin-top: 2.5rem;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}

.events-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

.events-table th,
.events-table td {
  border: 1px solid var(--border);
  padding: 0.75rem 1rem;
  text-align: left;
}

.events-table th.sortable {
  cursor: pointer;
  user-select: none;
  position: relative;
}

.events-table th.sortable::after {
  content: '\2195';
  font-size: 0.75rem;
  margin-left: 0.35rem;
  color: var(--muted);
}

.events-table th.sort-asc::after {
  content: '\25B4';
  color: var(--primary);
}

.events-table th.sort-desc::after {
  content: '\25BE';
  color: var(--primary);
}

.events-table tbody tr:nth-child(even) {
  background: rgba(0, 0, 0, 0.015);
}

.table-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.75rem 0 0;
  flex-wrap: wrap;
}

.table-controls button {
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.table-controls button:hover:not(:disabled) {
  background: var(--primary-light);
  border-color: var(--primary);
}

.table-controls button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.table-controls__info {
  color: var(--muted);
  font-weight: 500;
}

.button--small {
  display: inline-block;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
}

.inline-form {
  display: inline-block;
  margin-top: 0.35rem;
}

.table-section th {
  background: var(--primary-light);
  font-weight: 600;
}

.table-path {
  font-family: "Fira Code", "Courier New", monospace;
  white-space: nowrap;
}

.table-text {
  max-width: 320px;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.conteudo-list {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0 0;
  display: grid;
  gap: 1rem;
}

.conteudo-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  background: var(--primary-light);
}

.conteudo-item__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.conteudo-item__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}

.conteudo-item__attributes {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  font-size: 0.9rem;
  color: var(--muted);
}

.attr-name {
  font-weight: 600;
}

.conteudo-item__text {
  margin: 1rem 0 0;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  background: #fff;
  font-size: 1rem;
  line-height: 1.6;
}

.empty-state {
  margin-top: 1rem;
  padding: 1rem 1.25rem;
  border-radius: 8px;
  background: #f5f7fa;
  color: var(--muted);
}

.formatted-document {
  margin-top: 2.5rem;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}

.formatted-document__intro {
  margin: 0.75rem 0 1.5rem;
  color: var(--muted);
  line-height: 1.6;
}

.formatted-document__content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.document-node {
  --indent-step: 1.5rem;
  margin-left: calc(var(--indent-level, 0) * var(--indent-step));
  padding: 1rem 1.25rem;
  border-radius: 12px;
  border: 1px solid rgba(0, 86, 179, 0.15);
  background: #f7faff;
  box-shadow: inset 2px 0 0 var(--primary-light);
}

.document-node__header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  align-items: baseline;
}

.document-node__label {
  font-weight: 600;
  color: var(--primary);
  letter-spacing: 0.02em;
}

.document-node__attributes {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.document-attribute {
  display: flex;
  gap: 0.35rem;
}

.document-attribute dt {
  font-weight: 600;
}

.document-attribute dd {
  margin: 0;
}

.document-node__text {
  margin: 0.75rem 0 0;
  line-height: 1.7;
}

.document-node__children {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.tag-list {
  margin-top: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  background: #fff;
}

.tag-list ul {
  column-count: 3;
  margin: 0;
  padding-left: 1.2rem;
}

.tag-mapper {
  margin-top: 2.5rem;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.tag-mapper__header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  align-items: flex-start;
}

.tag-mapper__header p {
  margin: 0.5rem 0 0;
  color: var(--muted);
  max-width: 540px;
  line-height: 1.5;
}

.tag-mapper__actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.button--ghost {
  background: #fff;
  color: var(--primary);
  border: 1px solid var(--primary);
}

.button--ghost:disabled,
.button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.tag-mapper__body {
  display: flex;
  gap: 1rem; /* Reduzindo o gap de 1.5rem para 1rem */
  align-items: flex-start;
  flex-wrap: wrap;
}

.tag-selector {
  flex: 1 1 280px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem; /* Reduzindo o padding de 1.25rem para 1rem */
  background: #f8f9fb;
}

.tag-selector header h3 {
  margin: 0;
}

.tag-selector header p {
  margin: 0.5rem 0 0.75rem; /* Reduzindo margin inferior de 1rem para 0.75rem */
  color: var(--muted);
  font-size: 0.9rem;
}

.tag-selector__list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); /* Reduzindo o minmax de 200px para 180px */
  gap: 0.35rem; /* Reduzindo o espaçamento de 0.5rem para 0.35rem */
}

.tag-selector__item {
  display: flex;
  align-items: flex-start; /* Alinhar o texto no topo se quebrar */
  justify-content: space-between;
  gap: 0.5rem; /* Reduzindo gap de 0.75rem para 0.5rem */
  padding: 0.3rem 0.6rem; /* Reduzindo padding de 0.5rem 0.75rem */
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.tag-selector__item input[type="checkbox"] {
  margin-right: 0.5rem;
}

.tag-selector__name {
  flex: 1;
  font-weight: 500;
  color: var(--text);
  font-size: 0.85rem; /* DIMINUIÇÃO DA FONTE */
  word-break: break-all; /* NOVO: Garante a quebra de linha para tags longas */
  line-height: 1.3; /* Ajustar line-height para menor espaçamento */
}

.tag-selector__count {
  min-width: 32px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
  background: #eef2f7;
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
}

.tag-results {
  flex: 2 1 100%; /* Ajustado para usar mais espaço */
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.tag-results__header h3 {
  margin: 0;
}

.tag-results__header p {
  margin: 0.25rem 0 0;
  color: var(--muted);
}

.tag-results__table-wrapper {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow-x: auto; /* MUDANÇA: Permite scroll horizontal */
}

.tag-results table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed; /* NOVO: Essencial para controlar a largura das colunas */
  min-width: 600px; /* Garante um tamanho mínimo */
}

.tag-results th,
.tag-results td {
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1rem;
  text-align: left;
  vertical-align: top;
  word-break: break-word; /* NOVO: Ajuda a quebrar o texto se for longo */
}

.tag-results th {
  background: var(--primary-light);
  font-weight: 600;
}

.tag-results tbody tr:last-child td {
  border-bottom: none;
}

.tag-results td:nth-child(3) {
  /* white-space: pre-line; não é mais o padrão, usando normal para quebra mais fluida */
  white-space: normal;
}

.tag-results td:nth-child(4) {
  /* MUDANÇA: Removendo font-family e white-space para permitir que o texto truncado (com tooltip) flua normalmente */
  font-family: inherit; 
  white-space: normal;
}

.tag-results tbody tr:nth-child(even) {
  background: rgba(0, 0, 0, 0.02);
}

.tag-results tbody tr:nth-child(even) td {
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

.tag-results tbody tr:nth-child(odd) td {
  border-bottom-color: rgba(0, 0, 0, 0.06);
}

.tag-results tbody tr td:first-child {
  font-weight: 600;
  color: var(--primary);
}

.xml-structure {
  margin-top: 2.5rem;
}

.tree {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  background: #fff;
  overflow-x: auto;
}

.xml-node {
  list-style: none;
  padding-left: 1.2rem;
  margin: 0;
}

.xml-node > li {
  position: relative;
  padding-left: 1.5rem;
}

.xml-node > li::before {
  content: "";
  position: absolute;
  left: 0.45rem;
  top: 0.5rem;
  width: 0.75rem;
  height: calc(100% - 0.5rem);
  border-left: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.node-header .tag {
  font-family: "Fira Code", "Courier New", monospace;
  color: var(--primary);
}

.node-header .text {
  margin-left: 0.5rem;
  color: var(--muted);
}

.node-footer {
  font-family: "Fira Code", "Courier New", monospace;
  color: var(--muted);
  margin-left: 0.5rem;
}

.raw-xml textarea {
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 1rem;
  font-family: "Fira Code", "Courier New", monospace;
  background: #fdfdfd;
  color: #111827;
}

@media (max-width: 600px) {
  .tag-list ul {
    column-count: 1;
  }

  .xml-node > li {
    padding-left: 1rem;
  }

  .xml-node > li::before {
    left: 0.2rem;
  }

  .tag-selector__list {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }

  .tag-mapper__actions {
    width: 100%;
  }
}/* Table helpers */
.table-wrapper--scrollable {
  max-height: 60vh;
  overflow: auto;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 0.5rem;
  background: #fff;
}

/* Toggle-all button */
.btn-toggle-all {
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid #ccc;
  
  cursor: pointer;
  font-size: 0.75rem;
}

.btn-toggle-all:hover {
  background: #e8e8e8;
}

/* View saved batch data */
.view-batch-data-page .filter-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.view-batch-data__actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  margin: 0.5rem 0 1rem;
}

.view-batch-data-page .filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: min(240px, 100%);
}

.view-batch-data-page .filter-group label {
  font-weight: 600;
  color: #2d3748;
}

.view-batch-data-page .filter-group select,
.view-batch-data-page .filter-group input {
  padding: 0.5rem;
  border: 1px solid #ccd4dd;
  border-radius: 4px;
  font-size: 0.95rem;
}

.view-batch-data-page #batchDataTable,
.view-batch-data-page #queryResultTable {
  width: 100%;
}

@media (max-width: 640px) {
  .view-batch-data-page .filter-container {
    flex-direction: column;
    align-items: stretch;
  }
}

/* Batch import */
.batch-import__intro {
  margin-bottom: 1.5rem;
}

.batch-import__summary {
  background: #f8f9fb;
  border: 1px solid #dbe0e6;
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.batch-import__summary ul {
  margin: 0.5rem 0 0 1.25rem;
  font-size: 0.9rem;
}

.batch-import__summary code {
  background: #eef3f9;
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
}

.batch-import-page .client-selector {
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.batch-import-page .client-selector select {
  padding: 0.5rem;
  border: 1px solid #ccd4dd;
  border-radius: 4px;
  background: #fff;
  color: #000;
}

.batch-import-page .client-selector__hint {
  font-size: 0.85rem;
  color: #666;
}

.batch-import-page .client-selector__hint--warning {
  color: #b85450;
}

.directory-picker {
  margin-bottom: 1rem;
}

.directory-picker label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.directory-picker input[type="file"] {
  display: block;
  padding: 0.5rem;
  border: 1px solid #ccd4dd;
  border-radius: 4px;
  background: #fff;
}

.batch-feedback {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: #555;
}

.batch-import__actions {
  margin-top: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.batch-import__actions-buttons {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.btn-save {
  border: none;
  padding: 0.65rem 1.4rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  background: var(--primary);
  color: #fff;
  transition: background 0.2s ease, transform 0.05s ease;
}

.btn-save:hover {
  background: #004494;
}

.btn-save:active {
  transform: translateY(1px);
}

.btn-save--secondary {
  background: #f1f5f9;
  color: var(--text);
  border: 1px solid #d0d7e2;
}

.btn-save--secondary:hover {
  background: #e2e8f0;
}

.btn-save--ghost {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
}

.btn-save--ghost:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.tag-selector__hint {
  font-size: 0.7rem;
  color: #666;
}

.tag-selector--compact {
  margin: 1rem 0;
}

.tag-selector--compact .tag-selector__controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.tag-selector--compact .tag-selector__list {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid #eee;
  padding: 6px;
  border-radius: 4px;
  background: #fafafa;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 2px 10px;
}

.tag-selector--compact .tag-selector__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.tag-selector--compact .tag-selector__label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.batch-import-page .tag-selector__item {
  font-size: 0.8rem;
}

.batch-import-page #table-row-count-info {
  font-size: 0.75rem;
  margin: 4px 0 8px;
  color: #555;
}

.batch-import__table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 0.75rem;
}

.batch-import__table th,
.batch-import__table td {
  border: 1px solid #ddd;
  padding: 4px 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.batch-import__table th {
  background: #f2f2f2;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 2;
}

/* XML viewer */
.viewer-page .tag-selector--compact {
  margin-bottom: 12px;
}

.viewer-page .tag-selector__item {
  font-size: 10px;
}

.viewer-page__tag-hint {
  font-size: 10px;
  color: #666;
}

.viewer-page__tag-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.viewer-page__feedback {
  font-size: 10px;
  color: #4a4a4a;
  margin-top: 2px;
}

.viewer-page #table-row-count-info {
  font-size: 11px;
  margin: 4px 0 8px;
  color: #555;
}

.viewer-page .table-wrapper--scrollable {
  padding: 8px;
}

.viewer-page #xmlTable {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 12px;
}

.viewer-page #xmlTable th,
.viewer-page #xmlTable td {
  border: 1px solid #ddd;
  padding: 4px 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.viewer-page #xmlTable th {
  background: #f2f2f2;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 2;
}

.viewer-page .app-header,
.viewer-page .app-footer {
  background: #222;
  color: #fff;
  padding: 10px 0;
}

.viewer-page .app-header h1,
.viewer-page .app-footer p {
  margin: 0;
  padding: 0 16px;
  font-size: 16px;
}

/* Error pages */
.error-page {
  height: 100%;
  background: #fafafa;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: #777;
  font-weight: 300;
}

.error-page div.logo {
  height: 200px;
  width: 155px;
  display: inline-block;
  opacity: 0.08;
  position: absolute;
  top: 2rem;
  left: 50%;
  margin-left: -73px;
}

.error-page h1 {
  font-weight: lighter;
  letter-spacing: normal;
  font-size: 3rem;
  margin-top: 0;
  margin-bottom: 0;
  color: #222;
}

.error-page .wrap {
  max-width: 1024px;
  margin: 5rem auto;
  padding: 2rem;
  background: #fff;
  text-align: center;
  border: 1px solid #efefef;
  border-radius: 0.5rem;
  position: relative;
}

.error-page pre {
  white-space: normal;
  margin-top: 1.5rem;
}

.error-page code {
  background: #fafafa;
  border: 1px solid #efefef;
  padding: 0.5rem 1rem;
  border-radius: 5px;
  display: block;
}

.error-page p {
  margin-top: 1.5rem;
}

.error-page .footer {
  margin-top: 2rem;
  border-top: 1px solid #efefef;
  padding: 1em 2em 0 2em;
  font-size: 85%;
  color: #999;
}

.error-page a:active,
.error-page a:link,
.error-page a:visited {
  color: #dd4814;
}

/* Error debug layout */
.error-debug {
  --main-bg-color: #fff;
  --main-text-color: #555;
  --dark-text-color: #222;
  --light-text-color: #c7c7c7;
  --brand-primary-color: #DC4814;
  --light-bg-color: #ededee;
  --dark-bg-color: #404040;
}

.error-debug {
  height: 100%;
  background: var(--main-bg-color);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  color: var(--main-text-color);
  font-weight: 300;
  margin: 0;
  padding: 0;
}

.error-debug h1 {
  font-weight: lighter;
  font-size: 3rem;
  color: var(--dark-text-color);
  margin: 0;
}

.error-debug h1.headline {
  margin-top: 20%;
  font-size: 5rem;
}

.error-debug .text-center {
  text-align: center;
}

.error-debug p.lead {
  font-size: 1.6rem;
}

.error-debug .container {
  max-width: 75rem;
  margin: 0 auto;
  padding: 1rem;
}

.error-debug .header {
  background: var(--light-bg-color);
  color: var(--dark-text-color);
  margin-top: 2.17rem;
}

.error-debug .header .container {
  padding: 1rem;
}

.error-debug .header h1 {
  font-size: 2.5rem;
  font-weight: 500;
}

.error-debug .header p {
  font-size: 1.2rem;
  margin: 0;
  line-height: 2.5;
}

.error-debug .header a {
  color: var(--brand-primary-color);
  margin-left: 2rem;
  display: none;
  text-decoration: none;
}

.error-debug .header:hover a {
  display: inline;
}

.error-debug .environment {
  background: var(--brand-primary-color);
  color: var(--main-bg-color);
  text-align: center;
  padding: calc(4px + 0.2083vw);
  width: 100%;
  top: 0;
  position: fixed;
}

.error-debug .source {
  background: #343434;
  color: var(--light-text-color);
  padding: 0.5em 1em;
  border-radius: 5px;
  font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
  font-size: 0.85rem;
  margin: 0;
  overflow-x: scroll;
}

.error-debug .source span.line {
  line-height: 1.4;
}

.error-debug .source span.line .number {
  color: #666;
}

.error-debug .source .line .highlight {
  display: block;
  background: var(--dark-text-color);
  color: var(--light-text-color);
}

.error-debug .source span.highlight .number {
  color: #fff;
}

.error-debug .tabs {
  list-style: none;
  list-style-position: inside;
  margin: 0;
  padding: 0;
  margin-bottom: -1px;
}

.error-debug .tabs li {
  display: inline;
}

.error-debug .tabs a:link, .error-debug .tabs a:visited {
  padding: 0 1rem;
  line-height: 2.7;
  text-decoration: none;
  color: var(--dark-text-color);
  background: var(--light-bg-color);
  border: 1px solid rgba(0,0,0,0.15);
  border-bottom: 0;
  border-top-left-radius: 5px;
  border-top-right-radius: 5px;
  display: inline-block;
}

.error-debug .tabs a:hover {
  background: var(--light-bg-color);
  border-color: rgba(0,0,0,0.15);
}

.error-debug .tabs a.active {
  background: var(--main-bg-color);
  color: var(--main-text-color);
}

.error-debug .tab-content {
  background: var(--main-bg-color);
  border: 1px solid rgba(0,0,0,0.15);
}

.error-debug .content {
  padding: 1rem;
}

.error-debug .hide {
  display: none;
}

.error-debug .alert {
  margin-top: 2rem;
  display: block;
  text-align: center;
  line-height: 3.0;
  background: #d9edf7;
  border: 1px solid #bcdff1;
  border-radius: 5px;
  color: #31708f;
}

.error-debug table {
  width: 100%;
  overflow: hidden;
}

.error-debug th {
  text-align: left;
  border-bottom: 1px solid #e7e7e7;
  padding-bottom: 0.5rem;
}

.error-debug td {
  padding: 0.2rem 0.5rem 0.2rem 0;
}

.error-debug tr:hover td {
  background: #f1f1f1;
}

.error-debug td pre {
  white-space: pre-wrap;
}

.error-debug .trace a {
  color: inherit;
}

.error-debug .trace table {
  width: auto;
}

.error-debug .trace tr td:first-child {
  min-width: 5em;
  font-weight: bold;
}

.error-debug .trace td {
  background: var(--light-bg-color);
  padding: 0 1rem;
}

.error-debug .trace td pre {
  margin: 0;
}

.error-debug .args {
  display: none;
}

/* Welcome page */
.welcome-page * {
  transition: background-color 300ms ease, color 300ms ease;
}

.welcome-page *:focus {
  background-color: rgba(221, 72, 20, 0.2);
  outline: none;
}

.welcome-page {
  color: rgba(33, 37, 41, 1);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  font-size: 16px;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.welcome-page header {
  background-color: rgba(247, 248, 249, 1);
  padding: 0.4rem 0 0;
}

.welcome-page .menu {
  padding: 0.4rem 2rem;
}

.welcome-page header ul {
  border-bottom: 1px solid rgba(242, 242, 242, 1);
  list-style-type: none;
  margin: 0;
  overflow: hidden;
  padding: 0;
  text-align: right;
}

.welcome-page header li {
  display: inline-block;
}

.welcome-page header li a {
  border-radius: 5px;
  color: rgba(0, 0, 0, 0.5);
  display: block;
  height: 44px;
  text-decoration: none;
}

.welcome-page header li.menu-item a {
  border-radius: 5px;
  margin: 5px 0;
  height: 38px;
  line-height: 36px;
  padding: 0.4rem 0.65rem;
  text-align: center;
}

.welcome-page header li.menu-item a:hover,
.welcome-page header li.menu-item a:focus {
  background-color: rgba(221, 72, 20, 0.2);
  color: rgba(221, 72, 20, 1);
}

.welcome-page header .logo {
  float: left;
  height: 44px;
  padding: 0.4rem 0.5rem;
}

.welcome-page header .menu-toggle {
  display: none;
  float: right;
  font-size: 2rem;
  font-weight: bold;
}

.welcome-page header .menu-toggle button {
  background-color: rgba(221, 72, 20, 0.6);
  border: none;
  border-radius: 3px;
  color: rgba(255, 255, 255, 1);
  cursor: pointer;
  font: inherit;
  font-size: 1.3rem;
  height: 36px;
  padding: 0;
  margin: 11px 0;
  overflow: visible;
  width: 40px;
}

.welcome-page header .menu-toggle button:hover,
.welcome-page header .menu-toggle button:focus {
  background-color: rgba(221, 72, 20, 0.8);
  color: rgba(255, 255, 255, 0.8);
}

.welcome-page header .heroe {
  margin: 0 auto;
  max-width: 1100px;
  padding: 1rem 1.75rem 1.75rem 1.75rem;
}

.welcome-page header .heroe h1 {
  font-size: 2.5rem;
  font-weight: 500;
}

.welcome-page header .heroe h2 {
  font-size: 1.5rem;
  font-weight: 300;
}

.welcome-page section {
  margin: 0 auto;
  max-width: 1100px;
  padding: 2.5rem 1.75rem 3.5rem 1.75rem;
}

.welcome-page section h1 {
  margin-bottom: 2.5rem;
}

.welcome-page section h2 {
  font-size: 120%;
  line-height: 2.5rem;
  padding-top: 1.5rem;
}

.welcome-page section pre {
  background-color: rgba(247, 248, 249, 1);
  border: 1px solid rgba(242, 242, 242, 1);
  display: block;
  font-size: 0.9rem;
  margin: 2rem 0;
  padding: 1rem 1.5rem;
  white-space: pre-wrap;
  word-break: break-all;
}

.welcome-page section code {
  display: block;
}

.welcome-page section a {
  color: rgba(221, 72, 20, 1);
}

.welcome-page section svg {
  margin-bottom: -5px;
  margin-right: 5px;
  width: 25px;
}

.welcome-page .further {
  background-color: rgba(247, 248, 249, 1);
  border-bottom: 1px solid rgba(242, 242, 242, 1);
  border-top: 1px solid rgba(242, 242, 242, 1);
}

.welcome-page .further h2:first-of-type {
  padding-top: 0;
}

.welcome-page .svg-stroke {
  fill: none;
  stroke: #000;
  stroke-width: 32px;
}

.welcome-page footer {
  background-color: rgba(221, 72, 20, 0.8);
  text-align: center;
}

.welcome-page footer .environment {
  color: rgba(255, 255, 255, 1);
  padding: 2rem 1.75rem;
}

.welcome-page footer .copyrights {
  background-color: rgba(62, 62, 62, 1);
  color: rgba(200, 200, 200, 1);
  padding: 0.25rem 1.75rem;
}

@media (max-width: 629px) {
  .welcome-page header ul {
    padding: 0;
  }

  .welcome-page header .menu-toggle {
    padding: 0 1rem;
  }

  .welcome-page header .menu-item {
    background-color: rgba(244, 245, 246, 1);
    border-top: 1px solid rgba(242, 242, 242, 1);
    margin: 0 15px;
    width: calc(100% - 30px);
  }

  .welcome-page header .menu-toggle {
    display: block;
  }

  .welcome-page header .hidden {
    display: none;
  }

  .welcome-page header li.menu-item a {
    background-color: rgba(221, 72, 20, 0.1);
  }

  .welcome-page header li.menu-item a:hover,
  .welcome-page header li.menu-item a:focus {
    background-color: rgba(221, 72, 20, 0.7);
    color: rgba(255, 255, 255, 0.8);
  }
}
