/* Shared layout + auth form styles for /login, /dashboard, /garage, /account */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #080A0F;
  --bg2: #0C0F16;
  --gold: #C8A45A;
  --white: #F0EDE8;
  --muted: #6B7280;
  --border: rgba(255,255,255,.06);
  --font-d: 'Syne', sans-serif;
  --font-b: 'DM Sans', sans-serif;
  --font-m: 'JetBrains Mono', monospace;
}
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--white);
  font-family: var(--font-b);
  font-weight: 300;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
a:hover { opacity: .92; }

button,
input[type="submit"] {
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(255, 255, 255, 0.07);
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border);
  background: rgba(8,10,15,.92);
  backdrop-filter: blur(20px);
}
.app-topbar-inner {
  width: min(1120px, calc(100% - 48px));
  margin: 0 auto;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding: 12px 0;
}
.app-wordmark {
  font-family: var(--font-d);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .3px;
  color: var(--white);
}
.app-wordmark em { font-style: normal; color: var(--gold); }
.app-nav {
  display: flex;
  align-items: center;
  gap: 8px 20px;
  flex-wrap: wrap;
}
.app-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 6px 4px;
  font-size: 13px;
  color: var(--muted);
  transition: color .2s;
}
.app-nav a:hover { color: var(--white); }
.app-nav a.active {
  color: var(--gold);
}
.app-main {
  width: min(720px, calc(100% - 48px));
  margin: 0 auto;
  padding: 48px 0 80px;
}
.app-main h1 {
  font-family: var(--font-d);
  font-size: clamp(26px, 4vw, 34px);
  font-weight: 700;
  margin-bottom: 12px;
  letter-spacing: -.3px;
}
.app-lede {
  font-size: 15px;
  color: var(--muted);
  line-height: 1.7;
  margin-bottom: 28px;
}
.app-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px 26px;
  margin-bottom: 18px;
}
.app-card h2 {
  font-family: var(--font-d);
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 10px;
}
.app-card p { font-size: 14px; color: var(--muted); line-height: 1.65; }
.app-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.app-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 20px;
  font-family: var(--font-b);
  font-size: 14px;
  font-weight: 500;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--white);
  cursor: pointer;
  transition: border-color .2s, background .2s, opacity .2s;
}
.app-btn:hover { border-color: rgba(255,255,255,.18); }
.app-btn-primary {
  background: var(--gold);
  color: #080A0F;
  border-color: transparent;
  font-weight: 600;
}
.app-btn-primary:hover { opacity: .88; border-color: transparent; }

/* Login / auth panel (same visual language as former homepage modal) */
.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.auth-body {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 32px 24px 48px;
}
.auth-panel {
  width: min(390px, calc(100vw - 32px));
  background: #0e1118;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 30px;
}
.auth-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 22px;
}
.auth-title { font-family: var(--font-d); font-size: 21px; font-weight: 700; }
.auth-sub { margin-top: 4px; font-size: 13px; color: var(--muted); }
.auth-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 17px;
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
  margin: -8px -8px 0 0;
  display: grid;
  place-items: center;
  border-radius: 8px;
  transition: color .2s, background .2s;
}
.auth-close:hover { color: var(--white); background: rgba(255,255,255,.06); }
.auth-hint {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.55;
  margin: -6px 0 18px;
}
.auth-tabs {
  display: flex;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--border);
}
.auth-tab {
  background: none;
  border: none;
  color: var(--muted);
  font-family: var(--font-b);
  font-size: 13px;
  font-weight: 500;
  min-height: 44px;
  padding: 0 0 11px;
  margin-right: 22px;
  cursor: pointer;
  position: relative;
  transition: color .2s;
}
.auth-tab.on { color: var(--white); }
.auth-tab.on::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--gold);
}
.auth-google {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 48px;
  padding: 12px 14px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--white);
  font-family: var(--font-b);
  font-size: 13px;
  cursor: pointer;
  margin-bottom: 10px;
  transition: background .2s;
}
.auth-google:hover { background: rgba(255,255,255,.07); }
.auth-google:disabled,
.auth-apple:disabled,
.auth-submit:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.auth-google:disabled:hover,
.auth-apple:disabled:hover,
.auth-submit:disabled:hover {
  background: rgba(255,255,255,.04);
}
.auth-apple:disabled:hover { background: #000; }
.auth-input:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.auth-tab:disabled {
  pointer-events: none;
}
.auth-apple {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 12px 14px;
  background: #000;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 6px;
  color: #fff;
  font-family: var(--font-b);
  font-size: 13px;
  cursor: pointer;
  margin-bottom: 18px;
  transition: background .2s, border-color .2s;
}
.auth-apple:hover { background: #1a1a1a; border-color: rgba(255,255,255,.22); }
.auth-apple svg { flex-shrink: 0; }
.auth-or {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-m);
  font-size: 9px;
  color: var(--muted);
  letter-spacing: 1px;
  margin-bottom: 14px;
}
.auth-or::before, .auth-or::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.auth-input {
  width: 100%;
  min-height: 48px;
  background: rgba(255,255,255,.035);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 11px 13px;
  color: var(--white);
  font-family: var(--font-b);
  font-size: 13px;
  outline: none;
  margin-bottom: 9px;
  transition: border-color .2s;
}
.auth-input::placeholder { color: var(--muted); }
.auth-input:focus { border-color: rgba(200,164,90,.38); }
.auth-submit {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  background: var(--white);
  color: #080A0F;
  font-family: var(--font-b);
  font-size: 13px;
  font-weight: 500;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  margin-top: 4px;
  transition: opacity .2s;
}
.auth-submit:hover { opacity: .86; }
.auth-status {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 9px;
  min-height: 16px;
}

@media (max-width: 560px) {
  .auth-google, .auth-apple, .auth-submit {
    min-height: 52px;
    font-size: 15px;
  }
  .auth-tab {
    min-height: 48px;
    padding: 0 0 12px;
    margin-right: 18px;
    font-size: 14px;
  }
}

/* Protected app pages: hide chrome until Firebase confirms session */
body.auth-checking .app-topbar,
body.auth-checking .app-main {
  visibility: hidden;
}
#app-auth-loading {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  background: var(--bg);
}
.app-nav-signout {
  background: none;
  border: none;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--font-b);
  font-weight: 300;
  min-height: 44px;
  padding: 6px 8px;
  transition: color .2s;
}
.app-nav-signout:hover { color: var(--white); }
