/* ---------- Field ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  width: 100%;
}

.field__label {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  font-weight: 400;
}

.field__control {
  position: relative;
  display: flex;
  align-items: center;
}

.field__input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background-color: var(--color-input-bg);
  color: var(--color-text);
  font-size: var(--font-size-md);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field__input:focus {
  border-color: #8ab4f8;
  box-shadow: 0 0 0 1px #8ab4f8;
}

.field__input--with-icon {
  padding-right: 40px;
}

.field__icon-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  background: transparent;
  color: #6b7280;
}

.field__icon-btn:hover {
  color: #374151;
}

.field__icon-btn svg {
  width: 18px;
  height: 18px;
}

.field__icon-btn .is-hidden {
  display: none;
}

.field__label .req {
  color: #e53935;
  margin-left: 2px;
}

.field__label-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.field__help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid #9a9a9a;
  color: #6b6b6b;
  font-size: 11px;
  line-height: 1;
  cursor: help;
}

.field__input--app,
.field__select {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: 1px solid #cfcfcf;
  border-radius: var(--radius-md);
  background: var(--color-white);
  color: var(--color-text);
  font-size: var(--font-size-sm);
  outline: none;
}

.field__input--app:focus,
.field__select:focus {
  border-color: #333;
  box-shadow: none;
}

.field__select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666666' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* ---------- Form layout ---------- */
.form-panel {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 20px 24px 24px;
}

.form-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.form-panel__title {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-text);
}

.form-panel__section-title {
  margin: 20px 0 14px;
  font-size: var(--font-size-md);
  font-weight: 700;
  color: var(--color-text);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
}

.form-grid__full {
  grid-column: 1 / -1;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 24px;
}

/* ---------- Upload dropzone ---------- */
.upload {
  border: 1px dashed #bdbdbd;
  border-radius: var(--radius-md);
  background: #fafafa;
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px;
}

.upload.is-dragover {
  border-color: var(--color-accent);
  background: var(--color-accent-soft);
}

.upload__hint {
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
}

.upload__file-name {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: #4a5560;
  color: var(--color-white);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1;
}

.badge--success {
  background: var(--color-success);
  color: var(--color-white);
}

.badge--accent {
  background: var(--color-accent);
  color: var(--color-accent-contrast);
}

.badge--icon {
  width: 26px;
  min-width: 26px;
  padding: 0;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 700;
}

.badge-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---------- Tabs ---------- */
.tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow: visible;
  padding: 4px 0 12px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 18px;
  position: relative;
  z-index: 40;
}

.tabs__track {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  scrollbar-width: thin;
  padding-bottom: 2px;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 6px 14px;
  border: none;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
}

.tab:hover {
  background: var(--color-surface);
}

.tab.is-active {
  background: var(--color-accent);
  color: var(--color-accent-contrast);
}

.tab svg {
  width: 12px;
  height: 12px;
  opacity: 0.75;
}

.tab-dropdown {
  position: relative;
  flex-shrink: 0;
}

.tab-dropdown__menu {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  min-width: 200px;
  max-height: min(360px, calc(100vh - 120px));
  overflow-y: auto;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
  z-index: 1000;
}

.tab-dropdown.is-open .tab-dropdown__menu {
  display: block;
}

.tab-dropdown__header {
  display: block;
  padding: 10px 14px;
  background: #2f2f2f;
  color: var(--color-white);
  font-size: var(--font-size-sm);
  font-weight: 600;
  text-decoration: none;
}

.tab-dropdown__header:hover {
  color: var(--color-white);
  opacity: 0.92;
}

.tab-dropdown__item {
  display: block;
  padding: 9px 14px;
  color: var(--color-text);
  text-decoration: none;
  font-size: var(--font-size-sm);
  border-bottom: 1px solid #f0f0f0;
}

.tab-dropdown__item:last-child {
  border-bottom: none;
}

.tab-dropdown__item:hover {
  background: #f5f5f5;
}

.tab-dropdown__item.is-active {
  background: #f0f7f5;
  color: var(--color-accent-hover);
  font-weight: 600;
}

.tab-dropdown__item.is-disabled-by-license,
.tab-dropdown__header.is-disabled-by-license {
  color: #9aa3ad;
  background: #f7f7f7;
  cursor: not-allowed;
  pointer-events: auto;
  opacity: 0.72;
}

.tab-dropdown__item.is-disabled-by-license:hover,
.tab-dropdown__header.is-disabled-by-license:hover {
  background: #f7f7f7;
  color: #9aa3ad;
}

.tab-dropdown__item.is-disabled-by-license::after,
.tab-dropdown__header.is-disabled-by-license::after {
  content: " · fora da licença";
  font-size: 11px;
  font-weight: 500;
  color: #a0a8b0;
}

.tab-dropdown__license-hint {
  margin: 0;
  padding: 8px 14px;
  border-top: 1px solid #ececec;
  background: var(--color-accent-soft);
  color: #2f6b5d;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.35;
}

/* ---------- Switch ---------- */
.switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch__slider {
  position: absolute;
  inset: 0;
  cursor: pointer;
  background: #c5c5c5;
  border-radius: 999px;
  transition: background-color 0.15s ease;
}

.switch__slider::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.15s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.switch input:checked + .switch__slider {
  background: #9e9e9e;
}

.switch input:checked + .switch__slider::before {
  transform: translateX(18px);
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.switch-row__left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--font-size-sm);
  color: var(--color-text);
}

.switch-row__status {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  min-width: 78px;
  text-align: right;
}

.switch-row__right {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

/* ---------- Drawer ---------- */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 1100;
}

.drawer-backdrop.is-open {
  opacity: 1;
  visibility: visible;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(420px, 100vw);
  height: 100vh;
  background: var(--color-white);
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.18);
  transform: translateX(100%);
  transition: transform 0.25s ease;
  z-index: 1200;
  display: flex;
  flex-direction: column;
}

.drawer.is-open {
  transform: translateX(0);
}

.drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 12px;
  flex-shrink: 0;
}

.drawer__title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  color: var(--color-text);
}

.drawer__close {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: transparent;
  color: #666;
  font-size: var(--font-size-sm);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--radius-md);
}

.drawer__close:hover {
  background: #f3f3f3;
  color: #222;
}

.drawer__close svg {
  width: 14px;
  height: 14px;
}

.drawer__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 24px 20px;
}

.drawer__footer {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 24px 22px;
  border-top: 1px solid var(--color-border);
}

.drawer__section-title {
  margin: 22px 0 12px;
  font-size: var(--font-size-md);
  font-weight: 700;
  color: var(--color-text);
}

.drawer .form-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

body.drawer-open {
  overflow: hidden;
}

/* ---------- Radio / Checkbox ---------- */
.choice {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--font-size-sm);
  color: var(--color-text);
  cursor: pointer;
}

.choice input {
  width: 16px;
  height: 16px;
  accent-color: #2f2f2f;
  cursor: pointer;
}

.choice-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.field__input--app:disabled,
.field__input--readonly {
  background: #f0f0f0;
  color: #555;
  cursor: default;
}

.field__input--muted {
  background: #f3f3f3;
}

.btn--file {
  background: #ececec;
  color: var(--color-text);
  border-color: #d6d6d6;
  font-weight: 500;
  gap: 8px;
}

.btn--file:hover {
  background: #e2e2e2;
}

.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}

.detail-header__main {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.detail-header__title-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.detail-header__title {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.3;
  text-transform: uppercase;
  margin: 0;
}

.badge--muted {
  background: #8a939c;
}

.detail-header__actions {
  flex-shrink: 0;
}

.help-text {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  line-height: 1.5;
  margin: 0 0 16px;
  max-width: 920px;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 640px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 8px 20px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: var(--font-size-md);
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  transition: background-color 0.15s ease, opacity 0.15s ease;
}

.btn--primary {
  background-color: var(--color-accent);
  color: var(--color-accent-contrast);
  border-color: var(--color-accent);
  min-width: 96px;
}

.btn--primary:hover {
  background-color: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
}

.btn--primary:active {
  background-color: var(--color-accent-hover);
}

.btn--ghost {
  background: var(--color-white);
  color: var(--color-text);
  border-color: var(--color-border-strong);
  font-weight: 500;
  gap: 6px;
}

.btn--ghost:hover {
  background: var(--color-surface);
}

.btn--soft {
  background: var(--color-accent);
  color: var(--color-accent-contrast);
  border-color: var(--color-accent);
  font-weight: 500;
  gap: 6px;
}

.btn--soft:hover {
  background: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
}

.btn--text {
  background: transparent;
  color: var(--color-text-secondary);
  border-color: transparent;
  font-weight: 500;
  gap: 6px;
  padding-left: 10px;
  padding-right: 10px;
}

.btn--text:hover:not(:disabled) {
  background: var(--color-surface);
}

.btn:disabled,
.btn.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.btn--icon {
  width: 36px;
  min-width: 36px;
  padding: 0;
}

.btn svg {
  width: 16px;
  height: 16px;
}


/* ---------- Links ---------- */
.link {
  color: var(--color-link);
  font-size: var(--font-size-sm);
  text-decoration: underline;
}

.link:hover {
  color: var(--color-link-hover);
}

.link--footer {
  font-size: var(--font-size-xs);
}

/* ---------- Card ---------- */
.card {
  background: var(--color-card);
  box-shadow: var(--shadow-card);
}

.card--login {
  width: 100%;
  max-width: var(--login-card-width);
  padding: 28px 32px 24px;
  position: relative;
  z-index: 2;
}

.card__title {
  text-align: center;
  font-size: var(--font-size-lg);
  font-weight: 400;
  color: var(--color-text);
  margin-bottom: var(--space-md);
}

.card__divider {
  border: none;
  border-top: 1px solid var(--color-divider);
  margin: 0 0 var(--space-lg);
}

/* ---------- Logo ---------- */
.logo {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}

.logo img,
.logo svg {
  height: 24px;
  width: auto;
}

.logo--sm img,
.logo--sm svg {
  height: 20px;
}

.logo--corner {
  position: fixed;
  right: 24px;
  bottom: 18px;
  z-index: 10;
}

.logo--corner img,
.logo--corner svg {
  height: 22px;
}

/* ---------- Breadcrumb ---------- */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: var(--font-size-sm);
}

.breadcrumb__item {
  color: var(--color-text-muted);
  text-decoration: none;
}

.breadcrumb__item:hover {
  color: var(--color-text);
}

.breadcrumb__sep {
  color: #9a9a9a;
}

.breadcrumb__current {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-md);
  background: var(--color-accent);
  color: var(--color-white);
  font-weight: 600;
  font-size: var(--font-size-sm);
}

/* ---------- Chips / Tabs ---------- */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 4px 14px;
  border: none;
  border-radius: var(--radius-pill);
  background: var(--color-surface-alt);
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}

.chip:hover {
  background: #e6e6e6;
}

.chip.is-active {
  background: #dfe7ef;
  color: #1f3a5f;
  box-shadow: inset 0 0 0 1px #c5d3e0;
}

/* ---------- Search ---------- */
.search {
  display: flex;
  align-items: stretch;
  max-width: 340px;
  width: 100%;
  flex-shrink: 1;
}

.search__input {
  flex: 1;
  min-width: 0;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--color-border-strong);
  border-right: none;
  border-radius: var(--radius-md) 0 0 var(--radius-md);
  background: var(--color-white);
  font-size: var(--font-size-sm);
  color: var(--color-text);
  outline: none;
}

.search__input::placeholder {
  color: #9a9a9a;
}

.search__input:focus {
  border-color: #8ab4f8;
}

.search__btn {
  width: 36px;
  border: 1px solid var(--color-border-strong);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  background: var(--color-white);
  color: #666;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.search__btn:hover {
  background: var(--color-surface);
}

.search__btn svg {
  width: 16px;
  height: 16px;
}

/* ---------- Toolbar ---------- */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: nowrap;
}

.toolbar__left,
.toolbar__right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

.toolbar__left {
  flex: 1;
  min-width: 0;
}

.toolbar__right {
  flex-shrink: 0;
}

@media (max-width: 1100px) {
  .toolbar {
    flex-wrap: wrap;
  }

  .toolbar__left,
  .toolbar__right {
    flex-wrap: wrap;
  }
}

/* ---------- Data Table ---------- */
.table-panel {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.table-wrap {
  overflow: auto;
  width: 100%;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
  min-width: 980px;
}

.data-table th,
.data-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #ececec;
  white-space: nowrap;
  vertical-align: middle;
}

.data-table th {
  background: var(--color-table-header);
  color: var(--color-accent);
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 1;
  border-bottom: 1px solid var(--color-accent-muted);
}

.data-table tbody tr:hover {
  background: #fafafa;
}

.data-table__check {
  width: 40px;
  text-align: center;
}

.data-table__check input {
  width: 14px;
  height: 14px;
  cursor: pointer;
}

.data-table__sort {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: inherit;
  text-decoration: none;
  font: inherit;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

.data-table__sort svg {
  width: 12px;
  height: 12px;
  opacity: 0.55;
}

.data-table__settings {
  width: 42px;
  text-align: center;
}

.data-table__settings-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: #666;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
}

.data-table__settings-btn:hover {
  background: #e8e8e8;
}

/* ---------- Pagination ---------- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border-top: 1px solid var(--color-border);
  background: var(--color-white);
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

.pagination__left,
.pagination__right,
.pagination__pages {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.pagination__label {
  margin-right: 4px;
}

.page-size {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 28px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
  cursor: pointer;
}

.page-size.is-active {
  background: var(--color-accent);
  color: var(--color-accent-contrast);
}

.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
  cursor: pointer;
}

.page-btn:hover {
  background: var(--color-surface);
}

.page-btn.is-active {
  background: var(--color-accent);
  color: var(--color-accent-contrast);
  font-weight: 600;
}

.page-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.pagination__info {
  margin: 0 8px;
  color: var(--color-text-muted);
}

.pagination__icon-btn {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: #666;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.pagination__icon-btn:hover {
  background: var(--color-surface);
}

.pagination__icon-btn svg {
  width: 15px;
  height: 15px;
}

