:root {
  --bg-deep: #0a0e17;
  --bg-card: rgba(255, 255, 255, 0.04);
  --bg-card-hover: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.1);
  --text: #f0f4fc;
  --text-primary: #f0f4fc;
  --text-muted: #94a3b8;
  --accent-blue: #3b82f6;
  --accent-blue-glow: rgba(59, 130, 246, 0.45);
  --accent-emerald: #10b981;
  --accent-emerald-glow: rgba(16, 185, 129, 0.45);
  --accent-violet: #8b5cf6;
  --accent-violet-glow: rgba(139, 92, 246, 0.45);
  --accent-amber: #f59e0b;
  --accent-amber-glow: rgba(245, 158, 11, 0.45);
  --accent-rose: #f43f5e;
  --accent-rose-glow: rgba(244, 63, 94, 0.45);
  --radius-lg: 0.9rem;
  --radius-xl: 1.5rem;
  --radius-full: 9999px;
  --shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  --transition: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* display:flex/grid em cards e abas anula o atributo hidden do HTML. */
[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  font-family: "Outfit", system-ui, sans-serif;
  color: var(--text);
  background: var(--bg-deep);
  line-height: 1.6;
  overflow-x: hidden;
}

.bg-gradient {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(59, 130, 246, 0.18), transparent),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(16, 185, 129, 0.12), transparent),
    radial-gradient(ellipse 40% 30% at 0% 80%, rgba(139, 92, 246, 0.1), transparent),
    var(--bg-deep);
}

.container {
  width: min(1100px, 92vw);
  margin: 0 auto;
  padding: 2rem 0 4rem;
}

/* Header */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 0 2.5rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text);
}

.logo-mark {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-emerald));
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: -0.02em;
  box-shadow: 0 0 24px var(--accent-blue-glow);
}

.logo-text {
  font-weight: 600;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-full);
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  font-size: 0.8rem;
  color: #6ee7b7;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--accent-emerald);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.6;
    transform: scale(0.9);
  }
}

/* Hero */
.hero {
  text-align: center;
  margin-bottom: 3.5rem;
}

.hero-tag {
  display: inline-block;
  padding: 0.35rem 1rem;
  margin-bottom: 1rem;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 0.75rem;
}

.hero p {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 520px;
  margin: 0 auto;
}

/* Module grid */
.section-block {
  margin-bottom: 3rem;
}

.section-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  letter-spacing: 0.02em;
}

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

.module-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 2.5rem 2rem;
  border-radius: var(--radius-xl);
  background: var(--bg-card);
  border: 1px solid var(--border);
  backdrop-filter: blur(12px);
  text-decoration: none;
  color: inherit;
  transition: var(--transition);
  overflow: hidden;
}

.module-card::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: var(--transition);
  border-radius: inherit;
}

.module-card--blue::before {
  background: radial-gradient(circle at 50% 0%, var(--accent-blue-glow), transparent 70%);
}

.module-card--emerald::before {
  background: radial-gradient(circle at 50% 0%, var(--accent-emerald-glow), transparent 70%);
}

.module-card--violet::before {
  background: radial-gradient(circle at 50% 0%, var(--accent-violet-glow), transparent 70%);
}

.module-card--amber::before {
  background: radial-gradient(circle at 50% 0%, var(--accent-amber-glow), transparent 70%);
}

.module-card--rose::before {
  background: radial-gradient(circle at 50% 0%, var(--accent-rose-glow), transparent 70%);
}

.module-card:hover {
  transform: translateY(-6px);
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: var(--shadow-lg);
  background: var(--bg-card-hover);
}

.module-card:hover::before {
  opacity: 1;
}

/* Round icon button */
.icon-btn {
  position: relative;
  z-index: 1;
  width: 88px;
  height: 88px;
  border-radius: var(--radius-full);
  display: grid;
  place-items: center;
  margin-bottom: 1.5rem;
  border: 2px solid transparent;
  transition: var(--transition);
}

.module-card--blue .icon-btn {
  background: linear-gradient(145deg, rgba(59, 130, 246, 0.25), rgba(59, 130, 246, 0.08));
  border-color: rgba(59, 130, 246, 0.35);
  box-shadow: 0 8px 32px rgba(59, 130, 246, 0.2);
}

.module-card--emerald .icon-btn {
  background: linear-gradient(145deg, rgba(16, 185, 129, 0.25), rgba(16, 185, 129, 0.08));
  border-color: rgba(16, 185, 129, 0.35);
  box-shadow: 0 8px 32px rgba(16, 185, 129, 0.2);
}

.module-card--violet .icon-btn {
  background: linear-gradient(145deg, rgba(139, 92, 246, 0.25), rgba(139, 92, 246, 0.08));
  border-color: rgba(139, 92, 246, 0.35);
  box-shadow: 0 8px 32px rgba(139, 92, 246, 0.2);
}

.module-card--amber .icon-btn {
  background: linear-gradient(145deg, rgba(245, 158, 11, 0.25), rgba(245, 158, 11, 0.08));
  border-color: rgba(245, 158, 11, 0.35);
  box-shadow: 0 8px 32px rgba(245, 158, 11, 0.2);
}

.module-card--rose .icon-btn {
  background: linear-gradient(145deg, rgba(244, 63, 94, 0.25), rgba(244, 63, 94, 0.08));
  border-color: rgba(244, 63, 94, 0.35);
  box-shadow: 0 8px 32px rgba(244, 63, 94, 0.2);
}

.icon-btn svg {
  width: 36px;
  height: 36px;
  transition: var(--transition);
}

.module-card--blue .icon-btn svg {
  color: #60a5fa;
}

.module-card--emerald .icon-btn svg {
  color: #34d399;
}

.module-card--violet .icon-btn svg {
  color: #c4b5fd;
}

.module-card--amber .icon-btn svg {
  color: #fcd34d;
}

.module-card--rose .icon-btn svg {
  color: #fb7185;
}

.module-card:hover .icon-btn {
  transform: scale(1.12) rotate(-4deg);
}

.module-card--blue:hover .icon-btn {
  box-shadow: 0 0 40px var(--accent-blue-glow), 0 12px 40px rgba(59, 130, 246, 0.35);
  border-color: rgba(96, 165, 250, 0.6);
}

.module-card--emerald:hover .icon-btn {
  box-shadow: 0 0 40px var(--accent-emerald-glow), 0 12px 40px rgba(16, 185, 129, 0.35);
  border-color: rgba(52, 211, 153, 0.6);
}

.module-card--violet:hover .icon-btn {
  box-shadow: 0 0 40px var(--accent-violet-glow), 0 12px 40px rgba(139, 92, 246, 0.35);
  border-color: rgba(196, 181, 253, 0.6);
}

.module-card--amber:hover .icon-btn {
  box-shadow: 0 0 40px var(--accent-amber-glow), 0 12px 40px rgba(245, 158, 11, 0.35);
  border-color: rgba(252, 211, 77, 0.6);
}

.module-card--rose:hover .icon-btn {
  box-shadow: 0 0 40px var(--accent-rose-glow), 0 12px 40px rgba(244, 63, 94, 0.35);
  border-color: rgba(251, 113, 133, 0.6);
}

.module-card:hover .icon-btn svg {
  transform: scale(1.1);
}

.module-card h2 {
  position: relative;
  z-index: 1;
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.module-card p {
  position: relative;
  z-index: 1;
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 1.25rem;
}

.module-link {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.25rem;
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 500;
  transition: var(--transition);
}

.module-card--blue .module-link {
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.module-card--emerald .module-link {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.module-card--violet .module-link {
  background: rgba(139, 92, 246, 0.15);
  color: #ddd6fe;
  border: 1px solid rgba(139, 92, 246, 0.3);
}

.module-card--amber .module-link {
  background: rgba(245, 158, 11, 0.15);
  color: #fde68a;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.module-card--rose .module-link {
  background: rgba(244, 63, 94, 0.15);
  color: #fda4af;
  border: 1px solid rgba(244, 63, 94, 0.3);
}

.module-card:hover .module-link {
  gap: 0.65rem;
}

.module-link svg {
  width: 16px;
  height: 16px;
  transition: var(--transition);
}

.module-card:hover .module-link svg {
  transform: translateX(3px);
}

/* Module page */
.page-header {
  margin-bottom: 2.5rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 1.5rem;
  padding: 0.45rem 1rem;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  transition: var(--transition);
}

.back-link:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.2);
  background: var(--bg-card-hover);
}

.back-link svg {
  width: 16px;
  height: 16px;
  transition: var(--transition);
}

.back-link:hover svg {
  transform: translateX(-3px);
}

.page-header h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
}

.page-header p {
  color: var(--text-muted);
  max-width: 560px;
}

.content-panel {
  padding: 2rem;
  border-radius: var(--radius-xl);
  background: var(--bg-card);
  border: 1px solid var(--border);
  backdrop-filter: blur(12px);
}

.content-panel h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.content-panel p {
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.feature-list {
  list-style: none;
  display: grid;
  gap: 0.75rem;
}

.feature-list li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.925rem;
}

.feature-list li::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.content-panel--blue .feature-list li::before {
  background: var(--accent-blue);
  box-shadow: 0 0 10px var(--accent-blue-glow);
}

.content-panel--emerald .feature-list li::before {
  background: var(--accent-emerald);
  box-shadow: 0 0 10px var(--accent-emerald-glow);
}

.content-panel--violet .feature-list li::before {
  background: var(--accent-violet);
  box-shadow: 0 0 10px var(--accent-violet-glow);
}

.content-panel--amber .feature-list li::before {
  background: var(--accent-amber);
  box-shadow: 0 0 10px var(--accent-amber-glow);
}

.empresa-form {
  max-width: 720px;
}

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

.content-panel h3,
.form-section-title {
  margin: 1.25rem 0 0.35rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: #f0f4fc !important;
}

.form-hint {
  margin: 0 0 0.75rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.form-hint code {
  font-size: 0.8125rem;
}

.form-hint--ok {
  color: #86efac;
}

.form-hint--warn {
  color: #fcd34d;
}

.form-actions {
  margin-top: 0.5rem;
}

.coming-soon {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.25rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-full);
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.3);
  color: #fcd34d;
  font-size: 0.85rem;
  font-weight: 500;
}

.site-footer {
  text-align: center;
  padding: 2rem 0 1rem;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.site-footer a {
  color: var(--accent-blue);
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

/* Header actions & user menu */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.user-menu {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.35rem 0.35rem 0.35rem 0.9rem;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  border: 1px solid var(--border);
  backdrop-filter: blur(12px);
}

.user-email {
  font-size: 0.8rem;
  color: var(--text-muted);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-logout {
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  border: 1px solid rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.btn-logout:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.5);
  color: #fecaca;
}

/* Auth / Login */
.container--auth {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-header--center {
  justify-content: center;
}

.auth-section {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 1rem 0 3rem;
}

.login-card {
  width: min(420px, 100%);
  padding: 2.5rem 2rem;
  border-radius: var(--radius-xl);
  background: var(--bg-card);
  border: 1px solid var(--border);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-lg);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.login-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 0%, var(--accent-blue-glow), transparent 65%);
  pointer-events: none;
}

.login-card > * {
  position: relative;
  z-index: 1;
}

.login-card h1 {
  font-size: clamp(1.5rem, 4vw, 1.85rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
}

.login-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 1.75rem;
}

.auth-form {
  text-align: left;
  display: grid;
  gap: 1.1rem;
}

.form-group {
  display: grid;
  gap: 0.45rem;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

.form-input {
  width: 100%;
  padding: 0.85rem 1rem;
  border-radius: 1rem;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  transition: var(--transition);
}

.form-input::placeholder {
  color: rgba(148, 163, 184, 0.65);
}

.form-input:focus {
  outline: none;
  border-color: rgba(59, 130, 246, 0.5);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
  background: rgba(255, 255, 255, 0.05);
}

select.form-input:focus {
  background-color: #1e293b;
}

.auth-error {
  padding: 0.75rem 1rem;
  border-radius: 1rem;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  font-size: 0.85rem;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.9rem 1.25rem;
  margin-top: 0.25rem;
  border: 1px solid rgba(59, 130, 246, 0.4);
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.35), rgba(16, 185, 129, 0.25));
  color: #dbeafe;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 8px 32px rgba(59, 130, 246, 0.2);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 0 40px var(--accent-blue-glow), 0 12px 40px rgba(59, 130, 246, 0.35);
  border-color: rgba(96, 165, 250, 0.6);
}

.btn-primary:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.btn-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  border-radius: var(--radius-full);
  animation: spin 0.7s linear infinite;
}

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

.auth-hint {
  margin-top: 1.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Cadastro / CRUD */
.page-header--row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.btn-primary--inline {
  width: auto;
  margin-top: 0;
  padding-inline: 1.35rem;
}

.btn-secondary {
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.btn-secondary:hover {
  color: var(--text);
  background: var(--bg-card-hover);
}

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

.table-wrap--scroll {
  max-height: min(70vh, 720px);
  overflow-y: auto;
}

.table-wrap--scroll thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #0f172a;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

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

.data-table td.cell-retorno {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.data-table th {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.table-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-table {
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.78rem;
  cursor: pointer;
  transition: var(--transition);
}

.btn-table--edit:hover {
  color: #93c5fd;
  border-color: rgba(59, 130, 246, 0.35);
  background: rgba(59, 130, 246, 0.12);
}

.btn-table--delete:hover {
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.12);
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 1.5rem 0 0.5rem;
}

.cadastro-alert {
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  border-radius: 1rem;
  font-size: 0.875rem;
}

.cadastro-alert--error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

.cadastro-alert--success {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #6ee7b7;
}

.modal[hidden] {
  display: none !important;
}

.modal.is-open {
  display: grid;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  place-items: center;
  padding: 1rem;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(720px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.75rem;
  border-radius: var(--radius-xl);
  background: #111827;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}

.modal-card h2 {
  margin-bottom: 0;
  font-size: 1.25rem;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.modal-close {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  transition: var(--transition);
}

.modal-close:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

body.modal-open {
  overflow: hidden;
}

.modal-form {
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 0.25rem;
}

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

.form-checkbox {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.form-checkbox input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent-blue);
}

@media (max-width: 640px) {
  .site-header {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }

  .site-header--center {
    align-items: center;
  }

  .header-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .user-email {
    max-width: 140px;
  }

  .module-card {
    padding: 2rem 1.5rem;
  }

  .login-card {
    padding: 2rem 1.5rem;
  }
}

.container--wide {
  width: min(1280px, 94vw);
}

.emissao-grid {
  display: grid;
  gap: 1.5rem;
}

.env-row {
  margin-top: 1rem;
  display: grid;
  gap: 0.5rem;
}

.env-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
}

.env-badge--homolog {
  background: rgba(245, 158, 11, 0.14);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #fcd34d;
}

.env-badge--prod {
  background: rgba(239, 68, 68, 0.14);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

.env-badge--warn {
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

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

.cert-status {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

select.form-input,
textarea.form-input {
  appearance: none;
  resize: vertical;
}

select.form-input {
  color-scheme: dark;
  background-color: #1e293b;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m19 9-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  background-size: 1rem;
  padding-right: 2.5rem;
}

select.form-input option {
  background-color: #1e293b;
  color: #f1f5f9;
}

input[type="date"].form-input,
input[type="datetime-local"].form-input {
  color-scheme: dark;
}

.xml-preview {
  width: 100%;
  min-height: 180px;
  margin-top: 1.25rem;
  padding: 0.9rem 1rem;
  border-radius: 1rem;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.25);
  color: #cbd5e1;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.75rem;
  line-height: 1.45;
}

.suggest-wrap {
  position: relative;
}

.suggest-box {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  display: grid;
  max-height: 220px;
  overflow-y: auto;
  border-radius: 1rem;
  border: 1px solid var(--border);
  background: #111827;
  box-shadow: var(--shadow-lg);
}

.suggest-item {
  padding: 0.65rem 0.85rem;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.suggest-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.status-pill {
  display: inline-flex;
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
}

.status-pill--autorizada {
  background: rgba(16, 185, 129, 0.14);
  color: #6ee7b7;
}

.status-pill--rejeitada,
.status-pill--erro {
  background: rgba(239, 68, 68, 0.14);
  color: #fca5a5;
}

.status-pill--pendente {
  background: rgba(245, 158, 11, 0.14);
  color: #fcd34d;
}

@media (min-width: 1080px) {
  .emissao-grid {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    align-items: start;
  }
}

/* ===== D&D — Abas ===== */
.tabs {
  display: inline-flex;
  gap: 0.4rem;
  padding: 0.35rem;
  margin-bottom: 1.5rem;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  border: 1px solid var(--border);
}

.tab-btn {
  padding: 0.5rem 1.35rem;
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.tab-btn:hover {
  color: var(--text);
}

.tab-btn.is-active {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.35), rgba(139, 92, 246, 0.25));
  border-color: rgba(59, 130, 246, 0.4);
  color: #dbeafe;
}

/* Segundo nível de abas, dentro de NPCs. */
.tabs--sub {
  margin-top: -0.9rem;
  margin-left: 1rem;
  background: transparent;
  border-style: dashed;
}

.tabs--sub .tab-btn {
  padding: 0.35rem 1rem;
  font-size: 0.82rem;
}

/* ===== D&D — Cards de ficha ===== */
.ficha-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 1.25rem;
}

.ficha-card {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1.4rem;
  border-radius: var(--radius-xl);
  background: var(--bg-card);
  border: 1px solid var(--border);
  backdrop-filter: blur(12px);
  transition: var(--transition);
}

.ficha-card:hover {
  border-color: rgba(255, 255, 255, 0.18);
  background: var(--bg-card-hover);
}

.ficha-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
}

.ficha-card h3 {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.ficha-card-id {
  flex: 1;
  min-width: 0;
}

.ficha-name-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.ficha-avatar {
  flex-shrink: 0;
  width: 3.25rem;
  height: 3.25rem;
  border-radius: var(--radius-lg);
  object-fit: cover;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
}

.ficha-avatar-btn {
  flex-shrink: 0;
  padding: 0;
  border: none;
  background: none;
  line-height: 0;
  border-radius: var(--radius-lg);
  cursor: zoom-in;
  transition: var(--transition);
}

.ficha-avatar-btn:hover {
  transform: scale(1.06);
}

.ficha-avatar-btn:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 3px;
}

.ficha-avatar--vazio {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

/* Visualização da imagem em tamanho grande. */
.lightbox .modal-backdrop {
  background: rgba(2, 6, 23, 0.88);
  backdrop-filter: blur(8px);
}

.lightbox-figura {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  max-width: min(92vw, 980px);
}

.lightbox-figura img {
  max-width: 100%;
  max-height: 78vh;
  object-fit: contain;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}

.lightbox-figura figcaption {
  color: var(--text-muted);
  font-size: 0.95rem;
  text-align: center;
}

.lightbox-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: rgba(15, 23, 42, 0.75);
}

/* Editor de imagem no formulário da ficha. */
.foto-editor {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  margin-bottom: 1.25rem;
}

.foto-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 7rem;
  height: 7rem;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.04);
  border: 1px dashed var(--border);
}

.foto-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.foto-preview__vazio {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.foto-acoes {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.foto-botoes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Fichas sem vida ficam fora de novos combates: o cartão sinaliza o motivo. */
.ficha-card.is-dead {
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.06);
}

.ficha-card.is-dead h3 {
  color: #fca5a5;
  text-decoration: line-through;
}

.ficha-sub {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.stat-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.7rem;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.stat-pill strong {
  color: var(--text);
  font-weight: 600;
}

.hp-bar {
  width: 100%;
  height: 8px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}

.hp-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--accent-emerald), #34d399);
  transition: width 0.3s ease;
}

.hp-bar-fill--low {
  background: linear-gradient(90deg, var(--accent-amber), #fbbf24);
}

.hp-bar-fill--critical {
  background: linear-gradient(90deg, #ef4444, #f87171);
}

.hp-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ===== D&D — Formulário de ficha ===== */
.modal-card--wide {
  width: min(980px, 100%);
}

.attr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.attr-box {
  display: grid;
  gap: 0.3rem;
  padding: 0.75rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  text-align: center;
}

.attr-box label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.attr-box input {
  text-align: center;
  padding: 0.5rem;
}

.attr-mod {
  font-size: 0.85rem;
  font-weight: 600;
  color: #93c5fd;
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 0.4rem 1rem;
  margin-bottom: 0.75rem;
}

.item-rows {
  display: grid;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}

.item-row {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) 80px minmax(160px, 1.4fr) auto;
  gap: 0.5rem;
  align-items: center;
}

.attack-rows {
  display: grid;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}

.attack-row {
  display: grid;
  grid-template-columns: minmax(140px, 1.2fr) 90px minmax(120px, 1fr) auto;
  gap: 0.5rem;
  align-items: center;
}

.attack-row-labels {
  display: grid;
  grid-template-columns: minmax(140px, 1.2fr) 90px minmax(120px, 1fr) auto;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.btn-icon-remove {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  transition: var(--transition);
}

.btn-icon-remove:hover {
  background: rgba(239, 68, 68, 0.22);
}

.btn-add-inline {
  width: fit-content;
  padding: 0.45rem 1rem;
  border-radius: var(--radius-full);
  border: 1px dashed rgba(255, 255, 255, 0.25);
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  transition: var(--transition);
}

.btn-add-inline:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.4);
}

/* ===== D&D — Combate ===== */
.round-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  border-radius: var(--radius-xl);
  background: var(--bg-card);
  border: 1px solid var(--border);
}

.round-info {
  display: flex;
  align-items: baseline;
  gap: 1rem;
}

.round-info strong {
  font-size: 1.3rem;
  letter-spacing: -0.02em;
}

.round-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.combat-list {
  display: grid;
  gap: 0.85rem;
}

.combatant {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-xl);
  background: var(--bg-card);
  border: 1px solid var(--border);
  transition: var(--transition);
}

.combatant.is-turn {
  border-color: rgba(16, 185, 129, 0.55);
  background: rgba(16, 185, 129, 0.08);
  box-shadow: 0 0 24px rgba(16, 185, 129, 0.15);
}

.combatant.is-down {
  opacity: 0.55;
}

.init-badge {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: var(--radius-full);
  background: linear-gradient(145deg, rgba(59, 130, 246, 0.3), rgba(139, 92, 246, 0.2));
  border: 1px solid rgba(59, 130, 246, 0.4);
  font-weight: 700;
  font-size: 1.05rem;
}

.combatant-main {
  display: grid;
  gap: 0.4rem;
  min-width: 0;
}

.combatant-name-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.combatant-name-row h3 {
  font-size: 1.05rem;
  font-weight: 600;
}

.tipo-pill {
  padding: 0.12rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tipo-pill--pc {
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.tipo-pill--npc {
  background: rgba(139, 92, 246, 0.15);
  color: #ddd6fe;
  border: 1px solid rgba(139, 92, 246, 0.3);
}

.tipo-pill--monstro {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.effects-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.18rem 0.65rem;
  border-radius: var(--radius-full);
  background: rgba(245, 158, 11, 0.14);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #fcd34d;
  font-size: 0.75rem;
  font-weight: 500;
}

.chip button {
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  opacity: 0.7;
}

.chip button:hover {
  opacity: 1;
}

.chip-add {
  appearance: none;
  padding: 0.18rem 1.6rem 0.18rem 0.65rem;
  border-radius: var(--radius-full);
  border: 1px dashed rgba(255, 255, 255, 0.25);
  background-color: transparent;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m19 9-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  background-size: 0.8rem;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.75rem;
  cursor: pointer;
}

.chip-add option {
  background-color: #1e293b;
  color: #f1f5f9;
}

.combatant-side {
  display: grid;
  gap: 0.5rem;
  justify-items: end;
}

.hp-controls {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.hp-controls .hp-value {
  min-width: 86px;
  text-align: center;
  font-weight: 600;
  font-size: 0.95rem;
}

.btn-hp {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: var(--transition);
}

.btn-hp--dano:hover {
  border-color: rgba(239, 68, 68, 0.5);
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
}

.btn-hp--cura:hover {
  border-color: rgba(16, 185, 129, 0.5);
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
}

.ca-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.ca-badge strong {
  color: var(--text);
}

.combat-log-panel {
  margin-top: 1.5rem;
  overflow: visible;
}

.form-row--participants {
  grid-template-columns: repeat(2, minmax(220px, 1fr));
}

select.participant-select {
  appearance: auto;
  -webkit-appearance: listbox;
  min-height: 8.5rem;
  height: auto;
  padding: 0.35rem 0.5rem;
  line-height: 1.45;
  background-color: #1e293b;
  color: #f1f5f9;
}

select.participant-select option {
  padding: 0.45rem 0.55rem;
  background: #1e293b;
  color: #f1f5f9;
}

select.participant-select option:checked {
  background: linear-gradient(0deg, rgba(16, 185, 129, 0.35), rgba(16, 185, 129, 0.35));
  color: #ecfdf5;
}

select.result-select {
  appearance: auto;
  -webkit-appearance: menulist;
  background-color: #1e293b;
  color: #f1f5f9;
}

.combat-form-tabs {
  display: flex;
  gap: 0.5rem;
  margin: 0.25rem 0 1rem;
}

.combat-form-tab {
  padding: 0.55rem 1rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.combat-form-tab:hover {
  color: var(--text);
  border-color: rgba(59, 130, 246, 0.4);
}

.combat-form-tab.is-active {
  color: #dbeafe;
  border-color: rgba(59, 130, 246, 0.5);
  background: rgba(59, 130, 246, 0.15);
}

.combat-form-tabpanel {
  display: grid;
  gap: 1rem;
}

.field-hint {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.dead-badge,
.turn-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.12rem 0.55rem;
  border-radius: var(--radius-full);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.dead-badge {
  background: rgba(239, 68, 68, 0.18);
  border: 1px solid rgba(239, 68, 68, 0.45);
  color: #fca5a5;
}

.turn-badge {
  background: rgba(16, 185, 129, 0.18);
  border: 1px solid rgba(16, 185, 129, 0.45);
  color: #6ee7b7;
}

.combatant.is-dead {
  border-color: rgba(239, 68, 68, 0.55);
  background: rgba(239, 68, 68, 0.1);
  box-shadow: inset 0 0 0 1px rgba(239, 68, 68, 0.15);
}

.combatant.is-dead h3 {
  text-decoration: line-through;
  color: #fca5a5;
}

.panel-hint {
  margin: -0.25rem 0 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.panel-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.panel-header-row h2 {
  margin: 0;
}

.btn-secondary--small {
  padding: 0.35rem 0.85rem;
  font-size: 0.82rem;
}

.combat-log-form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.combat-log-preview {
  color: var(--text-muted);
  font-size: 0.88rem;
}

.combat-log-list {
  display: grid;
  gap: 0.75rem;
}

.combat-log-entry {
  padding: 1rem 1.15rem;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
}

.combat-log-entry__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-bottom: 0.45rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.combat-log-entry__action {
  font-size: 0.98rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.combat-log-entry__detail {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.combat-log-hit {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.55rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.combat-log-hit--sim {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.combat-log-hit--nao {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.combat-log-hit--inc {
  background: rgba(148, 163, 184, 0.12);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.25);
}

/* ===== D&D — História ===== */
.sessao-list {
  display: grid;
  gap: 1rem;
}

.sessao-card {
  padding: 1.5rem 1.75rem;
  border-radius: var(--radius-xl);
  background: var(--bg-card);
  border: 1px solid var(--border);
  backdrop-filter: blur(12px);
}

.sessao-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.6rem;
}

.sessao-card h3 {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.sessao-data {
  display: inline-block;
  padding: 0.2rem 0.75rem;
  border-radius: var(--radius-full);
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.3);
  color: #ddd6fe;
  font-size: 0.78rem;
  font-weight: 500;
}

.sessao-conteudo {
  color: var(--text-muted);
  font-size: 0.93rem;
  white-space: pre-wrap;
}

@media (max-width: 640px) {
  .combatant {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .combatant-side {
    grid-column: 1 / -1;
    justify-items: start;
  }

  .item-row {
    grid-template-columns: 1fr 70px auto;
  }

  .item-row .form-input--desc {
    grid-column: 1 / -1;
  }

  .attack-row {
    grid-template-columns: 1fr 70px 1fr auto;
  }
}

.nav-config {
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 500;
}

.nav-config:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.2);
}

.perm-form {
  margin-top: 1rem;
}

.perm-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1.25rem;
  margin: 0.75rem 0 1.1rem;
}

.table-panel {
  margin-top: 1.5rem;
}

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

.form-input--compact {
  min-width: 10rem;
  padding: 0.4rem 0.6rem;
  font-size: 0.85rem;
}

.combate-tabpanel {
  min-height: 12rem;
}

.historico-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.1rem;
}

.historico-select-label {
  display: grid;
  gap: 0.4rem;
  flex: 1 1 16rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.historico-select {
  font-size: 1rem;
  min-height: 3rem;
}

.historico-status {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.15rem;
  min-width: 10rem;
}

.historico-status strong {
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.historico-status span {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.historico-live {
  position: sticky;
  top: 0.4rem;
  z-index: 4;
  margin-bottom: 0.85rem;
  padding: 0.45rem 0.6rem 0.5rem;
  border-radius: var(--radius-lg);
  background: rgba(15, 23, 42, 0.94);
  border: 1px solid var(--border);
  backdrop-filter: blur(16px);
}

.historico-hp-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.historico-hp-head h2 {
  margin: 0;
  font-size: 0.78rem;
}

.historico-log-wrap h2 {
  margin: 0 0 1rem;
  font-size: 1.45rem;
  letter-spacing: -0.02em;
}

.historico-live-hint {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #6ee7b7;
}

.historico-hp-list {
  display: grid;
  gap: 0.28rem;
}

.live-hp {
  display: grid;
  gap: 0.15rem;
  padding: 0.22rem 0.35rem;
  border-radius: 0.55rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid transparent;
}

.live-hp.is-turn {
  border-color: rgba(16, 185, 129, 0.5);
  background: rgba(16, 185, 129, 0.1);
}

.live-hp.is-dead {
  opacity: 0.62;
}

.live-hp__top {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.35rem;
}

.live-hp__init {
  display: grid;
  place-items: center;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: var(--radius-full);
  background: rgba(59, 130, 246, 0.2);
  border: 1px solid rgba(59, 130, 246, 0.35);
  font-size: 0.62rem;
  font-weight: 700;
}

.live-hp__name {
  display: flex;
  align-items: center;
  gap: 0.28rem;
  min-width: 0;
}

.live-hp__name strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.78rem;
}

.live-hp .tipo-pill,
.live-hp .dead-badge,
.live-hp .turn-badge {
  padding: 0.04rem 0.35rem;
  font-size: 0.58rem;
}

.live-hp.is-dead .live-hp__name strong {
  text-decoration: line-through;
  color: #fca5a5;
}

.condicao-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.12rem 0.45rem;
  border-radius: var(--radius-full);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  border: 1px solid transparent;
}

.condicao-badge--saudavel {
  color: #6ee7b7;
  background: rgba(16, 185, 129, 0.14);
  border-color: rgba(16, 185, 129, 0.35);
}

.condicao-badge--arranhado {
  color: #a7f3d0;
  background: rgba(52, 211, 153, 0.12);
  border-color: rgba(52, 211, 153, 0.28);
}

.condicao-badge--machucado {
  color: #fde68a;
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.35);
}

.condicao-badge--bem-machucado {
  color: #fdba74;
  background: rgba(249, 115, 22, 0.16);
  border-color: rgba(249, 115, 22, 0.38);
}

.condicao-badge--fim {
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.16);
  border-color: rgba(239, 68, 68, 0.4);
}

.condicao-badge--morto {
  color: #cbd5e1;
  background: rgba(100, 116, 139, 0.22);
  border-color: rgba(100, 116, 139, 0.45);
}

.live-hp__effects {
  display: none;
}

.historico-log {
  display: grid;
  gap: 0.95rem;
}

.historico-log-entry {
  padding: 1.2rem 1.25rem;
  border-radius: var(--radius-xl);
  background: var(--bg-card);
  border: 1px solid var(--border);
}

.historico-log-entry__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.8rem;
  margin-bottom: 0.55rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.historico-log-entry__action {
  font-size: 1.22rem;
  font-weight: 650;
  line-height: 1.4;
}

.historico-log-entry__detail {
  margin-top: 0.4rem;
  color: var(--text-muted);
  font-size: 1rem;
}

@media (max-width: 640px) {
  .historico-toolbar {
    align-items: stretch;
  }

  .historico-status {
    align-items: flex-start;
    width: 100%;
  }

  .historico-live {
    top: 0;
    margin-left: -0.15rem;
    margin-right: -0.15rem;
  }

  .historico-log-entry {
    padding: 1.3rem 1.15rem;
  }

  .historico-log-entry__action {
    font-size: 1.28rem;
  }
}

.historia-tabpanel {
  min-height: 12rem;
}

.mundo-panel {
  margin-bottom: 0;
}

.mundo-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.mundo-texto {
  white-space: pre-wrap;
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.65;
}

.mundo-editor {
  min-height: 22rem;
  font-family: inherit;
  line-height: 1.6;
}

.mundo-acoes {
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
  margin-top: 0.85rem;
}

.utilidades-tabpanel {
  min-height: 14rem;
}

.utilidades-filtros {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.85rem;
  margin-bottom: 0.85rem;
}

.utilidades-contagem {
  margin: 0 0 1rem;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.magia-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 0.9rem;
}

.magia-card {
  padding: 1rem 1.1rem;
  border-radius: var(--radius-xl);
  background: var(--bg-card);
  border: 1px solid var(--border);
}

.magia-card__topo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.35rem;
}

.magia-card__topo h3 {
  flex: 1 1 8rem;
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.magia-circulo {
  display: inline-flex;
  padding: 0.12rem 0.5rem;
  border-radius: var(--radius-full);
  background: rgba(244, 63, 94, 0.16);
  border: 1px solid rgba(244, 63, 94, 0.35);
  color: #fda4af;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.magia-ritual {
  display: inline-flex;
  padding: 0.12rem 0.5rem;
  border-radius: var(--radius-full);
  background: rgba(245, 158, 11, 0.14);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #fcd34d;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
}

.magia-escola {
  margin: 0 0 0.55rem;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.magia-classes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.55rem;
}

.magia-pill {
  padding: 0.12rem 0.5rem;
  border-radius: var(--radius-full);
  background: rgba(59, 130, 246, 0.14);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #93c5fd;
  font-size: 0.7rem;
  font-weight: 600;
}

.magia-meta,
.magia-comp {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.magia-comp {
  margin-top: 0.25rem;
}

.magia-desc {
  margin: 0.75rem 0 0;
  color: var(--text);
  font-size: 0.88rem;
  line-height: 1.55;
  white-space: pre-wrap;
}

.utilidades-filtros--2 {
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
}

.talento-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1rem;
}

.talento-card {
  padding: 1.1rem 1.15rem;
  border-radius: var(--radius-xl);
  background: var(--bg-card);
  border: 1px solid var(--border);
}

.talento-prereq {
  margin: 0 0 0.65rem;
  color: #fcd34d;
  font-size: 0.82rem;
}

.talento-beneficios {
  margin: 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.4rem;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.5;
}

.talento-tabela {
  margin-top: 0.85rem;
}

.talento-tabela h4 {
  margin: 0 0 0.4rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.talento-tabela__grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.talento-tabela__grid td {
  padding: 0.35rem 0.45rem;
  border: 1px solid var(--border);
  vertical-align: top;
}

@media (max-width: 720px) {
  .utilidades-filtros,
  .utilidades-filtros--2 {
    grid-template-columns: 1fr;
  }

  .talento-grid {
    grid-template-columns: 1fr;
  }
}
