:root {
  --fm-ink: #1e293b;
  --fm-heading: #0f172a;
  --fm-muted: #64748b;
  --fm-soft: #e8f0fe;
  --fm-line: #dde5f4;
  --fm-bg: #f1f5f9;
  --fm-panel: #ffffff;
  --fm-panel-strong: #ffffff;
  --fm-primary: #2563eb;
  --fm-primary-dark: #1d4ed8;
  --fm-primary-soft: #dbeafe;
  --fm-accent: #b98b3b;
  --fm-coral: #dc2626;
  --fm-blue: #0ea5e9;
  --fm-sidebar: #3574d4;
  --fm-sidebar-2: #2455b8;
  --fm-sidebar-muted: #bfdbfe;
  --fm-shadow: 0 24px 70px rgba(15, 23, 42, .10);
  --fm-shadow-soft: 0 14px 38px rgba(15, 23, 42, .07);
  --fm-shadow-line: 0 1px 0 rgba(255, 255, 255, .78) inset, 0 18px 42px rgba(15, 23, 42, .06);
}

html {
  font-size: 16px;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--fm-ink);
  background:
    linear-gradient(135deg, rgba(4, 116, 95, .08), transparent 32%),
    linear-gradient(315deg, rgba(49, 95, 143, .08), transparent 36%),
    var(--fm-bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

.app-authenticated {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .65), rgba(255, 255, 255, 0) 200px),
    linear-gradient(135deg, rgba(37, 99, 235, .05), transparent 34%),
    linear-gradient(315deg, rgba(14, 165, 233, .04), transparent 40%),
    #f1f5f9;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Plus Jakarta Sans', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 700;
  letter-spacing: -0.02em;
}

a {
  color: var(--fm-primary);
}

a:hover {
  color: var(--fm-primary-dark);
}

.btn {
  border-radius: 8px;
  font-weight: 750;
  letter-spacing: 0;
  box-shadow: none;
}

.btn-primary {
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--fm-primary);
  --bs-btn-border-color: var(--fm-primary);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--fm-primary-dark);
  --bs-btn-hover-border-color: var(--fm-primary-dark);
  --bs-btn-active-bg: #1a3bbf;
  --bs-btn-active-border-color: #1a3bbf;
}

.btn-outline-secondary {
  --bs-btn-color: #374151;
  --bs-btn-border-color: #cbd5e1;
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: #475569;
  --bs-btn-hover-border-color: #475569;
  background: rgba(255, 255, 255, .82);
}

.btn-light {
  --bs-btn-color: var(--fm-heading);
  --bs-btn-bg: rgba(255, 255, 255, .92);
  --bs-btn-border-color: rgba(255, 255, 255, .72);
  --bs-btn-hover-color: var(--fm-heading);
  --bs-btn-hover-bg: #fff;
  --bs-btn-hover-border-color: #fff;
}

.btn-icon-action {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border-radius: 8px;
  font-size: 1rem;
  line-height: 1;
}

.btn-icon-action .action-icon {
  transform: translateY(-1px);
}

.app-main {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-content {
  flex: 1 0 auto;
  width: min(100%, 1720px);
  padding: 28px 10px 24px;
  margin: 0 auto;
}

.app-footer {
  margin-top: auto;
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 34px;
  color: var(--fm-muted);
  font-size: .86rem;
  border-top: 1px solid #e2e8f0;
  background: rgba(255, 255, 255, .80);
}

.app-footer span:first-child {
  color: var(--fm-heading);
  font-weight: 850;
}

.flash-wrap {
  padding: 0 0 18px;
}

.alert-info {
  color: #1e40af;
  background: #dbeafe;
  border-color: #bfdbfe;
  border-radius: 8px;
}

@keyframes alertPulse {
  0% { transform: scale(0.98); box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.35); }
  50% { transform: scale(1.02); box-shadow: 0 0 0 10px rgba(37, 99, 235, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}

.alert-pulse-highlight {
  animation: alertPulse 0.5s ease-out forwards;
  border-left: 5px solid var(--fm-primary);
  color: var(--fm-primary-dark);
}

.app-loader {
  position: fixed;
  inset: 0;
  z-index: 1080;
  display: grid;
  place-items: center;
  padding: 20px;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  background:
    radial-gradient(circle at 48% 44%, rgba(255, 255, 255, .92), rgba(255, 255, 255, .58) 28%, rgba(245, 247, 242, .30) 54%),
    rgba(17, 26, 22, .22);
  backdrop-filter: blur(10px);
  transition: opacity .18s ease, visibility .18s ease;
}

.app-loader.is-visible {
  pointer-events: auto;
  opacity: 1;
  visibility: visible;
}

.loader-card {
  position: relative;
  width: min(100%, 320px);
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  padding: 18px 46px 18px 18px;
  color: var(--fm-heading);
  background: rgba(255, 254, 250, .94);
  border: 1px solid rgba(217, 227, 220, .90);
  border-radius: 8px;
  box-shadow: 0 28px 70px rgba(17, 26, 22, .20);
  transform: translateY(8px) scale(.98);
  transition: transform .18s ease;
}

.app-loader.is-visible .loader-card {
  transform: translateY(0) scale(1);
}

.loader-orbit {
  position: relative;
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, .10), rgba(196, 131, 47, .14)),
    #fff;
}

.loader-orbit::before,
.loader-orbit::after {
  content: "";
  position: absolute;
  border-radius: 50%;
}

.loader-orbit::before {
  width: 42px;
  height: 42px;
  border: 3px solid rgba(37, 99, 235, .16);
  border-top-color: var(--fm-primary);
  border-right-color: var(--fm-accent);
  animation: loader-spin .82s linear infinite;
}

.loader-orbit::after {
  width: 12px;
  height: 12px;
  background: var(--fm-primary);
  box-shadow: 0 0 0 7px rgba(37, 99, 235, .10);
}

.loader-orbit span {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--fm-accent);
  animation: loader-pulse 1.15s ease-in-out infinite;
}

.loader-orbit span:first-child {
  top: 9px;
  right: 11px;
}

.loader-orbit span:last-child {
  left: 10px;
  bottom: 10px;
  background: var(--fm-coral);
  animation-delay: .22s;
}

.loader-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.loader-copy strong {
  font-size: .98rem;
  font-weight: 880;
}

.loader-copy span {
  color: var(--fm-muted);
  font-size: .84rem;
  font-weight: 650;
}

.loader-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
}

.loader-close::before,
.loader-close::after {
  content: "";
  position: absolute;
  width: 13px;
  height: 2px;
  border-radius: 999px;
  background: #7b877f;
}

.loader-close::before {
  transform: rotate(45deg);
}

.loader-close::after {
  transform: rotate(-45deg);
}

.loader-close:hover {
  background: rgba(37, 99, 235, .08);
}

.btn.is-loading {
  position: relative;
  pointer-events: none;
}

@keyframes loader-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes loader-pulse {
  0%, 100% {
    transform: scale(.72);
    opacity: .62;
  }

  50% {
    transform: scale(1.08);
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-loader,
  .loader-card {
    transition: none;
  }

  .loader-orbit::before,
  .loader-orbit span {
    animation: none;
  }
}

.page-shell {
  padding: 0;
}

.page-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  min-height: 72px;
  padding-bottom: 18px;
  margin-bottom: 22px;
  border-bottom: 1px solid #e2e8f0;
}

.page-title h1 {
  color: var(--fm-heading);
  font-size: 1.82rem;
  font-weight: 880;
  line-height: 1.1;
  margin: 0;
  letter-spacing: 0;
}

.page-title p {
  color: var(--fm-muted);
  margin: 7px 0 0;
  font-weight: 560;
}

.page-title .btn,
.panel .btn {
  box-shadow: 0 1px 0 rgba(255, 255, 255, .65) inset;
}

.badge-status {
  border-radius: 999px;
  padding: 5px 10px;
  background: #dbeafe;
  color: #1d4ed8;
  font-weight: 700;
  font-size: .78rem;
}

.badge-status.success {
  background: #dcfce7;
  color: #15803d;
}

.badge-status.warning {
  background: #fef9c3;
  color: #a16207;
}

.badge-status.danger {
  background: #fee2e2;
  color: #b91c1c;
}

.badge-status.muted {
  background: #f1f5f9;
  color: #64748b;
}

.profile-summary {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 22px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--fm-line);
}

.profile-avatar-wrap {
  position: relative;
  flex: 0 0 58px;
  width: 58px;
  height: 58px;
}

.profile-avatar {
  width: 58px;
  height: 58px;
  flex: 0 0 58px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #14211b;
  background: linear-gradient(135deg, #f4c87c, #dca14f);
  font-size: 1.25rem;
  font-weight: 900;
}

.profile-avatar-img {
  width: 58px;
  height: 58px;
  border-radius: 8px;
  object-fit: cover;
  display: block;
}

.profile-avatar-overlay {
  position: absolute;
  inset: 0;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  opacity: 0;
  cursor: pointer;
  transition: opacity 0.15s;
}

.profile-avatar-wrap:hover .profile-avatar-overlay {
  opacity: 1;
}

.profile-summary h2 {
  color: var(--fm-heading);
  font-size: 1.2rem;
  font-weight: 850;
  margin: 0 0 4px;
}

.profile-summary p {
  color: var(--fm-muted);
  margin: 0;
}

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

.data-grid div {
  min-height: 88px;
  display: grid;
  align-content: center;
  gap: 5px;
  padding: 16px;
  border: 1px solid rgba(217, 227, 220, .92);
  border-radius: 8px;
  background: rgba(245, 247, 242, .65);
}

.data-grid span {
  color: var(--fm-muted);
  font-size: .78rem;
  font-weight: 820;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.data-grid strong {
  color: var(--fm-heading);
  font-size: .98rem;
  font-weight: 820;
  overflow-wrap: anywhere;
}

.company-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.company-card {
  display: grid;
  gap: 18px;
  padding: 22px;
  border: 1px solid rgba(217, 227, 220, .9);
  border-radius: 8px;
  background: rgba(255, 254, 250, .94);
  box-shadow: var(--fm-shadow-soft);
}

.company-card.is-active {
  border-color: rgba(0, 109, 91, .36);
  background: linear-gradient(135deg, rgba(228, 246, 239, .62), rgba(255, 254, 250, .96));
}

.company-card-logo {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 8px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--fm-line);
  margin-right: 4px;
}

.company-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.company-card-head h2 {
  color: var(--fm-heading);
  font-size: 1.1rem;
  font-weight: 850;
  line-height: 1.2;
  margin: 0;
}

.company-card-head p {
  color: var(--fm-muted);
  margin: 5px 0 0;
  overflow-wrap: anywhere;
}

.company-status {
  flex: 0 0 auto;
  color: #66746c;
  font-weight: 800;
}

.company-card-data {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.company-card-data div {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.company-card-data span {
  color: var(--fm-muted);
  font-size: .75rem;
  font-weight: 820;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.company-card-data strong {
  color: var(--fm-heading);
  font-size: .95rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.company-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 2px;
}

.company-card-actions form {
  margin: 0;
}

.form-label {
  color: #405047;
  font-weight: 720;
}

.form-control,
.form-select {
  border-radius: 7px;
  border-color: #cdd9d2;
  background-color: rgba(255, 255, 255, .92);
  min-height: 40px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .70) inset;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--fm-primary);
  box-shadow: 0 0 0 .2rem rgba(37, 99, 235, .15);
}

.filter-action-col {
  position: relative;
}

.advanced-filters-collapse {
  margin-top: 1.65rem;
}

.filter-toggle-link {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 100%;
  padding: 0;
  border: 0;
  color: var(--fm-muted);
  background: transparent;
  font-size: .78rem;
  font-weight: 720;
  line-height: 1.2;
  text-align: center;
}

.filter-toggle-link::before {
  content: "";
  width: 7px;
  height: 7px;
  display: inline-block;
  margin-right: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform .16s ease;
}

.filter-toggle-link[aria-expanded="true"]::before {
  transform: rotate(225deg) translate(-2px, -1px);
}

.filter-toggle-link:hover {
  color: var(--fm-primary);
  text-decoration: underline;
}

.logo-preview-frame {
  width: 172px;
  height: 92px;
  flex: 0 0 172px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px dashed #aebdb4;
  border-radius: 8px;
  background: rgba(255, 255, 255, .7);
}

.logo-preview-frame img {
  max-width: 150px;
  max-height: 70px;
  object-fit: contain;
}

.logo-preview-frame span {
  color: #6b7a70;
  font-weight: 750;
}

.access-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.access-stat {
  padding: 18px;
  border: 1px solid rgba(217, 227, 220, .88);
  border-radius: 8px;
  background: rgba(255, 254, 250, .92);
  box-shadow: var(--fm-shadow-soft);
}

.access-stat span {
  display: block;
  color: #66746c;
  font-size: .78rem;
  font-weight: 760;
  text-transform: uppercase;
}

.access-stat strong {
  display: block;
  color: var(--fm-heading);
  font-size: 2rem;
  line-height: 1;
  margin-top: 8px;
}

.access-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.access-profile-card {
  display: grid;
  gap: 14px;
  padding: 20px;
  border: 1px solid rgba(217, 227, 220, .88);
  border-radius: 8px;
  background: rgba(255, 254, 250, .96);
  box-shadow: var(--fm-shadow-soft);
}

.access-card-head,
.access-card-actions {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.access-card-head h2 {
  color: var(--fm-heading);
  font-size: 1.05rem;
  margin: 0;
  font-weight: 820;
}

.access-card-head p {
  color: #66746c;
  margin: 4px 0 0;
}

.access-count {
  flex: 0 0 auto;
  color: var(--fm-primary);
  font-weight: 850;
}

.access-progress {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7eee9;
}

.access-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--fm-primary), #60a5fa);
}

.permission-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.permission-chip-row span,
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 760;
}

.permission-chip-row span {
  color: #1e40af;
  background: #dbeafe;
}

.status-pill.success {
  color: #0d6b45;
  background: #dff5e8;
}

.status-pill.muted {
  color: #6c757d;
  background: #eceff1;
}

.user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-cell > span {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(135deg, var(--fm-primary), #60a5fa);
  font-weight: 850;
}

.user-cell strong,
.user-cell small {
  display: block;
}

.user-cell small {
  color: #66746c;
}

.access-form-side {
  position: sticky;
  top: 88px;
  padding: 18px;
  border: 1px solid rgba(217, 227, 220, .88);
  border-radius: 8px;
  background: #f8fbf9;
}

.access-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.permission-group + .permission-group {
  margin-top: 18px;
}

.permission-group h2 {
  color: var(--fm-heading);
  font-size: .94rem;
  font-weight: 840;
  margin-bottom: 10px;
}

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

.permission-tile {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 78px;
  padding: 13px;
  border: 1px solid #d8e3dc;
  border-radius: 8px;
  background: rgba(255, 255, 255, .78);
  cursor: pointer;
}

.permission-tile input {
  margin-top: 3px;
}

.permission-tile strong,
.permission-tile small {
  display: block;
}

.permission-tile strong {
  color: var(--fm-heading);
}

.permission-tile small {
  color: #66746c;
}

.permission-matrix {
  display: grid;
  gap: 8px;
}

.permission-matrix-head,
.permission-matrix-row {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) repeat(3, minmax(84px, 112px));
  align-items: center;
  gap: 10px;
}

.permission-matrix-head {
  color: #5d6d64;
  font-size: .75rem;
  font-weight: 820;
  text-transform: uppercase;
  padding: 0 12px 2px;
}

.permission-matrix-head span:not(:first-child),
.permission-matrix-row label,
.permission-na {
  text-align: center;
}

.permission-matrix-row {
  min-height: 70px;
  padding: 12px;
  border: 1px solid #d8e3dc;
  border-radius: 8px;
  background: rgba(255, 255, 255, .82);
}

.permission-matrix-row strong,
.permission-matrix-row small {
  display: block;
}

.permission-matrix-row strong {
  color: var(--fm-heading);
  font-weight: 820;
}

.permission-matrix-row small,
.permission-na {
  color: #66746c;
}

.permission-matrix-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--fm-primary);
}

.html-editor {
  min-height: 260px;
  font-family: Consolas, "Courier New", monospace;
}

.html-editor-shell {
  overflow: hidden;
  border: 1px solid #cbd7ce;
  border-radius: 8px;
  background: rgba(255, 255, 255, .86);
}

.html-editor-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px;
  border-bottom: 1px solid rgba(217, 227, 220, .95);
  background: rgba(245, 247, 242, .82);
}

.html-editor-shell:not(.html-editor-ready) .html-editor-toolbar,
.html-editor-shell:not(.html-editor-ready) .html-editor-canvas {
  display: none;
}

.html-editor-toolbar button,
.html-editor-tags-list button {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid rgba(203, 215, 206, .95);
  border-radius: 7px;
  color: var(--fm-heading);
  background: rgba(255, 255, 255, .88);
  font-size: .84rem;
  font-weight: 800;
}

.html-editor-toolbar button:hover,
.html-editor-toolbar button.is-active,
.html-editor-tags-list button:hover {
  color: #fff;
  background: var(--fm-primary);
  border-color: var(--fm-primary);
}

.html-editor-canvas:focus {
  box-shadow: inset 0 0 0 .2rem rgba(37, 99, 235, .12);
}

.html-editor-icon {
  min-width: 1em;
  display: inline-grid;
  place-items: center;
  font-size: 1rem;
  line-height: 1;
}

.html-toolbar-select,
.html-toolbar-color {
  min-height: 34px;
  border: 1px solid rgba(203, 215, 206, .95);
  border-radius: 7px;
  color: var(--fm-heading);
  background: rgba(255, 255, 255, .88);
  font-size: .84rem;
  font-weight: 800;
}

.html-toolbar-select {
  padding: 6px 9px;
}

.html-toolbar-color {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
}

.html-toolbar-color input {
  width: 28px;
  height: 24px;
  padding: 0;
  border: 0;
  background: transparent;
}

.html-toolbar-divider {
  width: 1px;
  height: 26px;
  margin-inline: 3px;
  background: rgba(203, 215, 206, .95);
}

.html-editor-canvas {
  min-height: 300px;
  padding: 18px;
  color: var(--fm-ink);
  background: #fff;
  outline: none;
  overflow-wrap: anywhere;
}

.html-editor-canvas:focus {
  box-shadow: inset 0 0 0 .2rem rgba(0, 109, 91, .12);
}

.html-editor-canvas:empty::before {
  content: "Digite ou cole o conteudo do email...";
  color: var(--fm-muted);
}

.html-editor-canvas h2,
.html-editor-canvas h3 {
  color: var(--fm-heading);
  font-weight: 850;
}

.html-editor-canvas blockquote {
  margin: 1rem 0;
  padding: .8rem 1rem;
  border-left: 4px solid var(--fm-primary);
  background: rgba(37, 99, 235, .06);
  color: var(--fm-heading);
}

.html-editor-canvas img,
.html-preview-canvas img {
  max-width: 100%;
  height: auto;
}

.html-editor-canvas p {
  margin-bottom: .75rem;
}

.html-editor-tags {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid rgba(217, 227, 220, .95);
  background: rgba(250, 251, 247, .96);
}

.html-editor-tags-copy {
  display: grid;
  gap: 2px;
}

.html-editor-tags-copy strong {
  color: var(--fm-heading);
  font-size: .9rem;
  font-weight: 850;
}

.html-editor-tags-copy small {
  color: var(--fm-muted);
  font-size: .78rem;
}

.html-editor-tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.html-editor-tags-list button {
  min-height: 30px;
  padding: 5px 8px;
  color: var(--fm-primary-dark);
  background: var(--fm-primary-soft);
  font-size: .78rem;
}

.html-editor-source {
  border: 0;
  border-top: 1px solid rgba(217, 227, 220, .95);
  border-radius: 0;
  background: #101714;
  color: #eef3ef;
  resize: vertical;
}

.html-editor-shell.html-editor-ready .html-editor-source {
  display: none;
}

.html-editor-shell.html-editor-ready.is-code-mode .html-editor-canvas {
  display: none;
}

.html-editor-shell.html-editor-ready.is-code-mode .html-editor-source {
  display: block;
}

.html-preview-shell {
  min-height: 300px;
  overflow: hidden;
  border: 1px solid #cbd7ce;
  border-radius: 8px;
  background: rgba(255, 255, 255, .9);
}

.html-preview-canvas {
  min-height: 300px;
  padding: 18px;
  color: var(--fm-ink);
  background: #fff;
  overflow-wrap: anywhere;
}

.html-preview-canvas:empty::before {
  content: "A pre-visualizacao do template aparecera aqui.";
  color: var(--fm-muted);
}

.hero {
  min-height: calc(100vh - 68px);
  display: grid;
  align-items: center;
  color: #fff;
  background:
    linear-gradient(90deg, rgba(17, 26, 22, .94), rgba(17, 26, 22, .66), rgba(17, 26, 22, .20)),
    url("https://images.unsplash.com/photo-1554224155-6726b3ff858f?auto=format&fit=crop&w=1800&q=80");
  background-size: cover;
  background-position: center;
}

.hero-inner {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 62px 0 96px;
}

.hero h1 {
  max-width: 760px;
  font-size: clamp(2.4rem, 5vw, 4.9rem);
  line-height: 1.02;
  font-weight: 900;
  letter-spacing: 0;
  margin: 0 0 22px;
}

.hero p {
  max-width: 650px;
  color: rgba(255, 255, 255, .88);
  font-size: 1.1rem;
  margin-bottom: 30px;
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 190px));
  gap: 14px;
  margin-top: 46px;
}

.hero-metrics div {
  border-top: 1px solid rgba(255, 255, 255, .32);
  padding-top: 14px;
}

.hero-metrics strong {
  display: block;
  font-size: 1.24rem;
}

.hero-metrics span {
  color: rgba(255, 255, 255, .76);
}

.feature-band {
  background: var(--fm-panel-strong);
  padding: 44px 0;
}

.feature-grid {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.feature-item {
  border-left: 3px solid var(--fm-primary);
  padding: 4px 0 4px 16px;
}

.feature-item:nth-child(2) {
  border-left-color: var(--fm-accent);
}

.feature-item:nth-child(3) {
  border-left-color: var(--fm-coral);
}

.feature-item h2 {
  color: var(--fm-heading);
  font-size: 1rem;
  font-weight: 850;
  margin: 0 0 6px;
}

.feature-item p {
  color: var(--fm-muted);
  margin: 0;
}

.auth-shell {
  width: min(1120px, calc(100% - 40px));
  min-height: calc(100vh - 70px);
  margin: 0 auto;
  padding: 56px 0;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, .8fr);
  gap: 48px;
  align-items: center;
}

.auth-shell-wide {
  grid-template-columns: minmax(0, .9fr) minmax(460px, 1fr);
}

.auth-copy {
  max-width: 620px;
}

.auth-kicker {
  display: inline-flex;
  color: var(--fm-primary-dark);
  font-size: .78rem;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: 14px;
}

.auth-copy h1 {
  color: var(--fm-heading);
  font-size: clamp(2rem, 4vw, 3.8rem);
  line-height: 1.04;
  font-weight: 900;
  letter-spacing: 0;
  margin: 0 0 18px;
}

.auth-copy p {
  color: var(--fm-muted);
  font-size: 1.05rem;
  margin: 0;
}

.auth-highlights {
  display: grid;
  gap: 14px;
  margin-top: 34px;
}

.auth-highlights div {
  border-left: 3px solid var(--fm-primary);
  padding-left: 16px;
}

.auth-highlights div:nth-child(2) {
  border-left-color: var(--fm-accent);
}

.auth-highlights div:nth-child(3) {
  border-left-color: var(--fm-coral);
}

.auth-highlights strong,
.auth-highlights span {
  display: block;
}

.auth-highlights strong {
  color: var(--fm-heading);
  margin-bottom: 3px;
}

.auth-highlights span {
  color: var(--fm-muted);
}

.auth-card {
  background: rgba(255, 254, 250, .94);
  border: 1px solid rgba(217, 227, 220, .92);
  border-radius: 8px;
  box-shadow: var(--fm-shadow);
  padding: 28px;
}

.auth-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.auth-card-head h2 {
  color: var(--fm-heading);
  font-size: 1.45rem;
  font-weight: 850;
  letter-spacing: 0;
  margin: 0;
}

.auth-card-head p {
  color: var(--fm-muted);
  margin: 4px 0 0;
}

.auth-card-head a {
  flex: 0 0 auto;
  font-weight: 800;
  text-decoration: none;
  margin-top: 3px;
}

@media (max-width: 992px) {
  .data-grid,
  .feature-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .auth-shell,
  .auth-shell-wide {
    grid-template-columns: 1fr;
    gap: 28px;
    align-items: start;
  }

  .auth-copy {
    max-width: none;
  }
}

@media (max-width: 720px) {
  .page-shell {
    padding: 0;
  }

  .flash-wrap {
    padding: 0 0 16px;
  }

  .app-content {
    padding: 20px 0px 16px;
  }

  .app-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
    padding: 16px;
  }

  .page-title {
    align-items: stretch;
    flex-direction: column;
  }

  .page-title > .d-flex {
    flex-wrap: wrap;
  }

  .page-title .btn {
    width: 100%;
  }

  .data-grid,
  .company-card-grid,
  .company-card-data,
  .feature-grid,
  .hero-metrics,
  .access-summary,
  .access-card-grid,
  .permission-grid,
  .permission-matrix-head,
  .permission-matrix-row {
    grid-template-columns: 1fr;
  }

  .access-form-side {
    position: static;
  }

  .permission-matrix-head {
    display: none;
  }

  .permission-matrix-row label,
  .permission-na {
    text-align: left;
  }

  .permission-matrix-row label {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .permission-matrix-row label:nth-child(2)::after {
    content: "Visualizar";
  }

  .permission-matrix-row label:nth-child(3)::after {
    content: "Criar/editar";
  }

  .permission-matrix-row label:nth-child(4)::after {
    content: "Excluir";
  }

  .hero-inner {
    width: min(100% - 30px, 1120px);
    padding: 48px 0 72px;
  }

  .auth-shell,
  .auth-shell-wide {
    width: min(100% - 28px, 1120px);
    padding: 30px 0;
  }

  .auth-copy h1 {
    font-size: 2rem;
  }

  .auth-card {
    padding: 20px;
  }

  .auth-card-head {
    flex-direction: column;
  }
}
