:root {
  --gate-shadow: 0 28px 90px rgba(11, 19, 32, .24);
}

[hidden] { display: none !important; }

.access-gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  overflow-y: auto;
  padding: max(22px, env(safe-area-inset-top)) 18px max(22px, env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at 20% 5%, rgba(184, 240, 74, .22), transparent 24rem),
    linear-gradient(145deg, #0b1320, #172437);
}

body.app-ready .access-gate { display: none; }
body.auth-pending .workspace,
body.auth-locked .workspace { visibility: hidden; }

.gate-card {
  width: min(430px, 100%);
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 30px;
  background: rgba(255, 255, 255, .97);
  box-shadow: var(--gate-shadow);
}

.gate-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 30px;
}

.gate-brand img {
  width: 48px;
  height: 48px;
  border-radius: 15px;
}

.gate-brand strong,
.gate-brand span { display: block; }
.gate-brand strong { color: var(--ink); font-size: 24px; letter-spacing: -1px; }
.gate-brand span { margin-top: 2px; color: var(--muted); font-size: 10px; }

.gate-state h1 {
  margin: 6px 0;
  color: var(--ink);
  font-size: 28px;
  line-height: 1.08;
  letter-spacing: -1px;
}

.gate-state > p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.gate-kicker {
  color: #6d7c53;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 1.4px;
}

#gate-loading {
  padding: 30px 0 18px;
  text-align: center;
}

.gate-spinner {
  width: 44px;
  height: 44px;
  display: block;
  margin: 0 auto 18px;
  border: 5px solid #e9eee0;
  border-top-color: var(--lime);
  border-radius: 50%;
  animation: gate-spin .8s linear infinite;
}

@keyframes gate-spin { to { transform: rotate(360deg); } }

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin: 20px 0 16px;
  padding: 4px;
  border-radius: 13px;
  background: #ecefe8;
}

.auth-tabs button {
  border: 0;
  border-radius: 10px;
  padding: 10px;
  color: var(--muted);
  background: transparent;
  font-size: 11px;
  font-weight: 800;
}

.auth-tabs button.active {
  color: var(--ink);
  background: white;
  box-shadow: 0 5px 15px rgba(11, 19, 32, .08);
}

.auth-form,
.profile-form,
.admin-settings {
  display: grid;
  gap: 12px;
}

.auth-form label,
.profile-form label,
.admin-settings label,
.export-card label {
  color: #5e6672;
  font-size: 9px;
  font-weight: 800;
}

.auth-form input,
.auth-form select,
.profile-form input,
.admin-settings input,
.export-card select {
  width: 100%;
  margin-top: 5px;
  border: 1px solid #dfe3da;
  border-radius: 12px;
  padding: 11px 12px;
  color: var(--ink);
  background: white;
  outline: none;
  font-size: 12px;
}

.auth-form input:focus,
.auth-form select:focus,
.profile-form input:focus,
.admin-settings input:focus,
.export-card select:focus {
  border-color: #91be38;
  box-shadow: 0 0 0 3px rgba(184, 240, 74, .25);
}

.consent-check {
  display: grid !important;
  grid-template-columns: 19px 1fr;
  align-items: start;
  gap: 8px;
  line-height: 1.5;
}

.consent-check input {
  width: 17px;
  height: 17px;
  margin: 1px 0 0;
  accent-color: var(--ink);
}

.consent-check a { color: #3f6412; }

.form-message {
  min-height: 18px;
  margin-top: 10px;
  color: #c8493c;
  font-size: 10px;
  line-height: 1.4;
}

.form-message.success { color: var(--success); }

.gate-privacy {
  margin-top: 10px !important;
  padding: 10px;
  border-radius: 11px;
  color: #53653a !important;
  background: var(--lime-soft);
  font-size: 9px !important;
}

.price-card {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  margin: 18px 0 12px;
  padding: 16px;
  border-radius: 18px;
  color: white;
  background: var(--ink);
}

.price-card span,
.price-card small { color: #9ca8b7; }
.price-card span { align-self: start; font-size: 8px; font-weight: 900; letter-spacing: 1px; }
.price-card strong { grid-row: 1 / span 2; grid-column: 2; color: var(--lime); font-size: 27px; }
.price-card small { font-size: 9px; }

.payment-methods {
  display: grid;
  gap: 7px;
  margin-bottom: 13px;
}

.payment-method {
  display: grid;
  grid-template-columns: 30px 1fr;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
}

.payment-method b {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 9px;
}

.payment-method strong,
.payment-method small { display: block; }
.payment-method strong { font-size: 10px; }
.payment-method small { margin-top: 2px; color: var(--muted); font-size: 8px; }

.payment-history { display: grid; gap: 6px; margin-top: 12px; }
.payment-history-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  border-radius: 11px;
  background: #f1f3ee;
  font-size: 9px;
}
.payment-history-item span { color: var(--muted); }

.text-button {
  width: 100%;
  margin-top: 12px;
  border: 0;
  padding: 8px;
  color: var(--muted);
  background: transparent;
  font-size: 10px;
  font-weight: 800;
}

.danger-text { color: #c8493c; }

.avatar {
  border: 0;
  cursor: pointer;
}

.month-switcher {
  display: grid;
  grid-template-columns: 35px 1fr 35px;
  align-items: center;
  gap: 8px;
  margin: 14px 0 12px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
}

.month-switcher.compact { margin-top: 12px; }
.month-switcher button {
  height: 32px;
  border: 0;
  border-radius: 10px;
  color: var(--ink);
  background: #eff2eb;
  font-size: 20px;
  font-weight: 900;
}
.month-switcher strong {
  text-align: center;
  color: var(--ink);
  font-size: 11px;
  text-transform: capitalize;
}

.date-group { margin: 15px 0 6px; color: var(--muted); font-size: 8px; font-weight: 900; letter-spacing: 1px; text-transform: uppercase; }

.import-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 13px;
}

.import-card .import-actions button {
  display: grid;
  justify-items: center;
  gap: 4px;
  margin: 0;
  border: 1px solid #354257;
  color: white;
  background: #202d3e;
}

.import-card .import-actions button span {
  color: var(--lime);
  font-size: 18px;
}

.export-card {
  margin-top: 12px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: white;
}

.export-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 13px;
}
.export-heading > span {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  flex: 0 0 40px;
  border-radius: 13px;
  color: var(--ink);
  background: var(--lime);
  font-size: 19px;
}
.export-heading strong,
.export-heading small { display: block; }
.export-heading strong { font-size: 12px; }
.export-heading small { margin-top: 3px; color: var(--muted); font-size: 8px; line-height: 1.4; }

.export-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}
.export-actions button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 11px;
  color: var(--ink);
  background: #f4f6f1;
}
.export-actions b { font-size: 8px; }
.export-actions span { font-size: 10px; font-weight: 800; }
#export-status { min-height: 14px; margin: 8px 0 0; color: var(--success); font-size: 8px; text-align: center; }

.wide-modal { width: min(640px, 100%); }
.admin-modal { width: min(720px, 100%); max-height: min(860px, 90vh); overflow-y: auto; text-align: left; }
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 15px; }
.secondary-button {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 11px;
  color: var(--ink);
  background: #f4f6f1;
  font-size: 10px;
  font-weight: 900;
}

.import-review {
  max-height: 48vh;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  text-align: left;
}
.import-review-row {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border-bottom: 1px solid #eef0eb;
}
.import-review-row:last-child { border-bottom: 0; }
.import-review-row input { width: 16px; height: 16px; accent-color: var(--ink); }
.import-review-row strong,
.import-review-row small { display: block; }
.import-review-row strong { font-size: 10px; }
.import-review-row small { margin-top: 2px; color: var(--muted); font-size: 8px; }
.import-review-row b { font-size: 10px; }
.import-warning { padding: 12px; color: #815a14; background: #fff6df; font-size: 9px; line-height: 1.5; }

.profile-large {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  margin: 0 auto;
  border-radius: 18px;
  color: var(--lime);
  background: var(--ink);
  font-size: 24px;
  font-weight: 900;
}
.profile-form { margin: 18px 0 10px; text-align: left; }
.profile-security {
  margin: 12px 0;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  text-align: left;
}
.profile-security summary { cursor: pointer; color: #414a58; font-size: 11px; font-weight: 850; }
.profile-security .profile-form { margin-bottom: 6px; }
.subscription-mini {
  padding: 11px;
  border-radius: 12px;
  color: #53653a;
  background: var(--lime-soft);
  font-size: 9px;
  line-height: 1.5;
}

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.admin-settings { margin-top: 16px; text-align: left; }
.admin-section { margin-top: 22px; }
.admin-section h4 { margin: 0 0 9px; font-size: 13px; }
.admin-list-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 7px;
  background: #fafbf8;
}
.admin-list-item strong,
.admin-list-item small { display: block; }
.admin-list-item strong { font-size: 10px; }
.admin-list-item small { margin-top: 3px; color: var(--muted); font-size: 8px; line-height: 1.4; }
.admin-list-actions { display: flex; gap: 5px; }
.admin-list-actions button {
  border: 0;
  border-radius: 9px;
  padding: 7px 8px;
  color: var(--ink);
  background: var(--lime);
  font-size: 8px;
  font-weight: 900;
}
.admin-list-actions button.reject { color: #a63e32; background: #ffe7e2; }

.progress-track div { width: 100%; }

@media (max-width: 520px) {
  .gate-card { padding: 22px 18px; border-radius: 24px; }
  .gate-state h1 { font-size: 25px; }
  .form-grid,
  .modal-actions { grid-template-columns: 1fr; }
  .modal { padding: 24px 18px; }
  .admin-modal { max-height: 94vh; }
}

@media (display-mode: standalone) {
  .access-gate { padding-top: calc(18px + env(safe-area-inset-top)); }
}
