/*
 * styles-8-skeletons.css
 *
 * Loading skeletons (news / stocks / weather), pulse animations.
 *
 * Phase 5 S3 pass-2: extracted from the monolithic styles.css
 * (8 286 LOC) to bring every CSS source file under the < 1 500
 * LOC bar. Load order in index.html preserves the original
 * cascade exactly: this file occupies lines 7134 - 8252 of the
 * pre-split styles.css.
 */

/* ---------------------------------------------------------------------------
   Loading skeletons (news / stocks / weather) — pulse suppressed when reduced-motion
   --------------------------------------------------------------------------- */

/* Weather tile: heading + temp + meta bars + horizontal hour placeholders */
#weather-card.skeleton-zone .weather-skeleton-heading {
  display: block;
  width: min(11rem, 72%);
  height: 0.85rem;
  margin: 0;
  padding: 0;
  color: transparent !important;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--muted) 18%, var(--surface-alt));
}

#weather-card.skeleton-zone .weather-current__main.weather-skeleton-hero {
  display: inline-block;
  vertical-align: middle;
  width: 5.75rem;
  height: 1.35rem;
  margin: 0.15rem 0;
  color: transparent !important;
  font-size: 0 !important;
  line-height: 0 !important;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--muted) 18%, var(--surface-alt));
}

#weather-card.skeleton-zone .weather-desc.weather-skeleton-desc {
  height: 0.52rem;
  width: min(100%, 14rem);
  margin: 0.35rem 0 0;
  padding: 0;
  color: transparent !important;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--muted) 18%, var(--surface-alt));
}

.hourly-forecast.hourly-forecast--skeleton {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: var(--space-2);
  margin-top: var(--space-3);
  padding-bottom: var(--space-2);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

#weather-card.skeleton-zone .weather-hour-skeleton-block {
  flex-shrink: 0;
  min-width: 4.25rem;
  height: 4rem;
  margin: 0;
  border-radius: var(--radius-md);
}

.skeleton-zone .skeleton-line,
.skeleton-zone .skeleton-block {
  background: color-mix(in srgb, var(--muted) 18%, var(--surface-alt));
  border-radius: var(--radius-sm);
}

.skeleton-zone .skeleton-line--title {
  height: 0.72rem;
  width: 92%;
  margin-bottom: 0.38rem;
}

.skeleton-zone .skeleton-line--meta {
  height: 0.52rem;
  width: 42%;
}

.skeleton-zone .skeleton-chip-name {
  height: 0.62rem;
  width: 58%;
}

.skeleton-zone .skeleton-chip-price {
  height: 0.55rem;
  width: 36%;
}

.skeleton-zone .skeleton-chip-spark {
  height: 2rem;
  width: 100%;
  margin-top: 0.35rem;
  border-radius: var(--radius-md);
}

.stocks-skeleton-chips {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--stock-gap, 0.32rem);
}

.stock-chip-skeleton {
  padding: 0.38rem 0.42rem;
  border-radius: var(--radius-md);
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  background: color-mix(in srgb, var(--surface-alt) 90%, var(--surface));
}

.stock-chip-skeleton__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

@media (prefers-reduced-motion: no-preference) {
  .skeleton-zone .skeleton-line,
  .skeleton-zone .skeleton-block {
    animation: skeleton-pulse 1.4s ease-in-out infinite;
  }
}

@keyframes skeleton-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.55;
  }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton-zone .skeleton-line,
  .skeleton-zone .skeleton-block {
    opacity: 0.85;
  }
}

/* ─── Phase 4 S3: shared empty-state / error-state primitives ────────────
 * Designed to compose with `.skeleton-zone` (you can swap a `.skeleton-zone`
 * for a `.empty-state` / `.error-state` in the same container without any
 * layout jitter). Mirrors the Android `EmptyState` + `RetryableErrorState`
 * shape so the two platforms read as siblings:
 *   - vertically stacked icon + heading + body + optional action
 *   - centered horizontally with generous breathing room
 *   - the action slot is a button (use `.btn`, `.button-primary`, or
 *     plain `<button>` — the spacing reserves room for one).
 *
 * Use:
 *   <div class="empty-state" role="status" aria-live="polite">
 *     <div class="empty-state__icon" aria-hidden="true">📭</div>
 *     <h3 class="empty-state__title">No saved stories yet</h3>
 *     <p class="empty-state__body">Bookmark articles you love to find them here.</p>
 *     <button class="empty-state__action" type="button">Browse news</button>
 *   </div>
 *
 *   <div class="error-state" role="alert">
 *     <div class="error-state__icon" aria-hidden="true">⚠️</div>
 *     <h3 class="error-state__title">Couldn't load headlines</h3>
 *     <p class="error-state__body">Check your connection and try again.</p>
 *     <button class="error-state__action" type="button">Retry</button>
 *   </div>
 */
.empty-state,
.error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.5rem;
  padding: 1.5rem 1.25rem;
  border-radius: var(--radius-lg, 16px);
  background: color-mix(in srgb, var(--surface-alt) 60%, transparent);
  border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}

.error-state {
  background: var(--status-error-bg, color-mix(in srgb, #fee2e2 80%, transparent));
  border-color: color-mix(in srgb, var(--status-error-bg, #fca5a5) 60%, transparent);
}

.empty-state__icon,
.error-state__icon {
  font-size: 2rem;
  line-height: 1;
  opacity: 0.85;
  margin-bottom: 0.25rem;
}

.empty-state__title,
.error-state__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.error-state__title {
  color: var(--status-error-fg, #991b1b);
}

.empty-state__body,
.error-state__body {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--muted);
  max-width: 36ch;
}

.error-state__body {
  color: color-mix(in srgb, var(--status-error-fg, #991b1b) 85%, var(--text));
}

.empty-state__action,
.error-state__action {
  margin-top: 0.5rem;
  appearance: none;
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 0.45rem 1.05rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  /* Phase 4 S4 a11y: bumped 44 → 48 (Phase 4 S1 reconciliation hit-target floor).
     S3 originally landed at 44 by accident — corrected here. */
  min-height: var(--touch-target-min, 48px);
  min-width: var(--touch-target-min, 48px);
  transition: background-color 160ms ease, transform 120ms ease;
}

.empty-state__action:hover,
.error-state__action:hover {
  background: color-mix(in srgb, var(--surface) 80%, var(--accent, #2563eb));
}

.empty-state__action:active,
.error-state__action:active {
  transform: scale(0.98);
}

.empty-state__action:focus-visible,
.error-state__action:focus-visible {
  outline: 2px solid var(--accent, #2563eb);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .empty-state__action,
  .error-state__action {
    transition: none;
  }
  .empty-state__action:active,
  .error-state__action:active {
    transform: none;
  }
}

/* ═══ Glance-first mobile home (≤820px): one-screen density, 8pt grid, rotating spotlight ═══ */
@media (min-width: 821px) {
  .glance-rotate,
  .glance-rotate__slides,
  .glance-rotate__slide {
    display: contents;
  }

  .glance-rotate__arrow {
    display: none !important;
  }

  .glance-rotate__nav {
    display: none !important;
  }

  .glance-collapsible--ai-news {
    display: contents;
  }

  .glance-collapsible--ai-news .glance-collapsible__trigger {
    display: none !important;
  }

  .glance-collapsible--ai-news .glance-collapsible__panel {
    max-height: none !important;
    opacity: 1 !important;
    overflow: visible !important;
  }
}

@media (max-width: 820px) {
  body:not(.mobile-news-screen):not(.mobile-stocks-screen):not(.mobile-todos-screen):not(.mobile-favorites-screen):not(
      .mobile-prefs-screen
    )
    .app-shell {
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  body:not(.mobile-news-screen):not(.mobile-stocks-screen):not(.mobile-todos-screen):not(.mobile-favorites-screen):not(
      .mobile-prefs-screen
    )
    #main-content.dashboard {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  body:not(.mobile-news-screen):not(.mobile-stocks-screen):not(.mobile-todos-screen):not(.mobile-favorites-screen):not(
      .mobile-prefs-screen
    )
    #today-brief-section.glance-home-shell {
    --grid-step: var(--space-2);
    --glance-slot-h: clamp(8rem, 28svh, 12.5rem);
    --today-brief-commute-h: var(--glance-slot-h);
    flex: 1;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    gap: var(--grid-step);
    padding-bottom: var(--space-2);
    margin-bottom: 0;
  }

  body:not(.mobile-news-screen):not(.mobile-stocks-screen):not(.mobile-todos-screen):not(.mobile-favorites-screen):not(
      .mobile-prefs-screen
    )
    #today-brief-section.glance-home-shell
    .today-brief__intro--glance-primary {
    flex: 0 0 auto;
    padding: var(--space-4) var(--space-4);
    margin-bottom: 0;
    position: relative;
    isolation: isolate;
    overflow: hidden;
    border-radius: var(--radius-card-primary);
    background: linear-gradient(
      145deg,
      color-mix(in srgb, var(--surface-alt) 88%, var(--accent-soft)),
      color-mix(in srgb, var(--surface-alt) 96%, transparent)
    );
    border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--border));
    box-shadow: var(--card-elev-highlight);
  }

  body:not(.mobile-news-screen):not(.mobile-stocks-screen):not(.mobile-todos-screen):not(.mobile-favorites-screen):not(
      .mobile-prefs-screen
    )
    #today-brief-section.glance-home-shell
    .today-brief__intro--glance-primary::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    z-index: 0;
    background: linear-gradient(
      118deg,
      transparent 18%,
      color-mix(in srgb, var(--accent) 12%, transparent) 52%,
      color-mix(in srgb, var(--accent) 20%, transparent) 100%
    );
    opacity: 0.92;
  }

  body:not(.mobile-news-screen):not(.mobile-stocks-screen):not(.mobile-todos-screen):not(.mobile-favorites-screen):not(
      .mobile-prefs-screen
    )
    #today-brief-section.glance-home-shell
    .today-brief__intro--glance-primary
    .today-brief__hero-title {
    position: relative;
    z-index: 1;
  }

  body:not(.mobile-news-screen):not(.mobile-stocks-screen):not(.mobile-todos-screen):not(.mobile-favorites-screen):not(
      .mobile-prefs-screen
    )
    #today-brief-section.glance-home-shell
    .today-brief__hero-title {
    font-size: clamp(1rem, 0.92rem + 0.35vw, 1.2rem);
    margin: 0;
    line-height: var(--font-line-tight);
  }

  body:not(.mobile-news-screen):not(.mobile-stocks-screen):not(.mobile-todos-screen):not(.mobile-favorites-screen):not(
      .mobile-prefs-screen
    )
    #today-brief-section.glance-home-shell
    .today-brief-weather.mobile-weather-brief {
    flex: 0 0 auto;
    margin: 0;
    min-height: 0;
  }

  body:not(.mobile-news-screen):not(.mobile-stocks-screen):not(.mobile-todos-screen):not(.mobile-favorites-screen):not(
      .mobile-prefs-screen
    )
    #today-brief-section.glance-home-shell
    #weather-card.weather-card--brief {
    height: auto;
    min-height: 0;
    max-height: none;
    padding: var(--space-2) var(--space-3) var(--space-1);
    opacity: 0.94;
    box-shadow: var(--elev-1);
  }

  body:not(.mobile-news-screen):not(.mobile-stocks-screen):not(.mobile-todos-screen):not(.mobile-favorites-screen):not(
      .mobile-prefs-screen
    )
    #today-brief-section.glance-home-shell
    .weather-hourly-details {
    max-height: min(14rem, 48svh);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }

  body:not(.mobile-news-screen):not(.mobile-stocks-screen):not(.mobile-todos-screen):not(.mobile-favorites-screen):not(
      .mobile-prefs-screen
    )
    #today-brief-section.glance-home-shell
    #weather-hourly.hourly-forecast {
    max-height: min(11rem, 36svh);
  }

  body:not(.mobile-news-screen):not(.mobile-stocks-screen):not(.mobile-todos-screen):not(.mobile-favorites-screen):not(
      .mobile-prefs-screen
    )
    #today-brief-section.glance-home-shell
    .today-brief__grid--glance {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: var(--grid-step);
    /* Let the brief column scroll; clip horizontal bleed only (carousel uses position:absolute slides) */
    overflow-x: hidden;
    overflow-y: visible;
  }

  #glance-rotate {
    /* Do not grow to fill the column — that stretched the slide stack and let chips paint over the AI block */
    flex: 0 0 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    opacity: 0.96;
    position: relative;
    z-index: 0;
    overflow: hidden;
  }

  #glance-rotate-slides {
    position: relative;
    flex: 0 0 auto;
    width: 100%;
    /* Horizontal swipe rail: app.js keeps height aligned to active card. */
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    min-height: var(--today-brief-commute-h);
    scrollbar-width: none;
  }
  #glance-rotate-slides::-webkit-scrollbar {
    display: none;
  }

  #glance-rotate .glance-rotate__slide {
    position: relative;
    inset: auto;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    flex: 0 0 100%;
    width: 100%;
    min-height: 0;
    justify-content: flex-start;
    align-items: stretch;
    scroll-snap-align: start;
    scroll-snap-stop: always;
  }

  #glance-rotate .glance-rotate__arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3;
    /* Phase 4 S4 a11y: previously a 27px round button. Bumped to the
       Material 3 / WCAG 2.5.5 touch-target floor. The visual circle is
       intentionally smaller than the hit area — keeps the editorial
       glance design while making the control tappable by everyone. */
    width: var(--touch-target-min, 48px);
    height: var(--touch-target-min, 48px);
    min-width: var(--touch-target-min, 48px);
    min-height: var(--touch-target-min, 48px);
    border: 1px solid var(--border);
    border-radius: 999px;
    background: color-mix(in srgb, var(--surface-alt) 92%, transparent);
    color: var(--text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    box-shadow: var(--elev-1);
  }

  #glance-rotate .glance-rotate__arrow--prev {
    left: 0.2rem;
  }

  #glance-rotate .glance-rotate__arrow--next {
    right: 0.2rem;
  }

  #glance-rotate .glance-rotate__arrow:focus-visible {
    outline: var(--focus-ring-width) solid var(--focus-ring-color);
    outline-offset: var(--focus-ring-offset);
  }

  #glance-rotate .glance-rotate__arrow:active {
    transform: translateY(-50%) scale(0.96);
  }

  #glance-rotate .glance-rotate__slide--active {
    z-index: 0;
  }

  #glance-rotate .glance-rotate__slide > * {
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    max-height: 100%;
    width: 100%;
    box-sizing: border-box;
  }

  #glance-rotate #brief-card-ipl.today-brief__card--ipl-brief {
    height: auto;
    min-height: 0;
    max-height: none;
    overflow: visible;
  }

  #glance-rotate #brief-card-ipl .brief-ipl-scroll {
    flex: 0 1 auto;
    min-height: 0;
    max-height: none;
    overflow-x: hidden;
    overflow-y: hidden;
  }

  #glance-rotate-nav {
    flex: 0 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-2);
    padding: 0;
    margin-top: 0.1rem;
  }

  .glance-rotate__dot {
    /* Phase 4 S4 a11y: the visible dot stays small (--space-2 = 8px) but
       the actual hit area is the WCAG 2.5.5 / Material 3 floor of 48px.
       We use `position: relative` + `::before` to grow the hit area
       without disturbing visual layout — the dot row stays compact while
       a tap anywhere in the 48px square triggers the button. */
    position: relative;
    width: var(--space-2);
    height: var(--space-2);
    padding: 0;
    border-radius: 999px;
    border: 2px solid color-mix(in srgb, var(--muted) 55%, var(--border));
    background: transparent;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition:
      background var(--duration-fast) var(--ease-standard),
      transform var(--duration-fast) var(--ease-out);
  }

  .glance-rotate__dot::before {
    content: "";
    position: absolute;
    inset: 50% 50%;
    width: var(--touch-target-min, 48px);
    height: var(--touch-target-min, 48px);
    transform: translate(-50%, -50%);
    border-radius: 999px;
  }

  .glance-rotate__dot--active {
    background: var(--accent);
    border-color: var(--accent);
    transform: scale(1.15);
  }

  .glance-collapsible--ai-news {
    flex: 0 0 auto;
    min-height: 0;
    position: relative;
    z-index: 1;
    isolation: isolate;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface-alt) 92%, transparent);
    opacity: 0.9;
    box-shadow: var(--elev-1);
  }

  .glance-collapsible__trigger {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    align-items: center;
    gap: var(--space-1) var(--space-2);
    padding: var(--space-3) var(--space-3);
    margin: 0;
    border: none;
    background: transparent;
    color: var(--text);
    font: inherit;
    text-align: left;
    cursor: pointer;
    border-radius: var(--radius-md);
    -webkit-tap-highlight-color: transparent;
  }

  .glance-collapsible__label {
    grid-column: 1;
    grid-row: 1;
    font-weight: var(--font-weight-semibold);
    font-size: var(--type-section);
    letter-spacing: 0.015em;
    color: var(--text);
  }

  .glance-collapsible__summary {
    grid-column: 1 / -1;
    grid-row: 2;
    font-size: var(--type-meta);
    font-weight: var(--font-weight-regular);
    color: var(--text-secondary);
    line-height: var(--font-line-snug);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .glance-collapsible__chevron {
    grid-column: 2;
    grid-row: 1;
    width: 0.65rem;
    height: 0.65rem;
    border-right: 2px solid var(--text-secondary);
    border-bottom: 2px solid var(--text-secondary);
    transform: rotate(45deg);
    transition: transform var(--duration-base) var(--ease-out);
    justify-self: end;
    margin-top: 0.2rem;
  }

  .glance-collapsible--ai-news[data-expanded="true"] .glance-collapsible__chevron {
    transform: rotate(225deg);
    margin-top: 0.2rem;
  }

  .glance-collapsible__panel {
    position: static;
    left: auto;
    right: auto;
    bottom: auto;
    z-index: auto;
    overflow: hidden;
    max-height: 0;
    opacity: 0.65;
    visibility: visible;
    pointer-events: auto;
    transform: none;
    transition:
      max-height var(--duration-card-motion) var(--ease-out),
      opacity var(--duration-card-motion) var(--ease-out);
  }

  .glance-collapsible--ai-news[data-expanded="true"] .glance-collapsible__panel {
    max-height: 32rem;
    opacity: 1;
    overflow: visible;
    border-top: 1px solid var(--border-subtle);
  }

  .glance-collapsible__panel-inner {
    padding: 0;
    overflow: visible;
  }

  .glance-collapsible--ai-news[data-expanded="true"] #brief-card-ai-news {
    box-shadow: none;
    border: 1px solid var(--border);
    background: var(--surface-alt);
    padding: var(--space-3);
    overflow: visible;
  }

  /* Medium phones: open AI summary upward as a popup. */
  @media (min-width: 380px) and (max-width: 460px) {
    .glance-collapsible__chevron {
      transform: rotate(225deg);
    }

    .glance-collapsible--ai-news[data-expanded="true"] .glance-collapsible__chevron {
      transform: rotate(45deg);
    }

    .glance-collapsible__panel {
      position: absolute;
      left: 0;
      right: 0;
      bottom: calc(100% + var(--space-2));
      z-index: 4;
      opacity: 0;
      visibility: hidden;
      pointer-events: none;
      transform: translateY(0.28rem);
      overflow: visible;
      max-height: none;
      transition:
        opacity var(--duration-card-motion) var(--ease-out),
        transform var(--duration-card-motion) var(--ease-out),
        visibility 0s linear var(--duration-card-motion);
    }

    .glance-collapsible--ai-news[data-expanded="true"] .glance-collapsible__panel {
      opacity: 1;
      visibility: visible;
      pointer-events: auto;
      transform: translateY(0);
      border-top: none;
      transition:
        opacity var(--duration-card-motion) var(--ease-out),
        transform var(--duration-card-motion) var(--ease-out),
        visibility 0s linear 0s;
    }
  }
}

@media (max-width: 820px) and (prefers-reduced-motion: reduce) {
  #glance-rotate .glance-rotate__slide {
    transition: none;
  }

  .glance-collapsible__panel {
    transition: none;
  }
}

/* First-run mobile tip: bottom navigation discoverability */
.mobile-nav-hint {
  position: fixed;
  z-index: 55;
  left: max(0.5rem, env(safe-area-inset-left, 0px));
  right: max(0.5rem, env(safe-area-inset-right, 0px));
  top: max(0.4rem, env(safe-area-inset-top, 0px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--border));
  background: color-mix(in srgb, var(--surface) 96%, var(--accent-soft));
  color: var(--text);
  box-shadow: var(--elev-1);
  font-size: var(--font-size-sm);
  line-height: var(--font-line-snug);
}

.mobile-nav-hint[hidden] {
  display: none !important;
}

.mobile-nav-hint__text {
  margin: 0;
  flex: 1;
  min-width: 0;
}

.mobile-nav-hint__dismiss {
  flex-shrink: 0;
  font: inherit;
  font-size: var(--font-size-sm);
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  min-height: var(--touch-target-min);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.mobile-nav-hint__dismiss:hover {
  background: var(--surface-alt);
}

.mobile-nav-hint__dismiss:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
}

@media (min-width: 821px) {
  .mobile-nav-hint {
    display: none !important;
  }
}

/* ═══ Desktop rail + account (web parity) ═══ */
.desktop-rail {
  display: none;
}

.app-shell__body {
  min-width: 0;
}

@media (min-width: 1024px) {
  .app-shell {
    display: grid;
    grid-template-columns: 4.5rem minmax(0, 1fr);
    gap: var(--space-4);
    align-items: start;
    width: min(1600px, calc(100% - var(--space-8)));
  }

  .desktop-rail {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    position: sticky;
    top: var(--space-4);
    padding: var(--space-3) var(--space-2);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-card-secondary);
    box-shadow: var(--card-elev-subtle);
  }

  .desktop-rail__link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    padding: var(--space-2);
    border-radius: 10px;
    color: var(--muted);
    text-decoration: none;
    font-size: var(--type-meta);
    border: none;
    background: transparent;
    cursor: pointer;
    min-height: var(--touch-target-min);
  }

  .desktop-rail__link:hover,
  .desktop-rail__link:focus-visible {
    color: var(--text);
    background: var(--surface-alt);
    outline: var(--focus-ring-width) solid var(--focus-ring-color);
    outline-offset: var(--focus-ring-offset);
  }

  .desktop-rail__icon {
    font-size: 1.15rem;
    line-height: 1;
  }

  .desktop-rail__label {
    font-size: 0.625rem;
    font-weight: var(--font-weight-medium);
    text-align: center;
    line-height: 1.2;
  }
}

.account-chip-btn {
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  font-size: var(--type-meta);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  min-height: var(--touch-target-min);
}

.account-chip-btn:hover,
.account-chip-btn:focus-visible {
  border-color: var(--accent);
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
}

.account-sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1200;
}

.account-sheet {
  position: fixed;
  z-index: 1201;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(100%, 28rem);
  max-height: min(92dvh, 640px);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px 20px 0 0;
  box-shadow: var(--shadow-hover);
  padding: var(--space-5);
}

body.account-sheet-open {
  overflow: hidden;
}

@media (min-width: 720px) {
  .account-sheet {
    top: 50%;
    bottom: auto;
    transform: translate(-50%, -50%);
    border-radius: var(--radius-shell);
    max-height: min(85vh, 560px);
  }
}

.account-sheet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.account-sheet__title {
  margin: 0;
  font-size: var(--type-section);
  font-weight: var(--font-weight-semibold);
}

.account-sheet__close {
  border: none;
  background: var(--surface-alt);
  border-radius: 8px;
  padding: 0.35rem 0.65rem;
  cursor: pointer;
  color: var(--text);
  /* Phase 4 S4 a11y: ensure close button meets the touch-target floor. */
  min-width: var(--touch-target-min, 48px);
  min-height: var(--touch-target-min, 48px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.account-tabs {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.account-tabs__btn {
  flex: 1;
  border: 1px solid var(--border);
  background: transparent;
  border-radius: 10px;
  padding: 0.5rem;
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  color: var(--muted);
}

.account-tabs__btn.is-active {
  border-color: var(--accent);
  color: var(--text);
  background: var(--primary-soft);
}

.account-form__field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: var(--space-3);
  font-size: var(--type-body);
}

.account-form__field input {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.account-form__submit,
.account-form__secondary {
  width: 100%;
  margin-top: var(--space-2);
  border-radius: 10px;
  padding: 0.65rem 1rem;
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  font: inherit;
}

.account-form__submit {
  background: var(--btn-solid-bg);
  color: var(--btn-solid-fg);
  border: none;
}

.account-form__submit--ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.account-form__secondary {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--text);
}

.account-form__rebind {
  margin-top: 0.35rem;
}

.account-form__rebind-btn {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.55rem 0.85rem;
  background: var(--surface-alt);
  color: var(--accent);
  font-weight: 600;
  font-size: var(--type-meta);
  cursor: pointer;
}

.account-form__rebind-btn:hover {
  border-color: var(--accent);
}

.account-form__error {
  color: var(--stock-down);
  font-size: var(--type-body);
  margin: 0 0 var(--space-3);
}

.account-form__remember {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--type-body);
  margin-bottom: var(--space-3);
}

.account-sheet__tier {
  font-size: var(--type-meta);
  color: var(--muted);
  margin: 0 0 var(--space-2);
}

.account-sheet__hint {
  font-size: var(--type-body);
  color: var(--muted);
  margin: 0 0 var(--space-4);
  line-height: 1.45;
}
