@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=Sora:wght@400;500;600;700;800&display=swap");

:root {
  color-scheme: dark;
  --bg: #05070b;
  --bg2: #0a0e14;
  --panel: #0c1219;
  --panel2: #121a24;
  --line: #1a2838;
  --line-soft: rgba(0, 210, 255, .12);
  --grid: rgba(0, 210, 255, .08);
  --text: #eef3f9;
  --muted: #8b9aab;
  --muted2: #667788;
  --accent: #00d2ff;
  --accent-soft: rgba(0, 210, 255, .12);
  --accent2: #7dd3fc;
  --silver: #c8d2de;
  --warn: #f0b35a;
  --danger: #ff6f7a;
  --shadow: 0 18px 48px rgba(0, 0, 0, .4);
  --radius: 16px;
  --radius-sm: 12px;
  --font: "Sora", ui-sans-serif, system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html {
  background: var(--bg);
  overflow-x: hidden;
  max-width: 100%;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 210, 255, .35) rgba(8, 14, 22, .9);
}
*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
*::-webkit-scrollbar-track {
  background: rgba(8, 14, 22, .92);
  border-left: 1px solid rgba(0, 210, 255, .08);
}
*::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(0, 210, 255, .45), rgba(0, 160, 210, .28));
  border-radius: 999px;
  border: 2px solid rgba(8, 14, 22, .92);
  min-height: 40px;
}
*::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(0, 210, 255, .7), rgba(0, 180, 230, .45));
}
*::-webkit-scrollbar-corner {
  background: rgba(8, 14, 22, .92);
}
body {
  margin: 0;
  color: var(--text);
  font: 14px/1.5 var(--font);
  background:
    radial-gradient(ellipse 65% 40% at 88% -8%, rgba(0, 210, 255, .1), transparent 55%),
    radial-gradient(ellipse 45% 35% at 0% 18%, rgba(0, 140, 220, .06), transparent 50%),
    linear-gradient(180deg, #070b11 0%, var(--bg) 42%);
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  min-height: 100vh;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

/* —— Sidebar —— */
aside {
  background: linear-gradient(180deg, #05080d 0%, #070d14 55%, #061018 100%);
  border-right: 1px solid rgba(0, 180, 255, .12);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  max-width: 268px;
  width: 100%;
  min-width: 0;
  overflow-x: hidden;
  backdrop-filter: blur(18px);
  z-index: 5;
}
.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 8px 8px 18px;
  border-bottom: 1px solid rgba(0, 180, 255, .1);
  margin-bottom: 4px;
}
.brand-mark-img {
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  object-fit: cover;
  object-position: 50% 12%;
  border-radius: 12px;
  background: #000;
  border: 1px solid rgba(0, 200, 255, .28);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, .6) inset,
    0 0 22px rgba(0, 180, 255, .28);
}
.brand-copy {
  min-width: 0;
}
.brand-copy b {
  font-size: 18px;
  letter-spacing: .18em;
  display: block;
  color: #e8eef7;
  line-height: 1.1;
}
.brand-copy span {
  display: block;
  color: rgba(142, 163, 180, .9);
  font-size: 9px;
  margin-top: 4px;
  letter-spacing: .04em;
  line-height: 1.35;
  text-transform: uppercase;
}
.brand-logo {
  width: 100%;
  max-width: 228px;
  height: auto;
  display: block;
}
.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #00b4ff, #7dd3fc);
  color: #041016;
  font-weight: 800;
  font-size: 20px;
  box-shadow: 0 10px 28px rgba(0, 180, 255, .25);
}

.nav-group { margin-top: 14px; }
.nav-group:first-of-type { margin-top: 8px; }
.nav-group-label {
  display: block;
  color: var(--muted2);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  padding: 8px 12px 6px;
}
nav { display: grid; gap: 3px; }
nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  transition: color .15s ease, background .15s ease, border-color .15s ease;
  font-size: 13px;
  font-weight: 500;
}
nav a:hover { color: var(--text); background: rgba(255, 255, 255, .03); }
nav a.active {
  background: linear-gradient(90deg, rgba(0, 210, 255, .14), rgba(0, 180, 255, .05));
  border-color: rgba(0, 210, 255, .22);
  color: var(--text);
}
.nav-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: .55;
  flex-shrink: 0;
}
nav a.active .nav-dot { opacity: 1; color: var(--accent); }

.sidebar-foot {
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding: 16px 8px 2px;
}
.sidebar-foot small {
  display: block;
  color: var(--muted2);
  margin-top: 8px;
  font-size: 10px;
  line-height: 1.4;
}
.lock {
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
}
.logout-btn {
  margin-top: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  cursor: pointer;
  width: 100%;
}
.logout-btn:hover { color: var(--text); border-color: rgba(255, 255, 255, .22); }

/* —— Main —— */
main {
  padding: 28px clamp(16px, 2.5vw, 40px) 40px;
  min-width: 0;
  max-width: min(1680px, 100%);
  width: 100%;
  margin: 0;
  overflow-x: hidden;
  animation: fade-up .28s ease both;
}
.kpi-card strong,
.status-chip strong,
.live-pill span {
  transition: color .2s ease, opacity .2s ease;
}
body.is-live-tick .live-pill {
  border-color: rgba(0, 210, 255, .45);
  box-shadow: 0 0 0 1px rgba(0, 210, 255, .12);
}
body.is-live-tick [data-live-tbody] {
  opacity: .94;
}
[data-live-tbody] {
  transition: opacity .2s ease;
}
.page-guide article {
  transition: border-color .2s ease, background .2s ease;
}
header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 22px;
}
.eyebrow, .section-kicker {
  color: var(--accent);
  font-size: 10px;
  letter-spacing: .14em;
  font-weight: 700;
  text-transform: uppercase;
  margin: 0;
}
h1 {
  font-size: clamp(26px, 3vw, 34px);
  line-height: 1.12;
  margin: 6px 0 8px;
  letter-spacing: -.03em;
  font-weight: 700;
}
.subtitle {
  color: var(--muted);
  margin: 0;
  max-width: 620px;
  line-height: 1.55;
  font-size: 13px;
}
.header-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.status, .live-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 10px;
  letter-spacing: .07em;
  text-transform: uppercase;
  font-weight: 600;
}
.live-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
  background: var(--accent-soft);
  border-color: rgba(0, 210, 255, .25);
  min-width: 0;
  flex: 0 1 auto;
  max-width: 100%;
}
.live-pill i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 4px rgba(0, 210, 255, .12);
  animation: pulse 2s infinite;
}
.live-pill[data-state=error] {
  color: var(--danger);
  background: rgba(255, 111, 122, .08);
  border-color: rgba(255, 111, 122, .3);
}

/* —— Shared panels —— */
.kpi-card, .panel, .top-opportunity, .market-chart-card, .attention-ranking, .activity-panel {
  background: linear-gradient(160deg, rgba(16, 32, 46, .96), rgba(10, 22, 33, .96));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.panel { padding: 22px; }
.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}
.section-heading h2 {
  font-size: 17px;
  margin: 5px 0 0;
  letter-spacing: -.02em;
  font-weight: 650;
}
.section-description {
  color: var(--muted);
  margin: 7px 0 0;
  line-height: 1.55;
  font-size: 13px;
  max-width: 720px;
}
.detail-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.detail-link:hover { text-decoration: underline; }
.empty-state {
  display: grid;
  place-items: center;
  text-align: center;
  min-height: 180px;
  border: 1px dashed var(--line);
  border-radius: 13px;
  margin-top: 16px;
  padding: 28px;
  color: var(--muted);
  line-height: 1.55;
}
.muted, footer { color: var(--muted); }
footer {
  margin-top: 28px;
  font-size: 11px;
  letter-spacing: .02em;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
}

/* —— Guide strip —— */
.page-guide {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.page-guide article {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(9, 20, 30, .7);
}
.page-guide strong {
  display: block;
  font-size: 12px;
  margin-bottom: 4px;
}
.page-guide p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

/* —— Data connection —— */
.data-connection {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) auto minmax(0, .85fr);
  gap: 18px;
  align-items: center;
  margin-bottom: 16px;
  padding: 15px 17px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(12, 24, 35, .9);
  min-width: 0;
  max-width: 100%;
}
.data-connection > div { min-width: 0; }
.data-connection strong, .data-connection b, .data-connection span, .data-connection small { display: block; }
.data-connection strong { font-size: 14px; margin: 4px 0; }
.data-connection small, .data-connection span { color: var(--muted); font-size: 11px; }
.data-connection b { font-size: 12px; margin-top: 5px; font-family: var(--mono); }
.data-path code {
  display: block;
  margin-top: 5px;
  color: var(--text);
  font-size: 10px;
  font-family: var(--mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.data-live { border-color: rgba(0, 210, 255, .4); }
.data-live strong { color: var(--accent); }
.data-delayed { border-color: rgba(240, 179, 90, .4); }
.data-stale { border-color: rgba(255, 111, 122, .4); }
.data-stale strong { color: var(--danger); }

/* —— KPI —— */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.kpi-card {
  padding: 16px 17px;
  min-height: 108px;
  position: relative;
  overflow: hidden;
  transition: border-color .2s ease, transform .2s ease;
}
.kpi-card:hover {
  border-color: rgba(0, 210, 255, .28);
  transform: translateY(-1px);
}
.kpi-card:after {
  content: "";
  position: absolute;
  inset: auto -30px -40px auto;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: rgba(0, 210, 255, .04);
}
.kpi-card small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  font-weight: 500;
}
.kpi-card strong {
  display: block;
  font-size: 26px;
  margin-top: 10px;
  letter-spacing: -.03em;
  font-family: var(--mono);
  font-weight: 600;
}
.kpi-card .kpi-hint {
  display: block;
  margin-top: 8px;
  color: var(--muted2);
  font-size: 10px;
  line-height: 1.35;
}
.kpi-card strong.small {
  font-size: 13px;
  overflow-wrap: anywhere;
  line-height: 1.45;
  font-family: var(--font);
}

/* —— Workspace brief —— */
.workspace-brief {
  display: grid;
  grid-template-columns: 1fr 1.35fr .85fr;
  gap: 1px;
  margin: 16px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--line);
}
.workspace-brief > div {
  background: rgba(8, 18, 28, .97);
  padding: 16px 18px;
  min-width: 0;
}
.brief-label {
  display: block;
  color: var(--accent);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .12em;
  margin-bottom: 7px;
}
.workspace-brief strong {
  display: block;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.workspace-brief small {
  display: block;
  color: var(--muted);
  margin-top: 5px;
  font-size: 11px;
  line-height: 1.4;
}

/* —— Social strip —— */
.social-signal-strip {
  display: grid;
  grid-template-columns: 1.5fr .7fr .7fr 1fr;
  gap: 1px;
  margin: 0 0 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--line);
}
.social-signal-strip > div {
  padding: 15px 17px;
  background: rgba(8, 18, 28, .97);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.social-signal-strip strong { font-size: 14px; }
.social-signal-strip small { color: var(--muted); font-size: 11px; margin-top: 4px; }
.social-signal-strip b {
  font-size: 22px;
  margin-top: 5px;
  font-family: var(--mono);
  font-weight: 600;
}

/* —— Hero —— */
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, .85fr) minmax(0, 1.35fr);
  gap: 16px;
  align-items: stretch;
  min-width: 0;
  max-width: 100%;
}
.top-opportunity, .market-chart-card {
  padding: 22px;
  min-height: 380px;
}
.top-opportunity {
  border-color: rgba(0, 210, 255, .3);
}
.opportunity-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-top: 28px;
}
.token-line { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.token-line h3 {
  font-size: clamp(28px, 3vw, 36px);
  line-height: 1;
  margin: 0;
  letter-spacing: -.04em;
}
.growth-badge {
  background: var(--accent-soft);
  border: 1px solid rgba(0, 210, 255, .28);
  color: var(--accent);
  padding: 6px 9px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
}
.opportunity-main p, .explain, .chart-note, .chart-meta { color: var(--muted); }
.opportunity-main p { margin: 10px 0 0; font-size: 13px; }
.price-box { text-align: right; }
.price-box small {
  display: block;
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.price-box strong {
  display: block;
  font-size: 22px;
  margin-top: 7px;
  font-family: var(--mono);
  font-weight: 600;
}
.opportunity-facts {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 28px 0 16px;
}
.opportunity-facts div {
  background: rgba(255, 255, 255, .025);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px;
}
.opportunity-facts small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}
.opportunity-facts b {
  display: block;
  font-size: 20px;
  margin-top: 7px;
  font-family: var(--mono);
  font-weight: 600;
}
.explain { font-size: 12px; line-height: 1.6; }
.chart-meta { font-size: 11px; white-space: nowrap; }
.market-chart-card { display: flex; flex-direction: column; }
.chart-wrap {
  flex: 1;
  min-height: 250px;
  height: 300px;
  margin-top: 16px;
  position: relative;
}
.chart-wrap canvas { display: block; width: 100%; height: 100%; }
.chart-note { font-size: 11px; margin: 10px 0 0; line-height: 1.5; }
.external-chart-link, .token-chart-link, .table-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 650;
}
.external-chart-link {
  display: inline-flex;
  margin-top: 10px;
  padding: 8px 11px;
  border: 1px solid rgba(0, 210, 255, .28);
  border-radius: 9px;
  background: var(--accent-soft);
  font-size: 12px;
}
.external-chart-link:hover, .token-chart-link:hover, .table-link:hover { text-decoration: underline; }

/* —— Ranking —— */
.attention-ranking {
  margin-top: 16px;
  padding: 22px;
}
.ranking-list { display: grid; gap: 8px; margin-top: 16px; }
.ranking-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1.7fr) repeat(4, minmax(0, .7fr)) minmax(0, .85fr);
  align-items: center;
  gap: 10px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(6, 14, 22, .5);
  transition: border-color .15s ease, background .15s ease;
  min-width: 0;
  max-width: 100%;
}
.ranking-row:hover { border-color: rgba(0, 210, 255, .25); }
.ranking-row-first {
  border-color: rgba(0, 210, 255, .4);
  background: linear-gradient(90deg, rgba(0, 210, 255, .1), rgba(0, 180, 255, .04));
}
.rank-number {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--panel2);
  font-weight: 700;
  font-family: var(--mono);
  font-size: 12px;
}
.ranking-row-first .rank-number {
  background: var(--accent);
  color: #041016;
}
.rank-token { min-width: 0; }
.rank-token strong, .rank-token .token-chart-link {
  display: block;
  font-size: 14px;
  font-weight: 650;
}
.rank-token span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rank-metric small, .rank-price small {
  display: block;
  color: var(--muted);
  font-size: 10px;
  margin-bottom: 4px;
}
.rank-metric b, .rank-price b {
  font-size: 13px;
  font-family: var(--mono);
  font-weight: 550;
}
.ranking-disclaimer {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
  margin: 14px 2px 0;
}

/* —— Activity —— */
.activity-panel { margin-top: 16px; padding: 22px; }
.activity-list { display: grid; gap: 8px; margin-top: 14px; }
.activity-item {
  display: grid;
  grid-template-columns: 140px minmax(180px, 1fr) minmax(160px, .8fr) 90px;
  gap: 14px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(6, 14, 22, .42);
}
.activity-type {
  font-size: 10px;
  color: var(--accent);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.activity-item strong { font-size: 13px; }
.activity-item p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.activity-item time { color: var(--muted); font-size: 11px; font-family: var(--mono); }

/* —— Tables —— */
.table { overflow: auto; padding: 0; }
table { border-collapse: collapse; width: 100%; min-width: 900px; }
th, td { padding: 13px 15px; border-bottom: 1px solid var(--line); text-align: left; }
th {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 650;
}
tbody tr:hover { background: rgba(255, 255, 255, .02); }
.empty { padding: 34px; color: var(--muted); }
.table-hero { margin-bottom: 14px; padding: 22px; }
.data-table-card { padding: 0; overflow: hidden; }
.table-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}
.table-search {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: min(360px, 100%);
}
.table-search span {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-weight: 700;
}
.table-search input {
  padding: 11px 13px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: rgba(6, 14, 22, .75);
  color: var(--text);
  font: inherit;
}
.table-search input:focus {
  outline: none;
  border-color: rgba(0, 210, 255, .4);
  box-shadow: 0 0 0 3px rgba(0, 210, 255, .1);
}
.data-table { width: 100%; min-width: 920px; border-collapse: collapse; }
.data-table th {
  position: sticky;
  top: 0;
  background: rgba(8, 18, 28, .98);
  z-index: 1;
}
.data-table td { padding: 14px 15px; border-bottom: 1px solid rgba(30, 52, 70, .7); vertical-align: middle; }
.data-table tbody tr:hover { background: rgba(0, 210, 255, .04); }
.token-cell { display: grid; gap: 3px; min-width: 140px; }
.token-cell strong { font-size: 14px; }
.token-cell span {
  color: var(--muted);
  font-size: 11px;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chip {
  display: inline-flex;
  padding: 5px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .03);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.status-pill {
  display: inline-flex;
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.status-watch, .status-open {
  color: var(--accent);
  border-color: rgba(0, 210, 255, .28);
  background: var(--accent-soft);
}
.status-closed, .status-expired, .status-dropped {
  color: var(--muted);
  border-color: var(--line);
  background: rgba(255, 255, 255, .03);
}
.status-promoted {
  color: var(--accent2);
  border-color: rgba(0, 180, 255, .3);
  background: rgba(0, 180, 255, .08);
}
.status-alert, .status-rejected {
  color: var(--danger);
  border-color: rgba(255, 111, 122, .3);
  background: rgba(255, 111, 122, .08);
}
.observation-kpis {
  grid-template-columns: repeat(4, 1fr);
}
.cell-muted {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  max-width: 220px;
  display: inline-block;
}
.row-actions { text-align: right; white-space: nowrap; }
.btn-detail {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(0, 210, 255, .28);
  background: var(--accent-soft);
  color: var(--accent);
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}
.btn-detail:hover { background: rgba(0, 210, 255, .18); }
.table-scroll { overflow: auto; margin-top: 16px; }
.positive-value { color: var(--accent); font-weight: 650; }
.negative-value { color: var(--danger); font-weight: 650; }

/* —— Detail modal —— */
.detail-modal[hidden] { display: none !important; }
.detail-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
}
.detail-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 8, 14, .74);
  backdrop-filter: blur(8px);
}
.detail-modal-panel {
  position: relative;
  width: min(760px, 100%);
  max-height: min(88vh, 900px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(160deg, rgba(16, 32, 46, .98), rgba(8, 18, 28, .98));
  box-shadow: 0 30px 90px rgba(0, 0, 0, .45);
  padding: 22px;
  animation: fade-up .25s ease both;
}
.detail-modal-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 18px;
}
.detail-modal-head h2 { margin: 4px 0 6px; font-size: 26px; }
.detail-modal-close {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .03);
  color: var(--text);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
.detail-modal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.detail-fact {
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(6, 14, 22, .45);
}
.detail-fact small {
  display: block;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.detail-fact b {
  display: block;
  font-size: 13px;
  line-height: 1.45;
  word-break: break-word;
}
.detail-modal-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}
.detail-modal-links a {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(0, 210, 255, .28);
  background: var(--accent-soft);
  color: var(--accent);
  text-decoration: none;
  font-size: 12px;
  font-weight: 650;
}

/* —— Provider / settings —— */
.provider-intro { margin-bottom: 16px; }
.provider-intro p { max-width: 900px; color: var(--muted); line-height: 1.65; }
.provider-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.provider-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}
.provider-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.provider-card h3 { margin: 0; font-size: 17px; }
.provider-card p { color: var(--muted); line-height: 1.55; min-height: 44px; }
.provider-state {
  font-size: 10px;
  font-weight: 700;
  padding: 7px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
}
.state-healthy { color: var(--accent); border-color: rgba(0, 210, 255, .3); }
.state-degraded, .state-cooldown { color: var(--warn); }
.state-unknown { color: var(--muted); }
.provider-facts, .friendly-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.provider-facts > div, .friendly-facts > div {
  background: rgba(6, 14, 22, .45);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 12px;
}
.provider-facts small, .friendly-facts small {
  display: block;
  color: var(--muted);
  font-size: 10px;
  margin-bottom: 6px;
}
.friendly-facts { margin-top: 18px; }
.friendly-facts p {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
  margin: 7px 0 0;
}
.path-value { word-break: break-all; font-family: var(--mono); font-size: 12px; }
.validation-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-top: 16px;
}
.journal { max-width: 900px; }
.journal p { line-height: 1.6; color: var(--muted); }

/* —— Research —— */
.research-hero {
  display: flex;
  justify-content: space-between;
  gap: 28px;
  align-items: center;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(120deg, rgba(0, 210, 255, .08), rgba(0, 180, 255, .05));
  box-shadow: var(--shadow);
}
.research-hero h2 { margin: 6px 0 8px; font-size: 24px; }
.research-hero p { margin: 0; color: var(--muted); max-width: 820px; line-height: 1.6; }
.research-warning {
  min-width: 245px;
  padding: 14px 16px;
  border: 1px solid rgba(240, 179, 90, .3);
  border-radius: 13px;
  background: rgba(240, 179, 90, .06);
}
.research-warning strong { display: block; font-size: 12px; }
.research-warning span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-top: 5px;
}
.research-kpis {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin: 16px 0;
}
.research-kpis article {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(12, 24, 35, .9);
}
.research-kpis small, .research-kpis span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}
.research-kpis strong {
  display: block;
  font-size: 22px;
  margin: 8px 0 5px;
  font-family: var(--mono);
  font-weight: 600;
}
.research-grid {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 16px;
}
.strategy-list { display: grid; gap: 13px; margin-top: 18px; }
.strategy-row {
  display: grid;
  grid-template-columns: 1fr 70px;
  gap: 10px;
  align-items: center;
}
.strategy-row strong, .strategy-row span { display: block; }
.strategy-row span { font-size: 11px; color: var(--muted); margin-top: 4px; }
.strategy-rate { text-align: right; font-size: 16px; font-weight: 700; font-family: var(--mono); }
.strategy-bar {
  grid-column: 1 / -1;
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .05);
  overflow: hidden;
}
.strategy-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
}
.research-note {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
  margin: 17px 0 0;
}
.methodology-card dl { display: grid; gap: 12px; margin: 17px 0 0; }
.methodology-card dl div {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.methodology-card dl div:last-child { border: 0; }
.methodology-card dt {
  font-size: 10px;
  color: var(--accent);
  font-weight: 700;
  text-transform: uppercase;
}
.methodology-card dd {
  margin: 5px 0 0;
  color: var(--muted);
  line-height: 1.5;
}
.research-table-card { margin-top: 16px; }
.research-table { min-width: 1160px; }
.research-table td strong, .research-table td small { display: block; }
.research-table td small { color: var(--muted); font-size: 10px; margin-top: 4px; }
.research-table td b { font-size: 13px; font-weight: 600; }
.perf-token-table { min-width: 1080px; }
.research-hero a { color: var(--accent2); text-decoration: none; }
.research-hero a:hover { text-decoration: underline; }
.research-table-card .section-heading { align-items: flex-end; }

/* —— Social page —— */
.social-hero {
  display: flex;
  justify-content: space-between;
  gap: 26px;
  align-items: center;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(120deg, rgba(0, 180, 255, .08), rgba(0, 210, 255, .05));
  box-shadow: var(--shadow);
}
.social-hero h2 { font-size: 24px; margin: 7px 0; }
.social-hero p { color: var(--muted); line-height: 1.6; max-width: 850px; margin: 0; }
.social-status {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 13px;
  min-width: 220px;
}
.social-status.is-active { border-color: rgba(0, 210, 255, .35); }
.social-status strong, .social-status span { display: block; }
.social-status span { color: var(--muted); font-size: 11px; margin-top: 5px; }
.social-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 11px;
  margin: 16px 0;
}
.social-kpis article {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(12, 24, 35, .9);
}
.social-kpis small, .social-kpis span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}
.social-kpis strong {
  display: block;
  font-size: 22px;
  margin: 8px 0 5px;
  font-family: var(--mono);
  font-weight: 600;
}
.social-kpis .small-value {
  font-size: 12px;
  word-break: break-word;
  font-family: var(--font);
}
.social-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 16px;
}
.social-token-list { display: grid; gap: 8px; margin-top: 16px; }
.social-token-row {
  display: grid;
  grid-template-columns: minmax(160px, 1.5fr) repeat(4, minmax(70px, .55fr)) minmax(150px, .9fr);
  gap: 12px;
  align-items: center;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(6, 14, 22, .42);
}
.social-token-row.phase-early { border-color: rgba(0, 210, 255, .4); }
.social-token-row.phase-concentrated { border-color: rgba(240, 179, 90, .35); }
.social-token-name a, .social-token-name strong {
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}
.social-token-name span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.social-token-row small {
  display: block;
  color: var(--muted);
  font-size: 10px;
  margin-bottom: 4px;
}
.social-token-row b { font-family: var(--mono); font-weight: 550; }
.social-phase span {
  display: inline-block;
  padding: 6px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .05);
  font-size: 10px;
}
.social-method { position: sticky; top: 24px; height: max-content; }
.social-method > div {
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}
.social-method > div:last-child { border: 0; }
.social-method p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
  margin: 6px 0 0;
}
.social-sources, .social-runs { margin-top: 16px; }

/* —— Login (MAHI cybernetic hero) —— */
html:has(body.login-page) {
  height: 100%;
  overflow: hidden;
}
body.login-page {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  align-items: stretch;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  min-height: 0;
  margin: 0;
  padding: clamp(18px, 3.5vh, 36px) 20px clamp(16px, 3vh, 28px);
  overflow: hidden !important;
  overscroll-behavior: none;
  background: #000;
  color: #f4f8fc;
  font-family: var(--font);
}
.login-stage {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.login-hero {
  position: absolute;
  inset: 0;
  background-image: url("img/mahi-hero-cat.png");
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  opacity: 0;
  animation: login-hero-in 1.1s ease forwards;
}
.login-hero-veil {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, .22) 0%, rgba(0, 0, 0, .12) 28%, rgba(0, 0, 0, .28) 58%, rgba(0, 0, 0, .62) 100%);
  opacity: 0;
  animation: login-hero-in 1.1s ease .05s forwards;
}
.login-eye-glow {
  position: absolute;
  top: 34%;
  width: min(10vw, 78px);
  height: min(7vw, 52px);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(80, 190, 255, .55) 0%, rgba(0, 160, 255, .18) 42%, transparent 72%);
  filter: blur(10px) brightness(.7);
  opacity: 0;
  transform: translate(-50%, -50%) scale(.92);
  animation: login-eyes-in .9s ease .5s forwards, login-eyes-pulse 3.6s ease-in-out 1.4s infinite;
}
.login-eye-glow-l { left: 43.8%; }
.login-eye-glow-r { left: 56.2%; }
.login-stage.is-authenticated .login-eye-glow {
  animation: login-eyes-success .55s ease forwards;
}
.login-brand {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 8px;
  padding-top: clamp(4px, 1.5vh, 18px);
  opacity: 0;
  animation: login-fade-rise .7s cubic-bezier(.22, 1, .36, 1) 1.05s forwards;
}
.login-wordmark {
  margin: 0;
  color: #fff;
  font-size: clamp(34px, 5vw, 46px);
  font-weight: 700;
  letter-spacing: .42em;
  text-indent: .42em;
  line-height: 1;
}
.login-wordmark span {
  display: inline-block;
  transform: translateY(-1px);
}
.login-tagline {
  margin: 0;
  color: rgba(140, 190, 230, .78);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: .22em;
  text-transform: uppercase;
}
.login-shell {
  position: relative;
  z-index: 1;
  width: min(440px, 100%);
  display: grid;
  place-items: center;
  align-self: start;
  justify-self: center;
  margin: clamp(48px, 8vh, 110px) 0 0;
  min-height: 0;
}
.login-panel {
  width: 100%;
  border-radius: 20px;
  border: 1px solid rgba(80, 170, 255, .22);
  background: rgba(8, 12, 18, .55);
  backdrop-filter: blur(20px) saturate(1.15);
  -webkit-backdrop-filter: blur(20px) saturate(1.15);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, .03) inset,
    0 24px 60px rgba(0, 0, 0, .45),
    0 0 48px rgba(40, 140, 255, .12);
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px);
  animation: login-card-in .6s cubic-bezier(.22, 1, .36, 1) 1.35s forwards;
}
.login-body,
.login-boot {
  padding: 28px 28px 22px;
}
.login-kicker {
  margin: 0;
  color: rgba(120, 190, 255, .95);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  font-family: var(--mono);
}
.login-body h1 {
  margin: 10px 0 8px;
  font-size: clamp(22px, 3.4vw, 28px);
  font-weight: 650;
  letter-spacing: -.02em;
  color: #fff;
  line-height: 1.15;
}
.login-copy {
  margin: 0 0 22px;
  color: rgba(200, 214, 230, .78);
  font-size: 13px;
  line-height: 1.5;
}
.login-form {
  display: grid;
  gap: 8px;
}
.login-form label {
  color: rgba(120, 190, 255, .85);
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  font-weight: 700;
}
.login-field {
  position: relative;
}
.login-form input {
  width: 100%;
  padding: 13px 42px 13px 14px;
  border-radius: 12px;
  border: 1px solid rgba(80, 170, 255, .22);
  background: rgba(0, 0, 0, .45);
  color: #fff;
  font: inherit;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.login-form input::placeholder { color: rgba(170, 186, 204, .45); }
.login-form input:focus {
  outline: none;
  border-color: rgba(90, 180, 255, .65);
  box-shadow: 0 0 0 3px rgba(60, 150, 255, .16), 0 0 22px rgba(40, 140, 255, .18);
}
.login-lock {
  position: absolute;
  right: 12px;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  color: rgba(200, 220, 240, .72);
  pointer-events: none;
}
.login-lock svg { width: 100%; height: 100%; display: block; }
.login-form button {
  margin-top: 10px;
  padding: 13px 16px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, #4aa8ff 0%, #1f7fe0 52%, #1768c4 100%);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: .02em;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(30, 120, 220, .28);
  transition: filter .2s ease, transform .15s ease, box-shadow .2s ease;
}
.login-form button:hover {
  filter: brightness(1.08);
  box-shadow: 0 12px 32px rgba(40, 140, 255, .36);
}
.login-form button:active {
  transform: scale(.985);
}
.login-form button:disabled {
  opacity: .7;
  cursor: wait;
}
.login-error {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 111, 122, .4);
  background: rgba(255, 111, 122, .1);
  color: #ff9aa2;
  font-size: 12px;
}
.login-divider {
  height: 1px;
  margin: 20px 0 14px;
  background: linear-gradient(90deg, transparent, rgba(80, 170, 255, .45), transparent);
  position: relative;
}
.login-divider i {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: #5eb6ff;
  box-shadow: 0 0 10px rgba(90, 180, 255, .8);
}
.login-meta {
  margin: 0;
  text-align: center;
  color: rgba(170, 188, 208, .48);
  font-size: 9px;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.login-boot {
  font-family: var(--mono);
}
.login-boot-title {
  margin: 0 0 18px;
  color: rgba(140, 200, 255, .95);
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.login-boot-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}
.login-boot-list li {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: baseline;
  gap: 6px;
  color: rgba(210, 222, 236, .88);
  font-size: 12px;
  letter-spacing: .04em;
  opacity: 0;
  transform: translateY(6px);
  animation: login-boot-item .35s ease forwards;
  animation-delay: calc(.12s + (var(--i) * .16s));
}
.login-boot-list li span { color: rgba(190, 210, 228, .9); }
.login-boot-list li b {
  color: rgba(100, 140, 170, .55);
  font-weight: 500;
  letter-spacing: .08em;
}
.login-boot-list li em {
  color: #7ec8ff;
  font-style: normal;
  font-weight: 650;
}
.login-status {
  position: relative;
  z-index: 1;
  width: min(720px, 100%);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(80, 170, 255, .18);
  background: rgba(6, 10, 16, .48);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  opacity: 0;
  animation: login-fade-rise .7s cubic-bezier(.22, 1, .36, 1) 1.55s forwards;
}
.login-status-item {
  display: grid;
  grid-template-columns: 8px 1fr;
  grid-template-rows: auto auto;
  column-gap: 8px;
  row-gap: 2px;
  align-items: center;
}
.login-status-item i {
  grid-row: 1 / span 2;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4eb4ff;
  box-shadow: 0 0 10px rgba(78, 180, 255, .85);
}
.login-status-item strong {
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(230, 238, 248, .9);
  font-weight: 650;
}
.login-status-item span {
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(110, 180, 230, .85);
  font-family: var(--mono);
}
.login-status.is-booting .login-status-item i {
  animation: login-status-pulse .7s ease infinite alternate;
}
@keyframes login-hero-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes login-eyes-in {
  from {
    opacity: 0;
    filter: blur(14px) brightness(.4);
    transform: translate(-50%, -50%) scale(.85);
  }
  to {
    opacity: .85;
    filter: blur(10px) brightness(1.05) drop-shadow(0 0 14px rgba(70, 180, 255, .55));
    transform: translate(-50%, -50%) scale(1);
  }
}
@keyframes login-eyes-pulse {
  0%, 100% {
    opacity: .75;
    filter: blur(10px) brightness(1) drop-shadow(0 0 10px rgba(60, 160, 255, .4));
  }
  50% {
    opacity: .95;
    filter: blur(11px) brightness(1.15) drop-shadow(0 0 18px rgba(80, 190, 255, .65));
  }
}
@keyframes login-eyes-success {
  0% {
    opacity: .85;
    filter: blur(10px) brightness(1.05) drop-shadow(0 0 14px rgba(70, 180, 255, .55));
  }
  40% {
    opacity: 1;
    filter: blur(8px) brightness(1.45) drop-shadow(0 0 28px rgba(120, 210, 255, .9));
    transform: translate(-50%, -50%) scale(1.08);
  }
  100% {
    opacity: .95;
    filter: blur(10px) brightness(1.2) drop-shadow(0 0 20px rgba(90, 190, 255, .75));
    transform: translate(-50%, -50%) scale(1);
  }
}
@keyframes login-fade-rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes login-card-in {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes login-boot-item {
  to { opacity: 1; transform: translateY(0); }
}
@keyframes login-status-pulse {
  from { opacity: .55; box-shadow: 0 0 6px rgba(78, 180, 255, .4); }
  to { opacity: 1; box-shadow: 0 0 14px rgba(78, 180, 255, .95); }
}
@media (max-height: 820px) {
  .login-wordmark { font-size: 30px; letter-spacing: .34em; text-indent: .34em; }
  .login-body, .login-boot { padding: 22px 22px 16px; }
  .login-eye-glow { top: 34%; }
}
@media (max-width: 640px) {
  .login-status {
    grid-template-columns: 1fr 1fr;
    width: min(440px, 100%);
  }
  .login-body, .login-boot { padding-left: 20px; padding-right: 20px; }
  .login-eye-glow-l { left: 42%; }
  .login-eye-glow-r { left: 58%; }
}
@media (prefers-reduced-motion: reduce) {
  .login-hero, .login-hero-veil, .login-eye-glow,
  .login-brand, .login-panel, .login-status,
  .login-boot-list li {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
  }
  .login-eye-glow {
    opacity: .8 !important;
    filter: blur(10px) brightness(1.05) drop-shadow(0 0 12px rgba(70, 180, 255, .5)) !important;
    transform: translate(-50%, -50%) !important;
  }
}

/* —— Motion —— */
@keyframes pulse { 50% { opacity: .4; } }
@keyframes fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes mark-in {
  from { opacity: 0; transform: scale(.88); }
  to { opacity: 1; transform: scale(1); }
}

/* —— Responsive —— */
@media (max-width: 1400px) {
  .kpi-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 1250px) {
  .ranking-row { grid-template-columns: 42px minmax(0, 1.5fr) repeat(3, minmax(0, .7fr)); }
  .rank-price { display: none; }
}
@media (max-width: 1200px) {
  .research-kpis { grid-template-columns: repeat(3, 1fr); }
  .research-grid { grid-template-columns: 1fr; }
}
@media (max-width: 1100px) {
  .social-layout { grid-template-columns: 1fr; }
  .social-method { position: static; }
  .social-token-row { grid-template-columns: minmax(150px, 1.4fr) repeat(3, minmax(70px, .6fr)); }
  .social-token-row > div:nth-child(5) { display: none; }
}
@media (max-width: 1050px) {
  body { grid-template-columns: 1fr; }
  .hero-grid { grid-template-columns: 1fr; }
  .page-guide { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .data-connection { grid-template-columns: 1fr; }
  .data-path code { white-space: normal; word-break: break-all; }
  .provider-grid { grid-template-columns: 1fr; }
  .validation-grid { grid-template-columns: repeat(2, 1fr); }
  .workspace-brief { grid-template-columns: 1fr; }
  .activity-item { grid-template-columns: 120px 1fr; }
  .activity-item time { display: none; }
}
@media (max-width: 850px) {
  .ranking-row { grid-template-columns: 38px 1fr repeat(2, minmax(78px, .6fr)); }
  .ranking-row .rank-metric:nth-of-type(4),
  .ranking-row .rank-metric:nth-of-type(5) { display: none; }
}
@media (max-width: 760px) {
  .social-signal-strip, .social-kpis { grid-template-columns: 1fr 1fr; }
  .social-hero { flex-direction: column; align-items: flex-start; }
  .social-status { width: 100%; }
  .social-token-row { grid-template-columns: 1fr 70px; }
  .social-token-row > div:not(:first-child):not(.social-phase) { display: none; }
}
@media (max-width: 700px) {
  main { padding: 20px 14px 32px; }
  header { flex-direction: column; }
  .header-actions { margin-top: 12px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  nav { grid-template-columns: 1fr 1fr; }
  .opportunity-main { display: block; }
  .price-box { text-align: left; margin-top: 18px; }
  .chart-meta { display: none; }
  .top-opportunity, .market-chart-card { padding: 16px; }
  .chart-wrap { height: 240px; }
  .research-hero { flex-direction: column; align-items: flex-start; }
  .research-warning { min-width: 0; width: 100%; }
  .research-kpis { grid-template-columns: 1fr 1fr; }
  .detail-modal-grid { grid-template-columns: 1fr; }
  .data-table { min-width: 720px; }
}
@media (max-width: 560px) {
  .attention-ranking { padding: 14px; }
  .ranking-row { grid-template-columns: 34px 1fr; }
  .rank-metric, .rank-price { display: none !important; }
  .activity-item { grid-template-columns: 1fr; }
  .provider-facts, .friendly-facts, .validation-grid { grid-template-columns: 1fr; }
}

/* ===== MAHI Terminal UI 8.5 polish ===== */
.sidebar {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  padding: 18px 14px 14px;
}
.sidebar-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-right: 0;
  margin-bottom: 8px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.sidebar-scroll::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}
.sidebar-foot {
  flex: 0 0 auto;
  margin-top: 0 !important;
  position: sticky;
  bottom: 0;
  background: linear-gradient(180deg, rgba(5,14,22,0), rgba(5,14,22,.96) 28%, rgba(5,14,22,1));
  padding-top: 14px !important;
  z-index: 2;
}
.nav-icon {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  opacity: .85;
}
.nav-icon svg { width: 18px; height: 18px; display: block; }
.nav-label { min-width: 0; }
nav a { gap: 10px; }
.nav-dot { display: none; }
.logout-form { margin-top: 10px; }
.logout-btn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 40px;
  padding: 10px 12px !important;
  border: 1px solid rgba(0,210,255,.35) !important;
  border-radius: 11px !important;
  background: rgba(0,210,255,.08) !important;
  color: var(--accent) !important;
  font-weight: 700 !important;
  letter-spacing: .04em;
  text-transform: none !important;
  font-size: 13px !important;
}
.logout-btn svg { width: 16px; height: 16px; }
.logout-btn:hover {
  background: rgba(0,210,255,.16) !important;
  color: var(--text) !important;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 22px;
  min-width: 0;
  max-width: 100%;
  flex-wrap: wrap;
  overflow-x: clip;
}
.page-header-copy { min-width: 0; flex: 1 1 220px; }
.status-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  max-width: 100%;
  min-width: 0;
  flex: 1 1 280px;
}
.status-chip {
  min-width: 0;
  flex: 0 1 auto;
  max-width: min(168px, 100%);
  padding: 8px 11px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(8,18,28,.72);
  overflow: hidden;
}
.status-chip-label {
  display: block;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: .1em;
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 3px;
}
.status-chip strong {
  display: block;
  font-size: 12px;
  font-family: var(--mono);
  font-weight: 550;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.status-chip[data-state="live"] { border-color: rgba(0,210,255,.4); }
.status-chip[data-state="live"] strong { color: var(--accent); }
.status-chip[data-state="delayed"] { border-color: rgba(240,179,90,.4); }
.status-chip[data-state="stale"] { border-color: rgba(255,111,122,.4); }
.status-chip[data-state="stale"] strong { color: var(--danger); }

.kpi-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.kpi-trend {
  font-size: 10px;
  font-family: var(--mono);
  color: var(--muted2);
  white-space: nowrap;
}
.kpi-trend[data-dir="up"] { color: var(--accent); }
.kpi-trend[data-dir="down"] { color: var(--danger); }
.kpi-skeleton {
  display: none;
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.05), transparent);
  background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
}
body.is-loading .kpi-skeleton { display: block; }
body.is-loading .kpi-card strong,
body.is-loading .kpi-hint,
body.is-loading .kpi-trend { opacity: .25; }

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%) translateY(4px);
  padding: 7px 10px;
  border-radius: 8px;
  background: rgba(6,14,22,.96);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 11px;
  line-height: 1.35;
  white-space: nowrap;
  max-width: 260px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease, transform .15s ease;
  z-index: 40;
  box-shadow: var(--shadow);
}
[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast-host {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 90;
  display: grid;
  gap: 8px;
  width: min(340px, calc(100vw - 24px));
}
.toast {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(10,22,33,.96);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .2s ease, transform .2s ease;
}
.toast.is-visible { opacity: 1; transform: translateY(0); }
.toast-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 5px;
  background: var(--accent2);
  flex-shrink: 0;
}
.toast-success .toast-dot { background: var(--accent); }
.toast-error .toast-dot { background: var(--danger); }
.toast-msg { font-size: 13px; line-height: 1.4; }

.chart-wrap { position: relative; }
.chart-hover-tip { display: none; }

.command-palette {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: start center;
  padding: 12vh 16px 16px;
}
.command-palette[hidden] { display: none !important; }
.command-palette-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2,8,14,.7);
  backdrop-filter: blur(6px);
}
.command-palette-panel {
  position: relative;
  width: min(560px, 100%);
  padding: 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(16,32,46,.98), rgba(8,18,28,.98));
  box-shadow: 0 30px 90px rgba(0,0,0,.45);
}
.command-palette-panel input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(6,14,22,.75);
  color: var(--text);
  font: inherit;
  margin-bottom: 10px;
}

@media (max-width: 1050px) {
  .page-header { flex-direction: column; }
  .status-bar { justify-content: flex-start; max-width: none; }
}

/* Archive browser (Diario) */
.archive-panel { margin-top: 16px; }
.archive-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(0,210,255,.3);
  background: rgba(0,210,255,.08);
  color: var(--accent);
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
}
.btn-download:hover { background: rgba(0,210,255,.16); }
.btn-download-primary {
  background: linear-gradient(145deg, var(--accent), var(--accent2));
  color: #041016;
  border: 0;
}
.archive-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-top: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.archive-crumbs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.crumb {
  border: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
  padding: 0;
}
.crumb:hover { text-decoration: underline; }
.crumb-sep { color: var(--muted2); }
.archive-search { min-width: min(280px, 100%); }
.archive-list { display: grid; gap: 8px; margin-top: 14px; }
.archive-list.is-busy { opacity: .55; pointer-events: none; }
.archive-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.6fr) repeat(3, minmax(90px, .7fr)) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(6,14,22,.42);
}
.archive-name { min-width: 0; }
.archive-name strong, .archive-folder {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  text-align: left;
}
.archive-folder {
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  font: inherit;
}
.archive-folder:hover { color: var(--accent); }
.archive-name span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.archive-meta small {
  display: block;
  color: var(--muted);
  font-size: 10px;
  margin-bottom: 4px;
}
.archive-meta b {
  font-size: 12px;
  font-family: var(--mono);
  font-weight: 550;
}
.archive-row-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.archive-note { margin-top: 14px; font-size: 11px; line-height: 1.5; }
@media (max-width: 900px) {
  .archive-row { grid-template-columns: 1fr 1fr; }
  .archive-row-actions { grid-column: 1 / -1; justify-content: flex-start; }
}

/* Trading Journal (Operazioni) */
.detail-modal.journal-modal {
  display: flex !important;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 24px 16px;
  inset: 0;
  z-index: 90;
}
.detail-modal.journal-modal[hidden] { display: none !important; }
.journal-modal .detail-modal-backdrop {
  position: fixed;
}
.journal-modal .journal-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(980px, 100%);
  max-height: calc(100vh - 48px);
  margin: 0 auto;
  overflow: hidden;
  flex-shrink: 0;
  padding-bottom: 12px;
}
.journal-modal .detail-modal-head {
  flex: 0 0 auto;
  margin-bottom: 12px;
}
.journal-hero {
  flex: 0 0 auto;
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(120deg, rgba(0,210,255,.08), rgba(0,180,255,.05));
}
.journal-hero-status {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(6,14,22,.45);
  min-width: 0;
  width: 100%;
}
.journal-hero-status.is-open { border-color: rgba(0,210,255,.35); }
.journal-hero-status span,
.journal-hero-status small { display: block; }
.journal-hero-status small {
  color: var(--muted);
  margin-top: 4px;
  font-size: 11px;
}
.journal-hero-history {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.journal-hero-history > div {
  padding: 10px 12px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: rgba(6,14,22,.4);
}
.journal-hero-history small {
  display: block;
  color: var(--muted);
  font-size: 10px;
  margin-bottom: 4px;
}
.journal-hero-history b { font-size: 13px; }
.journal-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
  -webkit-overflow-scrolling: touch;
}
.journal-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.journal-stat {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(6,14,22,.45);
}
.journal-stat small {
  display: block;
  color: var(--muted);
  font-size: 10px;
  margin-bottom: 6px;
}
.journal-stat b {
  font-size: 13px;
  font-family: var(--mono);
  font-weight: 550;
}
.journal-sims { display: grid; gap: 14px; }
.journal-sim {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(8,18,28,.72);
  padding: 16px;
}
.journal-sim-head {
  display: grid;
  grid-template-columns: minmax(180px, .8fr) 1.4fr;
  gap: 14px;
  margin-bottom: 14px;
}
.journal-sim-head h3 { margin: 4px 0; font-size: 18px; }
.journal-sim-head p { margin: 0; color: var(--muted); font-size: 12px; }
.journal-sim-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.journal-sim-kpis > div {
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(6,14,22,.4);
}
.journal-sim-kpis small {
  display: block;
  color: var(--muted);
  font-size: 10px;
  margin-bottom: 4px;
}
.journal-sim-kpis b {
  font-size: 12px;
  font-family: var(--mono);
}
.journal-timeline { display: grid; gap: 8px; }
.journal-timeline-item {
  display: grid;
  grid-template-columns: 140px 1fr auto;
  gap: 12px;
  align-items: start;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(30,52,70,.8);
  background: rgba(6,14,22,.35);
}
.journal-event-type {
  color: var(--accent);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.journal-timeline-item strong { font-size: 12px; }
.journal-timeline-item p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.journal-timeline-item b { font-family: var(--mono); font-size: 12px; }
.latest-sim-cell, .history-cell { display: grid; gap: 4px; }
.latest-sim-cell small, .history-cell small {
  color: var(--muted);
  font-size: 11px;
}
.history-cell b { font-size: 12px; }
@media (max-width: 900px) {
  .journal-stats,
  .journal-hero-history { grid-template-columns: 1fr 1fr; }
  .journal-sim-head { grid-template-columns: 1fr; }
  .journal-sim-kpis { grid-template-columns: 1fr 1fr; }
  .journal-timeline-item { grid-template-columns: 1fr; }
}

/* ===== Mobile / phone layout ===== */
.mobile-topbar,
.nav-backdrop {
  display: none;
}

@media (max-width: 980px) {
  body {
    display: flex;
    flex-direction: column;
    grid-template-columns: none;
    padding-left: 0;
  }

  .mobile-topbar {
    display: flex;
    position: sticky;
    top: 0;
    z-index: 30;
    align-items: center;
    gap: 10px;
    min-height: 56px;
    padding: 10px 12px;
    padding-top: max(10px, env(safe-area-inset-top));
    border-bottom: 1px solid rgba(0, 180, 255, .14);
    background: rgba(5, 10, 16, .92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
  }
  .mobile-topbar-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
  }
  .mobile-topbar-brand img {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    object-fit: cover;
    object-position: 50% 12%;
    border: 1px solid rgba(0, 200, 255, .28);
  }
  .mobile-topbar-brand strong {
    font-size: 13px;
    letter-spacing: .14em;
  }
  .mobile-topbar-page {
    margin-left: auto;
    color: var(--muted);
    font-size: 11px;
    font-weight: 650;
    letter-spacing: .04em;
    text-transform: uppercase;
    max-width: 42%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .nav-toggle {
    width: 42px;
    height: 42px;
    border: 1px solid rgba(0, 180, 255, .2);
    border-radius: 11px;
    background: rgba(8, 16, 24, .8);
    display: grid;
    place-content: center;
    gap: 5px;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
  }
  .nav-toggle span {
    display: block;
    width: 16px;
    height: 1.5px;
    background: #d7e6f4;
    border-radius: 2px;
    transition: transform .2s ease, opacity .2s ease;
  }
  body.nav-open .nav-toggle span:nth-child(1) {
    transform: translateY(6.5px) rotate(45deg);
  }
  body.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
  body.nav-open .nav-toggle span:nth-child(3) {
    transform: translateY(-6.5px) rotate(-45deg);
  }

  .nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgba(0, 0, 0, .55);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
  }
  body.nav-open .nav-backdrop {
    opacity: 1;
    pointer-events: auto;
  }
  .nav-backdrop[hidden] { display: none !important; }

  body.nav-open {
    overflow: hidden;
  }

  aside.sidebar,
  .sidebar {
    position: fixed !important;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(300px, 86vw) !important;
    max-width: min(300px, 86vw) !important;
    height: 100dvh !important;
    z-index: 40;
    transform: translateX(-105%);
    transition: transform .24s ease;
    border-right: 1px solid rgba(0, 180, 255, .16);
    border-bottom: 0;
    box-shadow: 18px 0 50px rgba(0, 0, 0, .45);
    overflow: hidden;
  }
  body.nav-open aside.sidebar,
  body.nav-open .sidebar {
    transform: translateX(0);
  }
  .sidebar-scroll {
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  nav {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 3px;
  }

  main {
    padding: 16px 14px calc(28px + env(safe-area-inset-bottom));
    max-width: 100%;
  }
  .page-header {
    gap: 12px;
    margin-bottom: 16px;
  }
  .page-header-copy .subtitle {
    font-size: 12px;
    max-width: none;
  }
  h1 { font-size: clamp(22px, 7vw, 28px); }
  .status-bar {
    width: 100%;
    gap: 6px;
  }
  .status-chip {
    flex: 1 1 calc(50% - 6px);
    max-width: none;
    min-width: calc(50% - 6px);
  }
  .live-pill {
    flex: 1 1 100%;
    justify-content: center;
  }

  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 8px; }
  .kpi-card { padding: 12px; }
  .kpi-card strong { font-size: 18px; }
  .page-guide,
  .workspace-brief,
  .data-connection,
  .hero-grid,
  .social-layout,
  .research-grid,
  .provider-grid { grid-template-columns: 1fr !important; }

  .table,
  .table-scroll,
  .data-table-card {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .data-table { min-width: 640px; }
  .ranking-row {
    grid-template-columns: 34px minmax(0, 1fr) auto !important;
  }
  .ranking-row .rank-metric:nth-of-type(n+3),
  .rank-price { display: none !important; }

  .top-opportunity,
  .market-chart-card,
  .attention-ranking,
  .activity-panel,
  .panel { padding: 14px; }
  .chart-wrap { height: 220px; }
  .opportunity-main { display: block; }
  .price-box { text-align: left; margin-top: 14px; }
  .token-line h3 { font-size: 26px; }

  .detail-modal,
  .journal-modal {
    width: min(100vw - 16px, 100%);
    max-height: calc(100dvh - 16px);
    margin: 8px;
    border-radius: 14px;
  }
  .command-palette-panel {
    width: min(100vw - 16px, 100%);
  }

  .archive-row {
    grid-template-columns: 1fr !important;
    gap: 8px;
  }
  .journal-stats,
  .journal-hero-history,
  .journal-sim-kpis {
    grid-template-columns: 1fr 1fr !important;
  }
}

@media (max-width: 560px) {
  .status-chip { flex-basis: 100%; min-width: 100%; }
  .mobile-topbar-page { display: none; }
  .social-signal-strip,
  .social-kpis { grid-template-columns: 1fr !important; }
  .research-kpis { grid-template-columns: 1fr !important; }
  .validation-grid { grid-template-columns: 1fr !important; }
  .journal-stats,
  .journal-hero-history,
  .journal-sim-kpis { grid-template-columns: 1fr !important; }
  .page-header-copy .eyebrow { font-size: 9px; }
  .subtitle {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
}

@media (max-width: 640px) {
  body.login-page {
    padding: 12px 12px max(12px, env(safe-area-inset-bottom));
  }
  .login-hero { background-attachment: scroll; }
  .login-wordmark {
    font-size: 28px;
    letter-spacing: .28em;
    text-indent: .28em;
  }
  .login-shell {
    margin-top: clamp(24px, 6vh, 72px) !important;
    width: min(100%, 420px);
  }
  .login-body,
  .login-boot { padding: 20px 16px 16px; }
  .login-body h1 { font-size: 22px; }
  .login-status {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 12px;
  }
  .login-eye-glow { top: 30%; width: 56px; height: 36px; }
}

