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

:root {
  /* Santiment Design System — brand palette (неизменна) */
  --san-mint: #14c393;
  --san-mint-dark: #0fa87e;
  --san-mint-100: #1f6b58;
  --san-blue: #4da0eb;
  --san-blue-600: #3a8ad4;
  --san-amber: #f5a623;
  --san-red: #ef4444;

  --san-navy-900: #121212;
  --san-navy-800: #15192b;
  --san-navy-700: #1a1f33;
  --san-navy-600: #232a44;
}

/* ── Тёмная тема (по умолчанию) ── */
:root,
[data-theme="dark"] {
  --text-strong: #f8f9ff;
  --text-body: #d7dbe8;
  --text-muted: #8b93a7;
  --border-subtle: #374151;
  --border-faint: rgba(255, 255, 255, 0.07);
  --bg-page: #121212;
  --bg-card: #1a1f33;
  --bg-surface: #232a44;
  --bg-field: #15192b;
  --bg-nav: rgba(18, 18, 18, 0.9);
  --wordmark-filter: none;
}

/* ── Светлая тема ── */
[data-theme="light"] {
  --text-strong: #0d1026;
  --text-body: #2a3150;
  --text-muted: #5b6577;
  --border-subtle: #d1d5e0;
  --border-faint: rgba(0, 0, 0, 0.08);
  --bg-page: #f4f5fa;
  --bg-card: #ffffff;
  --bg-surface: #ebedf5;
  --bg-field: #f0f2f8;
  --bg-nav: rgba(255, 255, 255, 0.92);
  --wordmark-filter: invert(1);
}

/* ── Theme toggle button ── */
.theme-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.theme-toggle:hover {
  border-color: var(--san-mint);
  color: var(--text-strong);
}
.theme-toggle svg { width: 16px; height: 16px; flex-shrink: 0; }
.theme-toggle .icon-sun  { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="light"] .theme-toggle .icon-sun  { display: block; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  background: var(--bg-page);
  color: var(--text-body);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.page {
  width: 100%;
  max-width: 400px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 40px 36px;
}

/* ── Brand ── */

.brand {
  margin-bottom: 20px;
  display: flex;
  justify-content: center;
}

.brand-wordmark {
  height: 44px;
  width: auto;
  display: block;
  filter: var(--wordmark-filter, none);
}

/* ── Sign-in header ── */

.signin-title {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-strong);
  line-height: 1.3;
  margin-bottom: 6px;
  text-align: center;
}

.signin-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 24px;
  text-align: center;
}

.signin-subtitle strong {
  color: var(--text-body);
  font-weight: 600;
}

/* ── Legacy app-hint (kept for non-login pages) ── */

.app-hint {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 24px;
  line-height: 1.4;
}

.app-hint strong {
  color: #c5cae0;
  font-weight: 600;
}

/* ── Error / info ── */

.error-box {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  color: #fc8181;
  margin-bottom: 16px;
  line-height: 1.4;
}

.hidden {
  display: none !important;
}

/* ── Form fields ── */

.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-strong);
  margin-bottom: 8px;
}

.field .optional {
  color: var(--text-muted);
  font-weight: 400;
}

.field input {
  width: 100%;
  background: var(--bg-field);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text-strong);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
}

.field input:focus {
  border-color: var(--san-mint);
  box-shadow: 0 0 0 3px rgba(20, 195, 147, 0.12);
}

.field input::placeholder {
  color: var(--san-gray-500, #5b6577);
}

/* Email field with icon */

.field-icon-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  padding: 0 12px;
  background: var(--bg-field);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field-icon-wrap:focus-within {
  border-color: var(--san-mint);
  box-shadow: 0 0 0 3px rgba(20, 195, 147, 0.12);
}

.field-icon-wrap svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  color: var(--text-muted);
}

.field-icon-wrap input {
  flex: 1;
  background: transparent;
  border: none;
  padding: 0;
  font-size: 15px;
  color: var(--text-strong);
  outline: none;
  -webkit-appearance: none;
  box-shadow: none !important;
}

.field-icon-wrap input::placeholder {
  color: var(--san-gray-500, #5b6577);
}

/* ── Buttons ── */

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  border: none;
  transition: background 0.15s, opacity 0.15s, transform 0.1s;
  margin-bottom: 10px;
  line-height: 1;
}

.btn:last-child {
  margin-bottom: 0;
}

.btn:active {
  transform: scale(0.99);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Primary — mint green */
.btn-primary {
  background: var(--san-mint);
  color: #0a1a14;
}

.btn-primary:hover:not(:disabled) {
  background: var(--san-mint-dark);
}

/* Auth method buttons (Google / Wallet / Passkey) */
.btn-method {
  background: var(--bg-field);
  border: 1px solid var(--border-subtle);
  color: var(--text-strong);
  justify-content: flex-start;
  gap: 12px;
  padding: 0 16px;
  height: 46px;
}

.btn-method:hover:not(:disabled) {
  border-color: var(--san-mint);
}

.btn-method .btn-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-method .btn-label {
  flex: 1;
  text-align: left;
}

.btn-method .btn-chevron {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Legacy oauth button (kept for compatibility) */
.btn-oauth {
  background: var(--bg-field);
  border: 1px solid var(--border-subtle);
  color: #c5cae0;
}

.btn-oauth:hover:not(:disabled) {
  border-color: var(--border-subtle);
  color: var(--text-strong);
}

.btn-wallet {
  background: var(--bg-field);
  border: 1px solid var(--border-subtle);
  color: #c5cae0;
}

.btn-wallet:hover:not(:disabled) {
  border-color: var(--san-mint);
}

.oauth-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  border-radius: 4px;
}

/* Ghost button */
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 13px;
}

.btn-ghost:hover:not(:disabled) {
  border-color: #4d5580;
  color: var(--text-body);
}

/* ── Divider ── */

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 12px;
  margin: 18px 0;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

/* ── Info banner ── */

.info-banner {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  background: var(--bg-field);
  border: 1px solid var(--border-faint);
  border-radius: 8px;
  margin-top: 14px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted);
}

.info-banner svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  margin-top: 1px;
  color: var(--san-blue);
}

.terms-text {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 18px;
  line-height: 1.5;
}

.terms-text a {
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.terms-text a:hover {
  color: var(--text-body);
}

/* ── Sent confirmation box ── */

.sent-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 16px;
  padding: 8px 0 4px;
}

.sent-icon-wrap {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(20, 195, 147, 0.1);
  border: 1px solid rgba(20, 195, 147, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sent-icon-wrap svg {
  width: 32px;
  height: 32px;
  color: var(--san-mint);
}

.sent-title {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-strong);
  line-height: 1.3;
}

.sent-body {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
}

.sent-body strong {
  color: var(--text-strong);
  font-weight: 600;
}

.sent-hint {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 12px 14px;
  background: var(--bg-field);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
  text-align: left;
  width: 100%;
}

.sent-hint svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--text-muted);
}

.sent-hint strong {
  color: var(--text-strong);
}

.sent-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.sent-actions a,
.sent-actions button {
  font-size: 14px;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
  padding: 4px;
  text-decoration: none;
}

.sent-actions a:hover,
.sent-actions button:hover {
  color: var(--text-body);
}

.sent-actions a.link-primary {
  color: var(--san-mint);
  font-weight: 500;
}

.sent-actions a.link-primary:hover {
  color: var(--san-mint-dark);
}

.sent-actions button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── Tabs (legacy, used by older pages) ── */

.tabs {
  display: flex;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 24px;
}

.tab {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  padding: 8px 12px 12px;
  cursor: pointer;
  position: relative;
  transition: color 0.15s;
}

.tab:hover {
  color: #c5cae0;
}

.tab.active {
  color: var(--text-strong);
}

.tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--san-mint);
  border-radius: 2px 2px 0 0;
}

/* ── Mobile ── */

@media (max-width: 440px) {
  .card {
    padding: 32px 24px;
  }
}