/* Monochrome layout; semantic data colors are the scoped exception in DESIGN-airtable.md. */
:root {
  /* Data/status colors must not be used for decorative cards or navigation. */
  --color-data-up: #b42332;
  --color-data-down: #2554c7;
  --color-data-neutral: #555d68;
  --color-status-warning: #854d0e;
  --color-status-warning-bg: #fef3c7;
  --color-status-warning-border: #e5bd57;
  --color-status-success: #166534;
  --color-status-success-bg: #dcfce7;
  --color-status-success-border: #86c99d;
  --color-calendar-peach: #ffdfc7;
  --color-calendar-sky: #d4eaff;
  --color-calendar-sage: #d9ebd3;
  --color-calendar-lilac: #e6dcfa;
  --color-calendar-yellow: #fff0b3;
  --color-calendar-blush: #f9d6e3;
  --color-primary: #141414;
  --color-primary-active: #262626;
  --color-ink: #141414;
  --color-body: #262626;
  --color-muted: #707070;
  --color-hairline: #e0e0e0;
  --color-border-strong: #adadad;
  --color-canvas: #fff;
  --color-surface-soft: #f3f3f3;
  --color-surface-strong: #e9e9e9;
  --color-surface-dark: #141414;
  --color-surface-dark-elevated: #262626;
  --color-signature-coral: #303030;
  --color-signature-forest: #262626;
  --color-signature-cream: #f3f3f3;
  --color-signature-peach: #ededed;
  --color-signature-mint: #e9e9e9;
  --color-signature-yellow: #e7e7e7;
  --color-signature-mustard: #d6d6d6;
  --color-signature-sky: #f3f3f3;
  --color-signature-lilac: #ececec;
  --color-signature-sage: #e6e6e6;
  --color-signature-blush: #f0f0f0;
  --color-link: #141414;
  --color-link-active: #262626;
  --color-info-border: #141414;
  --radius-xs: 16px;
  --radius-sm: 16px;
  --radius-md: 24px;
  --radius-lg: 24px;
  --space-section: 80px;
  --font-display: "Saans", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-text: "Saans", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html { scroll-behavior: smooth; }
body { font-size: 16px; line-height: 1.43; min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; }
section { padding: var(--space-section) 0; }
.container { max-width: 1200px; padding-left: 32px; padding-right: 32px; }
a { color: var(--color-ink); text-underline-offset: 3px; }
a:hover { text-decoration: underline; }
button, input, textarea, select { font-family: var(--font-text); }
button { transition: background-color .18s ease, border-color .18s ease, color .18s ease; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 2px solid var(--color-ink); outline-offset: 3px;
}
[hidden] { display: none !important; }

.top-nav {
  position: sticky; top: 12px; z-index: 30; height: auto; padding: 0 20px;
  margin: 12px auto 0; width: min(100% - 24px, 1180px); min-height: 64px;
  background: var(--color-surface-soft); border: 1px solid var(--color-hairline);
  border-radius: var(--radius-pill);
}
.top-nav .container { min-height: 62px; gap: 8px; padding: 0 12px; }
.top-nav__brand { font-size: 16px; font-weight: 650; letter-spacing: 0; white-space: nowrap; }
.top-nav__back { display: none; }
.top-nav__settings, .top-nav__account {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px;
  padding: 0 18px; border: 1px solid var(--color-hairline); border-radius: var(--radius-pill);
  background: #fff; color: var(--color-ink); font-size: 14px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
}
.top-nav__settings { margin-left: auto; }
.top-nav__settings + .top-nav__account { margin-left: 0; }
.top-nav__account:hover, .top-nav__settings:hover { background: #e7e7e7; text-decoration: none; }

.eyebrow { display: inline-block; color: var(--color-muted); font-size: 13px; font-weight: 600; margin-bottom: 20px; }
.hero-band { padding: 108px 0 84px; text-align: center; }
.hero-band h1 { max-width: none; font-size: clamp(48px, 7vw, 80px); line-height: 1; font-weight: 650; margin: 0 auto 24px; }
.hero-band p { max-width: 720px; margin: auto; font-size: 20px; font-weight: 300; line-height: 1.45; color: var(--color-muted); }
.section-title { font-family: var(--font-display); font-size: clamp(26px, 3vw, 44px); line-height: 1.13; font-weight: 650; letter-spacing: 0; margin-bottom: 28px; }
.heatmap-header h1.section-title { font-size: clamp(40px, 5vw, 56px); line-height: 1.04; margin-bottom: 12px !important; }
.heatmap-header { align-items: center; margin-bottom: 36px; }
.heatmap-meta { font-size: 15px; line-height: 1.5; max-width: 800px; }

.demo-grid { gap: 16px; }
.demo-grid-card, .dash__card, .stat-tile, .adm-card, .adm-month, .adm-exam, .jh-stat, .jh-compare-card, .pm-tile, .pm-basket {
  background: var(--color-surface-soft); border: 1px solid #f0f0f0; border-radius: 24px; padding: 24px;
  box-shadow: none;
}
.demo-grid-card { min-height: 170px; transition: background-color .18s ease, transform .18s ease; }
.demo-grid-card:hover { background: #ececec; transform: translateY(-2px); }
.demo-grid-card h3 { font-size: 21px; line-height: 1.2; font-weight: 650; margin-bottom: 12px; }
.demo-grid-card p { font-size: 14px; line-height: 1.5; color: var(--color-muted); }
.demo-grid-card__image { width: 58px; height: 58px; border-radius: 30%; background: #fff; }
.demo-grid-card__link { align-items: flex-start; gap: 18px; }
.feature-sections { gap: 40px; }
.feature-folder__toggle { font-size: 20px; font-weight: 650; }
.feature-folder__count { padding: 5px 10px; }
.feature-pin, .feature-star, .feature-edit, .feature-folder__tool { width: 36px; height: 36px; background: #fff; border: 1px solid var(--color-hairline); }
.feature-star.is-favorited { background: var(--color-ink); color: #fff; }
.feature-folder.is-drop-target { box-shadow: 0 0 0 2px var(--color-ink) !important; }
.dash__card { gap: 16px; }
.dash__title { font-size: 20px; font-weight: 650; }
.dash__lede-when { font-size: 38px; font-weight: 650; }
.dash__list { background: #e0e0e0; }
.dash__row, .dash__day, .dash__ratio, .dash__stat, .dash-feed { background: #fff; }
.dash__stat-value { font-weight: 650; }
/* Signed data keeps the same convention in widgets, indices and ETF tables. */
.dash-up, .is-up, .market-block__change.is-up,
.adm-lastyear .is-ahead { color: var(--color-data-up); }
.dash-down, .is-down, .market-block__change.is-down,
.adm-lastyear .is-behind { color: var(--color-data-down); }

.btn-refresh, .login-card button[type="submit"], .folder-create button, .demo-grid-card__edit-actions .is-primary {
  display: inline-flex; justify-content: center; align-items: center; min-height: 46px;
  padding: 0 20px; border: 1px solid var(--color-ink); border-radius: var(--radius-pill);
  background: var(--color-ink); color: #fff; font-size: 15px; font-weight: 600;
}
.btn-refresh:hover, .login-card button[type="submit"]:hover { background: #303030; }
.chip-toggle, .jh-tab, .data-table .cell-btn, .pm-badge, .pm-tag, .adm-deadline, .adm-tag, .adm-window, .jh-me-chip, .jh-pending-chip {
  border-radius: var(--radius-pill); box-shadow: none;
}
.chip-toggle { min-height: 44px; padding: 0 18px; background: var(--color-surface-soft); border-color: transparent; font-size: 14px; }
.chip-toggle:hover { background: #e7e7e7; }
.chip-toggle.is-active, #favorites-filter.is-active, .jh-tab.is-active { background: var(--color-ink); color: #fff; border-color: var(--color-ink); }
.chart-controls__group { flex-wrap: wrap; gap: 8px; }
.jh-tab { min-height: 58px; padding: 12px 20px; background: var(--color-surface-soft); border-color: transparent; }
.jh-tab strong { font-weight: 650; }
.jh-tab.is-active strong, .jh-tab.is-active span { color: #fff; }
.jh-rank-table tr.is-me { background: #e9e9e9; }
.jh-rank-table tr.is-me:hover { background: #e9e9e9; }
.jh-me-chip { background: var(--color-ink); color: #fff; }
.adm-day, .adm-chip, .adm-pop__dot, .adm-legend i { border-radius: 8px; }
.adm-chip { border: 1px solid #d8d8d8; }
.adm-card__title { font-size: 20px; font-weight: 650; }
.adm-card__mark img { filter: grayscale(1); }
/* Semantic statuses only; closed/inactive states keep their neutral style. */
.pm-badge.is-live, .adm-deadline:not(.is-closed), .adm-tag.is-warn {
  background: var(--color-status-warning-bg); border-color: var(--color-status-warning-border); color: var(--color-status-warning);
}
.pm-badge.is-open, .adm-exam .cell-btn.is-done {
  background: var(--color-status-success-bg); border-color: var(--color-status-success-border); color: var(--color-status-success);
}
.adm-deadline.is-urgent {
  background: var(--color-data-up); border-color: var(--color-data-up); color: #fff;
}
.adm-dow.is-sun, .adm-day.is-sun .adm-day__num { color: var(--color-data-up); }
.adm-pop__warn { color: var(--color-status-warning-bg); }
.heatmap-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 16px 0; font-size: 13px; color: var(--color-muted); }
.heatmap-legend span { display: inline-flex; align-items: center; gap: 6px; }
.heatmap-legend i { width: 12px; height: 12px; border-radius: 3px; }
.heatmap-legend__up { background: var(--color-data-up); }
.heatmap-legend__flat { background: var(--color-data-neutral); }
.heatmap-legend__down { background: var(--color-data-down); }

.search-input-wrap input, .folder-create input, .login-card input, .pm-input, .jh-search, .dash-setup__form input, .adm-editor input, .data-table input, .demo-grid-card__edit-form input, .demo-grid-card__edit-form textarea {
  background: #f0f0f0; border: 1px solid transparent; border-radius: 16px; min-height: 46px; color: var(--color-ink);
}
.search-input-wrap input { min-height: 48px; padding-left: 42px; font-size: 16px; }
.search-icon { left: 15px; }
.login-card input { margin-bottom: 20px; padding: 12px 16px; }
.login-card input:focus, .search-input-wrap input:focus, .folder-create input:focus, .pm-input:focus, .jh-search:focus { border-color: var(--color-ink); }
.data-table-scroll, .jh-scroll { border-color: #f0f0f0; border-radius: 24px; }
.data-table th, .data-table td, .jh-rank-table th, .jh-rank-table td { padding: 14px 16px; border-color: #f0f0f0; }
.data-table thead th, .jh-rank-table thead th { font-weight: 600; color: var(--color-muted); }
.data-table .cell-btn { min-height: 36px; padding: 4px 12px; }
.heatmap-tooltip { box-shadow: none; border-radius: 16px; }
.heatmap-tile { border-radius: 5px; }
.heatmap-tile__name { font-weight: 650; }

.login-screen .login-page {
  flex: 1 0 auto;
  display: grid;
  place-items: center;
  min-height: calc(100svh - 80px);
  padding: 32px 24px;
}
.login-screen .login-card { width: min(100%, 480px); margin: 0 auto; }
.login-card { max-width: 480px; padding: 40px; border: 1px solid #f0f0f0; background: var(--color-surface-soft); border-radius: 24px; }
.login-card h1 { font-size: 44px; line-height: 1.05; font-weight: 650; margin-bottom: 16px; }
.login-card p { font-size: 16px; line-height: 1.45; }
.login-card label { font-size: 14px; font-weight: 600; }
.login-card .login-card__error { color: var(--color-ink); font-size: 14px; }
.login-card__error.is-success { background: #fff; border: 1px solid var(--color-hairline); border-radius: 16px; padding: 12px 16px; }
.account-page { width: 100%; padding-top: 96px; padding-bottom: 120px; }
.account-page .login-card { max-width: 600px; }
.page-heading { max-width: 650px; margin-bottom: 36px; }
.page-heading h1 { font-size: clamp(40px, 5vw, 56px); line-height: 1.04; margin: 0 0 20px; font-weight: 650; }
.page-heading p, .form-help { color: var(--color-muted); }
.form-help { font-size: 14px !important; margin: 0 0 20px !important; }

.footer { margin-top: auto; padding: 48px 0 calc(48px + env(safe-area-inset-bottom)); background: var(--color-ink); border: 0; border-radius: 24px 24px 0 0; color: #fff; }
.footer .container { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.footer__brand { font-size: 22px; font-weight: 650; }
.footer__legal { color: #adadad; font-size: 13px; }
.footer__meta { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.footer__email, .footer__email:link, .footer__email:visited {
  color: #fff !important;
  font-size: 16px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 4px;
}
.footer__email:hover { color: #e0e0e0 !important; }

/* Dense data maps use compact corners and their own readable mobile layout. */
.heatmap-page > section { padding: 40px 0 56px; }
.heatmap-page .heatmap-header { margin-bottom: 24px; }
.treemap { min-width: 0; }
.treemap__toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; margin: 0 0 12px; }
.treemap__switch { display: inline-flex; padding: 3px; background: var(--color-surface-soft); border-radius: 12px; }
.treemap__switch button { min-height: 40px; padding: 8px 16px; border: 0; border-radius: 9px; background: transparent; color: var(--color-body); font-size: 14px; cursor: pointer; }
.treemap__switch button[aria-pressed="true"] { background: var(--color-ink); color: #fff; }
.treemap__note { margin: 0; color: var(--color-muted); font-size: 12px; line-height: 1.5; }
.treemap__stage { position: relative; width: 100%; }
.treemap .heatmap-tile { border: 0; margin: 0; appearance: none; font-family: var(--font-text); touch-action: manipulation; }
.treemap .heatmap-tile:focus-visible { outline: 2px solid #fff; outline-offset: -4px; }
.treemap .heatmap-tile__name { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; white-space: normal; overflow-wrap: anywhere; line-height: 1.25; font-size: var(--tile-font-size, 14px); }
.treemap .heatmap-tile__rate { font-size: clamp(11px, var(--tile-font-size, 14px), 16px); line-height: 1.3; white-space: nowrap; font-variant-numeric: tabular-nums; }
.treemap__list { border: 1px solid var(--color-hairline); border-radius: 16px; overflow: hidden; }
.treemap__row { width: 100%; display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 14px 16px; min-height: 56px; text-align: left; background: #fff; color: var(--color-ink); border: 0; border-bottom: 1px solid var(--color-hairline); cursor: pointer; font-size: 14px; }
.treemap__row:last-child { border-bottom: 0; }
.treemap__rank { color: var(--color-muted); font-size: 12px; }
.treemap__row-name { overflow-wrap: anywhere; line-height: 1.4; font-weight: 600; }
.treemap__row-rate { font-variant-numeric: tabular-nums; font-size: 13px; white-space: nowrap; }
.treemap__detail { width: min(440px, calc(100% - 32px)); max-height: 80dvh; margin: auto; padding: 24px; border: 1px solid var(--color-hairline); border-radius: 20px; color: var(--color-body); background: #fff; overflow: auto; }
.treemap__detail::backdrop { background: rgb(0 0 0 / .45); }
.treemap__detail h3 { margin: 16px 0; padding-right: 64px; font-size: 22px; overflow-wrap: anywhere; }
.treemap__detail-body { white-space: pre-line; overflow-wrap: anywhere; line-height: 1.8; font-size: 15px; }
.treemap__close { float: right; min-width: 64px; min-height: 44px; padding: 8px 16px; border: 1px solid var(--color-hairline); border-radius: 12px; background: var(--color-surface-soft); color: var(--color-ink); cursor: pointer; }
@media (max-width: 600px) {
  .heatmap-page > section { padding: 28px 0 40px; }
  .heatmap-page .heatmap-header { gap: 12px; align-items: flex-start; }
  .heatmap-page .heatmap-header h1.section-title { font-size: 36px; }
  .heatmap-page .heatmap-meta { font-size: 13px; }
  .heatmap-page .btn-refresh { min-height: 44px; padding: 0 14px; font-size: 13px; }
  .heatmap-page .market-block { margin-bottom: 32px; }
  .heatmap-page .market-block h2 { display: flex; align-items: baseline; justify-content: space-between; font-size: 20px; }
  .treemap__toolbar { align-items: flex-start; }
  .treemap__note { flex-basis: 100%; }
  .treemap__detail { width: 100%; max-width: 100%; margin: auto 0 0; border-radius: 24px 24px 0 0; padding: 20px 24px calc(24px + env(safe-area-inset-bottom)); }
  .treemap__row { gap: 8px; padding: 14px 12px; }
  .pm-basket { padding: 16px; }
  .pm-basket__header > div { min-width: 0; }
  .pm-basket__header .section-title { font-size: 22px; overflow-wrap: anywhere; }
  .pm-basket__header .heatmap-meta { font-size: 12px; overflow-wrap: anywhere; }
  .pm-basket__header > button { flex-shrink: 0; }
}

@media (max-width: 768px) {
  .container { padding-left: 20px; padding-right: 20px; }
  .top-nav { top: 8px; margin-top: 8px; min-height: 58px; padding: 0 6px; }
  .top-nav .container { min-height: 56px; padding: 0 10px; }
  .top-nav__brand { font-size: 14px; }
  .top-nav__settings, .top-nav__account { min-height: 42px; padding: 0 13px; font-size: 13px; }
  section { padding: 60px 0; }
  .hero-band { padding: 80px 0 64px; }
  .hero-band h1 { font-size: 48px; }
  .hero-band p { font-size: 17px; }
  .demo-grid, .adm-grid, .adm-cal, .jh-stats, .jh-compare { grid-template-columns: 1fr; }
  .login-screen .login-page { min-height: calc(100svh - 68px); padding: 24px 20px; }
  .login-card { padding: 28px; }
  .account-page { padding-top: 64px; padding-bottom: 80px; }
  .footer .container { flex-direction: column; align-items: flex-start; }
  .footer__meta { align-items: flex-start; }
}
