:root {
  color-scheme: light;
  --ink: #16222c;
  --muted: #667580;
  --line: #dbe4e8;
  --paper: #ffffff;
  --background: #eef4f3;
  --primary: #087f6f;
  --primary-dark: #06675b;
  --danger: #9f2f2f;
  --danger-bg: #fff0ef;
  --success: #087f4f;
  --success-bg: #eaf9f0;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}
.stats .card { display: flex; flex-direction: column; gap: .35rem; }
.stats b { font-size: 1.8rem; }
.stats span { color: var(--muted, #667085); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .8rem; border-bottom: 1px solid #e6e9ef; text-align: left; }
th { color: #667085; font-size: .8rem; text-transform: uppercase; }
.narrow { max-width: 480px; margin: 4rem auto; }
@media (max-width: 800px) { .stats { grid-template-columns: 1fr 1fr; } }

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top right, #d8eee8 0, transparent 34rem),
    var(--background);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

.page {
  width: min(100% - 32px, 680px);
  margin: 0 auto;
  padding: 34px 0 60px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 22px;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 13px;
  background: var(--primary);
  color: white;
  font-size: 22px;
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 18px;
}

.brand span {
  color: var(--muted);
  font-size: 13px;
}

.card {
  padding: clamp(24px, 5vw, 42px);
  border: 1px solid rgba(166, 187, 190, 0.55);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 18px 50px rgba(44, 74, 73, 0.09);
}

.eyebrow {
  margin-bottom: 8px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.15;
}

h1 {
  font-size: clamp(29px, 6vw, 42px);
  letter-spacing: -0.035em;
}

h2 {
  font-size: 26px;
}

.lead {
  margin: 15px 0 28px;
  color: #41515d;
  font-size: 17px;
  line-height: 1.6;
}

form {
  display: grid;
  gap: 18px;
}

label {
  display: grid;
  gap: 7px;
  font-size: 14px;
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid #b8c7cc;
  border-radius: 12px;
  background: white;
  color: var(--ink);
  font: inherit;
  font-weight: 450;
  outline: none;
}

input {
  height: 49px;
  padding: 0 14px;
}

select {
  height: 49px;
  padding: 0 14px;
}

textarea {
  padding: 13px;
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(8, 127, 111, 0.12);
}

button,
.button-link {
  display: inline-flex;
  min-height: 50px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 12px;
  background: var(--primary);
  color: white;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  text-decoration: none;
  transition: 140ms ease;
}

button:hover,
.button-link:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

button.secondary {
  width: 100%;
  margin-top: 10px;
  border: 1px solid #a9c7c0;
  background: #edf8f5;
  color: var(--primary-dark);
}

.privacy,
.muted {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.privacy {
  margin: 22px 0 0;
}

.alert {
  margin: 18px 0;
  padding: 14px 16px;
  border-radius: 12px;
  line-height: 1.5;
}

.alert ul {
  margin: 6px 0 0;
  padding-left: 20px;
}

.alert-error {
  border: 1px solid #f2c4c0;
  background: var(--danger-bg);
  color: var(--danger);
}

.alert-success {
  border: 1px solid #a9dfbf;
  background: var(--success-bg);
  color: var(--success);
}

.alert-test {
  border: 1px solid #efd08a;
  background: #fff8e6;
  color: #75540a;
}

.inline-form {
  display: inline;
}

.button-test {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 9px;
  background: #9a6500;
  white-space: nowrap;
}

.button-test:hover {
  background: #7d5200;
}

.status-chip {
  display: inline-flex;
  padding: 5px 9px;
  border-radius: 999px;
  background: #edf1f3;
  font-size: 12px;
  font-weight: 800;
}

.status-simulated {
  background: #fff1c7;
  color: #775000;
}

.payment-card {
  text-align: center;
}

.payment-card label {
  text-align: left;
}

.qr {
  display: block;
  width: min(100%, 280px);
  margin: 2px auto 24px;
  border: 1px solid var(--line);
  border-radius: 18px;
}

.status {
  display: flex;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 22px;
  padding: 12px 16px;
  border-radius: 12px;
  font-weight: 700;
}

.status.waiting {
  background: #edf6f7;
  color: #355e65;
}

.status.failed {
  background: var(--danger-bg);
  color: var(--danger);
}

.spinner {
  width: 17px;
  height: 17px;
  border: 2px solid #96b9bd;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.success-panel {
  padding: 18px 0 4px;
}

.success-icon {
  display: grid;
  width: 70px;
  height: 70px;
  margin: 0 auto 18px;
  place-items: center;
  border-radius: 50%;
  background: var(--success-bg);
  color: var(--success);
  font-size: 36px;
  font-weight: 900;
}

.success-panel p {
  margin: 13px auto 22px;
  color: var(--muted);
  line-height: 1.55;
}

.button-link {
  padding: 0 24px;
}

.text-link {
  color: var(--primary);
  font-weight: 800;
}

[hidden] {
  display: none !important;
}

@media (max-width: 520px) {
  .page {
    width: min(100% - 20px, 680px);
    padding-top: 18px;
  }

  .card {
    border-radius: 18px;
  }
}

.admin-body {
  background:
    radial-gradient(circle at 88% 0, #ccebe4 0, transparent 32rem),
    #f3f6f7;
}

.admin-page {
  width: min(100% - 36px, 1240px);
}

.login-logo {
  display: grid;
  max-width: 480px;
  margin: 3rem auto -2.5rem;
  padding: 18px;
  place-items: center;
  border-radius: 24px;
  background:
    radial-gradient(circle at 50% 0, rgba(45, 212, 191, 0.22), transparent 70%),
    linear-gradient(160deg, #0d2b4a, #07142b);
  box-shadow: 0 18px 44px rgba(10, 30, 58, 0.28);
}

.login-logo img {
  width: min(100%, 260px);
  height: auto;
}

.login-wordmark {
  color: #fff;
  font-size: 1.6rem;
  letter-spacing: 0.02em;
}

.admin-banner {
  gap: 28px;
  margin: 0 0 18px;
  padding: 22px clamp(20px, 4vw, 40px);
  border-radius: 26px;
  background:
    radial-gradient(circle at 12% 0, rgba(45, 212, 191, 0.20), transparent 46%),
    linear-gradient(135deg, #0d2b4a 0%, #07142b 100%);
  box-shadow: 0 18px 44px rgba(10, 30, 58, 0.24);
  color: #fff;
}

.banner-logo {
  flex: none;
  width: auto;
  height: 150px;
}

.banner-text {
  flex: 1;
  min-width: 0;
}

.admin-banner .eyebrow {
  color: #2dd4bf;
}

.admin-banner h1 {
  color: #fff;
}

.admin-hero.admin-banner p {
  color: rgba(255, 255, 255, 0.72);
}

.banner-logout {
  margin-right: clamp(0px, 4vw, 56px);
  min-width: 84px;
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.banner-logout:hover {
  background: rgba(255, 255, 255, 0.18);
}

@media (max-width: 720px) {
  .admin-banner { align-items: center; text-align: center; }
  .banner-logo { height: 120px; }
}

.admin-hero,
.section-heading,
.plan-card-head,
.telegram-only {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.admin-hero {
  padding: 10px 0 18px;
}

.admin-hero p {
  margin: 8px 0 0;
  color: var(--muted);
}

.secondary-link {
  min-width: 84px;
  min-height: 42px;
  border: 1px solid #b8d2cd;
  background: white;
  color: var(--primary-dark);
}

.admin-nav {
  position: sticky;
  z-index: 5;
  top: 0;
  display: flex;
  gap: 8px;
  margin: 10px 0 18px;
  padding: 8px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(255,255,255,.93);
  backdrop-filter: blur(12px);
}

.admin-nav a {
  padding: 9px 13px;
  border-radius: 10px;
  color: #40515c;
  font-size: 14px;
  font-weight: 750;
  text-decoration: none;
  white-space: nowrap;
}

.admin-nav a:hover {
  background: #e9f5f2;
  color: var(--primary-dark);
}

.stats-six {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metric {
  min-height: 122px;
  padding: 22px;
  border: 1px solid rgba(166,187,190,.55);
  border-radius: 18px;
  background: rgba(255,255,255,.94);
  box-shadow: 0 12px 30px rgba(44,74,73,.07);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 14px;
}

.metric b {
  display: block;
  margin-top: 14px;
  color: #123c36;
  font-size: 30px;
}

.admin-section {
  margin-top: 22px;
  padding: 26px;
  border: 1px solid rgba(166,187,190,.55);
  border-radius: 22px;
  background: rgba(255,255,255,.96);
  box-shadow: 0 14px 34px rgba(44,74,73,.07);
  scroll-margin-top: 80px;
}

.section-heading {
  margin-bottom: 18px;
}

.search-form {
  display: flex;
  grid-template-columns: minmax(220px, 360px) auto;
  gap: 8px;
}

.search-form input {
  width: min(42vw, 360px);
}

.search-form button,
.button-small {
  min-height: 38px;
  padding: 0 13px;
}

.action-panel {
  margin: 16px 0 22px;
  padding: 15px 17px;
  border: 1px dashed #9fc5bd;
  border-radius: 14px;
  background: #f5fbf9;
}

.action-panel summary {
  cursor: pointer;
  color: var(--primary-dark);
  font-weight: 800;
}

.action-panel h4 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 20px 0 8px;
  color: var(--primary-dark);
}

.admin-form {
  margin-top: 16px;
}

.form-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
}

.form-grid.two {
  grid-template-columns: 1fr 1fr;
}

.form-grid button {
  height: 49px;
}

.form-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-grid .field-wide {
  grid-column: 1 / -1;
}

.form-grid .field-wide small {
  color: var(--muted);
  font-weight: 450;
}

.campaign-link {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.button-block {
  width: 100%;
}

.campaign-delete {
  margin-top: 10px;
}

.button-danger-outline {
  border: 1px solid #e0b3b3;
  background: white;
  color: var(--danger);
}

.button-danger-outline:hover {
  background: var(--danger-bg);
}

.plan-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.coupon-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.coupon-grid .form-grid.two {
  display: grid;
  gap: 14px;
  align-items: start;
}

[data-only][hidden] {
  display: none !important;
}

.coupon-meta {
  margin: 8px 0 0;
}

.coupon-grid .form-grid small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-weight: 450;
}

@media (max-width: 900px) {
  .coupon-grid { grid-template-columns: 1fr; }
}

.plan-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: #fbfdfd;
}

.plan-card-head b {
  font-size: 21px;
}

.plan-inactive {
  opacity: .68;
  background: #f1f3f4;
}

.button-quiet {
  width: 100%;
  min-height: 38px;
  margin-top: 9px;
  border: 1px solid #b9c8cc;
  background: white;
  color: #4d5d67;
}

.button-danger {
  background: #a33a3a;
}

.button-danger:hover {
  background: #852d2d;
}

.status-active,
.status-completed {
  background: #dcf5e7;
  color: #087044;
}

.status-expired,
.status-revoked {
  background: #f3e6e5;
  color: #8a3737;
}

.status-pending,
.status-creating,
.status-scheduled {
  background: #eaf1f8;
  color: #315d84;
}

.status-sent {
  background: #dcf5e7;
  color: #087044;
}

.status-failed,
.status-error {
  background: #f3e6e5;
  color: #8a3737;
}

.status-critical {
  background: #8a3737;
  color: #fff;
}

.status-warning {
  background: #fff1c7;
  color: #775000;
}

.resolved-errors {
  margin-top: 16px;
}

.resolved-errors summary {
  cursor: pointer;
  color: var(--muted, #667085);
  font-weight: 700;
}

.telegram-only {
  margin: 20px 0 0;
  padding: 17px 20px;
  border: 1px solid #a9d8ce;
  border-radius: 15px;
  background: #eaf8f4;
  color: #175c50;
}

.telegram-only span {
  color: #437168;
}

.summary-section {
  scroll-margin-top: 80px;
}

.period-form {
  display: grid;
  grid-template-columns: minmax(230px, 1fr) 170px 170px auto auto;
  align-items: end;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(255,255,255,.94);
}

.period-form strong {
  display: block;
  color: #203d38;
  font-size: 18px;
}

.period-form label {
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}

.period-form button,
.button-quiet-link {
  min-height: 49px;
  padding: 0 16px;
  white-space: nowrap;
}

.button-quiet-link {
  border: 1px solid #b9c8cc;
  background: white;
  color: #4d5d67;
}

.button-quiet-link:hover {
  background: #edf5f3;
  color: var(--primary-dark);
}

.settings-card {
  display: grid;
  grid-template-columns: minmax(280px, 1.5fr) minmax(180px, .65fr) auto;
  align-items: end;
  gap: 15px;
  padding: 18px;
  border: 1px solid #d4e2df;
  border-radius: 16px;
  background: #f8fcfb;
}

.sheet-settings {
  grid-template-columns: minmax(280px, 1.1fr) minmax(320px, 1.5fr) minmax(150px, .6fr) auto;
}

.reminder-settings {
  grid-template-columns: minmax(280px, 1.2fr) minmax(210px, .8fr) minmax(210px, .8fr);
}

.referral-settings {
  grid-template-columns: minmax(280px, 1.2fr) repeat(3, minmax(150px, .55fr));
}

.group-settings {
  grid-template-columns: minmax(300px, 1.3fr) minmax(230px, .8fr) minmax(190px, .55fr) auto;
}

.referral-switch,
.group-switch {
  grid-column: 1 / -1;
}

.referral-stats {
  grid-template-columns: repeat(4, 1fr);
  margin-bottom: 16px;
}

.group-stats {
  grid-template-columns: repeat(2, minmax(180px, 260px));
  margin-bottom: 16px;
}

.referral-table {
  margin-top: 16px;
}

.setup-steps {
  margin: 16px 0 0;
  padding-left: 24px;
  color: #53656d;
  font-size: 13px;
  line-height: 1.65;
}

.setup-steps code {
  color: var(--primary-dark);
  font-weight: 800;
}

.reminder-switch {
  grid-column: 1 / -1;
}

.reminder-message {
  grid-column: 1 / -1;
}

.reminder-message textarea {
  min-height: 165px;
  resize: vertical;
  line-height: 1.5;
}

.reminder-settings small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.reminder-settings code {
  color: var(--primary-dark);
  font-size: 11px;
}

.settings-card button {
  min-height: 49px;
  padding: 0 18px;
}

.switch-row {
  display: flex;
  min-height: 49px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 13px;
  border: 1px solid #c5d5d2;
  border-radius: 12px;
  background: white;
}

.switch-row span,
.switch-row small {
  display: block;
}

.switch-row small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.35;
}

.switch-row input[type="checkbox"] {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  accent-color: var(--primary);
}

.sync-summary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 22px;
  margin-top: 14px;
  padding: 13px 15px;
  border-radius: 12px;
  background: #f0f5f5;
  color: #4b6068;
  font-size: 13px;
}

.sync-summary a {
  color: var(--primary-dark);
  font-weight: 800;
}

.client-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -2px 0 16px;
}

.client-filters a {
  padding: 8px 12px;
  border: 1px solid #cad8db;
  border-radius: 999px;
  background: #f7fafb;
  color: #4e6069;
  font-size: 13px;
  font-weight: 750;
  text-decoration: none;
}

.client-filters a:hover,
.client-filters .filter-active {
  border-color: #80b9ad;
  background: #e6f5f1;
  color: var(--primary-dark);
}

.telegram-cell {
  min-width: 170px;
}

.telegram-username {
  display: inline-block;
  color: var(--primary-dark);
  font-weight: 850;
  text-decoration: none;
}

.telegram-username:hover {
  text-decoration: underline;
}

.telegram-missing {
  color: #78868d;
  font-size: 13px;
  font-weight: 700;
}

.telegram-id {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 5px;
  color: #87939a;
  font-size: 10px;
  white-space: nowrap;
}

.copy-id {
  min-height: 22px;
  padding: 0 7px;
  border: 1px solid #d1dadd;
  border-radius: 7px;
  background: #f7f9fa;
  color: #64737b;
  font-size: 9px;
}

.copy-id:hover {
  background: #eaf4f2;
  color: var(--primary-dark);
  transform: none;
}

.mini-label {
  display: inline-flex;
  margin-top: 4px;
  padding: 3px 7px;
  border-radius: 999px;
  background: #e7f4fb;
  color: #35657e;
  font-size: 10px;
  font-weight: 800;
}

.mini-failed {
  background: #f7e7e5;
  color: #923b3b;
}

.reminder-date {
  white-space: nowrap;
}

.contact-state {
  display: inline-flex;
  align-items: center;
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 850;
  white-space: nowrap;
}

.contact-ok {
  background: #dcf5e7;
  color: #087044;
}

.contact-failed {
  background: #f3e6e5;
  color: #8a3737;
}

.contact-unknown {
  background: #fff1c7;
  color: #775000;
}

.contact-none {
  background: #edf1f3;
  color: #66757d;
}

.actions-menu {
  position: relative;
  min-width: 48px;
}

.actions-menu > summary {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid #c8d5d8;
  border-radius: 10px;
  background: white;
  color: #40545c;
  cursor: pointer;
  font-size: 22px;
  font-weight: 900;
  list-style: none;
}

.actions-menu > summary::-webkit-details-marker {
  display: none;
}

.actions-menu[open] > summary {
  border-color: #76ad9f;
  background: #eaf6f3;
  color: var(--primary-dark);
}

.actions-list {
  display: grid;
  width: 230px;
  gap: 8px;
  margin-top: 8px;
  padding: 10px;
  border: 1px solid #cfdbde;
  border-radius: 13px;
  background: white;
  box-shadow: 0 12px 28px rgba(35,65,66,.14);
}

.actions-list > a,
.actions-list > button,
.actions-list > form > button {
  display: flex;
  width: 100%;
  min-height: 36px;
  align-items: center;
  justify-content: flex-start;
  padding: 0 10px;
  border-radius: 8px;
  background: #f1f7f6;
  color: #315d56;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.actions-list > a:hover,
.actions-list > button:hover,
.actions-list > form > button:hover {
  background: #e1f1ed;
  color: var(--primary-dark);
  transform: none;
}

.actions-list form {
  display: block;
}

.actions-list .menu-danger {
  background: #fff0ef;
  color: #9f2f2f;
}

.extend-form {
  padding: 9px;
  border: 1px solid #dce5e7;
  border-radius: 9px;
  background: #fafcfc;
}

.extend-form label {
  gap: 5px;
  color: #5f7078;
  font-size: 11px;
}

.extend-form label > span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.extend-form input {
  width: 76px;
  height: 34px;
  padding: 0 9px;
  border-radius: 8px;
}

.extend-form small {
  font-size: 11px;
}

.extend-form button {
  width: 100%;
  min-height: 34px;
  margin-top: 8px;
  padding: 0 9px;
  border-radius: 8px;
  font-size: 11px;
}

.history-panel {
  margin: 18px 0;
  padding: 20px;
  border: 1px solid #a9d5cc;
  border-radius: 16px;
  background: #f6fcfa;
}

.history-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.history-head h3 {
  margin: 0 0 4px;
  font-size: 20px;
}

.history-close {
  padding: 7px 10px;
  border-radius: 9px;
  background: white;
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.history-list {
  display: grid;
  gap: 0;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.history-list li {
  display: grid;
  grid-template-columns: 13px 1fr;
  gap: 11px;
  padding: 10px 0;
  border-top: 1px solid #dce8e5;
}

.history-list p {
  margin: 3px 0;
  color: #5c6f76;
  font-size: 13px;
}

.history-list time {
  color: #87939a;
  font-size: 11px;
}

.history-marker {
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border-radius: 50%;
  background: #7b8d94;
}

.history-success {
  background: #199763;
}

.history-warning {
  background: #d39b21;
}

.history-failed {
  background: #b84a4a;
}

@media (max-width: 900px) {
  .stats-six,
  .plan-grid,
  .referral-stats {
    grid-template-columns: 1fr 1fr;
  }
  .form-grid,
  .form-grid.three {
    grid-template-columns: 1fr 1fr;
  }
  .period-form {
    grid-template-columns: 1fr 1fr;
  }
  .period-form > div {
    grid-column: 1 / -1;
  }
  .settings-card,
  .sheet-settings,
  .reminder-settings,
  .referral-settings,
  .group-settings {
    grid-template-columns: 1fr 1fr;
  }
  .reminder-switch,
  .reminder-message,
  .referral-switch,
  .group-switch {
    grid-column: 1 / -1;
  }
}

@media (max-width: 620px) {
  .admin-page { width: min(100% - 18px, 1240px); }
  .admin-hero,
  .section-heading,
  .telegram-only { align-items: stretch; flex-direction: column; }
  .stats-six,
  .referral-stats,
  .group-stats,
  .plan-grid,
  .form-grid,
  .form-grid.two,
  .form-grid.three,
  .period-form,
  .settings-card,
  .sheet-settings,
  .reminder-settings,
  .referral-settings,
  .group-settings { grid-template-columns: 1fr; }
  .reminder-switch,
  .reminder-message,
  .referral-switch,
  .group-switch { grid-column: auto; }
  .search-form input { width: 100%; }
  .admin-section { padding: 18px 14px; }
}

.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}

.pager-pages {
  display: flex;
  gap: 6px;
}

.pager-pages button {
  min-width: 38px;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

.pager-pages button:hover:not(:disabled) {
  border-color: var(--primary);
}

.pager-pages button.is-current {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
  font-weight: 700;
}

.pager-pages button:disabled {
  opacity: 0.45;
  cursor: default;
}

.pager-size {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.pager-size select {
  min-height: 38px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
}

.fee-report .metric small { display: block; margin-top: 6px; color: var(--muted); font-size: 13px; }
.fee-report .metric b { font-size: 26px; }
.fee-report .metric-net { border-color: rgba(46,125,105,.55); }
.fee-report .metric-net b { color: var(--primary-dark); }
.fee-report .table-wrap { margin-top: 18px; }

/* --- Site público: logo, aviso, planos, rodapé ------------------------------------ */
.brand-logo {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  object-fit: contain;
  padding: 4px;
}

.notice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin: 18px 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f6f9f9;
}

.notice-icon {
  flex: none;
  font-size: 1.15rem;
  line-height: 1.3;
  color: var(--muted);
}

.notice strong {
  display: block;
  margin-bottom: 4px;
}

.notice p {
  margin: 0;
  color: var(--muted);
  font-size: 0.93rem;
  line-height: 1.5;
}

/* Aviso de destaque na tela do código: o e-mail costuma cair no spam. */
.spam-hint {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin: 18px 0;
  padding: 16px 18px;
  border: 1px solid #efd08a;
  border-left: 6px solid #e0a82e;
  border-radius: 14px;
  background: #fff8e6;
  color: #5c4208;
}

.spam-hint-icon {
  flex: none;
  font-size: 1.9rem;
  line-height: 1.1;
}

.spam-hint strong {
  display: block;
  margin-bottom: 6px;
  font-size: 1.08rem;
  color: #4a3306;
}

.spam-hint p {
  margin: 0 0 6px;
  font-size: 0.95rem;
  line-height: 1.5;
}

.spam-hint p:last-child {
  margin-bottom: 0;
}

.plans {
  margin: 0 0 18px;
  padding: 0;
  border: 0;
}

.plans legend {
  padding: 0;
  margin-bottom: 8px;
  font-weight: 600;
}

.plan-option {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin: 0 0 10px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
}

.plan-option:has(input:checked) {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(8, 127, 111, 0.18);
}

.plan-option input {
  flex: none;
  width: auto;
  margin-top: 4px;
}

.plan-option strong,
.plan-option small {
  display: block;
}

.plan-option small {
  margin-top: 3px;
  color: var(--muted);
  font-weight: 400;
}

.bullets {
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
  line-height: 1.8;
}

.how {
  margin: 18px 0 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f6f9f9;
}

.how summary {
  cursor: pointer;
  font-weight: 600;
}

.coupon-form {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.site-footer {
  margin-top: 22px;
  text-align: center;
}

.site-footer a {
  color: var(--primary-dark);
  font-weight: 600;
  text-decoration: none;
}

/* --- Indicações do cliente (site) ------------------------------------------------------ */
.ref-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 4px 0 14px;
}

.ref-stats > div {
  padding: 12px 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f6f9f9;
  text-align: center;
}

.ref-stats b {
  display: block;
  font-size: 1.55rem;
  line-height: 1.1;
}

.ref-stats span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.25;
}

.ref-progress-text {
  margin: 0 0 8px;
}

.ref-progress {
  height: 10px;
  margin-bottom: 18px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line);
}

.ref-progress span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--primary);
}

/* --- Botão Sair do site ------------------------------------------------------------------ */
.brand-logout {
  margin: 0 0 0 auto;
}

.brand-logout button {
  width: auto;
  min-height: 38px;
  padding: 0 18px;
  font-size: 0.92rem;
}
