/* Layout — общий каркас для публичных страниц и кабинета */

:root {
  --bg: #0f1419;
  --bg-elevated: #1a2332;
  --surface: #243047;
  --border: rgba(255, 255, 255, 0.08);
  --text: #e8ecf4;
  --muted: #8b9bb4;
  --accent: #5b9fd8;
  --accent-hover: #7cb8ea;
  --danger: #e57373;
  --radius: 12px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(165deg, var(--bg) 0%, #162030 45%, #0d1520 100%);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.layout {
  max-width: 46rem;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
}

.layout--narrow {
  max-width: 24rem;
}

.app-main {
  margin-top: 1rem;
}

h1 {
  font-size: 1.65rem;
  font-weight: 650;
  margin: 0 0 1rem;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 1.25rem 0 0.75rem;
}

h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 0.75rem;
}

/* Карточки */

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}

.card p:last-child {
  margin-bottom: 0;
}

/* Формы */

.row {
  margin-bottom: 1rem;
}

.row label {
  display: block;
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

input[type="email"],
input[type="password"],
input[type="text"],
select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
}

input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

button,
.button-link {
  display: inline-block;
  padding: 0.65rem 1.1rem;
  border-radius: 8px;
  border: none;
  background: linear-gradient(180deg, var(--accent) 0%, #4a8bc4 100%);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  text-align: center;
  text-decoration: none;
  transition: filter 0.15s ease, transform 0.05s ease;
}

button:hover,
.button-link:hover {
  filter: brightness(1.08);
  text-decoration: none;
  color: #fff;
}

button:active {
  transform: scale(0.99);
}

button.btn-secondary {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
}

.error {
  color: var(--danger);
  margin: 0.75rem 0;
  font-size: 0.95rem;
}

.hint {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0.5rem 0 1rem;
}

p code,
.hint code {
  display: inline;
  padding: 0.15rem 0.4rem;
  font-size: 0.88em;
  border-radius: 4px;
}

code,
.subscription-code {
  word-break: break-all;
  display: block;
  padding: 0.85rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.8rem;
  color: #c5d4e8;
  overflow-wrap: anywhere;
}

/* Навигация авторизованной зоны */

.nav-auth {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.35rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.nav-auth a {
  padding: 0.55rem 0.9rem;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 500;
  font-size: 0.9rem;
  text-decoration: none;
}

.nav-auth a:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  text-decoration: none;
}

.nav-auth a.nav-auth__active {
  color: #fff;
  background: var(--accent);
}

.nav-auth a.nav-auth__active:hover {
  color: #fff;
  background: var(--accent-hover);
}

/* Кабинет: локации */

.locations-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
}

.locations-list li {
  padding: 0.45rem 0.65rem;
  background: var(--surface);
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 0.95rem;
}

/* Платежи — компактные кнопки */

.pay-actions form {
  margin-bottom: 0.5rem;
}

.pay-actions form:last-of-type {
  margin-bottom: 0;
}

details.billing-sync-fallback {
  margin-top: 1rem;
  color: var(--muted);
  font-size: 0.875rem;
}

details.billing-sync-fallback summary {
  cursor: pointer;
}

details.billing-sync-fallback summary:hover {
  color: var(--text);
}

/* Страницы help: аккордеон */

.platform-details {
  margin-bottom: 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  overflow: hidden;
}

.platform-details summary {
  cursor: pointer;
  padding: 0.85rem 1rem;
  font-weight: 600;
  list-style: none;
}

.platform-details summary::-webkit-details-marker {
  display: none;
}

.platform-details[open] summary {
  border-bottom: 1px solid var(--border);
}

.platform-details .platform-body {
  padding: 1rem 1.1rem;
  font-size: 0.95rem;
  color: var(--muted);
}

.platform-details .platform-body a {
  color: var(--accent);
}

.trouble-list {
  margin: 0;
  padding-left: 1.25rem;
  color: var(--muted);
}

.trouble-list li {
  margin-bottom: 0.35rem;
}

.support-links {
  line-height: 1.8;
}

.logout-row {
  margin-top: 1.5rem;
}

.logout-row button {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font-weight: 500;
}

.logout-row button:hover {
  color: var(--text);
  border-color: var(--muted);
  filter: none;
}

.qr-wrap {
  margin-top: 1rem;
  text-align: center;
}

.qr-wrap img {
  border-radius: 8px;
  border: 1px solid var(--border);
}

/* Админка */

.admin-meta {
  margin-top: -0.25rem;
}

.admin-toolbar {
  margin-bottom: 1rem;
}

.admin-logout-form {
  margin: 0;
}

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

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

.admin-table th,
.admin-table td {
  padding: 0.5rem 0.65rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.admin-table th {
  color: var(--muted);
  font-weight: 600;
}

.admin-table code {
  font-size: 0.8rem;
  word-break: break-all;
}

.pagination {
  margin-top: 1.25rem;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}
