:root {
  --bg: #0b0d10;
  --surface: #12161b;
  --surface-strong: #171c23;
  --surface-soft: #0f1318;
  --border: #262d36;
  --border-strong: #313947;
  --text: #f3f5f7;
  --muted: #97a3b3;
  --accent: #4da3ff;
  --accent-soft: rgba(77, 163, 255, 0.14);
  --success: #46bf8a;
  --warning: #e0a74f;
  --danger: #f07c7c;
  --shadow: 0 22px 56px rgba(0, 0, 0, 0.26);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 18px;
  --radius-sm: 14px;
  --shell-max: 1500px;
  --content-max: 1180px;
  --reading-max: 860px;
  --data-max: 1320px;
  --gutter: clamp(16px, 2vw, 32px);
  --section-gap: clamp(18px, 2.4vw, 28px);
  --stack-gap: clamp(14px, 1.4vw, 20px);
  --panel-padding: clamp(16px, 1.65vw, 22px);
  --button-height: 44px;
  --measure: 66ch;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: "Manrope", system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
}

body.nav-open {
  overflow: hidden;
}

body::selection {
  background: rgba(77, 163, 255, 0.32);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea {
  font: inherit;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

code {
  font-family: "Space Grotesk", monospace;
  font-size: 0.94em;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.hidden {
  display: none !important;
}

.site-backdrop {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at top left, rgba(77, 163, 255, 0.08), transparent 34%),
    radial-gradient(circle at bottom right, rgba(77, 163, 255, 0.04), transparent 28%);
}

.app-shell {
  position: relative;
  width: min(var(--shell-max), calc(100% - (var(--gutter) * 2)));
  margin: 0 auto;
  padding: clamp(14px, 2vw, 24px) 0 clamp(40px, 5vw, 64px);
}

.page {
  display: grid;
  gap: var(--section-gap);
  width: 100%;
}

.page--landing {
  width: min(100%, var(--content-max));
  margin-inline: auto;
}

.page--login,
.page--register,
.page--news,
.page--subscription {
  width: min(100%, var(--reading-max));
  margin-inline: auto;
}

.page--dashboard,
.page--security,
.page--admin {
  width: min(100%, var(--data-max));
  margin-inline: auto;
}

.site-header,
.site-footer,
.panel,
.profile-card,
.empty-card,
.history-card,
.news-card,
.admin-stat,
.admin-user-panel,
.admin-profile-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.site-header,
.site-footer {
  border-radius: var(--radius-xl);
}

.site-header {
  position: sticky;
  top: 14px;
  z-index: 30;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  margin-bottom: clamp(18px, 2.8vw, 30px);
  padding: 14px 18px;
  backdrop-filter: blur(12px);
  background: rgba(18, 22, 27, 0.88);
}

.site-header__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
}

.site-header__panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-width: 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(0.98rem, 0.35vw + 0.92rem, 1.08rem);
  font-weight: 700;
  letter-spacing: 0.03em;
}

.brand__text {
  min-width: 0;
}

.brand__mark {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 6px rgba(77, 163, 255, 0.12);
}

.site-nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
  cursor: pointer;
}

.site-nav-toggle span {
  display: block;
  width: 16px;
  height: 2px;
  margin: 2px 0;
  border-radius: 999px;
  background: currentColor;
  transition: transform 180ms ease, opacity 180ms ease;
}

body.nav-open .site-nav-toggle span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

body.nav-open .site-nav-toggle span:nth-child(2) {
  opacity: 0;
}

body.nav-open .site-nav-toggle span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

.site-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
  color: var(--muted);
}

.site-nav a,
.site-footer a {
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid transparent;
}

.site-nav a:hover,
.site-nav a.is-active {
  color: var(--text);
  border-color: rgba(77, 163, 255, 0.18);
  background: rgba(77, 163, 255, 0.08);
}

.header-actions,
.hero-actions,
.profile-card__actions,
.history-card__actions,
.subscription-actions-grid,
.form-inline,
.form-inline--actions,
.site-footer__links,
.chip-row,
.admin-inline-actions,
.admin-inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.header-actions {
  align-items: center;
  justify-content: flex-end;
}

.header-actions .button,
.hero-actions .button {
  flex: 0 0 auto;
}

.profile-card__actions .button,
.form-inline .button,
.form-inline--actions .button,
.admin-inline-actions .button,
.admin-inline-form .button {
  flex: 1 1 168px;
}

.site-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px 24px;
  align-items: end;
  margin-top: clamp(24px, 4vw, 40px);
  padding: 18px 20px;
}

.site-footer p,
.page-lead,
.panel__head p,
.support-card p,
.news-card p,
.history-card__meta,
.empty-card p,
.auth-footnote,
.field-hint,
.form-feedback,
.inline-note,
.profile-card__meta,
.news-card__meta,
.admin-empty {
  color: var(--muted);
  line-height: 1.62;
}

.site-footer p {
  max-width: 48ch;
}

.site-footer__links {
  align-items: center;
  justify-content: flex-end;
}

.site-footer__links a {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid transparent;
}

.site-footer__links a:hover {
  color: var(--text);
  border-color: rgba(77, 163, 255, 0.18);
  background: rgba(77, 163, 255, 0.08);
}

.eyebrow {
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

h1,
h2,
h3,
h4 {
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: -0.03em;
}

h1 {
  font-size: clamp(2.15rem, 1.55rem + 2.6vw, 4.45rem);
  line-height: 0.98;
  text-wrap: balance;
}

h2 {
  font-size: clamp(1.28rem, 1.08rem + 0.9vw, 1.9rem);
  line-height: 1.06;
  text-wrap: balance;
}

h3 {
  font-size: clamp(1rem, 0.95rem + 0.35vw, 1.14rem);
  line-height: 1.18;
}

.page-lead {
  max-width: var(--measure);
  font-size: clamp(1rem, 0.95rem + 0.25vw, 1.08rem);
}

.page-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px 24px;
  align-items: end;
}

.page-intro > :first-child {
  display: grid;
  gap: 12px;
}

.page-intro--compact {
  max-width: 760px;
  grid-template-columns: minmax(0, 1fr);
}

.page-intro h1 {
  max-width: 14ch;
}

.page--news .page-intro h1,
.page--dashboard .page-intro h1,
.page--admin .page-intro h1,
.page--security .page-intro h1 {
  max-width: 15ch;
}

.panel,
.profile-card,
.empty-card,
.history-card,
.news-card,
.admin-stat,
.admin-user-panel,
.admin-profile-panel {
  border-radius: var(--radius-lg);
  padding: var(--panel-padding);
}

.panel {
  display: grid;
  gap: var(--stack-gap);
}

.panel--form,
.panel--soft {
  min-height: 100%;
}

.panel__head,
.hero-copy,
.hero-card,
.support-card,
.news-card,
.history-card,
.empty-card {
  display: grid;
  gap: 12px;
}

.panel__head--split,
.subscription-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.hero-panel,
.dashboard-grid,
.auth-grid,
.section-grid,
.security-layout,
.admin-layout {
  display: grid;
  gap: clamp(16px, 1.8vw, 22px);
}

.hero-panel {
  grid-template-columns: minmax(0, 1.04fr) minmax(320px, 0.96fr);
  align-items: stretch;
}

.hero-copy {
  align-content: start;
  padding: clamp(10px, 1.6vw, 18px) 0;
}

.hero-copy h1 {
  max-width: 10.5ch;
}

.hero-copy .page-lead {
  max-width: 58ch;
}

.hero-actions {
  margin-top: 6px;
}

.hero-card {
  align-content: start;
}

.hero-metrics {
  display: grid;
  gap: 14px;
}

.hero-metrics article,
.stat-card,
.admin-stat {
  display: grid;
  gap: 8px;
}

.hero-metrics article {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.hero-metrics article span {
  color: var(--muted);
  line-height: 1.58;
}

.section-grid--three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.section-grid--two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.step-card,
.support-card {
  align-content: start;
}

.support-card .button {
  align-self: start;
}

.step-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-family: "Space Grotesk", sans-serif;
}

.auth-layout {
  display: grid;
  gap: clamp(18px, 2.5vw, 26px);
  justify-items: center;
  padding: clamp(10px, 2vw, 22px) 0 4px;
}

.download-layout {
  display: grid;
  gap: clamp(18px, 2.5vw, 26px);
  justify-items: center;
  padding: clamp(10px, 2vw, 22px) 0 4px;
}

.auth-grid {
  width: min(100%, 920px);
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.download-grid {
  width: min(100%, 960px);
  display: grid;
  gap: clamp(16px, 1.8vw, 22px);
  grid-template-columns: minmax(300px, 0.95fr) minmax(0, 1.05fr);
}

.download-card {
  align-content: start;
}

.download-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.auth-grid--single {
  width: min(100%, 580px);
  grid-template-columns: minmax(0, 1fr);
}

.form-stack,
.details-list,
.stack,
.history-list,
.news-stack,
.news-feed,
.news-admin-list,
.promo-admin-list {
  display: grid;
  gap: 14px;
}

.field-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  font-size: 0.94rem;
  color: var(--muted);
}

input,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 13px 15px;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

textarea {
  resize: vertical;
  min-height: 110px;
}

input::placeholder,
textarea::placeholder {
  color: #7f8c9d;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(77, 163, 255, 0.12);
  background: #10161d;
}

.field--checkbox {
  grid-template-columns: auto 1fr;
  align-items: start;
}

.field--checkbox input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  padding: 0;
}

.field-hint[data-tone="danger"] {
  color: var(--danger);
}

.field-hint[data-tone="warning"] {
  color: var(--warning);
}

.field-hint[data-tone="success"] {
  color: var(--success);
}

.form-feedback {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(240, 124, 124, 0.22);
  background: rgba(240, 124, 124, 0.08);
  color: #ffb1b1;
}

.inline-note {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.inline-note strong {
  display: block;
  margin-bottom: 6px;
}

.inline-note--warning {
  border-color: rgba(255, 193, 92, 0.28);
  background: rgba(255, 193, 92, 0.08);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--button-height);
  min-width: 0;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.1;
  text-align: center;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    transform 160ms ease,
    box-shadow 160ms ease;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
  transform: none;
}

.button--primary {
  background: var(--accent);
  color: #08111b;
  box-shadow: 0 12px 24px rgba(77, 163, 255, 0.22);
}

.button--primary:hover {
  background: #67b0ff;
}

.button--secondary {
  background: rgba(77, 163, 255, 0.12);
  color: var(--text);
  border-color: rgba(77, 163, 255, 0.24);
}

.button--secondary:hover {
  background: rgba(77, 163, 255, 0.2);
}

.button--ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}

.button--ghost:hover {
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.03);
}

.button--danger {
  background: rgba(240, 124, 124, 0.12);
  color: #ffbbbb;
  border-color: rgba(240, 124, 124, 0.24);
}

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

.telegram-slot {
  min-height: 56px;
}

.dev-login {
  display: grid;
  gap: 12px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.stat-card span,
.admin-stat span:first-child {
  color: var(--muted);
  font-size: 0.92rem;
}

.stat-card strong,
.admin-stat strong {
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(1.3rem, 1.14rem + 0.7vw, 1.7rem);
  letter-spacing: -0.03em;
}

.dashboard-grid {
  grid-template-columns: minmax(0, 1.52fr) minmax(280px, 0.88fr);
  align-items: start;
}

.dashboard-main,
.dashboard-side,
.admin-main,
.admin-side {
  display: grid;
  gap: clamp(16px, 1.8vw, 22px);
  align-content: start;
}

.profile-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.profile-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  background: var(--surface-soft);
  box-shadow: none;
}

.profile-card__head,
.news-card__head,
.news-admin-card__header,
.promo-admin-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.profile-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.details-list--compact .detail-row {
  padding: 12px 14px;
}

.detail-row {
  display: grid;
  grid-template-columns: minmax(0, 0.88fr) minmax(0, 1.12fr);
  gap: 10px 14px;
  align-items: center;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.detail-row span {
  color: var(--muted);
}

.detail-row strong {
  justify-self: end;
  max-width: 100%;
  text-align: right;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.detail-row--stacked {
  grid-template-columns: minmax(0, 1fr);
}

.detail-row--stacked strong {
  justify-self: start;
  text-align: left;
}

.status-badge,
.status-pill,
.counter-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.9rem;
  white-space: nowrap;
}

.status-badge--success,
.status-pill--success {
  background: rgba(70, 191, 138, 0.14);
  color: #8be4b9;
}

.status-badge--warning,
.status-pill--warning {
  background: rgba(224, 167, 79, 0.14);
  color: #ffd089;
}

.status-badge--danger,
.status-pill--danger {
  background: rgba(240, 124, 124, 0.14);
  color: #ffb2b2;
}

.status-badge--muted,
.status-pill--muted,
.counter-badge {
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  border-color: var(--border);
}

.callout {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
}

.callout--warning {
  border: 1px solid rgba(224, 167, 79, 0.2);
  background: rgba(224, 167, 79, 0.08);
  color: #ffd899;
}

.subscription-compact {
  display: grid;
  justify-content: center;
  padding: clamp(8px, 2vw, 18px) 0 4px;
}

.subscription-card {
  width: min(100%, 680px);
  display: grid;
  gap: 18px;
}

.subscription-card__note {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted);
}

.subscription-qr {
  display: flex;
  justify-content: center;
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: #0d1115;
}

.subscription-qr img {
  width: min(100%, 300px);
  aspect-ratio: 1;
  border-radius: 18px;
  background: #fff;
  padding: 12px;
}

.subscription-actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.subscription-link-stack {
  display: grid;
  gap: 12px;
}

.link-line {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-soft);
}

.link-line span {
  color: var(--muted);
  font-size: 0.92rem;
}

.security-layout {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.panel--wide {
  grid-column: 1 / -1;
}

.history-list,
.news-feed,
.news-stack,
.news-admin-list,
.promo-admin-list {
  min-height: 48px;
}

.history-card,
.news-card {
  gap: 10px;
  box-shadow: none;
}

.history-card__meta {
  display: grid;
  gap: 8px;
}

.news-card--compact h3 {
  font-size: 1rem;
}

.news-admin-card,
.promo-admin-card {
  display: grid;
  gap: 12px;
  padding: 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface-soft);
}

.empty-card {
  padding: 18px;
  border-style: dashed;
  box-shadow: none;
}

.admin-layout {
  grid-template-columns: minmax(0, 1.42fr) minmax(300px, 0.92fr);
  align-items: start;
}

.admin-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  width: min(100%, 460px);
}

.admin-search input {
  min-width: 0;
}

.admin-users-directory,
.admin-profile-list {
  display: grid;
  gap: 14px;
}

.admin-user-panel,
.admin-profile-panel {
  padding: 0;
  overflow: hidden;
}

.admin-user-panel > summary,
.admin-profile-panel > summary {
  list-style: none;
}

.admin-user-panel > summary::-webkit-details-marker,
.admin-profile-panel > summary::-webkit-details-marker {
  display: none;
}

.admin-user-panel__summary,
.admin-profile-panel__summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px;
  cursor: pointer;
}

.admin-user-panel__summary:hover,
.admin-profile-panel__summary:hover {
  background: rgba(255, 255, 255, 0.02);
}

.admin-user-panel__body,
.admin-profile-panel__body {
  display: grid;
  gap: 14px;
  padding: 0 20px 20px;
}

.admin-user__meta,
.admin-user__summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.admin-user__meta span,
.admin-user__summary span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
}

.admin-inline-form input {
  flex: 1 1 220px;
}

.admin-link-preview {
  display: block;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--muted);
  word-break: break-word;
  overflow-wrap: anywhere;
}

.admin-line {
  display: grid;
  grid-template-columns: minmax(0, 0.88fr) minmax(0, 1.12fr);
  gap: 8px 14px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.admin-line:last-child {
  border-bottom: 0;
}

.admin-line__label {
  color: var(--muted);
}

.admin-line__value {
  justify-self: end;
  max-width: 100%;
  text-align: right;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.admin-empty {
  padding: 16px 18px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 40;
  max-width: min(420px, calc(100vw - 32px));
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(77, 163, 255, 0.2);
  background: rgba(18, 22, 27, 0.96);
  box-shadow: var(--shadow);
}

.toast:not(.hidden) {
  display: block;
}

:focus-visible {
  outline: 2px solid rgba(77, 163, 255, 0.75);
  outline-offset: 3px;
}

@media (hover: hover) and (pointer: fine) {
  .button:hover {
    transform: translateY(-1px);
  }
}

@media (min-width: 1440px) {
  .page--landing {
    width: min(100%, 1240px);
  }

  .dashboard-grid {
    grid-template-columns: minmax(0, 1.58fr) minmax(320px, 0.82fr);
  }

  .hero-panel {
    grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.92fr);
  }
}

@media (max-width: 1200px) {
  .app-shell {
    width: min(var(--shell-max), calc(100% - (var(--gutter) * 1.6)));
  }

  .section-grid--three {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-grid,
  .admin-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 1024px) {
  .hero-panel {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero-copy {
    padding: 2px 0 0;
  }

  .field-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 960px) {
  body.nav-open {
    overflow: hidden;
  }

  .site-header {
    grid-template-columns: minmax(0, 1fr);
    padding: 14px 16px;
  }

  .site-nav-toggle {
    display: inline-flex;
    flex-direction: column;
  }

  .site-header__panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    width: 100%;
    max-height: 0;
    margin-top: 0;
    padding-top: 0;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    border-top: 1px solid transparent;
    transition:
      max-height 220ms ease,
      opacity 180ms ease,
      margin-top 180ms ease,
      padding-top 180ms ease,
      border-color 180ms ease;
  }

  body.nav-open .site-header__panel {
    max-height: 560px;
    margin-top: 14px;
    padding-top: 14px;
    opacity: 1;
    pointer-events: auto;
    border-top-color: rgba(255, 255, 255, 0.06);
  }

  .site-nav,
  .header-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .site-nav {
    flex-direction: column;
    align-items: stretch;
  }

  .site-nav a {
    justify-content: space-between;
    min-height: 42px;
    border-radius: 14px;
  }

  .header-actions {
    padding-top: 4px;
  }

  .page-intro,
  .panel__head--split,
  .subscription-card__head,
  .admin-user-panel__summary,
  .admin-profile-panel__summary {
    grid-template-columns: minmax(0, 1fr);
    display: grid;
    align-items: start;
  }

  .site-footer {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
  }

  .site-footer__links {
    justify-content: flex-start;
  }

  .stats-grid,
  .section-grid--two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .security-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 768px) {
  .page--news,
  .page--login,
  .page--register,
  .page--subscription,
  .page--landing,
  .page--dashboard,
  .page--security,
  .page--admin {
    width: 100%;
  }

  .auth-grid,
  .download-grid,
  .section-grid--three,
  .section-grid--two,
  .stats-grid,
  .field-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .admin-search {
    width: 100%;
    grid-template-columns: minmax(0, 1fr);
  }

  .hero-copy h1,
  .page-intro h1 {
    max-width: 11.5ch;
  }

  .page--admin .page-intro h1,
  .page--security .page-intro h1,
  .page--dashboard .page-intro h1,
  .page--news .page-intro h1 {
    max-width: 13ch;
  }

  .subscription-actions-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: calc(100% - 20px);
    padding-top: 10px;
  }

  .site-header,
  .site-footer,
  .panel,
  .profile-card,
  .empty-card,
  .history-card,
  .news-card,
  .admin-stat {
    border-radius: 20px;
  }

  .site-header,
  .site-footer {
    padding-inline: 14px;
  }

  .site-footer {
    margin-top: 20px;
  }

  .hero-actions,
  .profile-card__actions,
  .subscription-actions-grid,
  .form-inline,
  .form-inline--actions,
  .admin-inline-actions,
  .header-actions {
    gap: 10px;
  }

  .hero-actions .button,
  .form-inline .button,
  .form-inline--actions .button,
  .subscription-actions-grid .button,
  .header-actions .button {
    flex: 1 1 100%;
  }

  .detail-row,
  .admin-line {
    grid-template-columns: minmax(0, 1fr);
  }

  .detail-row strong,
  .admin-line__value {
    justify-self: start;
    text-align: left;
  }

  .profile-card__head,
  .news-card__head,
  .news-admin-card__header,
  .promo-admin-card__header {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 430px) {
  :root {
    --panel-padding: 15px;
    --button-height: 42px;
  }

  .brand {
    gap: 10px;
    font-size: 0.95rem;
  }

  .hero-copy h1 {
    max-width: 9.5ch;
  }

  .page-intro h1 {
    max-width: 11ch;
  }

  .button {
    width: 100%;
  }

  .hero-actions .button,
  .profile-card__actions .button,
  .subscription-actions-grid .button,
  .chip-row .button,
  .admin-inline-actions .button,
  .admin-inline-form .button,
  .site-footer__links a {
    width: 100%;
  }

  .status-badge,
  .status-pill,
  .counter-badge {
    white-space: normal;
  }
}

@media (max-width: 360px) {
  .app-shell {
    width: calc(100% - 16px);
  }

  h1 {
    font-size: clamp(1.88rem, 1.35rem + 3vw, 2.28rem);
  }

  h2 {
    font-size: 1.18rem;
  }

  .site-header {
    top: 8px;
  }

  .brand__text {
    font-size: 0.92rem;
  }
}
