/* Timo Beats — login / sign up (mock-aligned) */
:root {
  --auth-blue: #0052ff;
  --auth-blue-dark: #1d4ed8;
  --auth-ink: #0f172a;
  --auth-muted: #64748b;
  --auth-border: #e2e8f0;
  --auth-bg: #ffffff;
  --auth-shell-max: 430px;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body.auth-page {
  margin: 0;
  min-height: 100dvh;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--auth-bg);
  color: var(--auth-ink);
  -webkit-font-smoothing: antialiased;
}

.auth-shell {
  width: 100%;
  max-width: var(--auth-shell-max);
  margin: 0 auto;
  min-height: 100dvh;
  padding: max(6px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Back + hero on one row; title tucked under hero */
.auth-header {
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 4px;
  row-gap: 6px;
  margin-bottom: 8px;
}

.auth-topbar {
  grid-column: 1;
  grid-row: 1;
  align-self: center;
  margin: 0;
}

.auth-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--auth-border);
  background: #fff;
  color: var(--auth-ink);
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.auth-back svg {
  display: block;
  width: 16px;
  height: 16px;
}

.auth-hero {
  grid-column: 1 / -1;
  grid-row: 1;
  display: flex;
  justify-content: center;
  margin: 0;
  pointer-events: none;
}

.auth-hero-svg {
  width: 96px;
  height: 96px;
  display: block;
}

.auth-topbar .auth-back {
  pointer-events: auto;
  position: relative;
  z-index: 2;
}

.auth-heading {
  grid-column: 1 / -1;
  grid-row: 2;
  text-align: center;
  margin: 0;
}

.auth-heading h1 {
  margin: 0;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #1e3a8a;
}

.auth-heading p {
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.35;
  color: var(--auth-muted);
  max-width: 280px;
  margin-left: auto;
  margin-right: auto;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--auth-border);
}

.auth-tabs a {
  position: relative;
  padding: 7px 8px 9px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  color: #94a3b8;
}

.auth-tabs a.is-active {
  color: var(--auth-blue);
}

.auth-tabs a.is-active::after {
  content: '';
  position: absolute;
  left: 20%;
  right: 20%;
  bottom: 0;
  height: 3px;
  border-radius: 999px 999px 0 0;
  background: var(--auth-blue);
}

.auth-alert {
  margin-bottom: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #991b1b;
  font-size: 11px;
  line-height: 1.35;
}

.auth-form {
  flex: 0 1 auto;
}

.auth-field {
  margin-bottom: 9px;
}

.auth-field label {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  font-weight: 600;
  color: #334155;
}

.auth-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  min-height: 42px;
  border: 1px solid var(--auth-border);
  border-radius: 12px;
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.auth-input-wrap:focus-within {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.auth-input-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  color: var(--auth-blue);
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-input-icon svg {
  width: 16px;
  height: 16px;
}

.auth-input-wrap input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 9px 0;
  font-size: 13px;
  color: var(--auth-ink);
  outline: none;
}

.auth-input-wrap input::placeholder {
  color: #94a3b8;
}

.auth-input-toggle {
  flex-shrink: 0;
  border: 0;
  background: transparent;
  padding: 4px;
  color: #94a3b8;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-phone-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.auth-input-wrap--phone {
  padding-left: 10px;
}

.auth-input-wrap--phone .auth-phone-row input {
  padding: 9px 0;
}

.auth-phone-country {
  position: relative;
  flex-shrink: 0;
}

.auth-phone-prefix-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 108px;
  padding: 5px 6px;
  border-radius: 8px;
  border: 0;
  background: #f1f5f9;
  font-size: 11px;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.2;
}

.auth-phone-prefix-btn:focus-visible {
  outline: 2px solid #93c5fd;
  outline-offset: 1px;
}

.auth-phone-flag {
  font-size: 14px;
  line-height: 1;
}

.auth-phone-dial {
  white-space: nowrap;
}

.auth-phone-chevron {
  flex-shrink: 0;
  opacity: 0.55;
}

.auth-phone-country-panel {
  position: absolute;
  z-index: 40;
  top: calc(100% + 4px);
  left: 0;
  width: min(280px, calc(100vw - 48px));
  max-height: 240px;
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  border: 1px solid var(--auth-border);
  background: #fff;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14);
  overflow: hidden;
}

.auth-phone-country-panel[hidden] {
  display: none !important;
}

.auth-phone-country-search {
  flex-shrink: 0;
  margin: 8px;
  padding: 8px 10px;
  border: 1px solid var(--auth-border);
  border-radius: 10px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
}

.auth-phone-country-search:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.auth-phone-country-list {
  list-style: none;
  margin: 0;
  padding: 0 4px 8px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.auth-phone-country-list li[role='option'] {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 8px 8px;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
  color: #334155;
}

.auth-phone-country-list li[role='option']:hover,
.auth-phone-country-list li[role='option'].is-selected {
  background: #eff6ff;
}

.auth-phone-list-flag {
  font-size: 16px;
  line-height: 1;
  text-align: center;
}

.auth-phone-list-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-phone-list-dial {
  font-weight: 700;
  color: #64748b;
  font-size: 11px;
}

.auth-phone-country-empty {
  padding: 12px 10px;
  text-align: center;
  font-size: 12px;
  color: #94a3b8;
}

.auth-phone-prefix {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 4px 6px;
  border-radius: 8px;
  background: #f1f5f9;
  font-size: 11px;
  font-weight: 600;
  color: #475569;
}

.auth-hint {
  margin-top: 4px;
  font-size: 10px;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 3px;
}

.auth-hint svg {
  flex-shrink: 0;
  color: #22c55e;
}

.auth-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 10px;
  font-size: 11px;
}

.auth-check {
  display: inline-flex;
  align-items: flex-start;
  gap: 6px;
  color: #475569;
  cursor: pointer;
  user-select: none;
  font-size: 11px;
  line-height: 1.35;
}

.auth-check input {
  width: 15px;
  height: 15px;
  margin-top: 1px;
  accent-color: var(--auth-blue);
  flex-shrink: 0;
}

.auth-link {
  color: var(--auth-blue);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.auth-link:hover {
  text-decoration: underline;
}

.auth-submit {
  width: 100%;
  border: 0;
  border-radius: 999px;
  padding: 11px 16px;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(90deg, #0066ff 0%, #0052ff 45%, #6366f1 100%);
  box-shadow: 0 6px 16px rgba(0, 82, 255, 0.3);
}

.auth-submit:active {
  transform: scale(0.99);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0 8px;
  font-size: 11px;
  color: #94a3b8;
}

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

.auth-social {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.auth-social-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 54px;
  padding: 6px 4px;
  border-radius: 12px;
  border: 1px solid var(--auth-border);
  background: #fff;
  font-size: 10px;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.auth-social-btn svg {
  display: block;
  width: 18px;
  height: 18px;
}

.auth-trust {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid #f1f5f9;
}

.auth-trust-item {
  text-align: center;
  font-size: 8px;
  line-height: 1.25;
  color: #64748b;
}

.auth-trust-item strong {
  display: block;
  margin-bottom: 2px;
  font-size: 9px;
  font-weight: 800;
  color: #334155;
}

.auth-trust-icon {
  width: 24px;
  height: 24px;
  margin: 0 auto 4px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-trust-icon svg {
  width: 12px;
  height: 12px;
}

.auth-trust-icon.blue {
  background: #eff6ff;
  color: #2563eb;
}

.auth-trust-icon.green {
  background: #ecfdf5;
  color: #16a34a;
}

.auth-trust-icon.purple {
  background: #f5f3ff;
  color: #7c3aed;
}

.auth-legal {
  margin-top: 8px;
  text-align: center;
  font-size: 9px;
  line-height: 1.35;
  color: #94a3b8;
}

.auth-legal a {
  color: var(--auth-blue);
  font-weight: 600;
  text-decoration: none;
}

.auth-optional-tag {
  font-weight: 500;
  color: #94a3b8;
  font-size: 11px;
}

/* Sign up has more fields — slightly smaller hero, tighter stack */
body.auth-page--register .auth-header {
  row-gap: 4px;
  margin-bottom: 6px;
}

body.auth-page--register .auth-hero-svg {
  width: 80px;
  height: 80px;
}

body.auth-page--register .auth-heading h1 {
  font-size: 18px;
}

body.auth-page--register .auth-heading p {
  font-size: 11px;
  margin-top: 2px;
}

body.auth-page--register .auth-tabs {
  margin-bottom: 10px;
}

body.auth-page--register .auth-field {
  margin-bottom: 7px;
}

body.auth-page--register .auth-divider {
  margin: 10px 0 6px;
}

body.auth-page--register .auth-social {
  margin-bottom: 8px;
}

body.auth-page--register .auth-trust-item {
  font-size: 7px;
}

body.auth-page--register .auth-legal {
  display: none;
}

@media (min-height: 740px) {
  body.auth-page:not(.auth-page--register) .auth-shell {
    justify-content: center;
    padding-top: max(12px, env(safe-area-inset-top));
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }

  body.auth-page:not(.auth-page--register) .auth-trust {
    margin-top: 20px;
  }
}

/* Fixed theme toggle — matches in-app control (top-right) */
.auth-theme-toggle {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  z-index: 60;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid #334155;
  background: rgba(15, 23, 42, 0.85);
  color: #fff;
  text-decoration: none;
  box-shadow: 0 10px 15px -3px rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.auth-theme-toggle:hover {
  opacity: 0.92;
}

.auth-theme-toggle svg {
  display: block;
}
