:root {
  --bg: #070611;
  --bg-elevated: rgba(13, 10, 27, 0.88);
  --bg-soft: rgba(19, 15, 39, 0.82);
  --border: rgba(168, 85, 247, 0.22);
  --border-soft: rgba(255, 255, 255, 0.08);
  --text: #f7f4ff;
  --muted: #b7afd4;
  --primary: #a855f7;
  --primary-strong: #c084fc;
  --success: #34d399;
  --warning: #f59e0b;
  --danger: #fb7185;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.35);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Segoe UI", system-ui, sans-serif;
  background:
    radial-gradient(720px 420px at 88% -8%, rgba(168, 85, 247, 0.26), transparent 62%),
    radial-gradient(620px 320px at 8% 6%, rgba(34, 211, 238, 0.08), transparent 58%),
    linear-gradient(180deg, #0f0b1b 0%, var(--bg) 56%, #05040b 100%);
}

a {
  color: inherit;
  text-decoration: none;
}

.empresa-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 24px 18px;
  background: rgba(7, 6, 17, 0.76);
  border-right: 1px solid var(--border-soft);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.brand strong {
  display: block;
  font-size: 1.2rem;
}

.brand span {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
}

.brand-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
}

.brand-logo.large {
  width: 72px;
  height: 72px;
}

.sidebar-nav {
  display: grid;
  gap: 10px;
}

.sidebar-nav a {
  padding: 13px 14px;
  border-radius: 14px;
  color: var(--muted);
  border: 1px solid transparent;
  transition: 0.18s ease;
}

.sidebar-nav a:hover,
.sidebar-nav a.is-active {
  color: var(--text);
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.22), rgba(168, 85, 247, 0.08));
  border-color: var(--border);
  box-shadow: 0 0 24px rgba(168, 85, 247, 0.12);
}

.sidebar-footer {
  display: grid;
  gap: 12px;
}

.empresa-badge,
.usuario-badge,
.panel-card,
.metric-card,
.public-card {
  border: 1px solid var(--border-soft);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.035));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.empresa-badge,
.usuario-badge {
  padding: 14px;
  border-radius: 16px;
}

.empresa-badge strong,
.usuario-badge strong {
  display: block;
}

.empresa-badge span,
.usuario-badge span,
.muted-note,
.page-header p,
.panel-title span,
.empty-state {
  color: var(--muted);
}

.content {
  padding: 32px;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.page-header h1,
.public-header h1 {
  margin: 0 0 6px;
  font-size: clamp(2rem, 3vw, 2.6rem);
  letter-spacing: -0.04em;
}

.periodo-form,
.page-actions,
.inline-form {
  display: flex;
  align-items: end;
  gap: 12px;
}

.periodo-form label,
.field {
  display: grid;
  gap: 8px;
}

.periodo-form span,
.field span {
  font-size: 0.88rem;
  color: var(--muted);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.metric-card,
.panel-card {
  padding: 22px;
  border-radius: var(--radius-lg);
}

.metric-card span {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
}

.metric-card strong {
  font-size: 2rem;
}

.panel-grid {
  display: grid;
  gap: 20px;
  margin-bottom: 20px;
}

.panel-grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.panel-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.panel-title h2 {
  margin: 0;
}

.chart-list,
.alert-list,
.read-only-list,
.field-stack,
.switch-list {
  display: grid;
  gap: 14px;
}

.chart-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) 40px;
  gap: 12px;
  align-items: center;
}

.chart-bar-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.chart-bar {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--primary-strong));
}

.alert-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.04);
}

.alert-item span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

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

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

.data-table th,
.data-table td {
  padding: 14px 12px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

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

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 90px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: capitalize;
}

.chip-success,
.chip-status-ativo {
  background: rgba(52, 211, 153, 0.16);
  color: #bdf8dd;
}

.chip-warning,
.chip-status-pendente {
  background: rgba(245, 158, 11, 0.18);
  color: #ffd89c;
}

.chip-status-removido,
.chip-status-cancelado,
.chip-status-inativo {
  background: rgba(251, 113, 133, 0.16);
  color: #ffc2cd;
}

.chip-info {
  background: rgba(168, 85, 247, 0.16);
  color: #e6d2ff;
}

.chip-neutro,
.chip-atencao {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.settings-form {
  display: grid;
  gap: 18px;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.switch-input {
  width: 18px;
  height: 18px;
}

.read-only-list div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.read-only-list dt {
  color: var(--muted);
}

.input,
input[type="date"] {
  width: 100%;
  padding: 13px 14px;
  border-radius: 12px;
  border: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: 12px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 700;
}

.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary,
.btn-secondary {
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  color: #fff;
  border-color: rgba(192, 132, 252, 0.26);
}

.btn-ghost,
.btn-inline {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  border-color: var(--border-soft);
}

.btn-block {
  width: 100%;
}

.public-page {
  display: grid;
  place-items: center;
}

.public-shell {
  width: min(640px, calc(100% - 32px));
  padding: 48px 0;
}

.public-card {
  padding: 30px;
  border-radius: var(--radius-xl);
}

.public-header,
.success-card {
  text-align: center;
}

.public-form {
  display: grid;
  gap: 16px;
}

.field-error {
  color: #ffc2cd;
}

.flash-stack {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.flash {
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(168, 85, 247, 0.12);
}

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

@media (max-width: 960px) {
  .empresa-shell,
  .panel-grid-2 {
    grid-template-columns: 1fr;
  }

  .sidebar {
    gap: 24px;
  }

  .content {
    padding: 20px;
  }

  .page-header,
  .periodo-form,
  .page-actions {
    flex-direction: column;
    align-items: stretch;
  }
}

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