/* Painel admin — layout e componentes */

.admin-body {
  margin: 0;
  background: #f0f2f5;
  min-height: 100vh;
}

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

.admin-sidebar {
  display: flex;
  flex-direction: column;
  background: #1a1d24;
  color: #e8eaed;
  padding: 20px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 40;
}

.admin-sidebar__brand {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-sidebar__brand-link {
  text-decoration: none;
  color: inherit;
  display: grid;
  gap: 4px;
}

.admin-sidebar__brand-name {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
}

.admin-sidebar__brand-tag {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #9aa0a6;
}

.admin-sidebar__nav {
  display: grid;
  gap: 6px;
  flex: 1;
}

.admin-sidebar__link {
  display: grid;
  gap: 2px;
  padding: 12px 14px;
  border-radius: 10px;
  text-decoration: none;
  color: #c4c7cc;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s;
}

.admin-sidebar__link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.admin-sidebar__link.is-active {
  background: rgba(255, 122, 0, 0.15);
  border-color: rgba(255, 122, 0, 0.35);
  color: #fff;
}

.admin-sidebar__link-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.admin-sidebar__link-desc {
  font-size: 0.75rem;
  color: #9aa0a6;
}

.admin-sidebar__link.is-active .admin-sidebar__link-desc {
  color: #ffb380;
}

.admin-sidebar__footer {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: grid;
  gap: 10px;
}

.admin-sidebar__user {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.admin-sidebar__user-name {
  font-weight: 600;
  font-size: 0.9rem;
}

.admin-role-badge {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: #c4c7cc;
}

.admin-role-badge--master {
  background: rgba(255, 122, 0, 0.25);
  color: #ffb380;
}

.admin-sidebar__utility {
  font-size: 0.82rem;
  color: #9aa0a6;
  text-decoration: none;
}

.admin-sidebar__utility:hover {
  color: #ff7a00;
}

.admin-sidebar__logout {
  margin: 0;
}

.btn--block {
  width: 100%;
}

.admin-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.admin-topbar {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 20px 28px 0;
  background: #f0f2f5;
  position: sticky;
  top: 0;
  z-index: 20;
}

.admin-topbar__menu {
  display: none;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #fff;
  font-size: 1.2rem;
  cursor: pointer;
}

.admin-topbar__head {
  flex: 1;
  min-width: 0;
}

.admin-topbar__title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: #1a1d24;
}

.admin-topbar__subtitle {
  margin: 6px 0 0;
  font-size: 0.9rem;
  color: #666;
  line-height: 1.45;
}

.admin-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  font-size: 0.82rem;
}

.admin-breadcrumb a {
  color: #ff7a00;
  text-decoration: none;
  font-weight: 600;
}

.admin-breadcrumb__sep {
  color: #bbb;
}

.admin-page {
  padding: 16px 28px 32px;
  flex: 1;
}

.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 16px;
}

.admin-toolbar--split {
  justify-content: space-between;
}

.admin-toolbar__group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.admin-toolbar__hint {
  font-size: 0.82rem;
  color: #888;
}

.admin-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.admin-kpi-grid--compact {
  margin-bottom: 0;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.access-panel-filters {
  padding-bottom: 0;
  border-bottom: 1px solid #e8eaed;
}

.access-filters {
  margin-bottom: 10px;
}

.access-filter-summary {
  margin: 0 0 12px;
  font-size: 0.85rem;
  color: #5f6368;
}

.access-campaign-filter {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 12px;
}

.access-campaign-filter__label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #3c4043;
  white-space: nowrap;
}

.access-campaign-filter__select {
  min-width: min(100%, 320px);
  max-width: 100%;
  flex: 1 1 220px;
  padding: 8px 10px;
  border: 1px solid #dadce0;
  border-radius: 8px;
  background: #fff;
  color: #202124;
  font-size: 0.85rem;
}

.access-campaign-filter__select:focus {
  outline: 2px solid rgba(255, 122, 0, 0.35);
  border-color: #ff7a00;
}

.campaign-row--filterable {
  cursor: pointer;
}

.campaign-row--filterable:hover td {
  background: #fff8f0;
}

.campaign-row--filterable.is-active td {
  background: #fff3e6;
}

.access-funnel {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid #e8eaed;
}

.access-funnel__title {
  margin: 0 0 10px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #3c4043;
}

.access-funnel__steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.access-funnel__step {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: #5f6368;
}

.access-funnel__step::before {
  content: '→';
  color: #ff7a00;
  font-weight: 700;
}

.access-funnel__step:first-child::before {
  content: '';
  width: 0;
}

.access-funnel__count {
  font-weight: 700;
  color: #202124;
  min-width: 2rem;
}

.access-funnel__pct {
  margin-left: auto;
  font-size: 0.8rem;
  color: #80868b;
}

.access-funnel__step--ok .access-funnel__count {
  color: #1e8e3e;
}

.access-card__funnel-pill {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  background: #fff5eb;
  color: #e65100;
  vertical-align: middle;
}

.access-card__funnel-badge {
  display: inline-block;
  font-weight: 700;
  color: #e65100;
}

.access-card__dropoff {
  display: block;
  margin-top: 4px;
  font-size: 0.82rem;
  color: #c62828;
  line-height: 1.35;
}

.access-card__journey {
  margin-top: 8px;
}

.access-card__journey-title {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #80868b;
  margin-bottom: 4px;
}

.access-card__journey-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
}

.access-card__journey-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.82rem;
  color: #3c4043;
  line-height: 1.35;
}

.access-card__journey-num {
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  background: #f1f3f4;
  color: #5f6368;
  font-size: 0.7rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.engagement--survey-view {
  background: #e8f0fe;
  color: #1967d2;
}

.admin-kpi {
  background: #fff;
  border: 1px solid #e8eaed;
  border-radius: 12px;
  padding: 14px 16px;
  display: grid;
  gap: 4px;
}

.admin-kpi--highlight {
  border-color: #c8e6c9;
  background: linear-gradient(135deg, #f1fbf3 0%, #fff 100%);
}

.admin-kpi--warn {
  border-color: #ffe0b2;
  background: linear-gradient(135deg, #fff8f0 0%, #fff 100%);
}

.admin-kpi--online {
  border-color: #b3e5fc;
  background: linear-gradient(135deg, #e8f7fd 0%, #fff 100%);
}

.admin-kpi__value {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1a1d24;
  line-height: 1.1;
}

.admin-kpi--highlight .admin-kpi__value {
  color: #0a5c2a;
}

.admin-kpi--warn .admin-kpi__value {
  color: #ff7a00;
}

.admin-kpi--online .admin-kpi__value {
  color: #0277bd;
}

.admin-kpi__label {
  font-size: 0.8rem;
  color: #666;
}

.admin-kpi__hint {
  font-size: 0.72rem;
  color: #999;
}

.admin-guide {
  background: #fff;
  border: 1px solid #e0e7ff;
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 16px;
}

.admin-guide__title {
  margin: 0 0 10px;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #5c6bc0;
}

.admin-guide__steps {
  margin: 0;
  padding-left: 1.2rem;
  display: grid;
  gap: 6px;
  font-size: 0.88rem;
  color: #444;
}

.admin-guide__steps strong {
  color: #1a1d24;
}

.admin-panel {
  background: #fff;
  border: 1px solid #e8eaed;
  border-radius: 12px;
  margin-bottom: 16px;
  overflow: hidden;
}

.admin-panel__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid #eee;
  background: #fafbfc;
}

.admin-panel__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: #1a1d24;
}

.admin-panel__subtitle {
  margin: 4px 0 0;
  font-size: 0.8rem;
  color: #888;
}

.admin-panel__body {
  padding: 0;
}

.admin-panel__body--padded {
  padding: 16px 18px;
}

.admin-panel--orphaned .admin-panel__head {
  background: #fff8f0;
  border-bottom-color: #f0dcc8;
}

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

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.admin-table th,
.admin-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #eee;
  text-align: left;
  vertical-align: middle;
}

.admin-table th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #888;
  background: #fafbfc;
  font-weight: 700;
  white-space: nowrap;
}

.admin-table tbody tr:hover {
  background: #fafbfc;
}

.admin-table__client {
  display: grid;
  gap: 2px;
  text-decoration: none;
  color: inherit;
}

.admin-table__client:hover strong {
  color: #ff7a00;
}

.admin-table__client strong {
  font-size: 0.92rem;
}

.admin-table__client-sub {
  font-size: 0.75rem;
  color: #999;
}

.admin-table__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  white-space: nowrap;
}

.admin-table__mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
}

/* Login admin mobile */
.admin-body--login .page {
  max-width: 420px;
  margin: 0 auto;
  padding: 24px 16px;
  padding-top: max(24px, env(safe-area-inset-top));
  padding-bottom: max(24px, env(safe-area-inset-bottom));
}

.admin-body--login .admin-login-form .btn {
  min-height: 48px;
}

/* --- Backdrop menu mobile --- */
.admin-sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 35;
  -webkit-tap-highlight-color: transparent;
}

.admin-shell--sidebar-open .admin-sidebar-backdrop {
  display: block;
}

.admin-body--menu-open {
  overflow: hidden;
}

/* --- Tabelas viram cards no mobile --- */
@media (max-width: 720px) {
  .admin-table-responsive .admin-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
}

@media (max-width: 720px) {
  .admin-topbar {
    padding: 12px 16px 0;
    padding-top: max(12px, env(safe-area-inset-top));
  }

  .admin-topbar__title {
    font-size: 1.2rem;
    line-height: 1.25;
  }

  .admin-topbar__subtitle {
    font-size: 0.82rem;
  }

  .admin-page {
    padding: 12px 16px 24px;
    padding-bottom: max(24px, env(safe-area-inset-bottom));
  }

  .admin-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .admin-toolbar--split {
    align-items: stretch;
  }

  .admin-toolbar__hint {
    text-align: center;
  }

  .admin-toolbar__group {
    width: 100%;
    justify-content: stretch;
  }

  .admin-toolbar__group .btn {
    flex: 1 1 auto;
    min-width: 0;
    text-align: center;
  }

  .admin-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .admin-kpi {
    padding: 12px;
  }

  .admin-kpi__value {
    font-size: 1.2rem;
    word-break: break-word;
  }

  .admin-guide {
    padding: 12px 14px;
  }

  .admin-guide__steps {
    font-size: 0.84rem;
  }

  .admin-filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    margin-bottom: 12px;
    scrollbar-width: none;
  }

  .admin-filters::-webkit-scrollbar {
    display: none;
  }

  .admin-filter {
    flex-shrink: 0;
    min-height: 40px;
  }

  .admin-panel__head {
    padding: 12px 14px;
  }

  .admin-panel__body--padded {
    padding: 12px 14px;
  }

  .admin-page .btn,
  .admin-page .btn--small {
    min-height: 44px;
    padding: 10px 14px;
  }

  .admin-table-responsive {
    overflow: visible;
  }

  .admin-table-responsive .admin-table {
    display: block;
    width: 100%;
  }

  .admin-table-responsive .admin-table tbody {
    display: block;
  }

  .admin-table-responsive .admin-table tbody tr {
    display: block;
    margin-bottom: 12px;
    border: 1px solid #e8eaed;
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  }

  .admin-table-responsive .admin-table tbody tr:hover {
    background: #fff;
  }

  .admin-table-responsive .admin-table td {
    display: grid;
    grid-template-columns: minmax(88px, 36%) 1fr;
    gap: 8px 12px;
    align-items: start;
    padding: 10px 14px;
    border-bottom: 1px solid #f0f0f0;
    white-space: normal;
  }

  .admin-table-responsive .admin-table td:last-child {
    border-bottom: none;
  }

  .admin-table-responsive .admin-table td::before {
    content: attr(data-label);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #888;
    font-weight: 700;
    padding-top: 2px;
  }

  .admin-table-responsive .admin-table td[data-label='']::before,
  .admin-table-responsive .admin-table td:not([data-label])::before {
    display: none;
  }

  .admin-table-responsive .admin-table__actions {
    grid-template-columns: 1fr;
    justify-items: stretch;
  }

  .admin-table-responsive .admin-table__actions::before {
    margin-bottom: 4px;
  }

  .admin-table-responsive .admin-table__actions .btn {
    width: 100%;
    justify-content: center;
  }

  .banned-item {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .banned-item .btn {
    width: 100%;
  }

  .gift-history__head {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .gift-history__head-actions {
    width: 100%;
    justify-content: space-between;
  }

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

  .label-row {
    flex-direction: column;
  }

  .label-row .btn {
    width: 100%;
  }

  .admin-status-row {
    gap: 6px;
  }

  .admin-master-zone .btn--danger {
    width: 100%;
  }
}

@media (max-width: 400px) {
  .admin-kpi-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: min(300px, 92vw);
    height: 100%;
    height: 100dvh;
    padding-top: max(20px, env(safe-area-inset-top));
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.25);
  }

  .admin-shell--sidebar-open .admin-sidebar {
    transform: translateX(0);
  }

  .admin-topbar__menu {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
  }
}

@media (min-width: 901px) {
  .admin-sidebar-backdrop {
    display: none !important;
  }
}

.admin-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.admin-detail-grid .admin-panel {
  margin-bottom: 0;
}

.admin-status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
}

.admin-status-row .session-detail-expires {
  font-size: 0.82rem;
  color: #888;
}

@media (max-width: 960px) {
  .admin-detail-grid {
    grid-template-columns: 1fr;
  }
}

.admin-page .card {
  border-radius: 12px;
  border: 1px solid #e8eaed;
  box-shadow: none;
}

.admin-page .card + .card {
  margin-top: 16px;
}

.admin-master-zone {
  border-color: #f5c6cb !important;
  background: #fffafa !important;
}

.admin-master-zone .card__title {
  color: #b71c1c;
}
