:root {
  --wine-950: #350814;
  --wine-900: #4b0b1c;
  --wine-800: #681027;
  --red-600: #d9233f;
  --red-700: #bd1833;
  --yellow-400: #f7c948;
  --neutral-950: #19171a;
  --neutral-700: #5f5961;
  --neutral-500: #8d8790;
  --neutral-300: #d9d4db;
  --neutral-100: #f5f3f6;
  --white: #ffffff;
  --danger-bg: #fff0f2;
  --danger-text: #a5102a;
  --success-bg: #edf9f1;
  --success-text: #237342;
  --shadow-lg: 0 28px 70px rgb(39 11 21 / 16%);
}

* { box-sizing: border-box; }

html { color-scheme: light; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--neutral-950);
  background: var(--neutral-100);
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button { cursor: pointer; }

.login-page { background: var(--white); }

.login-shell {
  display: grid;
  grid-template-columns: minmax(420px, 46%) 1fr;
  min-height: 100vh;
}

.login-brand {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100vh;
  padding: 48px clamp(40px, 6vw, 88px);
  overflow: hidden;
  color: var(--white);
  background:
    radial-gradient(circle at 18% 86%, rgb(247 201 72 / 17%), transparent 28%),
    linear-gradient(145deg, var(--wine-950), var(--wine-800) 65%, #8a142f);
}

.login-brand::after {
  content: "";
  position: absolute;
  right: -120px;
  bottom: -140px;
  width: 420px;
  height: 420px;
  border: 1px solid rgb(255 255 255 / 10%);
  border-radius: 50%;
  box-shadow: 0 0 0 70px rgb(255 255 255 / 3%), 0 0 0 140px rgb(255 255 255 / 2%);
}

.brand {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  width: max-content;
  color: var(--white);
  font-size: 25px;
  font-weight: 800;
  letter-spacing: -0.04em;
  text-decoration: none;
}

.brand > span:last-child span { color: var(--yellow-400); }

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 14px;
  color: var(--wine-950);
  background: var(--yellow-400);
}

.brand-mark svg { width: 34px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2.4; }

.brand-copy { position: relative; z-index: 1; max-width: 570px; margin: auto 0; }

.eyebrow {
  margin: 0 0 16px;
  color: var(--yellow-400);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.eyebrow--dark { color: var(--red-600); }

.brand-copy h1 {
  max-width: 540px;
  margin: 0;
  font-size: clamp(38px, 4.8vw, 68px);
  line-height: 1.04;
  letter-spacing: -.055em;
}

.brand-copy > p:last-child {
  max-width: 520px;
  margin: 24px 0 0;
  color: rgb(255 255 255 / 74%);
  font-size: 17px;
  line-height: 1.7;
}

.route-art { position: relative; z-index: 1; display: flex; align-items: center; width: min(100%, 440px); height: 48px; }
.route-dot { width: 12px; height: 12px; border: 3px solid var(--wine-900); border-radius: 50%; background: var(--yellow-400); box-shadow: 0 0 0 5px rgb(247 201 72 / 18%); }
.route-line { flex: 1; height: 2px; margin: 0 8px; background: repeating-linear-gradient(90deg, rgb(255 255 255 / 45%) 0 8px, transparent 8px 15px); }
.route-pin { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 50%; color: var(--yellow-400); background: rgb(255 255 255 / 10%); }
.route-pin svg { width: 24px; fill: none; stroke: currentColor; stroke-width: 1.9; }

.login-panel { display: grid; min-height: 100vh; padding: 48px clamp(28px, 8vw, 120px); place-items: center; background: linear-gradient(145deg, #fff, #fbf9fb); }
.login-card { width: min(100%, 470px); padding: 42px; border: 1px solid #ece7ed; border-radius: 24px; background: rgb(255 255 255 / 94%); box-shadow: var(--shadow-lg); }
.login-heading h2 { margin: 0; font-size: clamp(28px, 3vw, 38px); letter-spacing: -.04em; }
.login-heading > p:last-child { margin: 12px 0 0; color: var(--neutral-700); line-height: 1.6; }

.flash-list { display: grid; gap: 8px; margin-top: 22px; }
.flash { padding: 12px 14px; border-radius: 10px; font-size: 14px; line-height: 1.4; }
.flash--error { color: var(--danger-text); background: var(--danger-bg); }
.flash--success { color: var(--success-text); background: var(--success-bg); }
.flash--info { color: #684900; background: #fff8df; }

.login-form { display: grid; gap: 20px; margin-top: 30px; }
.field { display: grid; gap: 9px; color: #3f3941; font-size: 14px; font-weight: 700; }
.field-control { display: flex; align-items: center; min-height: 54px; padding: 0 15px; border: 1px solid var(--neutral-300); border-radius: 12px; background: var(--white); transition: border-color .2s, box-shadow .2s; }
.field-control:focus-within { border-color: var(--red-600); box-shadow: 0 0 0 4px rgb(217 35 63 / 10%); }
.field-control > svg, .password-toggle svg { width: 20px; flex: 0 0 20px; fill: none; stroke: var(--neutral-500); stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.field-control input { width: 100%; min-width: 0; padding: 14px 12px; border: 0; outline: 0; color: var(--neutral-950); background: transparent; }
.field-control input::placeholder { color: #aaa4ad; }
.password-toggle { display: grid; flex: 0 0 36px; width: 36px; height: 36px; padding: 0; place-items: center; border: 0; border-radius: 8px; background: transparent; }
.password-toggle:hover, .password-toggle:focus-visible { background: var(--neutral-100); outline: none; }

.form-options { display: flex; justify-content: space-between; align-items: center; }
.checkbox { display: inline-flex; align-items: center; gap: 9px; color: var(--neutral-700); font-size: 14px; }
.checkbox input { width: 17px; height: 17px; accent-color: var(--red-600); }

.primary-button, .secondary-button { min-height: 52px; padding: 0 22px; border-radius: 12px; font-weight: 800; transition: transform .2s, background .2s, box-shadow .2s; }
.primary-button { border: 0; color: var(--white); background: linear-gradient(135deg, var(--red-600), var(--red-700)); box-shadow: 0 12px 24px rgb(189 24 51 / 24%); }
.primary-button:hover { transform: translateY(-1px); box-shadow: 0 15px 28px rgb(189 24 51 / 30%); }
.primary-button:focus-visible, .secondary-button:focus-visible { outline: 3px solid rgb(247 201 72 / 70%); outline-offset: 3px; }
.secondary-button { border: 1px solid var(--wine-800); color: var(--wine-800); background: transparent; }

.login-help { margin: 26px 0 0; color: var(--neutral-500); font-size: 12px; line-height: 1.6; text-align: center; }

.placeholder-page { display: grid; min-height: 100vh; padding: 28px; place-items: center; background: linear-gradient(145deg, #fff, #f5eef1); }
.placeholder-page section { width: min(100%, 620px); padding: 44px; border-radius: 24px; background: var(--white); box-shadow: var(--shadow-lg); }
.placeholder-page h1 { margin: 0; font-size: 40px; }
.placeholder-page p:not(.eyebrow) { margin: 16px 0 28px; color: var(--neutral-700); line-height: 1.7; }


.app-page {
  --app-bg: #f6f4f5;
  --surface: #ffffff;
  --surface-muted: #faf8f9;
  --text: #201c20;
  --text-muted: #706a72;
  --border: #e8e3e7;
  --map-bg: #eeeae8;
  color: var(--text);
  background: var(--app-bg);
  transition: color .2s, background .2s;
}

.app-page[data-theme="dark"] {
  --app-bg: #171316;
  --surface: #221c21;
  --surface-muted: #2b2429;
  --text: #f7f3f5;
  --text-muted: #bdb4bb;
  --border: #40353d;
  --map-bg: #312a2f;
  color-scheme: dark;
}

.app-header {
  position: sticky;
  z-index: 50;
  top: 0;
  display: grid;
  grid-template-columns: auto 1fr auto;
  min-height: 74px;
  padding: 0 clamp(20px, 4vw, 64px);
  align-items: center;
  gap: clamp(24px, 4vw, 60px);
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: 0 2px 14px rgb(39 11 21 / 4%);
  backdrop-filter: blur(18px);
}

.app-logo { display: inline-flex; align-items: center; gap: 9px; color: var(--text); font-size: 19px; font-weight: 800; letter-spacing: -.04em; text-decoration: none; }
.app-logo > span:last-child span { color: var(--red-600); }
.app-logo__mark { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 11px; color: var(--wine-950); background: var(--yellow-400); }
.app-logo__mark svg { width: 27px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2.4; }

.main-nav { display: flex; height: 74px; align-items: stretch; gap: 4px; }
.main-nav__link { position: relative; display: grid; padding: 0 17px; place-items: center; color: var(--text-muted); font-size: 14px; font-weight: 600; text-decoration: none; }
.main-nav__link::after { position: absolute; right: 17px; bottom: 0; left: 17px; height: 3px; border-radius: 4px 4px 0 0; content: ""; background: transparent; }
.main-nav__link:hover, .main-nav__link.is-active { color: var(--red-600); }
.main-nav__link.is-active::after { background: var(--red-600); }

.header-actions { display: flex; align-items: center; gap: 12px; }
.icon-button { display: grid; width: 42px; height: 42px; padding: 0; place-items: center; border: 1px solid var(--border); border-radius: 12px; color: var(--text-muted); background: var(--surface); }
.icon-button:hover, .icon-button:focus-visible { color: var(--red-600); border-color: color-mix(in srgb, var(--red-600) 42%, var(--border)); outline: 0; }
.theme-icon { width: 20px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.alert-sound-button { position: relative; }
.alert-sound-icon { width: 20px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.alert-sound-icon--off { display: none; }
.alert-sound-button.is-muted .alert-sound-icon--on { display: none; }
.alert-sound-button.is-muted .alert-sound-icon--off { display: block; }
.alert-sound-button.has-pending-alerts:not(.is-muted) { color: var(--red-600); }
.alert-sound-button.needs-interaction { animation: sound-button-pulse 1.8s infinite; }
.alert-sound-button.has-audio-error { color: #a06512; }
.alert-sound-badge { display: grid; position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 4px; place-items: center; border: 2px solid var(--surface); border-radius: 10px; color: #fff; background: var(--red-600); font-size: 8px; font-weight: 800; line-height: 1; }
.alert-sound-badge[hidden] { display: none; }
@keyframes sound-button-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgb(217 35 63 / 0%); } 50% { box-shadow: 0 0 0 7px rgb(217 35 63 / 16%); } }
.theme-icon--moon { display: none; }
[data-theme="dark"] .theme-icon--sun { display: none; }
[data-theme="dark"] .theme-icon--moon { display: block; }

.profile-menu { position: relative; }
.profile-menu summary { display: flex; padding: 4px 6px; align-items: center; gap: 10px; border-radius: 13px; list-style: none; cursor: pointer; }
.profile-menu summary::-webkit-details-marker { display: none; }
.profile-menu summary:hover { background: var(--surface-muted); }
.profile-menu summary > svg { width: 17px; fill: none; stroke: var(--text-muted); stroke-width: 2; }
.profile-avatar { display: grid; width: 40px; height: 40px; place-items: center; border: 2px solid rgb(247 201 72 / 55%); border-radius: 50%; color: var(--white); background: linear-gradient(145deg, var(--wine-800), var(--red-600)); font-size: 14px; font-weight: 800; }
.profile-copy { display: grid; gap: 2px; min-width: 92px; }
.profile-copy strong { color: var(--text); font-size: 13px; }
.profile-copy small { color: var(--text-muted); font-size: 11px; }
.profile-dropdown { position: absolute; top: calc(100% + 12px); right: 0; width: 250px; padding: 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); box-shadow: 0 18px 45px rgb(20 9 14 / 18%); }
.profile-dropdown p { display: grid; gap: 4px; margin: 0; padding: 6px 8px 14px; border-bottom: 1px solid var(--border); }
.profile-dropdown p strong { font-size: 14px; }
.profile-dropdown p span { overflow: hidden; color: var(--text-muted); font-size: 12px; text-overflow: ellipsis; }
.profile-dropdown button { display: flex; width: 100%; margin-top: 8px; padding: 10px; align-items: center; gap: 9px; border: 0; border-radius: 9px; color: var(--danger-text); background: transparent; font-weight: 700; }
.profile-dropdown button:hover { background: var(--danger-bg); }
.profile-dropdown button svg { width: 18px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.nav-toggle { display: none; }
