:root {
  --bg: #f7f7f9;
  --surface: #ffffff;
  --surface-2: #fafafc;
  --surface-3: #f0f1f4;
  --text: #111827;
  --muted: #6b7280;
  --muted-2: #9ca3af;
  --line: #edf0f3;
  --line-strong: #e5e7eb;
  --brand: #4f46e5;
  --brand-dark: #3730a3;
  --brand-soft: #eef2ff;
  --brand-rgb: 79, 70, 229;
  --accent: #4f46e5;
  --danger: #b42318;
  --danger-bg: #fef2f2;
  --danger-rgb: 180, 35, 24;
  --success: #067647;
  --success-bg: #ecfdf3;
  --warning: #b54708;
  --warning-bg: #fffbeb;
  --muted-rgb: 107, 114, 128;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 10px 24px rgba(17, 24, 39, 0.035);
  --shadow-hover: 0 3px 10px rgba(0, 0, 0, 0.055), 0 14px 30px rgba(17, 24, 39, 0.045);
  --shadow-soft: 0 1px 2px rgba(0, 0, 0, 0.035);
  --radius: 16px;
  --radius-sm: 8px;
  --sidebar-width: 250px;
  --sidebar-collapsed-width: 76px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, Manrope, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--brand);
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
  isolation: isolate;
  overflow-x: hidden;
  background:
    linear-gradient(135deg, rgba(17, 24, 39, 0.82), rgba(79, 70, 229, 0.34)),
    url("/assets/img/fundo_Inicial.jpg") center / cover no-repeat,
    var(--bg);
}

.login-body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(120deg, rgba(17, 24, 39, 0.18), transparent 52%),
    rgba(17, 24, 39, 0.12);
}

.login-shell {
  position: relative;
  z-index: 1;
  width: min(920px, 100%);
}

.login-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(390px, 0.92fr);
  min-height: 590px;
  padding: 0;
  border: 0;
  border-radius: 24px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 34px 90px rgba(17, 24, 39, 0.26);
  backdrop-filter: blur(14px);
}

.login-panel.compact {
  grid-template-columns: 1fr;
  min-height: 320px;
}

.login-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 58px;
  color: #fff;
  background: #161b22;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 58px;
}

.login-brand > span:last-child {
  display: grid;
  gap: 2px;
}

.login-brand strong {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.login-brand small {
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.76rem;
}

.login-kicker {
  width: fit-content;
  margin-bottom: 14px;
  padding: 7px 11px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: #e0e7ff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.login-copy h1 {
  margin: 0 0 16px;
  max-width: 560px;
  color: #fff;
  font-size: clamp(2.15rem, 4vw, 3.45rem);
  font-weight: 600;
  line-height: 1.02;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.login-copy p {
  max-width: 520px;
  margin: 0;
  color: rgba(239, 246, 255, 0.78);
  font-size: 1.06rem;
  line-height: 1.6;
}

.login-benefits {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 30px;
}

.login-benefits span {
  padding: 8px 11px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.1);
  color: #e0e7ff;
  font-size: 0.78rem;
  font-weight: 600;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--brand);
  color: #fff;
  font-weight: 700;
}

.brand-mark.large {
  width: 56px;
  height: 56px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.15);
  box-shadow: none;
  font-size: 1.5rem;
}

.login-form-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: 50px 48px;
  background: #fff;
}

.login-form-heading {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 30px;
}

.login-form-heading > div {
  display: grid;
  gap: 3px;
}

.login-form-heading span {
  color: var(--brand);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.login-form-heading h2 {
  margin: 0;
  font-size: 1.55rem;
  font-weight: 600;
  letter-spacing: 0;
}

.login-lock {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: var(--brand-soft);
}

.login-lock svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.login-form {
  display: grid;
  gap: 11px;
}

.login-form label {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.login-form input {
  width: 100%;
  height: 50px;
  padding: 0 15px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.login-form input:focus {
  outline: 0;
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.12);
}

.login-form button,
.button-link {
  display: inline-grid;
  place-items: center;
  min-height: 46px;
  padding: 0 18px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--brand);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  box-shadow: none;
  transition: transform 160ms ease, background 160ms ease;
}

.login-form button {
  display: flex;
  justify-content: space-between;
  margin-top: 5px;
}

.login-form button:hover {
  transform: translateY(-1px);
  background: var(--brand-dark);
}

.login-form .login-install-button[hidden] {
  display: none;
}

.login-form .login-install-button {
  justify-content: center;
  gap: 10px;
  margin-top: 0;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--brand);
  box-shadow: none;
}

.login-form .login-install-button:hover {
  background: var(--brand-soft);
}

.login-install-button-icon {
  display: inline-grid;
  place-items: center;
  min-width: 36px;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.password-help {
  display: grid;
  gap: 10px;
  margin-top: 2px;
}

.password-help summary {
  width: fit-content;
  color: var(--brand);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.password-help summary::-webkit-details-marker {
  display: none;
}

.password-help summary:hover {
  color: var(--brand-dark);
  text-decoration: underline;
}

.password-help-message {
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.45;
}

.password-help-message a {
  font-weight: 600;
}

.login-security-note {
  margin: 26px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

.login-panel.compact .login-copy {
  min-height: 320px;
  color: var(--text);
  background: #fff;
}

.login-panel.compact .login-copy h1 {
  color: var(--text);
}

.login-panel.compact .login-copy p {
  color: var(--muted);
}

.alert {
  padding: 12px 14px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--danger-bg);
  color: var(--danger);
  font-weight: 600;
}

.success-alert {
  background: var(--success-bg);
  color: var(--success);
}

.pwa-install-prompt {
  position: fixed;
  z-index: 80;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  width: min(420px, calc(100vw - 24px));
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 13px;
  align-items: start;
  padding: 14px;
  border: 0;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.98);
  color: var(--text);
  box-shadow: 0 22px 55px rgba(17, 24, 39, 0.18);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, calc(100% + 24px));
  transition: opacity 180ms ease, transform 180ms ease;
}

.pwa-install-prompt.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0);
}

.pwa-install-icon {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 700;
  box-shadow: none;
}

.pwa-install-content {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.pwa-install-content h2 {
  margin: 0;
  color: var(--text);
  font-size: 1rem;
  letter-spacing: 0;
}

.pwa-install-content p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.4;
}

.pwa-install-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 2px;
}

.pwa-install-primary,
.pwa-install-secondary,
.pwa-install-close {
  border: 0;
  cursor: pointer;
}

.pwa-install-primary,
.pwa-install-secondary {
  min-height: 36px;
  padding: 0 13px;
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  font-weight: 600;
}

.pwa-install-primary {
  background: var(--brand);
  color: #fff;
  box-shadow: none;
}

.pwa-install-secondary {
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--muted);
}

.pwa-install-close {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0;
}

.pwa-install-close::before {
  content: "x";
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1;
}

.pwa-install-primary:focus-visible,
.pwa-install-secondary:focus-visible,
.pwa-install-close:focus-visible {
  outline: 3px solid rgba(79, 70, 229, 0.14);
  outline-offset: 2px;
}

.app-body {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  grid-template-areas: "sidebar main";
  background: var(--bg);
  transition: grid-template-columns 180ms ease;
}

.app-body.sidebar-collapsed {
  grid-template-columns: var(--sidebar-collapsed-width) minmax(0, 1fr);
}

.sidebar {
  grid-area: sidebar;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 28px 16px 20px;
  background: #161b22;
  color: #fff;
  box-shadow: 10px 0 32px rgba(17, 24, 39, 0.06);
  z-index: 20;
}

.sidebar-header {
  display: flex;
  align-items: center;
  min-height: 58px;
  padding: 0 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1 1 auto;
  color: #fff;
}

.brand-text {
  display: grid;
  min-width: 0;
}

.brand strong {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand small {
  display: block;
  margin-top: 4px;
  color: #9ca3af;
  font-size: 0.72rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar .brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: #f9fafb;
  box-shadow: none;
}

.sidebar-toggle,
.mobile-menu-toggle {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.sidebar-toggle {
  position: absolute;
  top: 90px;
  right: -14px;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: #fff;
  color: var(--muted);
  box-shadow: 0 8px 20px rgba(17, 24, 39, 0.12);
}

.sidebar-toggle:hover {
  background: var(--surface-2);
}

.sidebar-toggle svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 180ms ease;
}

.mobile-menu-toggle {
  display: none;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--brand);
}

.sidebar-scrim {
  display: none;
}

.nav {
  display: grid;
  gap: 34px;
  margin-top: 32px;
}

.nav-section {
  display: grid;
  gap: 14px;
}

.nav-section-title {
  padding: 0 12px;
  color: #8b95a7;
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

.nav-links {
  display: grid;
  gap: 8px;
}

.nav a {
  position: relative;
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 12px;
  border-radius: 10px;
  color: #d1d5db;
  font-size: 0.9rem;
  font-weight: 500;
  overflow: hidden;
  transition: background 160ms ease, color 160ms ease;
}

.nav-icon {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  color: #9ca3af;
}

.nav-icon svg {
  display: block;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-label,
.logout-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav a:hover,
.nav a.active {
  background: rgba(255, 255, 255, 0.07);
  color: #f9fafb;
}

.nav a.active::before {
  content: "";
  position: absolute;
  inset: 10px auto 10px 0;
  width: 3px;
  border-radius: 999px;
  background: #818cf8;
}

.nav a.active .nav-icon {
  color: #c7d2fe;
}

.sidebar-profile {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-profile button {
  width: 100%;
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #fff;
  text-align: left;
  cursor: pointer;
}

.sidebar-profile button:hover {
  background: rgba(255, 255, 255, 0.07);
}

.sidebar-avatar {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.10);
  color: #fff;
  font-size: 0.86rem;
  font-weight: 600;
}

.sidebar-user-meta {
  display: grid;
  min-width: 0;
  flex: 1 1 auto;
}

.sidebar-user-meta strong,
.sidebar-user-meta small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user-meta strong {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
}

.sidebar-user-meta small {
  margin-top: 3px;
  color: #9ca3af;
  font-size: 0.7rem;
}

.sidebar-logout-icon {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  color: #9ca3af;
}

.sidebar-logout-icon svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-body.sidebar-collapsed .sidebar {
  padding-inline: 10px;
}

.app-body.sidebar-collapsed .sidebar-header {
  align-items: center;
  padding-inline: 0;
}

.app-body.sidebar-collapsed .brand {
  flex: 0 0 auto;
  justify-content: center;
}

.app-body.sidebar-collapsed .brand-text,
.app-body.sidebar-collapsed .nav-label,
.app-body.sidebar-collapsed .nav-section-title,
.app-body.sidebar-collapsed .sidebar-user-meta,
.app-body.sidebar-collapsed .sidebar-logout-icon {
  display: none;
}

.app-body.sidebar-collapsed .nav a,
.app-body.sidebar-collapsed .sidebar-profile button {
  justify-content: center;
  padding-inline: 0;
}

.app-body.sidebar-collapsed .sidebar-toggle svg {
  transform: rotate(180deg);
}

.app-body.sidebar-collapsed .nav {
  gap: 18px;
}

.main {
  grid-area: main;
  min-width: 0;
  min-height: 100vh;
  padding: 32px;
  background: var(--bg);
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-bottom: 30px;
  padding: 18px 20px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(250, 250, 252, 0.94));
  box-shadow: var(--shadow-soft);
}

.dashboard-topbar {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(0, auto) minmax(120px, 1fr);
}

.topbar-title {
  min-width: 0;
}

.dashboard-topbar .topbar-title {
  grid-column: 2;
  justify-self: center;
  text-align: center;
}

.dashboard-topbar .user-chip {
  grid-column: 3;
  justify-self: end;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar h1 {
  margin: 0;
  color: var(--text);
  font-size: 1.9rem;
  font-weight: 600;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
  flex: 0 0 auto;
  color: var(--text);
}

.user-avatar {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 0.86rem;
  font-weight: 700;
}

.user-meta {
  display: grid;
  gap: 2px;
  text-align: right;
}

.user-meta small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.user-meta strong {
  font-size: 0.96rem;
  font-weight: 600;
  line-height: 1.1;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 26px;
}

.metric-card,
.panel {
  border: 0;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric-card {
  position: relative;
  min-height: 166px;
  display: grid;
  gap: 16px;
  align-content: space-between;
  padding: 22px;
  overflow: hidden;
  background: var(--surface);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.metric-card::before {
  display: none;
}

.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.metric-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.metric-icon {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 0.74rem;
  font-weight: 700;
}

.metric-icon svg {
  display: block;
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.metric-label {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.metric-card strong {
  display: block;
  color: var(--text);
  font-size: clamp(1.45rem, 2vw, 1.9rem);
  font-weight: 600;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.metric-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

.metric-card-primary strong {
  color: var(--text);
}

.metric-card.success strong {
  color: var(--text);
}

.metric-card.danger strong {
  color: var(--text);
}

.metric-card.success::before {
  display: none;
}

.metric-card.success .metric-icon {
  background: var(--success-bg);
  color: var(--success);
}

.metric-card.danger::before {
  display: none;
}

.metric-card.danger .metric-icon {
  background: var(--danger-bg);
  color: var(--danger);
}

.content-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
  margin-bottom: 22px;
}

.reports-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
  margin-bottom: 22px;
}

.chart-panel-wide {
  grid-column: 1 / -1;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.admin-grid.single {
  grid-template-columns: 1fr;
}

.panel {
  overflow: hidden;
}

.panel-header {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.panel-header h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0;
}

.panel-header span,
.panel-header a {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
}

.panel-header a.panel-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--muted);
  transition: border-color 160ms ease, color 160ms ease, background 160ms ease;
}

.panel-header a.panel-action:hover {
  border-color: rgba(79, 70, 229, 0.28);
  background: var(--brand-soft);
  color: var(--brand);
}

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

.filter-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr)) auto;
  gap: 14px;
  align-items: end;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.finance-filter {
  grid-template-columns:
    minmax(150px, 0.85fr)
    minmax(170px, 0.9fr)
    minmax(170px, 0.9fr)
    minmax(132px, 0.58fr)
    auto;
}

.report-filter-panel {
  margin-bottom: 22px;
}

.report-filter {
  grid-template-columns: repeat(2, minmax(180px, 240px)) auto;
}

.filter-form label {
  display: grid;
  gap: 6px;
}

.filter-form span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.filter-form input,
.filter-form select {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.status-select-field {
  max-width: 180px;
}

.status-select-field select {
  min-width: 132px;
}

.filter-form input:focus,
.filter-form select:focus {
  outline: 0;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.status-filter {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.status-filter legend {
  grid-column: 1 / -1;
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.status-choice {
  position: relative;
  min-width: 0;
}

.status-choice input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.status-choice span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  white-space: nowrap;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.status-choice span::before {
  content: "";
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
}

.status-choice.warning span::before {
  background: var(--warning);
}

.status-choice.danger span::before {
  background: var(--danger);
}

.status-choice.success span::before {
  background: var(--success);
}

.status-choice input:checked + span {
  border-color: rgba(79, 70, 229, 0.28);
  background: var(--brand-soft);
  color: var(--brand);
  box-shadow: none;
}

.status-choice input:focus-visible + span {
  outline: 3px solid rgba(79, 70, 229, 0.14);
  outline-offset: 2px;
}

.filter-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 38px;
}

.filter-actions button,
.filter-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  font-weight: 600;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.filter-actions button {
  border: 0;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
}

.filter-actions button:hover,
.form-body button:hover,
.table-button:hover {
  background: var(--brand-dark);
}

.filter-actions a {
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--muted);
}

.filter-actions a:hover {
  border-color: var(--line-strong);
  background: var(--surface-2);
  color: var(--text);
}

.form-panel {
  overflow: visible;
}

.form-body {
  display: grid;
  gap: 10px;
  padding: 22px;
}

.form-body label {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 600;
}

.form-body input[type="text"],
.form-body input[type="email"],
.form-body input[type="number"],
.form-body input[type="password"] {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.form-body input:focus {
  outline: 0;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.check-row {
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 34px;
}

.check-row input {
  width: 18px;
  height: 18px;
}

.form-body button {
  min-height: 42px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--brand);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: background 160ms ease;
}

.admin-messages {
  display: grid;
  gap: 10px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

td {
  color: #374151;
  font-size: 0.92rem;
}

tbody tr {
  transition: background 140ms ease;
}

tbody tr:hover {
  background: #fafafa;
}

tr:last-child td {
  border-bottom: 0;
}

.empty {
  color: var(--muted);
  text-align: center;
}

.chart-shell {
  position: relative;
  height: 320px;
  padding: 18px;
}

.chart-shell canvas {
  width: 100% !important;
  height: 100% !important;
}

.chart-empty {
  position: absolute;
  inset: 18px;
  display: grid;
  place-items: center;
  pointer-events: none;
  z-index: 1;
}

.report-ranking {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(0, 1.1fr);
  gap: 0;
}

.ranking-chart {
  height: 360px;
  border-right: 1px solid var(--line);
}

.table-subtext {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
}

.mono {
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: Consolas, Monaco, monospace;
}

.admin-table {
  min-width: 1120px;
}

.table-input {
  width: 190px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  font-size: 0.9rem;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.table-input.compact {
  width: 140px;
}

.table-input.tiny {
  width: 92px;
}

.table-input:focus {
  outline: 0;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.table-input[readonly],
.table-input:disabled {
  background: var(--surface-2);
  color: var(--muted);
}

.table-check {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  min-height: 34px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 600;
}

.table-check input {
  width: 17px;
  height: 17px;
}

.table-button {
  min-height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--brand);
  color: #fff;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 160ms ease;
}

.table-actions {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.delete-control {
  position: relative;
}

.delete-control summary {
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid #fecaca;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--danger);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.delete-control summary::-webkit-details-marker {
  display: none;
}

.delete-control form {
  position: absolute;
  z-index: 20;
  top: 40px;
  right: 0;
  width: 230px;
  padding: 14px;
  border: 0;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 16px 40px rgba(17, 24, 39, 0.16);
}

.delete-control p {
  margin: 0 0 12px;
  color: var(--text);
  font-size: 0.84rem;
  line-height: 1.4;
}

.delete-control button {
  width: 100%;
  min-height: 34px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--danger);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

.row-error td {
  background: var(--warning-bg);
}

.download-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.download-link:hover {
  border-color: rgba(79, 70, 229, 0.28);
  background: var(--brand-soft);
  color: var(--brand);
}

.download-link.secondary {
  border-color: var(--line);
  background: transparent;
  color: var(--muted);
}

.download-link.disabled {
  border-color: var(--line);
  background: var(--surface-2);
  color: var(--muted-2);
  cursor: not-allowed;
  user-select: none;
}

.boleto-contact {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.boleto-contact-tooltip {
  position: absolute;
  z-index: 40;
  left: 50%;
  bottom: calc(100% + 10px);
  width: max-content;
  max-width: min(340px, calc(100vw - 32px));
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  background: #111827;
  color: #fff;
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 5px);
  transition: opacity 150ms ease, transform 150ms ease;
}

.boleto-contact-tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  border: 6px solid transparent;
  border-top-color: #111827;
  transform: translateX(-50%);
}

.boleto-contact:hover .boleto-contact-tooltip,
.boleto-contact:focus-within .boleto-contact-tooltip,
.boleto-document-contact:hover .boleto-contact-tooltip,
.boleto-document-contact:focus-within .boleto-contact-tooltip {
  opacity: 1;
  transform: translate(-50%, 0);
}

.whatsapp-finance-link {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(6, 118, 71, 0.18);
  background: var(--success-bg);
  color: var(--success);
  box-shadow: none;
  transition: transform 150ms ease, background 150ms ease, border-color 150ms ease;
}

.whatsapp-finance-link:hover {
  border-color: rgba(6, 118, 71, 0.30);
  background: var(--success-bg);
  transform: translateY(-1px);
}

.whatsapp-finance-link svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.certificate-action.is-available {
  border-color: rgba(79, 70, 229, 0.24);
  background: transparent;
  color: var(--brand);
}

.certificate-action.is-request {
  border-color: var(--line-strong);
  background: transparent;
  color: var(--muted);
}

.certificate-action:hover {
  filter: none;
}

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

.download-group {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.request-link {
  font-family: inherit;
}

.page-message {
  padding: 14px 18px 0;
}

.document-dialog {
  width: min(520px, calc(100vw - 32px));
  max-height: min(720px, calc(100vh - 32px));
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 28px 80px rgba(17, 24, 39, 0.24);
}

.document-dialog::backdrop {
  background: rgba(17, 24, 39, 0.58);
  backdrop-filter: blur(3px);
}

.document-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.document-dialog-header h3 {
  margin: 2px 0 0;
}

.dialog-close {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: #fff;
  color: var(--muted);
  font-size: 1.35rem;
  cursor: pointer;
}

.document-options {
  display: grid;
  gap: 10px;
  max-height: 560px;
  padding: 18px 20px 22px;
  overflow-y: auto;
}

.document-option {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  transition: border-color 160ms ease, background 160ms ease;
}

.document-option:hover {
  border-color: rgba(79, 70, 229, 0.28);
  background: var(--brand-soft);
}

.document-option strong {
  color: var(--brand);
  font-weight: 600;
}

.document-option span {
  color: var(--muted);
  font-size: 0.84rem;
}

.document-option.unavailable {
  background: var(--surface-2);
  opacity: 0.75;
}

.document-option.unavailable strong {
  color: var(--muted);
}

.boleto-document-contact {
  position: relative;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  opacity: 1;
  cursor: not-allowed;
}

.boleto-document-contact > span:first-child {
  display: grid;
  gap: 4px;
}

.boleto-document-contact small {
  color: var(--muted);
  font-size: 0.84rem;
}

.boleto-document-contact .whatsapp-finance-link {
  cursor: pointer;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}

.status.success {
  background: var(--success-bg);
  color: var(--success);
}

.status.warning {
  background: var(--warning-bg);
  color: var(--warning);
}

.status.danger {
  background: var(--danger-bg);
  color: var(--danger);
}

@media (max-width: 980px) {
  .app-body {
    grid-template-columns: 1fr;
    grid-template-areas: "main";
  }

  .app-body.sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(284px, calc(100vw - 32px));
    height: 100svh;
    padding: 18px;
    transform: translateX(-105%);
    transition: transform 180ms ease;
  }

  .sidebar-toggle {
    top: 25px;
    right: 14px;
  }

  .app-body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .app-body.sidebar-collapsed .sidebar-header {
    flex-direction: row;
    align-items: center;
  }

  .app-body.sidebar-collapsed .brand {
    flex: 1 1 auto;
    justify-content: flex-start;
  }

  .app-body.sidebar-collapsed .brand-text,
  .app-body.sidebar-collapsed .nav-label,
  .app-body.sidebar-collapsed .nav-section-title,
  .app-body.sidebar-collapsed .sidebar-user-meta,
  .app-body.sidebar-collapsed .sidebar-logout-icon {
    display: block;
  }

  .app-body.sidebar-collapsed .nav a,
  .app-body.sidebar-collapsed .sidebar-profile button {
    justify-content: flex-start;
    padding-inline: 8px;
  }

  .app-body.sidebar-collapsed .sidebar-toggle svg {
    transform: none;
  }

  .sidebar-scrim {
    position: fixed;
    inset: 0;
    display: block;
    background: rgba(8, 24, 48, 0.42);
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease;
    z-index: 15;
  }

  .app-body.sidebar-open .sidebar-scrim {
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-menu-toggle {
    display: inline-grid;
  }

  .topbar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .dashboard-topbar {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .dashboard-topbar .topbar-title {
    grid-column: 2;
  }

  .dashboard-topbar .user-chip {
    grid-column: 3;
  }

  .metrics-grid,
  .content-grid,
  .reports-grid,
  .admin-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .status-select-field {
    max-width: none;
  }

  .report-ranking {
    grid-template-columns: 1fr;
  }

  .ranking-chart {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 720px) {
  .login-body {
    padding: 16px;
    align-items: start;
  }

  .login-shell {
    width: 100%;
  }

  .login-panel {
    grid-template-columns: 1fr;
    min-height: auto;
    padding: 0;
    gap: 0;
    border-radius: 18px;
  }

  .login-copy,
  .login-form-card {
    padding: 34px;
  }

  .login-brand {
    margin-bottom: 34px;
  }

  .login-copy h1 {
    font-size: clamp(1.65rem, 9vw, 2.1rem);
    line-height: 1.12;
  }

  .login-copy p {
    font-size: 0.98rem;
  }

  .main {
    padding: 18px;
  }

  .topbar {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 12px;
  }

  .dashboard-topbar {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .dashboard-topbar .topbar-title {
    grid-column: 2;
    text-align: left;
  }

  .topbar h1 {
    font-size: clamp(1.35rem, 7vw, 1.7rem);
  }

  .user-chip {
    grid-column: 1 / -1;
    min-width: 0;
    justify-content: flex-start;
  }

  .dashboard-topbar .user-chip {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .user-meta {
    text-align: left;
  }

  .metrics-grid,
  .content-grid,
  .reports-grid,
  .admin-grid,
  .filter-form,
  .report-filter,
  .nav {
    grid-template-columns: 1fr;
  }

  .chart-shell {
    height: 280px;
    padding: 14px;
  }

  .nav a {
    justify-content: flex-start;
  }

  .filter-actions {
    grid-column: 1 / -1;
    flex-wrap: wrap;
  }

  .filter-actions button,
  .filter-actions a {
    flex: 1 1 120px;
  }
}

@media (max-width: 460px) {
  .login-body {
    min-height: 100svh;
    padding: 12px;
  }

  .login-panel {
    padding: 0;
    border-radius: 14px;
  }

  .login-copy,
  .login-form-card {
    padding: 25px;
  }

  .login-brand {
    margin-bottom: 26px;
  }

  .brand-mark.large {
    width: 48px;
    height: 48px;
    font-size: 1.25rem;
  }

  .login-copy h1 {
    font-size: clamp(1.45rem, 10vw, 1.85rem);
  }

  .login-form input,
  .login-form button {
    min-height: 44px;
  }
}
