.account-gate {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(0, .94fr);
  max-width: 980px;
  min-height: 474px;
  margin: clamp(18px, 4vw, 54px) auto 48px;
  overflow: hidden;
  border: 1px solid var(--panel-edge);
  border-radius: var(--radius);
  background: var(--setup-panel);
  box-shadow: 0 18px 42px #10232820;
}

.account-gate-content {
  display: grid;
  align-content: center;
  gap: 12px;
  padding: clamp(22px, 4vw, 52px);
}

.account-admin-login {
  grid-template-columns: minmax(0, 1fr);
  max-width: 480px;
  min-height: auto;
}

.account-admin-login .account-gate-content { gap: 22px; }

.account-gate h1, .account-admin h1 {
  font: 760 clamp(1.9rem, 3.8vw, 3.2rem)/1.05 var(--display);
  overflow-wrap: anywhere;
  letter-spacing: -.035em;
}

.account-gate-content > h1[tabindex='-1']:focus { outline: none; }

.account-admin-login h1 { font-size: clamp(1.65rem, 3.7vw, 2.4rem); }

.account-intro {
  margin: 0 0 9px;
  color: var(--muted);
  font-size: .96rem;
  line-height: 1.55;
}

.account-gate-photo {
  min-height: 100%;
  border-inline-start: 1px solid var(--panel-edge);
  background: linear-gradient(160deg, #0b26362b, #1225307d), url('/arena.webp') center / cover;
}

.account-form {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.account-field {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--label);
  font-size: .89rem;
  font-weight: 690;
}

.account-field input:not([type='radio']):not([type='checkbox']), .account-field select {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 46px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--field-bg);
  color: var(--ink);
  font: inherit;
  font-size: max(1em, 16px);
}

.account-field input::placeholder { color: var(--placeholder); }
.account-field :is(input, select):focus-visible { outline: 2px solid var(--selected-edge); outline-offset: 1px; }
.account-field input[type='checkbox'], .account-field input[type='radio'] { accent-color: var(--selected-edge); }

.account-checkbox, .account-channel .account-field {
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.account-channel {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  margin: 0;
  padding: 7px 0 0;
  border: 0;
}

.account-channel legend { color: var(--label); font-weight: 700; font-size: .89rem; }
.account-form .primary { width: 100%; min-height: 45px; }
.account-hint { margin: 0; color: var(--muted); font-size: .83rem; font-weight: normal; line-height: 1.5; }
.account-verify-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }

.account-text-button {
  width: fit-content;
  min-height: 36px;
  padding: 5px 0;
  border: 0;
  background: transparent;
  color: var(--violet);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-align: left;
  font: inherit;
  font-size: .89rem;
  font-weight: 690;
  cursor: pointer;
}

.account-message, .account-trial {
  padding: 10px 13px;
  border: 1px solid var(--panel-edge);
  border-radius: 10px;
  background: var(--status-bg);
  color: var(--status-ink);
  font-size: .89rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.account-message[data-error='true'] {
  border-color: color-mix(in srgb, var(--error), var(--border) 45%);
  background: color-mix(in srgb, var(--error) 8%, var(--surface));
  color: var(--error);
}

.account-trial { width: fit-content; margin: 8px 0 12px; }
.app-dialog.account-dialog { width: min(calc(100% - 24px), 520px); }
.account-dialog > .account-message { margin-top: 12px; }
.account-details { display: grid; gap: 4px; overflow-wrap: anywhere; }
.account-details p { margin: 0; color: var(--muted); line-height: 1.5; }
.account-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.account-subtitle { border-top: 1px solid var(--border); padding-top: 14px; margin: 18px 0 10px; }

.account-avatar {
  position: relative;
  display: grid;
  flex: none;
  place-items: center;
  width: 28px;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--selected-edge);
  border-radius: 50%;
  background: var(--status-bg);
  color: var(--status-ink);
  font: 730 .62rem/1 var(--display);
}

.account-avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.account-avatar-large { width: 68px; font-size: 1.35rem; }
.app-dialog.account-profile-dialog { width: min(calc(100% - 24px), 560px); max-height: calc(100dvh - 24px); }
.account-profile { display: grid; gap: 12px; }
.account-profile-identity { display: flex; align-items: center; gap: 14px; min-width: 0; }
.account-profile-identity .account-details { flex: 1; min-width: 0; }
.account-profile-identity .account-details p { margin: 0; }
.account-photo-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.account-profile-section { display: grid; gap: 12px; padding-top: 14px; border-top: 1px solid var(--panel-edge); }
.account-profile-section h3 { margin: 0; font-size: 1rem; }
.account-profile-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.account-profile-section .primary { justify-self: start; width: auto; }
.account-profile-disclosure { border: 1px solid var(--border); border-radius: 11px; }
.account-profile-disclosure summary { min-height: 44px; padding: 12px; font-weight: 690; cursor: pointer; }
.account-profile-disclosure summary small { display: block; margin: 4px 0 0 14px; color: var(--muted); font-weight: 500; }
.account-profile-disclosure[open] summary { border-bottom: 1px solid var(--border); }
.account-profile-disclosure-body { display: grid; gap: 10px; padding: 12px; }
.app-dialog .account-profile p { margin-block: 0; }
.account-profile-dialog .account-toolbar { margin: 16px 0 0; }

@media (max-width: 440px) {
  .account-profile-fields { grid-template-columns: minmax(0, 1fr); }
  .account-profile-section .primary { width: 100%; }
  .account-avatar-large { width: 54px; font-size: 1.15rem; }
}

.account-admin {
  display: grid;
  gap: 18px;
  margin: clamp(18px, 3vw, 32px) 0 42px;
  min-width: 0;
}

.account-admin-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.account-user-filters { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); width: min(100%, 430px); gap: 8px; }

.account-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(138px, 1fr));
  gap: 9px;
  margin: 0;
}

.account-metric {
  padding: 12px;
  display: grid;
  gap: 5px;
  border: 1px solid var(--panel-edge);
  border-radius: 13px;
  background: var(--surface);
  overflow-wrap: anywhere;
}

.account-metric dt { color: var(--muted); font-size: .8rem; font-weight: 670; }
.account-metric dd { margin: 0; font: 750 clamp(1.1rem, 2.1vw, 1.55rem)/1.2 var(--display); color: var(--violet); font-variant-numeric: tabular-nums; }

.account-panel {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: clamp(12px, 2.7vw, 21px);
  border: 1px solid var(--panel-edge);
  border-radius: 16px;
  background: var(--surface);
}

.account-visit-period {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--nav-base);
}
.account-visit-option {
  min-height: 44px;
  padding: 4px 12px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: .84rem;
  font-weight: 700;
  white-space: nowrap;
}
.account-visit-option:hover { background: var(--nav-hover); color: var(--ink); }
.account-visit-option[aria-pressed='true'] { border-color: var(--selected-edge); background: var(--selected-bg); color: var(--ink); }
.account-visit-option:focus-visible { outline-offset: -2px; }
.account-visit-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.account-visit-card {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: clamp(12px, 2vw, 18px);
  border: 1px solid var(--panel-edge);
  border-radius: 12px;
  background: var(--setup-panel);
}
.account-visit-card h3 { color: var(--label); font-size: 1rem; overflow-wrap: anywhere; }
.account-visit-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0; }
.account-visit-stats > div { min-width: 0; }
.account-visit-stats > div + div { border-inline-start: 1px solid var(--border); padding-inline-start: 12px; }
.account-visit-stats dt { color: var(--muted); font-size: .82rem; font-weight: 670; }
.account-visit-stats dd {
  margin: 3px 0 0;
  color: var(--violet);
  font: 750 clamp(1.4rem, 3vw, 2rem)/1.1 var(--display);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.account-visits > button { justify-self: start; }

.account-table-wrap { overflow-x: auto; min-width: 0; }
.account-table { width: 100%; min-width: 580px; border-collapse: collapse; font-size: .88rem; text-align: start; }
.account-table th, .account-table td { padding: 9px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.account-table th { text-align: start; white-space: nowrap; color: var(--label); font-size: .78rem; }
.account-table td { color: var(--ink); }
.account-table td:not(:first-child) { white-space: nowrap; }
.account-table td:last-child { white-space: normal; overflow-wrap: anywhere; }
.account-table.account-user-table { min-width: 0; }
.account-table.account-user-table :is(th, td) { white-space: normal; overflow-wrap: anywhere; }
.account-user-label { display: grid; min-width: 0; overflow-wrap: anywhere; gap: 2px; }
.account-user-cell-label { display: none; }
.account-user-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.account-geo-credit { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.account-danger {
  color: var(--error);
  border-color: color-mix(in srgb, var(--error), var(--border) 55%);
}
.account-danger:hover:not(:disabled) {
  background: color-mix(in srgb, var(--error) 8%, var(--surface));
  border-color: var(--error);
}
.account-confirm[open] { display: grid; gap: 10px; }
.account-confirm-actions, .account-sync-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.account-badge { display: inline-block; padding: 4px 8px; border-radius: 999px; background: var(--status-bg); color: var(--status-ink); font-size: .76rem; font-weight: 700; }
.account-badge[data-status='paid'] { background: var(--positive-bg); color: #172c21; }
.account-badge[data-status='expired'] { color: var(--pending); }
.account-badge:is([data-status='blocked'], [data-status='banned']) { color: var(--error); }
.account-whatsapp-status { margin: 0; }
.account-whatsapp-status [data-status='pending'] { color: var(--pending); }
.account-whatsapp-status [data-status='unavailable'] { color: var(--error); }
.account-whatsapp-qr {
  display: grid;
  justify-items: start;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--panel-edge);
  border-radius: 12px;
}
.account-whatsapp-qr:empty { display: none; }
.account-whatsapp-qr img { display: block; width: min(100%, 252px); height: auto; background: #fff; border-radius: 7px; image-rendering: pixelated; }

@media (max-width: 960px) {
  .account-user-table-wrap { overflow: visible; }
  .account-user-table { display: block; }
  .account-user-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .account-user-table tbody { display: grid; gap: 8px; }
  .account-user-table tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--panel-edge);
    border-radius: 12px;
  }
  .account-user-table tbody td {
    display: grid;
    align-content: start;
    justify-items: start;
    gap: 3px;
    min-width: 0;
    padding: 0;
    border: 0;
  }
  .account-user-table tbody td:is(:first-child, :last-child) { grid-column: 1 / -1; }
  .account-user-cell-label { display: block; color: var(--label); font-size: .76rem; font-weight: 700; }
}

@media (max-width: 680px) {
  .account-gate { grid-template-columns: minmax(0, 1fr); min-height: auto; }
  .account-gate-photo { display: none; }
  .account-gate-content { padding: clamp(16px, 4.5vw, 26px); }
  .account-user-filters { grid-template-columns: minmax(0, 1fr); }
  .account-sync-fields { grid-template-columns: minmax(0, 1fr); }
  .account-visit-grid { grid-template-columns: minmax(0, 1fr); }
}

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