:root {
  color-scheme: light;
  --color-bg: #f3f8ff;
  --color-surface: #ffffff;
  --color-surface-soft: #f7fbff;
  --color-surface-blue: #edf7ff;
  --color-text: #0f172a;
  --color-muted: #5d6f86;
  --color-subtle: #8da2b8;
  --color-line: #dbeafe;
  --color-line-strong: #bfdbfe;
  --color-brand: #0088ff;
  --color-brand-strong: #0069c8;
  --color-brand-soft: #e6f4ff;
  --color-brand-faint: #f2f9ff;
  --color-info: #0ea5ff;
  --color-success: #16a34a;
  --color-success-strong: #15803d;
  --color-success-soft: #dcfce7;
  --color-warning: #f59e0b;
  --color-warning-strong: #b45309;
  --color-warning-soft: #fef3c7;
  --color-danger: #ef4444;
  --color-danger-strong: #b91c1c;
  --color-danger-soft: #fee2e2;
  --shadow-xs: 0 1px 2px rgba(0, 59, 112, .05);
  --shadow-sm: 0 10px 28px rgba(0, 59, 112, .08);
  --shadow-md: 0 22px 56px rgba(0, 59, 112, .13);
  --shadow-lg: 0 30px 90px rgba(0, 59, 112, .22);
  --radius-sm: 12px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --space-page: 28px;
  --focus: 0 0 0 4px rgba(0, 136, 255, .16);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, Segoe UI, Arial, sans-serif;
  color: var(--color-text);
  background:
    radial-gradient(circle at 18% 0%, rgba(0, 136, 255, .10), transparent 30%),
    linear-gradient(180deg, #fbfdff 0%, var(--color-bg) 46%, #eaf5ff 100%);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .68; }
button, .btn, .nav button, .icon-btn, .alert-column button, .rank-item, .payment-item, .kpi {
  transition: background .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease, transform .18s ease, opacity .18s ease;
}
button:focus-visible, input:focus-visible, select:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}
svg { flex: 0 0 auto; stroke-width: 2.2; }

.app-shell { min-height: 100vh; }

/* Buttons */
.btn {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 700;
  line-height: 1;
  background: var(--color-surface);
  color: var(--color-text);
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(0); box-shadow: none; }
.btn.primary {
  background: linear-gradient(135deg, var(--color-brand), var(--color-brand-strong));
  color: #fff;
  box-shadow: 0 10px 24px rgba(0, 136, 255, .22);
}
.btn.primary:hover { background: linear-gradient(135deg, #1678ff, var(--color-brand-strong)); }
.btn.ghost { border-color: var(--color-line); color: #1e293b; }
.btn.ghost:hover { border-color: rgba(0, 136, 255, .34); color: var(--color-brand-strong); }
.btn.secondary { background: var(--color-brand-soft); color: var(--color-brand-strong); border-color: rgba(0, 136, 255, .18); }
.btn.secondary:hover { background: #dcefff; border-color: rgba(0, 136, 255, .32); }
.btn.success { background: var(--color-success-soft); color: var(--color-success-strong); border-color: #a7f3d0; }
.btn.success:hover { border-color: #6ee7b7; }
.btn.warn { background: var(--color-warning-soft); color: var(--color-warning-strong); border-color: #fde68a; }
.btn.danger { background: var(--color-danger-soft); color: var(--color-danger-strong); border-color: #fecaca; }
.btn.outline { background: transparent; border-color: var(--color-brand); color: var(--color-brand-strong); }
.btn.outline:hover { background: var(--color-brand-faint); }
.btn.small { min-height: 34px; padding: 0 11px; border-radius: 9px; font-size: 13px; }
.btn.is-loading { pointer-events: none; opacity: .74; }
.btn .spin { animation: btn-spin .7s linear infinite; }
@keyframes btn-spin { to { transform: rotate(360deg); } }

/* Forms */
.field {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}
.field span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}
.input, .select {
  width: 100%;
  min-height: 46px;
  border: 1px solid #dbe4ef;
  border-radius: var(--radius-sm);
  padding: 0 13px;
  background: var(--color-surface);
  color: var(--color-text);
  outline: none;
  box-shadow: var(--shadow-xs);
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.input::placeholder { color: var(--color-subtle); font-weight: 500; }
.input:hover, .select:hover { border-color: var(--color-line-strong); }
.input:focus, .select:focus { transform: translateY(-1px); }
.field.has-error .input, .field.has-error .select { border-color: rgba(239, 68, 68, .55); }
.field.has-error .input:focus, .field.has-error .select:focus { box-shadow: 0 0 0 4px rgba(239, 68, 68, .14); }
.field-error { margin: 2px 0 0; color: var(--color-danger); font-size: 12px; font-weight: 700; }
.input:focus, .select:focus { border-color: rgba(0, 136, 255, .78); box-shadow: var(--focus); }
input[type="color"].input { padding: 5px; cursor: pointer; }
.check-field {
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 9px;
  color: #334155;
  font-size: 13px;
  font-weight: 700;
}
.check-field input { width: 17px; height: 17px; accent-color: var(--color-brand); }

/* Login */
.login-screen {
  min-height: 100vh;
  padding: 32px;
  display: grid;
  grid-template-columns: minmax(0, 460px);
  gap: 48px;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(135deg, rgba(0, 136, 255, .16), rgba(14, 165, 255, .06)),
    radial-gradient(circle at top left, rgba(0, 136, 255, .20), transparent 34%),
    #f7fbff;
}
.login-card {
  width: min(460px, 100%);
  padding: 30px;
  border: 1px solid rgba(203, 213, 225, .85);
  border-radius: 28px;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 34px 100px rgba(15, 23, 42, .16);
  backdrop-filter: blur(18px);
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}
.brand-mark {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--color-brand), var(--color-brand-strong));
  box-shadow: 0 14px 28px rgba(0, 136, 255, .26);
  font-weight: 800;
  letter-spacing: 0;
  margin-bottom: 28px;
}
.login-brand .brand-mark { margin: 0; }
.login-brand strong { display: block; font-size: 17px; }
.login-brand span { color: var(--color-muted); font-size: 13px; font-weight: 700; }
.login-heading { margin-bottom: 24px; }
.login-heading h1 {
  margin: 0 0 10px;
  color: var(--color-text);
  font-size: 34px;
  line-height: 1.05;
  letter-spacing: 0;
}
.login-heading p {
  margin: 0 0 30px;
  color: var(--color-muted);
  font-size: 16px;
  line-height: 1.6;
}
.login-panel { display: grid; gap: 2px; }
.login-actions { display: grid; grid-template-columns: 1fr; gap: 10px; align-items: center; margin-top: 8px; }
.login-proof {
  margin-top: 20px;
  padding-top: 18px;
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--color-line);
}
.login-proof span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #475569;
  font-size: 13px;
  font-weight: 800;
}
.form-error {
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #b91c1c;
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  margin-bottom: 14px;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
}
.login-visual {
  display: none;
}
.login-visual-grid { width: min(640px, 100%); display: grid; gap: 18px; }
.visual-row { display: grid; grid-template-columns: 1.18fr .82fr; gap: 18px; }
@media (min-width: 1120px) {
  .login-screen { grid-template-columns: minmax(0, 460px) minmax(0, 640px); }
  .login-visual { display: flex; align-items: center; justify-content: center; animation: login-visual-in .5s ease-out; }
}
@keyframes login-visual-in {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: translateX(0); }
}
.insight-card, .metric-card, .client-strip {
  padding: 20px;
  border: 1px solid rgba(226, 232, 240, .86);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, .86);
  box-shadow: 0 24px 60px rgba(15, 23, 42, .10);
  backdrop-filter: blur(14px);
}
.insight-card h2 { margin: 0 0 10px; font-size: 23px; line-height: 1.12; }
.insight-card h2, .strip-item strong {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.insight-card p, .metric-card p { margin: 0; color: var(--color-muted); line-height: 1.48; }
.metric-value { color: var(--color-brand); font-size: 36px; font-weight: 800; }
.client-strip { display: grid; gap: 12px; }
.strip-item { display: flex; justify-content: space-between; gap: 12px; align-items: center; }

/* App layout */
.portal-layout { min-height: 100vh; display: grid; grid-template-columns: 288px minmax(0, 1fr); }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  color: var(--color-text);
  background: rgba(255, 255, 255, .92);
  border-right: 1px solid rgba(226, 232, 240, .95);
  box-shadow: 16px 0 48px rgba(15, 23, 42, .05);
  backdrop-filter: blur(16px);
}
.sidebar .brand-line {
  padding: 8px 8px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--color-line);
}
.sidebar .brand-mark { width: 42px; height: 42px; margin: 0; }
.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--color-line);
}
.brand-copy strong { display: block; color: var(--color-text); font-size: 15px; }
.brand-copy span { color: var(--color-muted); font-size: 12px; font-weight: 600; }
.nav { display: grid; gap: 4px; overflow: auto; padding-right: 2px; }
.nav-group {
  display: block;
  margin: 14px 10px 6px;
  color: var(--color-subtle);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}
.nav button {
  width: 100%;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 13px;
  padding: 10px 11px;
  display: flex;
  align-items: center;
  gap: 11px;
  background: transparent;
  color: #475569;
  text-align: left;
  font-weight: 700;
}
.nav button span { flex: 1; }
.nav button em { color: var(--color-subtle); font-size: 10px; font-style: normal; font-weight: 800; }
.nav button.active {
  color: var(--color-brand-strong);
  border-color: rgba(0, 136, 255, .18);
  background: linear-gradient(135deg, rgba(0, 136, 255, .14), rgba(0, 111, 209, .06));
  box-shadow: 0 10px 24px rgba(0, 136, 255, .10);
}
.nav button:hover { color: var(--color-brand-strong); background: var(--color-surface-soft); }
.nav button.disabled { opacity: .74; }
.sidebar-user {
  margin-top: auto;
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--color-line);
  border-radius: 14px;
  background: #fff;
}
.sidebar-user .avatar { flex: 0 0 auto; }
.sidebar-user-copy { min-width: 0; }
.sidebar-user-copy strong {
  display: block;
  overflow: hidden;
  color: var(--color-text);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-user-copy span {
  display: block;
  overflow: hidden;
  color: var(--color-muted);
  font-size: 11px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.content { min-width: 0; display: flex; flex-direction: column; position: relative; }

/* Top progress bar */
.top-progress {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 6;
  background: transparent;
  overflow: hidden;
}
.top-progress.active {
  background: rgba(0, 136, 255, .14);
}
.top-progress.active::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 40%;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, var(--color-brand), var(--color-brand-strong), transparent);
  animation: top-progress-slide 1.1s ease-in-out infinite;
}
@keyframes top-progress-slide {
  from { transform: translateX(-100%); }
  to { transform: translateX(350%); }
}
.main-content.is-busy {
  position: relative;
  pointer-events: none;
  opacity: .6;
  transition: opacity .15s ease;
}

/* Header */
.topbar {
  min-height: 86px;
  padding: 0 var(--space-page);
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(220px, 1fr) auto auto;
  gap: 18px;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(255, 255, 255, .88);
  border-bottom: 1px solid rgba(226, 232, 240, .95);
  backdrop-filter: blur(16px);
}
.page-title h1 { margin: 4px 0 0; font-size: 23px; letter-spacing: 0; }
.breadcrumb {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  color: var(--color-muted);
  font-size: 12px;
  font-weight: 700;
}
.global-search {
  min-height: 46px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--color-line);
  border-radius: 999px;
  background: var(--color-surface-soft);
}
.global-search:focus-within { border-color: rgba(0, 136, 255, .58); box-shadow: var(--focus); background: #fff; }
.global-search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--color-text);
}
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  position: relative;
  width: 42px;
  height: 42px;
  border: 1px solid var(--color-line);
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #fff;
  color: #475569;
}
.icon-btn:hover { color: var(--color-brand); border-color: rgba(0, 136, 255, .35); transform: translateY(-1px); }
.icon-btn span {
  position: absolute;
  top: 9px;
  right: 10px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--color-danger);
  box-shadow: 0 0 0 3px #fff;
}
.date-chip {
  min-height: 42px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--color-line);
  border-radius: 999px;
  background: #fff;
  color: var(--color-muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: capitalize;
}
.user-chip {
  min-width: 0;
  padding-left: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--color-muted);
  border-left: 1px solid var(--color-line);
  font-size: 13px;
  justify-content: flex-end;
}
.user-chip-identity {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-chip span {
  max-width: 170px;
  overflow: hidden;
  color: var(--color-text);
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-chip small { color: var(--color-muted); font-weight: 700; }
@media (min-width: 981px) {
  /* Identidade do usuário já aparece no rodapé do menu lateral nesta largura - evita duplicar no topbar. */
  .user-chip-identity { display: none; }
  .user-chip { border-left: 0; padding-left: 0; }
}
.avatar {
  width: 34px;
  height: 34px;
  border: 1px solid #bfdbfe;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--color-brand-strong);
  background: linear-gradient(135deg, #dbeafe, #eff6ff);
  font-weight: 800;
}
.main-content { padding: var(--space-page); display: grid; gap: 20px; }
@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.main-content > * { animation: fade-in-up .22s ease-out backwards; }
.kpis .kpi, .kpis-wide .kpi { animation: fade-in-up .22s ease-out backwards; }
.kpis .kpi:nth-child(1), .kpis-wide .kpi:nth-child(1) { animation-delay: .02s; }
.kpis .kpi:nth-child(2), .kpis-wide .kpi:nth-child(2) { animation-delay: .06s; }
.kpis .kpi:nth-child(3), .kpis-wide .kpi:nth-child(3) { animation-delay: .10s; }
.kpis .kpi:nth-child(4), .kpis-wide .kpi:nth-child(4) { animation-delay: .14s; }
@media (prefers-reduced-motion: reduce) {
  .main-content > *, .kpis .kpi, .kpis-wide .kpi, .modal, .toast { animation: none !important; }
}

/* Core cards */
.dashboard-hero, .summary-hero, .kpi, .panel, .table-wrap {
  border: 1px solid rgba(226, 232, 240, .92);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
}
.dashboard-hero {
  padding: 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}
.premium-hero {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(0, 136, 255, .14), transparent 48%),
    linear-gradient(180deg, #fff, #f9fbff);
}
.operational-hero {
  align-items: flex-start;
  background: #fff;
}
.summary-hero {
  padding: 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: start;
  border: 1px solid rgba(203, 213, 225, .9);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(135deg, rgba(0, 136, 255, .14), rgba(14, 165, 255, .05)),
    #fff;
  box-shadow: var(--shadow-sm);
}
.summary-copy h2 {
  margin: 6px 0 8px;
  color: var(--color-text);
  font-size: 30px;
  line-height: 1.12;
}
.summary-copy p {
  max-width: 760px;
  margin: 0;
  color: var(--color-muted);
  line-height: 1.55;
}
.summary-actions {
  justify-content: flex-end;
}
.premium-hero::after {
  content: none;
}
.dashboard-hero h2 { margin: 6px 0 8px; color: var(--color-text); font-size: 32px; line-height: 1.12; }
.dashboard-hero p { max-width: 760px; margin: 0; color: var(--color-muted); line-height: 1.55; }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--color-brand-strong);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; position: relative; z-index: 1; }

/* Period picker (popover mes/ano) */
.period-picker { position: relative; z-index: 4; }
.period-picker-trigger {
  min-height: 42px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  font-weight: 800;
  font-size: 13px;
  white-space: nowrap;
}
.period-picker-trigger:hover { border-color: rgba(0, 136, 255, .34); color: var(--color-brand-strong); }
.period-picker-trigger svg:first-child { color: var(--color-brand); }
.period-picker-trigger svg:last-child { color: var(--color-subtle); }
.period-picker-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 264px;
  padding: 14px;
  border: 1px solid rgba(226, 232, 240, .95);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, .98);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(16px);
  animation: fade-in-up .16s ease-out;
}
.period-picker-year {
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.period-picker-year strong { font-size: 15px; letter-spacing: .02em; }
.period-picker-year button {
  width: 30px;
  height: 30px;
  border: 1px solid var(--color-line);
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #fff;
  color: var(--color-text);
}
.period-picker-year button:hover:not(:disabled) { border-color: rgba(0, 136, 255, .34); color: var(--color-brand-strong); }
.period-picker-year button:disabled { opacity: .35; cursor: not-allowed; }
.period-picker-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
.period-picker-month {
  min-height: 38px;
  border: 1px solid var(--color-line);
  border-radius: 10px;
  background: #fff;
  color: var(--color-text);
  font-size: 12px;
  font-weight: 800;
  text-transform: capitalize;
}
.period-picker-month:hover:not(:disabled) { border-color: rgba(0, 136, 255, .34); color: var(--color-brand-strong); background: var(--color-surface-soft); }
.period-picker-month:disabled { color: var(--color-subtle); background: #f8fafc; cursor: not-allowed; opacity: .5; }
.period-picker-month.active {
  border-color: transparent;
  color: #fff;
  background: linear-gradient(135deg, var(--color-brand), var(--color-brand-strong));
  box-shadow: 0 8px 18px rgba(0, 136, 255, .26);
}
.period-picker-all {
  margin-top: 10px;
  width: 100%;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--color-line);
  border-radius: 10px;
  background: #fff;
  color: var(--color-text);
  font-size: 12px;
  font-weight: 800;
}
.period-picker-all:hover { border-color: rgba(0, 136, 255, .34); color: var(--color-brand-strong); }
.period-picker-all.active {
  border-color: transparent;
  color: #fff;
  background: linear-gradient(135deg, var(--color-brand), var(--color-brand-strong));
}
.panel-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.kpi {
  position: relative;
  overflow: hidden;
  padding: 18px;
  border-radius: var(--radius-lg);
}
.kpi:hover { border-color: rgba(0, 136, 255, .24); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.kpi span { color: var(--color-muted); font-size: 13px; font-weight: 800; }
.kpi strong { display: block; margin-top: 8px; font-size: 30px; letter-spacing: 0; }
.kpi small { color: var(--color-muted); }
.metric-top { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.metric-top span { display: inline-flex; align-items: center; gap: 8px; }
.metric-top svg { color: var(--color-brand); }
.metric-top b {
  padding: 4px 7px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  font-size: 11px;
}
.trend-up { color: var(--color-success-strong); background: var(--color-success-soft); }
.trend-down { color: var(--color-danger-strong); background: var(--color-danger-soft); }
.trend-neutral { color: #475569; background: #f1f5f9; }
.panel { padding: 20px; }
.panel-header {
  margin-bottom: 14px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}
.panel-header h2 { margin: 0; display: inline-flex; align-items: center; gap: 8px; font-size: 18px; }
.panel-header > div { display: grid; gap: 4px; }
.muted-copy { margin: 0; color: var(--color-muted); line-height: 1.55; }
.panel-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: flex-end; margin-top: 0; }
.dashboard-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: stretch; }
.dashboard-panel { min-height: 100%; transition: box-shadow .18s ease, transform .18s ease, border-color .18s ease; }
.dashboard-panel:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: rgba(0, 136, 255, .20); }
.chart-grid { align-items: stretch; }

/* Widgets */
.meter-row {
  padding: 12px 0;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 14px;
  align-items: center;
  border-bottom: 1px solid var(--color-line);
}
.meter-row:last-of-type { border-bottom: 0; }
.meter-row strong { display: block; font-size: 14px; }
.meter-row span { display: block; margin-top: 3px; color: var(--color-muted); font-size: 12px; }
.meter-row b { color: var(--color-brand-strong); }
.meter { grid-column: 1 / -1; height: 9px; border-radius: 999px; overflow: hidden; background: #eaf0f8; }
.meter i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--color-brand), #60a5fa); }
.mini-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.mini-stats div, .insight-row, .rank-item, .alert-column button, .alert-column p, .detail-card, .history-item, .payment-item, .admin-card {
  border: 1px solid var(--color-line);
  border-radius: 14px;
  background: var(--color-surface-soft);
}
.mini-stats div { padding: 12px; }
.mini-stats strong { display: block; font-size: 22px; }
.mini-stats span { color: var(--color-muted); font-size: 12px; font-weight: 800; }
.insight-list, .rank-list, .payment-list, .history-list { display: grid; gap: 10px; }
.work-list { display: grid; gap: 8px; }
.quick-actions { overflow: hidden; }
.quick-action-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.quick-action-grid button {
  min-height: 104px;
  padding: 16px;
  border: 1px solid var(--color-line);
  border-radius: 16px;
  display: grid;
  gap: 6px;
  justify-items: start;
  color: var(--color-text);
  background: linear-gradient(180deg, #fff, #f8fbff);
  text-align: left;
}
.quick-action-grid button:hover {
  border-color: rgba(0, 136, 255, .28);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.quick-action-grid svg { color: var(--color-brand); }
.quick-action-grid span { font-weight: 900; }
.quick-action-grid small { color: var(--color-muted); line-height: 1.35; }
.work-item {
  min-height: 58px;
  padding: 10px 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--color-line);
  border-radius: 10px;
  background: var(--color-surface-soft);
}
.work-item strong,
.work-item small,
.work-item b {
  display: block;
}
.work-item strong {
  overflow: hidden;
  color: var(--color-text);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.work-item small {
  margin-top: 3px;
  color: var(--color-muted);
  font-size: 12px;
}
.work-item b {
  margin-bottom: 5px;
  text-align: right;
}
.insight-row { padding: 12px; }
.insight-row span { display: block; color: var(--color-muted); font-size: 12px; font-weight: 800; }
.insight-row strong { display: block; margin: 5px 0; font-size: 20px; }
.insight-row small { color: var(--color-muted); line-height: 1.4; }
.mini-chart {
  height: 126px;
  padding: 18px;
  margin-bottom: 14px;
  display: flex;
  align-items: end;
  gap: 10px;
  border: 1px solid var(--color-line);
  border-radius: 14px;
  background: linear-gradient(180deg, #f8fbff, #fff);
}
.mini-chart i {
  flex: 1;
  min-width: 16px;
  border-radius: 999px 999px 5px 5px;
  background: linear-gradient(180deg, var(--color-brand), rgba(0, 136, 255, .18));
}
.chart-card {
  overflow: visible;
}
.chart-summary {
  margin-bottom: 14px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.chart-summary div {
  padding: 12px;
  border: 1px solid rgba(0, 136, 255, .14);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(0, 136, 255, .08), transparent 62%),
    var(--color-brand-faint);
}
.chart-summary span {
  display: block;
  color: var(--color-muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}
.chart-summary strong {
  display: block;
  margin-top: 5px;
  color: var(--color-text);
  font-size: 18px;
  line-height: 1.1;
}
.chart-summary div:last-child { display: flex; flex-direction: column; justify-content: center; }
.chart-summary .trend-up,
.chart-summary .trend-down,
.chart-summary .trend-neutral {
  margin-top: 5px;
  width: fit-content;
  font-size: 13px;
}

/* Trend chart (linha/área suave) */
.trend-chart {
  position: relative;
  height: 210px;
  padding: 10px 4px 0;
}
.trend-chart-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.trend-grid { stroke: rgba(0, 136, 255, .10); stroke-width: .5; vector-effect: non-scaling-stroke; }
.trend-line-path {
  stroke: var(--color-brand);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 4px 8px rgba(0, 136, 255, .28));
}
.trend-points {
  position: absolute;
  inset: 0;
}
.trend-point {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  outline: none;
}
.trend-dot {
  position: absolute;
  left: 50%;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #fff;
  border: 2.5px solid var(--color-brand);
  box-shadow: 0 2px 6px rgba(0, 136, 255, .3);
  transform: translate(-50%, -50%);
  transition: transform .16s ease, box-shadow .16s ease;
}
.trend-point.is-current .trend-dot {
  width: 11px;
  height: 11px;
  background: var(--color-brand);
  box-shadow: 0 0 0 5px rgba(0, 136, 255, .16);
}
.trend-point:hover .trend-dot,
.trend-point:focus-visible .trend-dot {
  transform: translate(-50%, -50%) scale(1.35);
  box-shadow: 0 0 0 6px rgba(0, 136, 255, .2);
}
.trend-tooltip {
  position: absolute;
  left: 50%;
  margin-bottom: 14px;
  min-width: 140px;
  padding: 9px 11px;
  border: 1px solid rgba(0, 136, 255, .20);
  border-radius: 12px;
  color: var(--color-text);
  background: rgba(255, 255, 255, .97);
  box-shadow: 0 18px 40px rgba(0, 59, 112, .18);
  backdrop-filter: blur(14px);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 6px) scale(.96);
  transition: opacity .14s ease, transform .14s ease;
  z-index: 5;
}
.trend-point:hover .trend-tooltip,
.trend-point:focus-visible .trend-tooltip {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}
.trend-tooltip span {
  display: block;
  color: var(--color-muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: capitalize;
}
.trend-tooltip strong {
  display: block;
  margin: 3px 0;
  color: var(--color-brand-strong);
  font-size: 16px;
  line-height: 1.1;
}
.trend-tooltip small {
  color: var(--color-muted);
  font-size: 11px;
  font-weight: 700;
}
.trend-axis {
  margin-top: 10px;
  padding: 0 4px;
  display: flex;
  justify-content: space-between;
  color: var(--color-subtle);
  font-size: 11px;
  font-weight: 800;
  text-transform: capitalize;
}
.rank-item {
  padding: 12px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
}
.rank-item:hover, .alert-column button:hover, .payment-item:hover {
  transform: translateY(-1px);
  border-color: rgba(0, 136, 255, .30);
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.rank-number {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--color-brand-strong);
  background: #dbeafe;
  font-size: 12px;
  font-weight: 900;
}
.rank-item strong { display: block; font-size: 14px; }
.rank-item small { display: block; margin-top: 3px; color: var(--color-muted); }
.rank-item em { color: var(--color-muted); font-size: 12px; font-style: normal; font-weight: 800; text-align: right; }
.alert-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.alert-column { display: grid; gap: 8px; align-content: start; }
.alert-column > strong { color: #334155; font-size: 13px; }
.alert-column button, .alert-column p {
  min-height: 42px;
  padding: 9px 10px;
  display: grid;
  gap: 3px;
  color: var(--color-text);
  text-align: left;
}
.alert-column button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alert-column button em { color: var(--color-muted); font-size: 12px; font-style: normal; }
.alert-column p { margin: 0; color: var(--color-muted); font-size: 13px; }

/* Tables */
.toolbar { padding: 4px 0; display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; }
.toolbar-inside { margin: 2px 0 14px; padding: 0; }
.list-panel { padding-bottom: 0; overflow: hidden; }
.panel .table-wrap {
  margin-inline: -20px;
  border-right: 0;
  border-bottom: 0;
  border-left: 0;
  border-radius: 0;
  box-shadow: none;
}
.filters {
  padding: 6px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  border: 1px solid var(--color-line);
  border-radius: 16px;
  background: rgba(248, 250, 252, .88);
}
.filters .input, .filters .select { border-color: transparent; background: #fff; }
.search { min-width: 280px; }
.filter-chips {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.filter-chip {
  min-height: 38px;
  border: 1px solid var(--color-line);
  border-radius: 999px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #334155;
  background: #fff;
  font-weight: 850;
}
.filter-chip strong {
  min-width: 24px;
  min-height: 24px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  padding: 0 7px;
  color: var(--color-brand-strong);
  background: var(--color-brand-soft);
  font-size: 12px;
}
.filter-chip.active {
  border-color: rgba(0, 136, 255, .34);
  color: var(--color-brand-strong);
  background: #eef7ff;
  box-shadow: 0 8px 18px rgba(0, 136, 255, .10);
}
.load-more {
  margin: 14px 0 2px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--color-muted);
  border: 1px solid var(--color-line);
  border-radius: 14px;
  background: #f8fbff;
  font-size: 13px;
  font-weight: 800;
}
.table-wrap { overflow: auto; background: #fff; scrollbar-gutter: stable; }
table { width: 100%; min-width: 940px; border-collapse: collapse; background: #fff; }
th, td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-line);
  text-align: left;
  vertical-align: middle;
  font-size: 14px;
}
th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--color-muted);
  background: #f8fbff;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}
.sort-th {
  width: 100%;
  min-height: 28px;
  border: 0;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  color: inherit;
  background: transparent;
  font: inherit;
  text-align: left;
  text-transform: inherit;
}
.sort-th:hover,
.sort-th.active {
  color: var(--color-brand-strong);
}
td small { color: var(--color-muted); }
tbody tr:nth-child(even) td { background: rgba(248, 250, 252, .55); }
tr:hover td { background: #f5faff; }
.table-wrap td:last-child { max-width: 360px; }
.table-wrap th.col-actions,
.table-wrap td.col-actions {
  position: sticky;
  right: 0;
  z-index: 1;
  box-shadow: -8px 0 12px -8px rgba(15, 23, 42, .14);
}
.table-wrap th.col-actions { z-index: 2; }
.row-clickable { cursor: pointer; }
.row-clickable:focus-visible { outline: none; box-shadow: inset 0 0 0 2px rgba(0, 136, 255, .45); }
td[colspan] {
  height: 86px;
  color: var(--color-muted);
  text-align: center;
  font-weight: 700;
  background:
    linear-gradient(180deg, rgba(248, 250, 252, .78), rgba(255, 255, 255, .96));
}
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions .btn { min-width: 104px; }
.mobile-card-list { display: none; }
.mobile-card {
  padding: 14px;
  display: grid;
  gap: 12px;
  border: 1px solid var(--color-line);
  border-radius: 16px;
  background: #fff;
}
.mobile-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}
.mobile-card-head strong {
  display: block;
  color: var(--color-text);
  font-size: 15px;
}
.mobile-card-head span:not(.status) {
  display: block;
  margin-top: 4px;
  color: var(--color-muted);
  font-size: 12px;
  font-weight: 700;
}
.mobile-card dl {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.mobile-card dt {
  color: var(--color-subtle);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}
.mobile-card dd {
  margin: 3px 0 0;
  color: var(--color-text);
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.empty-card {
  min-height: 120px;
  place-items: center;
  gap: 6px;
  text-align: center;
  color: var(--color-muted);
  font-weight: 800;
}
.empty-card svg { color: var(--color-brand); }
.empty-card strong { color: var(--color-text); font-size: 14px; }
.empty-card span { color: var(--color-muted); font-weight: 700; font-size: 12px; line-height: 1.4; }
.commission-scope {
  margin: -4px 0 12px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.commission-scope span {
  min-height: 30px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--color-line);
  border-radius: 999px;
  color: var(--color-muted);
  background: #fff;
  font-size: 12px;
  font-weight: 800;
}
.commission-value {
  min-width: 150px;
  display: grid;
  gap: 3px;
}
.commission-value span {
  color: var(--color-subtle);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}
.commission-value strong {
  color: var(--color-text);
  font-size: 15px;
}
.commission-value small,
.commission-value em {
  color: var(--color-muted);
  font-size: 11px;
  font-style: normal;
  line-height: 1.3;
}
.commission-value em {
  color: var(--color-brand-strong);
  font-weight: 800;
}

/* Status */
.status {
  min-height: 24px;
  padding: 0 9px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}
.status.ok { color: var(--color-success-strong); background: var(--color-success-soft); }
.status.off { color: #475569; background: #eef2f7; }
.status.block { color: var(--color-danger-strong); background: var(--color-danger-soft); }
.status.warn { color: var(--color-warning-strong); background: var(--color-warning-soft); }
.compact-empty {
  min-height: 170px;
  display: grid;
  place-items: center;
  text-align: center;
}
.compact-empty strong { display: block; }
.compact-empty span { color: var(--color-muted); }

/* Admin */
.admin-tabs {
  padding: 6px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.admin-tabs button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 0 13px;
  background: transparent;
  color: var(--color-text);
  font-weight: 800;
}
.admin-tabs button:hover { color: var(--color-brand-strong); background: var(--color-surface-soft); }
.admin-tabs button.active {
  color: #fff;
  background: linear-gradient(135deg, var(--color-brand), var(--color-brand-strong));
  box-shadow: 0 10px 20px rgba(0, 136, 255, .18);
}
.admin-shortcuts {
  padding-bottom: 18px;
}
.admin-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}
.admin-form .field { margin-bottom: 0; }
.admin-form .btn.primary {
  min-width: 170px;
}
.panel-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.admin-card { padding: 16px; }
.admin-card h3 { margin: 0 0 8px; font-size: 15px; }
.admin-card p { margin: 0; color: var(--color-muted); line-height: 1.45; }
.admin-card code {
  color: var(--color-brand-strong);
  font-family: Consolas, monospace;
  font-size: 12px;
}
.inline-form { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.inline-form .field { width: min(260px, 100%); margin-bottom: 0; }
.subscription-config .field { flex: 1 1 180px; }
.white-preview {
  padding: 18px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 14px;
  align-items: center;
  border: 1px solid var(--color-line);
  border-radius: 14px;
  background: linear-gradient(180deg, #fff, #f8fbff);
}
.white-preview img, .white-preview div {
  grid-row: span 2;
  width: 54px;
  height: 54px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  object-fit: contain;
  color: #fff;
  background: var(--preview-brand);
  font-weight: 900;
}
.white-preview strong { color: var(--preview-brand); font-size: 20px; }
.white-preview span { padding-left: 10px; color: var(--color-muted); border-left: 4px solid var(--preview-accent); }
.code-block {
  margin: 0;
  padding: 16px;
  overflow: auto;
  border: 1px solid #1e293b;
  border-radius: 14px;
  background: #0f172a;
  color: #dbeafe;
  font-family: Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
}

/* Payments and details */
.payment-item {
  padding: 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: 12px;
  align-items: center;
}
.payment-item:has(> strong:only-child) {
  justify-content: center;
  min-height: 90px;
  color: var(--color-muted);
  background: linear-gradient(180deg, #fff, var(--color-surface-soft));
}
.payment-item .btn { margin-left: auto; }
.payment-methods {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.payment-methods .btn {
  min-width: 84px;
}
.payment-main strong,
.payment-amount strong { display: block; }
.payment-main small,
.payment-amount small { color: var(--color-muted); font-size: 12px; }
.payment-amount { text-align: right; }
.detail-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.detail-card { padding: 12px; min-width: 0; }
.detail-card span { color: var(--color-muted); font-size: 12px; font-weight: 800; }
.detail-card strong { display: block; margin-top: 6px; overflow-wrap: anywhere; font-size: 16px; }
.detail-card small { color: var(--color-muted); overflow-wrap: anywhere; }
.detail-table { box-shadow: none; }
.detail-history { margin-top: 14px; }
.detail-section-title {
  margin: 18px 0 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #334155;
  font-size: 13px;
  font-weight: 900;
}
.history-item { padding: 10px 12px; }
.history-item span { color: var(--color-muted); font-size: 12px; font-weight: 700; }
.history-item strong { display: block; margin-top: 4px; font-size: 13px; }
.history-item p { margin: 5px 0 0; color: var(--color-muted); font-size: 13px; }

/* Feedback */
.security-banner {
  padding: 13px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border: 1px solid #fde68a;
  border-radius: 14px;
  background: #fffbeb;
  color: #7c2d12;
  box-shadow: var(--shadow-sm);
}
.security-banner strong { display: block; font-size: 14px; }
.security-banner span { display: block; margin-top: 2px; color: #9a3412; font-size: 13px; }
.toast-stack {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 11;
  display: flex;
  flex-direction: column-reverse;
  gap: 10px;
  max-width: min(420px, calc(100vw - 32px));
}
.toast {
  padding: 13px 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: #fff;
  border-radius: 14px;
  background: #0b1220;
  box-shadow: 0 18px 44px rgba(15, 23, 42, .28);
  animation: toast-in .22s cubic-bezier(.2, .9, .3, 1.2);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
}
.toast > svg { margin-top: 1px; flex: 0 0 auto; }
.toast span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.toast-close {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  margin: -2px -4px -2px 0;
  border: 0;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, .68);
  background: rgba(255, 255, 255, .08);
}
.toast-close:hover { color: #fff; background: rgba(255, 255, 255, .18); }
.toast-success { background: linear-gradient(135deg, var(--color-success), var(--color-success-strong)); }
.toast-error { background: linear-gradient(135deg, var(--color-danger), var(--color-danger-strong)); }
.toast-warning { background: linear-gradient(135deg, var(--color-warning), var(--color-warning-strong)); color: #fff; }
.toast-info { background: linear-gradient(135deg, #1e293b, #0b1220); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px) scale(.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@media (max-width: 680px) {
  .toast-stack { right: 12px; bottom: 84px; left: 12px; max-width: none; }
}
.skeleton-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.skeleton-grid div {
  min-height: 140px;
  border-radius: var(--radius-lg);
  background: linear-gradient(90deg, #eef2f7 0%, #f8fafc 45%, #eef2f7 100%);
  background-size: 220% 100%;
  animation: skeleton 1.2s ease-in-out infinite;
}
@keyframes skeleton { to { background-position: -220% 0; } }
.empty-state {
  min-height: 360px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  text-align: center;
}
.empty-state svg { color: var(--color-brand); }
.empty-state h2, .empty-state p { margin: 0; }
.empty-state p { max-width: 560px; color: var(--color-muted); line-height: 1.55; }

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10;
  padding: 18px;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, .38);
  backdrop-filter: blur(8px);
}
.modal {
  width: min(520px, 100%);
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, .75);
  border-radius: 22px;
  background: #fff;
  box-shadow: var(--shadow-lg);
  animation: modal-in .18s ease-out;
}
.modal-wide { width: min(980px, 100%); max-height: calc(100vh - 48px); overflow: auto; }
.modal h2 { margin: 0 0 10px; }
.modal p { color: var(--color-muted); line-height: 1.5; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.modal-title-row { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 16px; }
.modal-title-row h2 { margin-bottom: 4px; }
.reason-chips {
  margin: 4px 0 14px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.reason-chips button {
  min-height: 34px;
  border: 1px solid var(--color-line);
  border-radius: 999px;
  padding: 0 12px;
  color: #334155;
  background: #fff;
  font-weight: 800;
}
.reason-chips button:hover {
  color: var(--color-brand-strong);
  border-color: rgba(0, 136, 255, .32);
  background: #f4faff;
}
.mobile-dock {
  display: none;
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Responsive */
@media (max-width: 1500px) {
  .topbar { grid-template-columns: minmax(180px, 250px) minmax(220px, 1fr) auto; }
  .topbar-actions { display: none; }
}

@media (max-width: 1180px) {
  .topbar {
    grid-template-columns: 1fr auto;
    min-height: auto;
    padding-block: 14px;
  }
  .global-search { grid-column: 1 / -1; order: 3; }
  .topbar-actions { display: none; }
}

@media (max-width: 980px) {
  :root { --space-page: 20px; }
  .login-screen { padding: 22px; }
  .portal-layout { width: 100%; max-width: 100vw; grid-template-columns: minmax(0, 1fr); overflow-x: hidden; }
  .content, .topbar, .main-content { width: 100%; min-width: 0; max-width: 100vw; }
  .sidebar {
    width: 100%;
    min-width: 0;
    max-width: 100vw;
    height: auto;
    position: sticky;
    top: 0;
    z-index: 6;
    padding: 12px;
    gap: 12px;
  }
  .sidebar .brand-line { min-width: 0; padding-bottom: 10px; overflow: hidden; }
  .brand-copy { min-width: 0; }
  .brand-copy strong, .brand-copy span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .sidebar-user, .nav-group { display: none; }
  .nav { min-width: 0; max-width: 100%; display: flex; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
  .nav button { width: auto; min-width: auto; flex: 0 0 auto; padding-inline: 12px; }
  .topbar { top: 70px; }
  .summary-hero { grid-template-columns: 1fr; }
  .dashboard-hero { flex-direction: column; align-items: flex-start; }
  .hero-actions, .summary-actions { justify-content: flex-start; }
  .kpis, .panel-grid, .dashboard-grid, .alert-grid, .detail-grid, .quick-action-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .payment-item { grid-template-columns: 1fr auto; }
  .payment-methods { grid-column: 1 / -1; justify-content: flex-start; }
}

@media (max-width: 680px) {
  :root { --space-page: 16px; }
  body { padding-bottom: 74px; }
  .login-screen { padding: 16px; }
  .login-card { padding: 22px; border-radius: 22px; }
  .login-heading h1 { font-size: 29px; }
  .login-actions { grid-template-columns: 1fr; }
  .visual-row, .kpis, .panel-grid, .dashboard-grid, .alert-grid, .detail-grid, .skeleton-grid, .quick-action-grid { grid-template-columns: 1fr; }
  .mini-stats { grid-template-columns: 1fr; }
  .admin-form { grid-template-columns: 1fr; }
  .topbar { grid-template-columns: 1fr; gap: 12px; align-items: start; }
  .user-chip { width: 100%; padding-left: 0; border-left: 0; flex-wrap: wrap; }
  .search { min-width: 100%; }
  .filters { width: 100%; }
  .filters .input, .filters .select { min-width: 100%; }
  .filters .period-picker { width: 100%; }
  .filters .period-picker-trigger { width: 100%; justify-content: space-between; }
  .period-picker-panel { left: 0; right: 0; width: auto; }
  .filter-chips { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-chip { justify-content: space-between; width: 100%; border-radius: 13px; }
  .load-more { display: grid; justify-items: stretch; }
  .load-more .btn { width: 100%; }
  .panel-actions { width: 100%; justify-content: stretch; }
  .panel-actions .btn { flex: 1 1 140px; }
  .toolbar .btn { width: 100%; }
  .summary-hero { padding: 20px; }
  .summary-copy h2 { font-size: 26px; }
  .summary-actions .btn, .summary-actions .select { width: 100%; }
  .summary-actions .period-picker { width: 100%; }
  .summary-actions .period-picker-trigger { width: 100%; justify-content: space-between; }
  .dashboard-hero { padding: 20px; }
  .dashboard-hero h2 { font-size: 26px; }
  .chart-summary { grid-template-columns: 1fr; }
  .trend-chart { height: 170px; }
  .trend-axis span:nth-child(even) { visibility: hidden; }
  .work-item { grid-template-columns: 1fr; }
  .work-item b { text-align: left; }
  table { min-width: 760px; }
  .responsive-table { overflow: visible; padding: 0; border: 0; background: transparent; box-shadow: none; }
  .panel .responsive-table { margin-inline: 0; }
  .responsive-table table { display: none; }
  .responsive-table .mobile-card-list { display: grid; gap: 12px; }
  .mobile-card dl { grid-template-columns: 1fr; }
  .mobile-card .actions .btn { flex: 1 1 130px; }
  th, td { padding: 12px 10px; }
  .actions .btn { min-width: 96px; }
  .modal { padding: 18px; border-radius: 14px; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .btn { width: 100%; }
  .payment-item { grid-template-columns: 1fr; align-items: flex-start; }
  .payment-amount { text-align: left; }
  .payment-item .btn { width: 100%; margin-left: 0; }
  .payment-methods { width: 100%; }
  .payment-methods .btn { flex: 1 1 100%; }
  .mobile-dock {
    position: fixed;
    right: 10px;
    bottom: 10px;
    left: 10px;
    z-index: 9;
    min-height: 58px;
    padding: 6px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    border: 1px solid rgba(226, 232, 240, .92);
    border-radius: 18px;
    background: rgba(255, 255, 255, .94);
    box-shadow: 0 18px 46px rgba(15, 23, 42, .20);
    backdrop-filter: blur(16px);
  }
  .mobile-dock button {
    min-width: 0;
    min-height: 46px;
    border: 0;
    border-radius: 13px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 2px;
    color: #475569;
    background: transparent;
    font-size: 11px;
    font-weight: 850;
  }
  .mobile-dock button.active {
    color: var(--color-brand-strong);
    background: var(--color-brand-soft);
  }
  .mobile-dock span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
