:root {
  --bg: #06111f;
  --bg-2: #091a2f;
  --surface: rgba(10, 29, 51, 0.86);
  --surface-2: rgba(15, 43, 74, 0.82);
  --card: rgba(8, 24, 43, 0.92);
  --border: rgba(84, 190, 255, 0.18);
  --border-strong: rgba(84, 190, 255, 0.38);
  --text: #eef7ff;
  --muted: #8da8c2;
  --blue: #19b7ff;
  --blue-2: #006eff;
  --green: #22c55e;
  --yellow: #ffd166;
  --red: #ef4444;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
  --radius: 22px;
  --sidebar: 292px;
}

html[data-theme="light"] {
  --bg: #eef6ff;
  --bg-2: #ddecff;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-2: rgba(241, 248, 255, 0.96);
  --card: rgba(255, 255, 255, 0.98);
  --border: rgba(0, 94, 170, 0.16);
  --border-strong: rgba(0, 122, 210, 0.35);
  --text: #0d2238;
  --muted: #5c7188;
  --shadow: 0 18px 50px rgba(10, 40, 78, 0.12);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  width: 100%;
  min-height: 100%;
  overflow-x: hidden;
}

body {
  width: 100%;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(25, 183, 255, 0.22), transparent 34%),
    radial-gradient(circle at bottom right, rgba(0, 110, 255, 0.22), transparent 36%),
    linear-gradient(135deg, var(--bg), var(--bg-2));
  color: var(--text);
}

button,
input,
select,
textarea {
  font-family: inherit;
}

button {
  touch-action: manipulation;
}

a {
  color: inherit;
  text-decoration: none;
}

.hidden {
  display: none !important;
}

/* LOGIN */

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 22px;
}

.login-card {
  width: min(100%, 980px);
  min-height: 610px;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  background: rgba(4, 16, 30, 0.74);
  border: 1px solid var(--border);
  border-radius: 34px;
  box-shadow: var(--shadow);
  overflow: hidden;
  backdrop-filter: blur(18px);
}

html[data-theme="light"] .login-card {
  background: rgba(255, 255, 255, 0.82);
}

.login-brand {
  position: relative;
  padding: 46px;
  background:
    linear-gradient(145deg, rgba(25, 183, 255, 0.18), rgba(0, 110, 255, 0.08)),
    rgba(0, 0, 0, 0.15);
  overflow: hidden;
}

.login-brand::before {
  content: "";
  position: absolute;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  background: rgba(25, 183, 255, 0.16);
  filter: blur(10px);
  right: -120px;
  bottom: -120px;
}

.brand-logo-row {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo-img {
  width: 68px;
  height: 68px;
  object-fit: contain;
  filter: drop-shadow(0 0 18px rgba(25, 183, 255, 0.5));
}

.brand-logo-fallback {
  width: 68px;
  height: 68px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--blue), var(--blue-2));
  color: white;
  font-weight: 900;
  letter-spacing: -0.08em;
  box-shadow: 0 0 36px rgba(25, 183, 255, 0.45);
}

.brand-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.login-copy {
  position: relative;
  z-index: 1;
  margin-top: 74px;
}

.login-copy h1 {
  max-width: 460px;
  margin: 0;
  font-size: clamp(2rem, 5vw, 4.3rem);
  line-height: 0.98;
  letter-spacing: -0.07em;
}

.login-copy p {
  max-width: 500px;
  margin: 22px 0 0;
  color: var(--muted);
  line-height: 1.6;
  font-weight: 600;
}

.login-pills {
  position: relative;
  z-index: 1;
  margin-top: 34px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pill {
  border: 1px solid var(--border-strong);
  background: rgba(25, 183, 255, 0.1);
  color: var(--text);
  padding: 9px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 800;
}

.login-form-area {
  padding: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-form-box {
  width: 100%;
}

.login-form-box h2 {
  margin: 0;
  font-size: 2rem;
  letter-spacing: -0.04em;
}

.login-form-box p {
  margin: 10px 0 28px;
  color: var(--muted);
  font-weight: 600;
}

/* FORM */

.form-grid {
  display: grid;
  gap: 15px;
}

.form-two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-three {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.field label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: var(--surface-2);
  color: var(--text);
  padding: 0 14px;
  outline: none;
  font-weight: 700;
  font-size: 16px;
}

.select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 20px) 21px,
    calc(100% - 14px) 21px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 38px;
}

.textarea {
  padding: 14px;
  min-height: 120px;
  resize: vertical;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(25, 183, 255, 0.12);
}

input[type="date"] {
  color-scheme: dark;
}

html[data-theme="light"] input[type="date"] {
  color-scheme: light;
}

/* BUTTONS */

.btn {
  border: 0;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 14px;
  font-weight: 900;
  cursor: pointer;
  display: inline-flex;
  gap: 9px;
  align-items: center;
  justify-content: center;
  transition: transform 0.18s ease, filter 0.18s ease, background 0.18s ease;
  white-space: nowrap;
}

.btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.65;
  transform: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--blue), var(--blue-2));
  color: #fff;
  box-shadow: 0 16px 35px rgba(25, 183, 255, 0.22);
}

.btn-ghost {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
}

html[data-theme="light"] .btn-ghost {
  background: rgba(0, 77, 140, 0.06);
}

.btn-danger {
  color: #fff;
  background: linear-gradient(135deg, #ef4444, #b91c1c);
}

.btn-green {
  color: #fff;
  background: linear-gradient(135deg, #22c55e, #15803d);
}

.btn-full {
  width: 100%;
}

/* ALERTS */

.alert {
  padding: 13px 14px;
  border-radius: 14px;
  font-weight: 800;
  font-size: 0.92rem;
  margin-top: 14px;
}

.alert-error {
  border: 1px solid rgba(239, 68, 68, 0.28);
  background: rgba(239, 68, 68, 0.12);
  color: #ffb4b4;
}

.alert-success {
  border: 1px solid rgba(34, 197, 94, 0.28);
  background: rgba(34, 197, 94, 0.12);
  color: #a7f3d0;
}

html[data-theme="light"] .alert-error {
  color: #991b1b;
}

html[data-theme="light"] .alert-success {
  color: #166534;
}

/* APP LAYOUT - MENU FIXO DESKTOP */

.app-layout {
  width: 100%;
  min-height: 100vh;
  display: block;
}

.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: var(--sidebar);
  height: 100dvh;
  padding: 22px;
  background: rgba(3, 13, 26, 0.86);
  border-right: 1px solid var(--border);
  backdrop-filter: blur(18px);
  display: flex;
  flex-direction: column;
  gap: 22px;
  z-index: 30;
  overflow-y: auto;
  overflow-x: hidden;
}

html[data-theme="light"] .sidebar {
  background: rgba(255, 255, 255, 0.86);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo {
  width: 52px;
  height: 52px;
  object-fit: contain;
  filter: drop-shadow(0 0 18px rgba(25, 183, 255, 0.45));
}

.sidebar-brand .brand-logo-fallback {
  width: 52px !important;
  height: 52px !important;
  border-radius: 16px !important;
  font-size: 1rem;
}

.sidebar-title strong {
  display: block;
  font-weight: 900;
  letter-spacing: 0.06em;
}

.sidebar-title span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.user-box {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 18px;
  padding: 15px;
}

.user-box strong {
  display: block;
  overflow-wrap: anywhere;
}

.user-box span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-btn {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  min-height: 48px;
  padding: 0 13px;
  border-radius: 15px;
  cursor: pointer;
  display: flex;
  gap: 11px;
  align-items: center;
  font-weight: 900;
  text-align: left;
}

.nav-btn:hover,
.nav-btn.active {
  color: var(--text);
  border-color: var(--border-strong);
  background: rgba(25, 183, 255, 0.1);
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 10px;
}

.main {
  width: calc(100% - var(--sidebar));
  min-width: 0;
  margin-left: var(--sidebar);
  padding: 28px;
}

.topbar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 25;
  padding: 12px;
  background: rgba(4, 16, 30, 0.82);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

html[data-theme="light"] .topbar {
  background: rgba(255, 255, 255, 0.86);
}

.mobile-overlay {
  display: none;
}

/* PAGE */

.page {
  width: 100%;
  display: grid;
  gap: 18px;
}

.hero {
  border: 1px solid var(--border);
  background:
    linear-gradient(135deg, rgba(25, 183, 255, 0.16), transparent 52%),
    var(--card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.kicker {
  color: var(--blue);
  font-weight: 900;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  font-size: 0.74rem;
}

.hero h1 {
  margin: 7px 0 0;
  font-size: clamp(1.65rem, 4vw, 2.8rem);
  letter-spacing: -0.06em;
  line-height: 1.02;
}

.hero p {
  max-width: 760px;
  margin: 10px 0 0;
  color: var(--muted);
  font-weight: 600;
  line-height: 1.5;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  min-width: 0;
}

.card h2 {
  color: var(--text);
  letter-spacing: -0.04em;
}

.filter-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr 0.8fr auto;
  gap: 14px;
  align-items: end;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}

.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 17px;
  min-width: 0;
}

.kpi span {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
}

.kpi strong {
  display: block;
  margin-top: 8px;
  font-size: 1.45rem;
  letter-spacing: -0.04em;
  overflow-wrap: anywhere;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.empty {
  padding: 34px;
  color: var(--muted);
  text-align: center;
  font-weight: 800;
}

.loading {
  display: grid;
  place-items: center;
  padding: 44px;
  color: var(--muted);
  font-weight: 900;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(25, 183, 255, 0.18);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 10px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* TABLE DESKTOP */

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 18px;
  -webkit-overflow-scrolling: touch;
}

.table {
  width: 100%;
  min-width: 960px;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

.table th {
  color: var(--muted);
  font-size: 0.73rem;
  font-weight: 900;
  text-transform: uppercase;
  background: var(--surface-2);
}

.table td {
  font-weight: 700;
}

.table tr:last-child td {
  border-bottom: 0;
}

/* BADGES */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 900;
  border: 1px solid var(--border);
}

.badge-green {
  color: #86efac;
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.25);
}

.badge-red {
  color: #fecaca;
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.25);
}

.badge-blue {
  color: #a5e7ff;
  background: rgba(25, 183, 255, 0.12);
  border-color: rgba(25, 183, 255, 0.25);
}

html[data-theme="light"] .badge-green {
  color: #166534;
}

html[data-theme="light"] .badge-red {
  color: #991b1b;
}

html[data-theme="light"] .badge-blue {
  color: #075985;
}

/* PREVIEW ADS */

.preview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.ad-card {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 22px;
  overflow: hidden;
  min-width: 0;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.16);
}

.ad-image-button {
  width: 100%;
  display: block;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: zoom-in;
  background:
    radial-gradient(circle, rgba(25, 183, 255, 0.14), transparent 52%),
    rgba(255, 255, 255, 0.035);
}

.ad-image-button:hover .ad-image {
  transform: scale(1.015);
}

.ad-image {
  width: 100%;
  aspect-ratio: 1.15 / 1;
  object-fit: contain;
  object-position: center;
  display: block;
  background:
    radial-gradient(circle, rgba(25, 183, 255, 0.14), transparent 52%),
    rgba(255, 255, 255, 0.035);
  image-rendering: auto;
  transform: translateZ(0);
  transition: transform 0.22s ease, filter 0.22s ease;
}

.ad-body {
  padding: 16px;
}

.ad-body h3 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.ad-copy {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.45;
  font-size: 0.92rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* POPUP IMAGEM CRIATIVO */

.image-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(0, 0, 0, 0.84);
  backdrop-filter: blur(8px);
}

.image-modal.show {
  display: flex;
}

.image-modal__content {
  position: relative;
  width: fit-content;
  height: fit-content;
  max-width: calc(100vw - 28px);
  max-height: calc(100dvh - 28px);
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.image-modal__img {
  display: block;
  width: auto;
  height: auto;
  max-width: calc(100vw - 28px);
  max-height: calc(100dvh - 28px);
  object-fit: contain;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.58);
  background: transparent;
}

.image-modal__close {
  position: absolute;
  top: -18px;
  right: -18px;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 999px;
  background: #ffffff;
  color: #071522;
  display: grid;
  place-items: center;
  font-size: 1.25rem;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.42);
  z-index: 2;
}

.image-modal__close:hover {
  transform: scale(1.06);
  filter: brightness(0.98);
}

/* RESPONSIVE TABLET */

@media (max-width: 1180px) {
  .kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .preview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* MOBILE GERAL */

@media (max-width: 860px) {
  body {
    background:
      radial-gradient(circle at top, rgba(25, 183, 255, 0.18), transparent 34%),
      linear-gradient(135deg, var(--bg), var(--bg-2));
  }

  .login-page {
    display: block;
    min-height: 100dvh;
    padding: 14px;
  }

  .login-card {
    min-height: calc(100dvh - 28px);
    grid-template-columns: 1fr;
    border-radius: 26px;
  }

  .login-brand {
    padding: 24px;
  }

  .brand-logo-img,
  .brand-logo-fallback {
    width: 54px;
    height: 54px;
    border-radius: 16px;
  }

  .brand-title {
    font-size: 1rem;
  }

  .brand-subtitle {
    font-size: 0.76rem;
  }

  .login-copy {
    margin-top: 34px;
  }

  .login-copy h1 {
    font-size: 2.1rem;
    line-height: 1.02;
  }

  .login-copy p {
    margin-top: 15px;
    font-size: 0.94rem;
  }

  .login-pills {
    margin-top: 24px;
  }

  .pill {
    font-size: 0.76rem;
    padding: 8px 10px;
  }

  .login-form-area {
    padding: 24px;
  }

  .login-form-box h2 {
    font-size: 1.65rem;
  }

  .app-layout {
    display: block;
    min-height: 100dvh;
  }

  .topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: calc(60px + env(safe-area-inset-top));
    padding: calc(10px + env(safe-area-inset-top)) 12px 10px;
  }

  .topbar strong {
    font-size: 0.96rem;
    letter-spacing: -0.02em;
  }

  .sidebar {
    position: fixed;
    left: -310px;
    top: 0;
    width: 292px;
    max-width: calc(100vw - 52px);
    height: 100dvh;
    z-index: 50;
    transition: left 0.22s ease;
    padding: calc(18px + env(safe-area-inset-top)) 18px calc(18px + env(safe-area-inset-bottom));
    overflow-y: auto;
  }

  .sidebar.open {
    left: 0;
  }

  .main {
    width: 100%;
    margin-left: 0;
    padding: 14px;
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
  }

  .mobile-overlay.show {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 45;
    background: rgba(0, 0, 0, 0.58);
    backdrop-filter: blur(3px);
  }

  .page {
    gap: 14px;
  }

  .hero {
    border-radius: 20px;
    padding: 18px;
    display: grid;
    gap: 16px;
  }

  .hero h1 {
    font-size: 1.9rem;
    line-height: 1.02;
  }

  .hero p {
    font-size: 0.92rem;
    line-height: 1.45;
  }

  .hero .actions,
  .hero .btn {
    width: 100%;
  }

  .card {
    border-radius: 20px;
    padding: 16px;
  }

  .card h2 {
    font-size: 1.16rem;
    margin-bottom: 14px;
  }

  .filter-grid,
  .form-two,
  .form-three {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }

  .input,
  .select,
  .textarea,
  .btn {
    min-height: 50px;
    border-radius: 15px;
  }

  .actions {
    width: 100%;
  }

  .actions .btn {
    flex: 1 1 100%;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .kpi {
    min-height: 96px;
    border-radius: 18px;
    padding: 14px;
  }

  .kpi span {
    font-size: 0.66rem;
    line-height: 1.2;
  }

  .kpi strong {
    font-size: 1.2rem;
    margin-top: 9px;
  }

  .preview-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .ad-card {
    border-radius: 20px;
  }

  .ad-image {
    aspect-ratio: 1.2 / 1;
    object-fit: contain;
  }

  .ad-body {
    padding: 15px;
  }

  .ad-body h3 {
    font-size: 1rem;
  }

  .ad-copy {
    font-size: 0.9rem;
  }

  canvas {
    max-width: 100%;
  }

  .image-modal {
    padding: 12px;
  }

  .image-modal__content {
    max-width: calc(100vw - 20px);
    max-height: calc(100dvh - 20px);
  }

  .image-modal__img {
    max-width: calc(100vw - 20px);
    max-height: calc(100dvh - 20px);
  }

  .image-modal__close {
    top: -14px;
    right: -8px;
    width: 40px;
    height: 40px;
  }
}

/* MOBILE TABLES VIRAM CARDS */

@media (max-width: 760px) {
  .table-wrap {
    border: 0;
    border-radius: 0;
    overflow: visible;
    background: transparent;
  }

  .table {
    display: block;
    min-width: 0;
    width: 100%;
  }

  .table thead {
    display: none;
  }

  .table tbody {
    display: grid;
    gap: 12px;
  }

  .table tr {
    display: grid;
    gap: 8px;
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background:
      linear-gradient(135deg, rgba(25, 183, 255, 0.08), transparent 46%),
      var(--surface);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.16);
  }

  .table td {
    display: grid;
    grid-template-columns: minmax(88px, 38%) minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface-2);
    padding: 10px 11px;
    font-size: 0.86rem;
    line-height: 1.3;
    overflow-wrap: anywhere;
  }

  .table td::before {
    content: "Campo";
    color: var(--muted);
    font-size: 0.66rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }

  .table td:has(.empty),
  .table td.empty {
    display: block;
    padding: 28px 14px;
    text-align: center;
  }

  .table td:has(.empty)::before,
  .table td.empty::before {
    display: none;
  }

  .table .empty {
    padding: 26px 12px;
  }

  #metrik-table td:nth-child(1)::before {
    content: "Cliente";
  }

  #metrik-table td:nth-child(2)::before {
    content: "Campanha";
  }

  #metrik-table td:nth-child(3)::before {
    content: "Conjunto";
  }

  #metrik-table td:nth-child(4)::before {
    content: "Anúncio";
  }

  #metrik-table td:nth-child(5)::before {
    content: "Leads";
  }

  #metrik-table td:nth-child(6)::before {
    content: "Gasto";
  }

  #metrik-table td:nth-child(7)::before {
    content: "CPL";
  }

  #metrik-table td:nth-child(8)::before {
    content: "CTR";
  }

  #metrik-table td:nth-child(9)::before {
    content: "CPC";
  }

  #metrik-table td:nth-child(10)::before {
    content: "CPM";
  }

  #metrik-table td:nth-child(11)::before {
    content: "Orçamento";
  }

  #metrik-table td:nth-child(12)::before {
    content: "Status";
  }

  #master-users-table td:nth-child(1)::before {
    content: "Nome";
  }

  #master-users-table td:nth-child(2)::before {
    content: "Usuário";
  }

  #master-users-table td:nth-child(3)::before {
    content: "Perfil";
  }

  #master-users-table td:nth-child(4)::before {
    content: "Status";
  }

  #master-users-table td:nth-child(5)::before {
    content: "Conta Meta";
  }

  #master-users-table td:nth-child(6)::before {
    content: "Criado em";
  }

  #master-users-table td:nth-child(7)::before {
    content: "Ações";
  }

  #master-users-table td:nth-child(7) {
    grid-template-columns: 1fr;
  }

  #master-users-table td:nth-child(7)::before {
    margin-bottom: 4px;
  }

  #master-users-table td:nth-child(7) .actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #master-users-table td:nth-child(7) .btn {
    min-height: 44px;
    width: 100%;
  }

  #metrik-table td:nth-child(1),
  #metrik-table td:nth-child(2),
  #metrik-table td:nth-child(3),
  #metrik-table td:nth-child(4) {
    grid-template-columns: 1fr;
    align-items: start;
  }

  #metrik-table td:nth-child(1)::before,
  #metrik-table td:nth-child(2)::before,
  #metrik-table td:nth-child(3)::before,
  #metrik-table td:nth-child(4)::before {
    margin-bottom: 2px;
  }

  #metrik-table td:nth-child(2) {
    border-color: rgba(25, 183, 255, 0.32);
    background: rgba(25, 183, 255, 0.1);
    font-size: 0.94rem;
  }

  #metrik-table td:nth-child(5),
  #metrik-table td:nth-child(6),
  #metrik-table td:nth-child(7),
  #metrik-table td:nth-child(8),
  #metrik-table td:nth-child(9),
  #metrik-table td:nth-child(10),
  #metrik-table td:nth-child(11),
  #metrik-table td:nth-child(12) {
    font-weight: 900;
  }
}

/* CELULARES PEQUENOS */

@media (max-width: 520px) {
  .main {
    padding: 12px;
    padding-bottom: calc(22px + env(safe-area-inset-bottom));
  }

  .topbar .btn {
    min-width: 46px;
    padding: 0 12px;
  }

  .hero {
    padding: 16px;
  }

  .hero h1 {
    font-size: 1.65rem;
  }

  .kicker {
    font-size: 0.68rem;
  }

  .hero p {
    font-size: 0.88rem;
  }

  .card {
    padding: 14px;
  }

  .kpi-grid {
    grid-template-columns: 1fr 1fr;
  }

  .kpi {
    padding: 13px;
    min-height: 90px;
  }

  .kpi strong {
    font-size: 1.12rem;
  }

  .table tr {
    padding: 10px;
    border-radius: 16px;
  }

  .table td {
    grid-template-columns: minmax(76px, 34%) minmax(0, 1fr);
    padding: 9px 10px;
    font-size: 0.82rem;
  }

  .badge {
    font-size: 0.66rem;
    padding: 5px 8px;
  }

  .ad-image {
    aspect-ratio: 1.05 / 1;
  }

  .login-page {
    padding: 10px;
  }

  .login-card {
    border-radius: 22px;
    min-height: calc(100dvh - 20px);
  }

  .login-brand,
  .login-form-area {
    padding: 20px;
  }

  .login-copy h1 {
    font-size: 1.78rem;
  }
}

@media (max-width: 390px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .table td {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .table td::before {
    margin-bottom: 0;
  }

  .hero h1 {
    font-size: 1.48rem;
  }
}