:root {
  --auth-bg: #0b0d12;
  --auth-surface: #12151c;
  --auth-surface-2: #181c25;
  --auth-border: #232836;
  --auth-text: #e6e8ee;
  --auth-muted: #8a93a6;
  --auth-primary: #6366f1;
  --auth-primary-hover: #4f52e5;
  --auth-primary-fg: #ffffff;
  --auth-danger: #ef4444;
  --auth-success: #10b981;
  --auth-radius: 14px;
  --auth-radius-sm: 10px;
  --auth-shadow: 0 20px 60px -20px rgba(0, 0, 0, 0.6);
}

.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  background: var(--auth-bg);
  color: var(--auth-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.auth-brand {
  position: relative;
  padding: 56px 64px;
  background:
    radial-gradient(circle at 20% 20%, rgba(99, 102, 241, 0.35), transparent 55%),
    radial-gradient(circle at 80% 80%, rgba(16, 185, 129, 0.18), transparent 55%),
    linear-gradient(135deg, #131826 0%, #0b0d12 100%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}

.auth-brand::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 60%, rgba(0,0,0,0.4));
  pointer-events: none;
}

.auth-logo {
  display: flex; align-items: center; gap: 12px;
  font-weight: 600; font-size: 18px;
  position: relative; z-index: 1;
}

.auth-logo-mark {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--auth-primary), #8b5cf6);
  display: grid; place-items: center;
  color: #fff; font-weight: 700;
  box-shadow: 0 8px 24px -8px rgba(99,102,241,0.6);
}

.auth-brand-content { position: relative; z-index: 1; max-width: 480px; }
.auth-brand-content h2 {
  font-size: 36px; line-height: 1.15; font-weight: 700;
  margin: 0 0 16px; letter-spacing: -0.02em;
}
.auth-brand-content p {
  color: var(--auth-muted); font-size: 16px; line-height: 1.6; margin: 0;
}

.auth-brand-foot {
  position: relative; z-index: 1;
  color: var(--auth-muted); font-size: 13px;
}

.auth-main {
  display: flex; align-items: center; justify-content: center;
  padding: 48px 32px;
}

.auth-card {
  width: 100%; max-width: 420px;
  background: var(--auth-surface);
  border: 1px solid var(--auth-border);
  border-radius: var(--auth-radius);
  padding: 36px 32px;
  box-shadow: var(--auth-shadow);
}

.auth-card h1 {
  font-size: 26px; font-weight: 700; margin: 0 0 6px;
  letter-spacing: -0.02em;
}
.auth-card .auth-sub {
  color: var(--auth-muted); font-size: 14px; margin: 0 0 24px;
}

.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-field { display: flex; flex-direction: column; gap: 6px; }
.auth-field > label {
  font-size: 13px; font-weight: 500; color: var(--auth-text);
}
.auth-field input[type="text"],
.auth-field input[type="email"],
.auth-field input[type="password"],
.auth-field input[type="tel"],
.auth-field input[type="url"],
.auth-field input[type="number"],
.auth-field input:not([type]) {
  background: var(--auth-surface-2);
  border: 1px solid var(--auth-border);
  color: var(--auth-text);
  border-radius: var(--auth-radius-sm);
  padding: 11px 13px;
  font-size: 14px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.auth-field input::placeholder { color: #5b6478; }
.auth-field input:focus {
  outline: none;
  border-color: var(--auth-primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.2);
  background: #1c2130;
}

/* Override browser autofill (Chrome/Edge) white background on dark inputs */
.auth-field input:-webkit-autofill,
.auth-field input:-webkit-autofill:hover,
.auth-field input:-webkit-autofill:focus,
.auth-field input:-webkit-autofill:active {
  -webkit-text-fill-color: var(--auth-text);
  -webkit-box-shadow: 0 0 0 1000px var(--auth-surface-2) inset;
  box-shadow: 0 0 0 1000px var(--auth-surface-2) inset;
  caret-color: var(--auth-text);
  transition: background-color 9999s ease-in-out 0s;
}
.auth-field .field-error,
.auth-field .text-danger {
  color: var(--auth-danger); font-size: 12px; min-height: 1em;
}

.auth-password-wrap { position: relative; }
.auth-password-wrap > input { width: 100%; padding-right: 44px; }
.auth-toggle-pass {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: transparent; border: 0; color: var(--auth-muted);
  font-size: 12px; padding: 6px 8px; cursor: pointer; border-radius: 6px;
}
.auth-toggle-pass:hover { color: var(--auth-text); background: rgba(255,255,255,0.04); }

.auth-row {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px;
}
.auth-check { display: inline-flex; align-items: center; gap: 8px; color: var(--auth-muted); }
.auth-check input { accent-color: var(--auth-primary); width: 16px; height: 16px; }
.auth-link { color: var(--auth-primary); text-decoration: none; }
.auth-link:hover { text-decoration: underline; }

.auth-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 11px 16px;
  border-radius: var(--auth-radius-sm); border: 1px solid transparent;
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, transform .05s;
}
.auth-btn-primary {
  background: var(--auth-primary); color: var(--auth-primary-fg);
}
.auth-btn-primary:hover { background: var(--auth-primary-hover); }
.auth-btn-primary:active { transform: translateY(1px); }

.auth-btn-outline {
  background: transparent; color: var(--auth-text);
  border-color: var(--auth-border);
}
.auth-btn-outline:hover { background: var(--auth-surface-2); border-color: #2e3346; }

.auth-divider {
  display: flex; align-items: center; gap: 12px; margin: 22px 0;
  color: var(--auth-muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em;
}
.auth-divider::before, .auth-divider::after {
  content: ""; flex: 1; height: 1px; background: var(--auth-border);
}

.auth-external { display: flex; flex-direction: column; gap: 10px; }

.auth-foot {
  margin-top: 22px; text-align: center;
  font-size: 13px; color: var(--auth-muted);
}

.auth-validation-summary {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fecaca;
  border-radius: var(--auth-radius-sm);
  padding: 10px 12px; font-size: 13px;
}
.auth-validation-summary:empty { display: none; }
.auth-validation-summary ul { margin: 0; padding-left: 18px; }

.auth-info {
  text-align: center; padding: 8px 0 4px;
}

/* Каталоги приглашения: название, роль и после принятия — ссылки на приложения каталога. */
.auth-catalogs { display: flex; flex-direction: column; gap: 10px; margin: 0 0 18px; padding: 0; list-style: none; }
.auth-catalog {
  display: flex; flex-direction: column; gap: 10px;
  padding: 12px 14px; text-align: left;
  border: 1px solid var(--auth-border); border-radius: var(--auth-radius-sm);
}
.auth-catalog-name { font-weight: 600; }
.auth-catalog-role { color: var(--auth-muted); font-size: 13px; }
.auth-catalog-actions { display: flex; gap: 8px; }
.auth-catalog-actions .auth-btn { padding: 8px 12px; text-decoration: none; }
.auth-catalog-note { color: var(--auth-muted); font-size: 13px; }

/* Стартовая страница (Pages/Index): список каталогов шире формы входа, внизу — админка и выход. */
.auth-card-wide { max-width: 560px; }
.auth-empty { margin: 0 0 18px; }
.auth-empty .auth-sub { margin: 0; }
.auth-actions { display: flex; gap: 8px; }
.auth-actions > .auth-btn { flex: 1; text-decoration: none; }
.auth-actions > form { flex: 1; display: flex; }
.auth-info-icon {
  width: 56px; height: 56px; border-radius: 50%;
  background: rgba(16, 185, 129, 0.12);
  color: var(--auth-success);
  display: grid; place-items: center; margin: 0 auto 14px;
  font-size: 28px; font-weight: 700;
}

@media (max-width: 960px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .auth-main { padding: 32px 16px; }
  .auth-card { padding: 28px 22px; }
}
