/* Estimize app home — light body, dark header */

:root {
  --ah-bg: #f4f6f9;
  --ah-bg-soft: #eef2f7;
  --ah-surface: #ffffff;
  --ah-surface-2: #f8fafc;
  --ah-ink: #0f172a;
  --ah-ink-soft: #64748b;
  --ah-line: #e2e8f0;
  --ah-line-strong: #cbd5e1;
  --ah-header: #0f1629;
  --ah-header-ink: #f0f4fc;
  --ah-header-muted: #94a3b8;
  --ah-accent: #2563eb;
  --ah-accent-bright: #3b82f6;
  --ah-up: #15803d;
  --ah-down: #b91c1c;
  --ah-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --ah-left: 232px;
  --ah-right: 300px;
  --ah-max: 1280px;
  --ah-tabbar-h: 64px;
  --ah-safe-bottom: env(safe-area-inset-bottom, 0px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body.app-home-page {
  margin: 0;
  font-family: var(--ah-font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--ah-ink);
  background:
    radial-gradient(900px 320px at 50% -140px, rgba(37, 99, 235, 0.08), transparent 60%),
    var(--ah-bg);
  -webkit-font-smoothing: antialiased;
}

body.ah-nav-open {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

.ah-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.ah {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(var(--ah-tabbar-h) + var(--ah-safe-bottom));
}

.ah-shell {
  width: 100%;
  flex: 1 0 auto;
}

.ah-footer {
  padding-bottom: 36px;
}

/* Logo — always dark wordmark for light surfaces; inverted only on dark chrome */
.ah-logo {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.ah-logo img {
  display: block;
  height: 18px;
  width: auto;
  filter: none;
}

.ah-top .ah-logo img {
  /* header-logo is dark; force white on dark navy chrome */
  filter: brightness(0) invert(1);
}

/* Top bar — dark chrome over light page */
.ah-top {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--ah-header);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  color: var(--ah-header-ink);
}

.ah-top__inner {
  max-width: var(--ah-max);
  margin: 0 auto;
  padding: 0 16px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.ah-menu-btn {
  display: none;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
}

.ah-menu-btn span {
  display: block;
  width: 18px;
  height: 2px;
  margin: 0 auto;
  background: var(--ah-header-ink);
  border-radius: 1px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.ah-search {
  position: relative;
  flex: 1;
  max-width: 420px;
}

.ah-search::before {
  content: '';
  position: absolute;
  left: 14px;
  top: 50%;
  width: 14px;
  height: 14px;
  transform: translateY(-50%);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M21 21l-4.35-4.35M11 18a7 7 0 100-14 7 7 0 000 14z'/%3E%3C/svg%3E") center / contain no-repeat;
  pointer-events: none;
}

.ah-search__input {
  width: 100%;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  padding: 0 52px 0 36px;
  background: rgba(255, 255, 255, 0.08);
  font: inherit;
  color: var(--ah-header-ink);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.ah-search__kbd {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: var(--ah-header-muted);
  font: inherit;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.2;
  pointer-events: none;
}

@media (hover: none) {
  .ah-search__kbd {
    display: none;
  }
}

.ah-search__input::placeholder {
  color: var(--ah-header-muted);
}

.ah-search__input:focus {
  outline: none;
  border-color: rgba(96, 165, 250, 0.8);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.22);
  background: rgba(255, 255, 255, 0.12);
}

.ah-top__nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
}

.ah-top__link {
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ah-header-muted);
  border-radius: 8px;
}

.ah-top__link:hover,
.ah-top__link--accent {
  color: #93c5fd;
}

.ah-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  font-weight: 650;
  font-size: 13px;
  border: 1px solid transparent;
}

.ah-btn--primary {
  background: var(--ah-accent);
  color: #fff;
  box-shadow: 0 4px 18px rgba(59, 130, 246, 0.28);
}

.ah-btn--primary:hover {
  background: var(--ah-accent-bright);
}

.ah-btn--block {
  width: 100%;
}

/* Ticker — seamless marquee */
.ah-ticker {
  border-bottom: 1px solid var(--ah-line);
  background: var(--ah-surface);
  overflow: hidden;
  mask-image: linear-gradient(90deg, transparent, #000 20px, #000 calc(100% - 20px), transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 20px, #000 calc(100% - 20px), transparent);
}

.ah-ticker__track {
  display: flex;
  align-items: center;
  gap: 28px;
  width: max-content;
  padding: 10px 16px;
  animation: ah-ticker-scroll 48s linear infinite;
}

.ah-ticker:hover .ah-ticker__track {
  animation-play-state: paused;
}

.ah-ticker__item {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  white-space: nowrap;
  font-size: 13px;
  flex-shrink: 0;
}

@keyframes ah-ticker-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

@media (prefers-reduced-motion: reduce) {
  .ah-ticker__track {
    animation: none;
    max-width: 100%;
    width: auto;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .ah-ticker__track::-webkit-scrollbar {
    display: none;
  }
}

.ah-ticker__sym {
  font-weight: 700;
  letter-spacing: 0.02em;
}

.ah-ticker__meta,
.ah-ticker__gap {
  color: var(--ah-ink-soft);
  font-variant-numeric: tabular-nums;
}

.ah-ticker__gap.is-up,
.ah-num.is-up,
.ah-panel__secondary.is-up {
  color: var(--ah-up);
}

.ah-ticker__gap.is-down,
.ah-num.is-down,
.ah-panel__secondary.is-down {
  color: var(--ah-down);
}

/* Shell */
.ah-shell {
  max-width: var(--ah-max);
  margin: 0 auto;
  padding: 20px 16px 32px;
  display: grid;
  grid-template-columns: var(--ah-left) minmax(0, 1fr) var(--ah-right);
  gap: 18px;
  align-items: start;
  animation: ah-rise 0.4s ease-out;
}

@keyframes ah-rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.ah-rail {
  position: sticky;
  top: 72px;
}

.ah-side-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 18px;
}

.ah-side-nav__item {
  display: block;
  padding: 10px 12px;
  border-radius: 10px;
  font-weight: 600;
  color: var(--ah-ink-soft);
}

.ah-side-nav__item:hover,
.ah-side-nav__item.is-active {
  background: rgba(15, 23, 42, 0.05);
  color: var(--ah-ink);
}

.ah-signup {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 18px;
}

.ah-signup__title {
  margin: 0 0 6px;
  font-size: 1.05rem;
}

.ah-signup__copy {
  margin: 0 0 14px;
  color: var(--ah-ink-soft);
  font-size: 13px;
}

.ah-signup__login {
  display: block;
  margin-top: 10px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--ah-accent-bright);
}

.ah-rail-foot {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  color: var(--ah-ink-soft);
}

.ah-rail-foot a:hover {
  color: var(--ah-accent-bright);
}

.ah-rail-foot__widgets {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.ah-rail-foot__badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 999px;
  background: #dbeafe;
  color: var(--ah-accent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.4;
}

/* Footer — same dark chrome as /home */
.ah-footer {
  margin-top: 8px;
  padding: 28px 0 36px;
  background: var(--ah-header);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--ah-header-muted);
}

.ah-footer__inner {
  max-width: var(--ah-max);
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 24px;
}

.ah-footer__brand {
  margin: 0;
  font-size: 14px;
}

.ah-footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}

.ah-footer__links a {
  font-size: 14px;
  color: var(--ah-header-muted);
}

.ah-footer__links a:hover {
  color: #fff;
}

/* Main sections */
.ah-section-head {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    'title link'
    'lede lede';
  gap: 4px 16px;
  margin-bottom: 14px;
  align-items: end;
}

.ah-title {
  grid-area: title;
  margin: 0;
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.ah-lede {
  grid-area: lede;
  margin: 0;
  color: var(--ah-ink-soft);
  max-width: 52ch;
  font-size: 14px;
}

.ah-text-link {
  grid-area: link;
  font-size: 13px;
  font-weight: 700;
  color: var(--ah-accent-bright);
  white-space: nowrap;
}

.ah-earnings,
.ah-feed,
.ah-panel {
  background: var(--ah-surface);
  border: 1px solid var(--ah-line);
  border-radius: 16px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.04);
}

.ah-earnings {
  padding: 18px 16px 8px;
  margin-bottom: 16px;
}

.ah-week {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.ah-week__day {
  display: block;
  border: 1px solid var(--ah-line);
  border-radius: 12px;
  padding: 10px;
  background: var(--ah-surface-2);
  min-height: 120px;
  min-width: 0;
  transition: border-color 0.15s, background 0.15s;
}

.ah-week__day:hover {
  border-color: var(--ah-line-strong);
}

.ah-week__day.is-selected {
  border-color: #93c5fd;
  background: #eff6ff;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.2);
}

.ah-week__label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}

.ah-week__dow {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ah-ink-soft);
}

.ah-week__date {
  font-size: 12px;
  font-weight: 700;
}

.ah-week__day.is-today .ah-week__date {
  color: var(--ah-accent-bright);
}

.ah-week__tickers {
  list-style: none;
  margin: 0;
  padding: 0;
  min-height: 48px;
  font-size: 13px;
  font-weight: 650;
}

.ah-week__tickers li + li {
  margin-top: 2px;
}

.ah-week__empty {
  color: #64748b;
  font-weight: 500;
}

.ah-week__count {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--ah-line);
  font-size: 11px;
  color: var(--ah-ink-soft);
}

.ah-day-table-wrap {
  overflow-x: auto;
  margin: 0 -4px;
  -webkit-overflow-scrolling: touch;
}

.ah-day-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 640px;
}

.ah-day-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
  padding: 10px 8px;
  border-bottom: 1px solid var(--ah-line);
}

.ah-day-table td {
  padding: 12px 8px;
  border-bottom: 1px solid #eef2f7;
  vertical-align: middle;
}

.ah-day-table tr:last-child td {
  border-bottom: 0;
}

.ah-sym {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.ah-sym strong {
  font-size: 14px;
}

.ah-sym span {
  color: var(--ah-ink-soft);
  font-size: 12px;
}

.ah-num {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.ah-empty,
.ah-empty-block {
  color: var(--ah-ink-soft);
  text-align: center;
  padding: 28px 12px;
}

/* Feed */
.ah-feed {
  padding: 18px 16px;
}

.ah-feed__tabs {
  display: flex;
  gap: 16px;
  border-bottom: 1px solid var(--ah-line);
  margin-bottom: 8px;
}

.ah-feed__tab {
  padding: 10px 0;
  font-weight: 700;
  font-size: 14px;
  color: var(--ah-ink-soft);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.ah-feed__tab.is-active {
  color: var(--ah-ink);
  border-bottom-color: var(--ah-accent);
}

.ah-feed__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ah-feed__item + .ah-feed__item {
  border-top: 1px solid #eef2f7;
}

.ah-feed__card {
  display: block;
  padding: 14px 2px;
  border-radius: 10px;
}

.ah-feed__card:hover {
  background: #f8fafc;
}

.ah-feed__meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.ah-feed__avatar {
  border-radius: 50%;
  background: #e2e8f0;
}

.ah-feed__who {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.ah-feed__user {
  font-weight: 700;
}

.ah-feed__time {
  font-size: 12px;
  color: var(--ah-ink-soft);
}

.ah-feed__body {
  margin: 0 0 10px;
}

.ah-cashtag {
  color: var(--ah-accent-bright);
  font-weight: 700;
}

.ah-feed__metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.ah-metric {
  border: 1px solid var(--ah-line);
  border-radius: 10px;
  padding: 8px 10px;
  background: var(--ah-surface-2);
}

.ah-metric__label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #64748b;
}

.ah-metric__value {
  display: block;
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin: 2px 0;
}

.ah-metric__sub {
  display: block;
  font-size: 11px;
  color: var(--ah-ink-soft);
}

/* Right panels */
.ah-panel {
  padding: 14px;
  margin-bottom: 12px;
}

.ah-panel--quiet {
  background: var(--ah-surface-2);
}

.ah-panel__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 10px;
}

.ah-panel h2 {
  margin: 0;
  font-size: 1rem;
}

.ah-panel p {
  margin: 8px 0 0;
  color: var(--ah-ink-soft);
  font-size: 13px;
}

.ah-panel__hint {
  font-size: 12px;
  color: var(--ah-ink-soft);
}

.ah-panel__list,
.ah-rankings {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ah-panel__row,
.ah-rankings__row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 0;
  border-top: 1px solid #eef2f7;
}

.ah-panel__list li:first-child .ah-panel__row,
.ah-rankings li:first-child .ah-rankings__row {
  border-top: 0;
}

.ah-panel__primary {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.ah-panel__primary span,
.ah-panel__secondary {
  font-size: 12px;
  color: var(--ah-ink-soft);
}

.ah-panel__secondary {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ah-rankings__row {
  align-items: center;
}

.ah-rankings__n {
  width: 18px;
  color: #64748b;
  font-weight: 700;
  font-size: 12px;
}

.ah-rankings__name {
  flex: 1;
  font-weight: 650;
}

.ah-rankings__score {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--ah-accent-bright);
}

/* Drawer + scrim */
.ah-scrim {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(2, 6, 17, 0.62);
  backdrop-filter: blur(2px);
}

.ah-drawer {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 90;
  width: min(320px, 86vw);
  height: 100%;
  background: var(--ah-bg-soft);
  border-right: 1px solid var(--ah-line);
  transform: translateX(-105%);
  transition: transform 0.22s ease;
  display: flex;
  flex-direction: column;
  padding: 16px 16px calc(24px + var(--ah-safe-bottom));
}

body.ah-nav-open .ah-drawer {
  transform: translateX(0);
}

.ah-drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.ah-drawer__close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: #e2e8f0;
  color: var(--ah-ink);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.ah-drawer__nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  overflow-y: auto;
}

.ah-drawer__link {
  display: block;
  padding: 12px 12px;
  border-radius: 10px;
  font-weight: 600;
  color: var(--ah-ink-soft);
}

.ah-drawer__link:hover,
.ah-drawer__link.is-active {
  background: #eff6ff;
  color: var(--ah-accent);
}

.ah-drawer__link--accent {
  margin-top: 8px;
  background: #eff6ff;
  color: var(--ah-accent);
}

.ah-drawer__foot {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--ah-line);
  font-size: 13px;
  color: var(--ah-ink-soft);
}

/* Bottom tab bar */
.ah-tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  display: none;
  height: calc(var(--ah-tabbar-h) + var(--ah-safe-bottom));
  padding: 6px 8px var(--ah-safe-bottom);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--ah-line);
  box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.08);
}

.ah-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  color: var(--ah-ink-soft);
  border-radius: 12px;
  padding: 6px 4px;
}

.ah-tab.is-active,
.ah-tab:active {
  color: var(--ah-accent);
  background: #eff6ff;
}

.ah-tab__icon {
  width: 22px;
  height: 22px;
  display: inline-flex;
}

.ah-tab__icon svg {
  width: 22px;
  height: 22px;
}

.ah-tab__label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

/* Responsive */
@media (max-width: 1100px) {
  .ah-shell {
    grid-template-columns: var(--ah-left) minmax(0, 1fr);
  }

  .ah-rail--right {
    grid-column: 1 / -1;
    position: static;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
  }

  .ah-rail--right .ah-panel {
    margin: 0;
  }
}

@media (max-width: 900px) {
  .ah-menu-btn {
    display: flex;
  }

  .ah-top__nav {
    display: none;
  }

  .ah-search {
    max-width: none;
  }

  .ah-shell {
    grid-template-columns: 1fr;
    padding-top: 14px;
  }

  /* Grid items default to min-width:auto, so the 5-day strip (5 x 132px) and
     the 640px day table were forcing the column — and the whole page — wider
     than the phone viewport. Let the inner scrollers do the scrolling. */
  .ah-main {
    min-width: 0;
  }

  .ah-rail--left {
    display: none;
  }

  .ah-rail--right {
    grid-template-columns: 1fr;
  }

  .ah-tabbar {
    display: flex;
  }

  .ah-week {
    grid-auto-flow: column;
    grid-auto-columns: minmax(132px, 1fr);
    grid-template-columns: none;
    padding-bottom: 4px;
  }

  .ah-feed__metrics {
    grid-template-columns: 1fr;
  }

  .ah-section-head {
    grid-template-columns: 1fr;
    grid-template-areas:
      'title'
      'lede'
      'link';
  }
}

@media (max-width: 560px) {
  .ah-top__inner {
    gap: 10px;
  }

  .ah-search__input {
    font-size: 14px;
  }

  .ah-title {
    font-size: 1.3rem;
  }

  .ah-earnings,
  .ah-feed {
    border-radius: 14px;
  }
}

@media (min-width: 901px) {
  .ah {
    padding-bottom: 0;
  }

  .ah-drawer,
  .ah-scrim {
    display: none !important;
  }
}
