/* App shell, public shell, navigation, error pages. One <nav> markup, three layouts
   (UI spec §2): phone bottom bar < 768 px, labelled 88 px rail 768-1279 px, full
   sidebar >= 1280 px. Same HTML, CSS media queries only. */

.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 100;
  padding: 12px 16px;
  background: var(--c-brand-charcoal);
  color: #fff;
  border-radius: var(--radius-lg);
}
.skip-link:focus {
  left: 8px;
}

/* ---- Wordmark: HISTORIKU. with the amber period --------------------------------------- */
.wordmark {
  font-family: var(--font-brand);
  font-weight: 800;
  font-size: 26px;
  letter-spacing: 0.03em;
  line-height: 1;
  color: var(--c-text);
}
.wordmark__dot {
  color: var(--c-brand-amber);
}

/* ---- Main area ------------------------------------------------------------------------ */
.app__main {
  padding: 16px 16px calc(var(--size-nav-item) + 24px + env(safe-area-inset-bottom));
}
.app__main:focus {
  outline: none;
}

/* ---- Navigation: phone bottom bar (default) ------------------------------------------- */
.nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  background: var(--c-surface);
  border-top: 1px solid var(--c-border);
  padding-bottom: env(safe-area-inset-bottom);
}
.nav__list {
  display: flex;
}
.nav__cell {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
}
.nav__item {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: var(--size-nav-item);
  padding: 4px 2px;
  background: none;
  border: 0;
  border-radius: 0;
  color: var(--c-text-2);
  font-size: var(--type-meta-min, 13px);
  font-weight: 600;
  text-decoration: none;
}
.nav__label {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav__item--active {
  color: var(--c-selected);
  box-shadow: inset 0 3px 0 var(--c-selected);
}
/* Phone shows Home, Vehicles, Reminders and More only. */
.nav__cell--wide,
.nav__brand,
.nav__logout {
  display: none;
}

/* Due badge: amber, charcoal text. The number is aria-hidden; the words are visually hidden. */
.badge {
  position: absolute;
  top: 4px;
  left: calc(50% + 6px);
  display: grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  background: var(--c-brand-amber);
  color: var(--c-brand-charcoal);
  border-radius: 11px;
  font-family: var(--font-data);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
}

/* ---- More sheet ----------------------------------------------------------------------- */
.more {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.more__item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: var(--size-list-row);
  padding: 0 16px;
  background: var(--c-surface);
  border: 2px solid var(--c-border);
  border-radius: var(--radius-lg);
  color: var(--c-text);
  font-size: var(--type-body);
  font-weight: 600;
  text-align: left;
  text-decoration: none;
}

/* ---- Public shell --------------------------------------------------------------------- */
.public__head {
  display: flex;
  align-items: center;
  min-height: 64px;
  padding: 0 16px;
  background: var(--c-brand-charcoal);
}
.public__brand {
  text-decoration: none;
}
.public__head .wordmark {
  color: #fff;
}
.public__main {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px;
}
.public__main:focus {
  outline: none;
}

/* ---- Error pages ---------------------------------------------------------------------- */
.error-page {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  padding-block: 24px;
}
.error-page__status {
  font-size: 18px;
  font-weight: 600;
  color: var(--c-text-2);
}
.error-page .btn {
  margin-top: 12px;
}

/* ---- Tablet: labelled 88 px rail ------------------------------------------------------ */
@media (min-width: 768px) {
  .app {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr);
    align-items: start;
  }
  .nav {
    position: sticky;
    top: 0;
    bottom: auto;
    left: auto;
    right: auto;
    display: flex;
    flex-direction: column;
    height: 100dvh;
    padding: 8px 0;
    border-top: 0;
    border-right: 1px solid var(--c-border);
  }
  .nav__list {
    flex-direction: column;
  }
  .nav__cell {
    flex: none;
  }
  .nav__cell--wide,
  .nav__logout {
    display: flex;
  }
  .nav__cell--phone-only {
    display: none;
  }
  .nav__item {
    flex: none;
    width: 100%;
    min-height: 64px;
    padding: 6px 4px;
    gap: 4px;
  }
  .nav__item--active {
    box-shadow: inset 3px 0 0 var(--c-selected);
  }
  .nav__logout {
    margin-top: auto;
  }
  .badge {
    top: 6px;
    left: calc(50% + 8px);
  }
  .app__main {
    padding: 24px;
  }
  .toast-region {
    left: 88px;
    bottom: 24px;
  }
}

/* ---- Counter PC: full sidebar --------------------------------------------------------- */
@media (min-width: 1280px) {
  .app {
    grid-template-columns: 200px minmax(0, 1fr);
  }
  .nav__brand {
    display: block;
    padding: 20px 16px 16px;
    text-decoration: none;
  }
  .nav__item {
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    min-height: var(--size-nav-item);
    padding: 0 16px;
    font-size: var(--type-body);
  }
  .badge {
    position: static;
    margin-left: auto;
  }
  .toast-region {
    left: 200px;
  }
}

/* ---- Auth pages (signup, login) ------------------------------------------------------- */
.auth {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: var(--form-max);
}
.auth__lead {
  color: var(--c-text-2);
}
.auth__form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.auth__form .btn {
  width: 100%;
}
.auth__error {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border: 2px solid var(--c-danger);
  border-radius: var(--radius-lg);
  background: var(--tint-danger);
  font-weight: 600;
  color: var(--c-danger);
}
.auth__alt {
  color: var(--c-text-2);
}
.auth__alt a {
  margin-left: 6px;
  font-weight: 600;
}
/* The magic-link request sits below the password form, set apart by a rule. */
.auth__magic {
  padding-top: 20px;
  border-top: 1px solid var(--c-border);
}
.check__label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-height: var(--touch-min);
  font-weight: 400;
  cursor: pointer;
}
.check__input {
  flex: none;
  width: 24px;
  height: 24px;
  margin-top: 2px;
  accent-color: var(--c-brand-graphite);
}
.field[data-invalid] .check__input {
  outline: 2px solid var(--c-danger);
  outline-offset: 2px;
}

/* ---- Home (UI spec §6 header) ---------------------------------------------------------- */
.home__head {
  margin-bottom: 16px;
}
.home__garage {
  text-transform: uppercase;
}
.home__date {
  color: var(--c-text-2);
}
.home__empty {
  color: var(--c-text-2);
}
.banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: var(--radius-lg);
  font-weight: 600;
}
.banner--info {
  border: 2px solid var(--c-info);
  background: color-mix(in srgb, var(--c-info) 10%, var(--c-surface));
}
