/* The design refresh (design_refresh switch, Nov 21): every change the
   design audit suggested. Loaded only for people the switch is on for,
   with class="d2" on <html> (council/api/ui_files.py), so the current look
   is untouched for everyone else. Page-specific JS checks D2 (app.js). */

/* Faint grey readable as text: 4.6:1 light, 5.6:1 dark (was 2.8:1). */
:root.d2 { --faint: #667085; }
@media (prefers-color-scheme: dark) { :root.d2:not([data-theme="light"]) { --faint: #8792a4; } }
:root.d2[data-theme="dark"] { --faint: #8792a4; }

/* No 300ms wait before a tap on phones. */
.d2 a, .d2 button, .d2 input, .d2 select, .d2 textarea, .d2 label, .d2 summary, .d2 [role="button"] { touch-action: manipulation; }

/* Controls answer a press (Emil Kowalski): a small scale-down, ease-out. */
.d2 .btn, .d2 .seg button, .d2 .pill[role="button"], .d2 button.pill, .d2 .chip, .d2 .tab, .d2 [role="tab"], .d2 .scr-chip, .d2 .nav-tab {
  transition: background-color .15s, border-color .15s, color .15s, transform .14s cubic-bezier(.2, .8, .2, 1);
}
.d2 .btn:active:not(:disabled), .d2 .seg button:active, .d2 button.pill:active, .d2 .chip:active, .d2 .tab:active,
.d2 [role="tab"]:active, .d2 .nav-tab:active { transform: scale(.97); }
@media (prefers-reduced-motion: reduce) {
  .d2 .btn:active, .d2 .seg button:active, .d2 button.pill:active, .d2 .chip:active, .d2 .tab:active, .d2 [role="tab"]:active, .d2 .nav-tab:active { transform: none; }
}

/* 44px to tap on touch screens. */
@media (pointer: coarse) {
  .d2 .btn, .d2 .btn-small, .d2 .seg button, .d2 button.pill, .d2 a.pill, .d2 .chip, .d2 .tab, .d2 [role="tab"],
  .d2 .section-menu a, .d2 select.input, .d2 .input { min-height: 44px; }
  .d2 .seg button { padding-top: 10px; padding-bottom: 10px; }
  .d2 table.data th, .d2 table.data td { padding-top: 13px; padding-bottom: 13px; }
}

/* Settings (and any page whose menu has no group headings): one row that
   scrolls on a phone instead of wrapping onto two lines. */
@media (max-width: 760px) {
  .d2 .section-menu:not(:has(.section-group)) { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
    margin: 0 -16px; padding: 0 16px 2px; scroll-padding: 0 16px; -webkit-overflow-scrolling: touch; }
  .d2 .section-menu:not(:has(.section-group))::-webkit-scrollbar { display: none; }
  .d2 .section-menu:not(:has(.section-group)) a { flex: none; }
}

/* A 12px floor for anything that's read (generated from every rule under
   12px when the switch was built; icons and glyphs under 9px left alone). */
.d2 .acc-axis { font-size: 12px; }  /* admin.css */
.d2 .plan-pill { font-size: 12px; }  /* admin.css */
.d2 .mx-foot { font-size: 12px; }  /* admin.css */
.d2 .mx-v { font-size: 12px; }  /* admin.css */
.d2 .mx-x { font-size: 12px; }  /* admin.css */
.d2 .mx-goal-t { font-size: 12px; }  /* admin.css */
.d2 .mx-f-note { font-size: 12px; }  /* admin.css */
.d2 .fin-proj-t { font-size: 12px; }  /* admin.css */
.d2 .beta-tag { font-size: 12px; }  /* clean.css */
.d2 .survey-preview { font-size: 12px; }  /* clean.css */
.d2 .survey-faces button { font-size: 12px; }  /* clean.css */
.d2 .badge-beta { font-size: 12px; }  /* clean.css */
.d2 .nav-badge { font-size: 12px; }  /* clean.css */
.d2 .tabbar a { font-size: 12px; }  /* clean.css */
.d2 .chip .t { font-size: 12px; }  /* clean.css */
.d2 [data-pink] .seat-dot::before { font-size: 12px; }  /* clean.css */
.d2 .status-badge { font-size: 12px; }  /* clean.css */
.d2 .status-welcome .sw-preview { font-size: 12px; }  /* clean.css */
.d2 [data-galaxy] .seat-dot::before { font-size: 12px; }  /* clean.css */
.d2 .dw-flame span { font-size: 12px; }  /* clean.css */
.d2 .daily-welcome .sw-preview { font-size: 12px; }  /* clean.css */
.d2 .an-new { font-size: 12px; }  /* clean.css */
.d2 .an-on-tag { font-size: 12px; }  /* clean.css */
.d2 .av.sm { font-size: 12px; }  /* clean.css */
.d2 .badge-owner { font-size: 12px; }  /* clean.css */
.d2 .badge-mod { font-size: 12px; }  /* clean.css */
.d2 .badge-plan { font-size: 12px; }  /* clean.css */
.d2 .av-ticker { font-size: 12px; }  /* clean.css */
.d2 .av-ticker.len3 { font-size: 12px; }  /* clean.css */
.d2 .av-ticker.len4 { font-size: 12px; }  /* clean.css */
.d2 .an-lb-rank { font-size: 12px; }  /* clean.css */
.d2 .rail-h { font-size: 12px; }  /* community.css */
.d2 .n-unread, .d2 .n-mention { font-size: 12px; }  /* community.css */
.d2 .tickers-btn .chev::after, .d2 .place-pick .chev::after { font-size: 12px; }  /* community.css */
.d2 .tk-group { font-size: 12px; }  /* community.css */
.d2 .tk .n { font-size: 12px; }  /* community.css */
.d2 .day { font-size: 12px; }  /* community.css */
.d2 .new-line { font-size: 12px; }  /* community.css */
.d2 .who time { font-size: 12px; }  /* community.css */
.d2 .who .edited { font-size: 12px; }  /* community.css */
.d2 .menu .lbl { font-size: 12px; }  /* community.css */
.d2 .chint { font-size: 12px; }  /* community.css */
.d2 .ac .lbl { font-size: 12px; }  /* community.css */
.d2 .dg-pro { font-size: 12px; }  /* digest.css */
.d2 .dg-fg-tick { font-size: 12px; }  /* digest.css */
.d2 .dg-fg-key li { font-size: 12px; }  /* digest.css */
.d2 .dg-rm-q { font-size: 12px; }  /* digest.css */
.d2 .dg-pol-who { font-size: 12px; }  /* digest.css */
.d2 .dg-pol-who.more { font-size: 12px; }  /* digest.css */
.d2 .dg-pol-act { font-size: 12px; }  /* digest.css */
.d2 .lb-dot { font-size: 12px; }  /* leaderboard.css */
.d2 .cell-sub { font-size: 12px; }  /* pages.css */
.d2 .section-group { font-size: 12px; }  /* pages.css */
.d2 .section-n { font-size: 12px; }  /* pages.css */
.d2 .plan-list .pill { font-size: 12px; }  /* pages.css */
.d2 .founder-badge { font-size: 12px; }  /* pricing.css */
.d2 .plan-card .features em { font-size: 12px; }  /* pricing.css */
.d2 .rtour-count b { font-size: 12px; }  /* record.css */
.d2 .pos-objection summary::before { font-size: 12px; }  /* run.css */
.d2 .pos-warn::before { font-size: 12px; }  /* run.css */
.d2 .seat .chip .t { font-size: 12px; }  /* run.css */
.d2 .pc-axis { font-size: 12px; }  /* run.css */
.d2 .pc-label { font-size: 12px; }  /* run.css */
.d2 .pc-pill text { font-size: 12px; }  /* run.css */
.d2 .tape-note { font-size: 12px; }  /* run.css */
.d2 .biz-bars text { font-size: 12px; }  /* run.css */
.d2 .ask-badge { font-size: 12px; }  /* run.css */
.d2 .run-v2 .seat .chip .t { font-size: 12px; }  /* run.css */
.d2 .run-v2 .seat .chip { font-size: 12px; }  /* run.css */
.d2 .sp-grid.three .sp-s { font-size: 12px; }  /* run.css */
.d2 .sp-legend { font-size: 12px; }  /* run.css */
.d2 .sp-dots-lab { font-size: 12px; }  /* run.css */
.d2 .sp-mark { font-size: 12px; }  /* run.css */
.d2 .sp-bar-col { font-size: 12px; }  /* run.css */
.d2 .sp-form { font-size: 12px; }  /* run.css */
.d2 .sp-dv-name small { font-size: 12px; }  /* run.css */
.d2 .sp-grade { font-size: 12px; }  /* run.css */
.d2 .sp-hold-name small { font-size: 12px; }  /* run.css */
.d2 .sp-hold-h { font-size: 12px; }  /* run.css */
.d2 .chips .chip-note { font-size: 12px; }  /* run.css */
.d2 .scr-q { font-size: 12px; }  /* screener.css */
.d2 .scr-th .scr-q { font-size: 12px; }  /* screener.css */
.d2 .scr-tag { font-size: 12px; }  /* screener.css */
.d2 .scr-mkt { font-size: 12px; }  /* screener.css */
.d2 .scr-cc i { font-size: 12px; }  /* screener.css */
.d2 .wl-ring-pct small { font-size: 12px; }  /* watchlist.css */

/* ---- Navigation: five tabs, Research sub-tabs, the You page ---------------- */
.research-tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; margin: 0 0 4px;
  border-bottom: 1px solid var(--line); }
.research-tabs::-webkit-scrollbar { display: none; }
.research-tabs a { flex: none; padding: 10px 14px; font-size: 14.5px; font-weight: 600; color: var(--muted); text-decoration: none;
  border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color .15s, border-color .15s; }
.research-tabs a:hover { color: var(--ink); }
.research-tabs a.active { color: var(--accent); border-bottom-color: var(--accent); }
@media (pointer: coarse) { .research-tabs a { min-height: 44px; display: inline-flex; align-items: center; } }
.you-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.you-card { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 16px 18px; text-decoration: none; color: var(--ink);
  transition: border-color .15s, transform .14s cubic-bezier(.2, .8, .2, 1); }
.you-card:hover { border-color: var(--line-strong); }
.you-card:active { transform: scale(.98); }
.you-card b { font-size: 16px; }
.you-card span { grid-column: 1; font-size: 14px; color: var(--muted); line-height: 1.4; }
.you-card i { grid-row: 1 / span 2; grid-column: 2; align-self: center; font-style: normal; color: var(--faint); }
.you-foot { grid-column: 1 / -1; display: flex; gap: 18px; padding: 8px 2px; font-size: 14px; }

/* ---- The run page ------------------------------------------------------------ */

/* A calm one-line note for sample answers, not a warning box. */
.d2 .sample-banner { border: 1px solid var(--line); background: var(--surface-2); padding: 10px 12px 10px 16px; border-radius: 12px; }
.d2 .sample-banner p { margin: 0; color: var(--muted); }

/* Header: ticker, name and date on one line; Watch, Share, Plain/Expert. */
.d2 .run-head { align-items: center; }
.d2 .run-title { gap: 4px; }
.d2 .run-meta .d2-when { color: var(--muted); }
/* "+ New debate" stays in the header as the main button (Nov 22, Ethan:
   "need that more accessible"), after the view switch. */
.d2 #new-run-btn { order: 10; }
@media (max-width: 640px) {
  .d2 .run-actions { width: 100%; }
  .d2 #new-run-btn { flex: 1 0 100%; min-height: 44px; justify-content: center; font-size: 15px; }
}
.d2 .d2-watch.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.d2 #detail-seg { order: 9; }
.d2 #detail-seg button { font-size: 13px; padding: 5px 10px; }

/* Bigger, bolder hero numbers (retail polish). */
.d2 .pos-value .big { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
.d2 .pos-value .big.num { font-weight: 600; }
.d2 .d2-price { margin: 2px 20px 6px; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.d2 .d2-price b { font-size: 30px; font-weight: 600; letter-spacing: -0.02em; }
.d2 .d2-price span { font-size: 13px; color: var(--faint); }

/* Dots stay solid (Ethan, Nov 22: where a dot sits on the bar already says
   up or down); the seats table's cells carry ▲ / ▼. */

/* The seats as one table: name and one-line read, then a cell per period. */
.d2 .seat-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; padding: 4px 0 8px; }
.d2 .d2-seat-head, .d2 .seat { display: grid; grid-template-columns: minmax(0, 1fr) repeat(3, 84px); column-gap: 8px; align-items: center; }
.d2 .d2-seat-head { padding: 8px 20px; font-size: 12px; font-weight: 600; color: var(--faint); text-transform: uppercase; letter-spacing: .05em;
  border-bottom: 1px solid var(--line); }
.d2 .d2-seat-head span:not(:first-child) { text-align: center; }
.d2 .seat { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; box-shadow: none !important; padding: 10px 20px; min-height: 56px;
  grid-template-rows: auto auto; row-gap: 2px; background: transparent; }
.d2 .seat:hover { background: var(--surface-2); }
.d2 .seat[aria-expanded="true"] { background: var(--accent-soft); box-shadow: none; }
.d2 .seat-top { grid-column: 1; grid-row: 1; min-width: 0; }
.d2 .seat-text { grid-column: 1; grid-row: 2; min-height: 0; -webkit-line-clamp: 1; font-size: 13px; }
.d2 .seat .chips { display: contents; }
.d2 .seat .chips > .chip { grid-row: 1 / span 2; justify-content: center; }
.d2 .seat .chips > .chip:nth-child(1) { grid-column: 2; }
.d2 .seat .chips > .chip:nth-child(2) { grid-column: 3; }
.d2 .seat .chips > .chip:nth-child(3) { grid-column: 4; }
.d2 .seat .chip .t { display: none; }
.d2 .seat .seat-fact { grid-column: 2 / 5; grid-row: 1 / span 2; font-size: 13px; color: var(--muted); text-align: center; }
.d2 .seat .chip-note { display: none; }
.d2 .seat-group-head { padding: 14px 20px 6px; }
.d2 .v2-seat-key { display: none !important; }
.d2 .seat-bubble { margin: 8px 16px; }
@media (max-width: 640px) {
  .d2 .d2-seat-head, .d2 .seat { grid-template-columns: minmax(0, 1fr) repeat(3, 50px); column-gap: 4px; padding-left: 14px; padding-right: 14px; }
  .d2 .seat { min-height: 52px; }
  .d2 .seat .chip { padding: 4px 2px; font-size: 12px; }
  .d2 .seat-status { display: none; }
}

/* Funds and coins: a snapshot strip, the vote line and the third tab. */
.d2 .d2-snapshot { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 10px 0 2px; padding-bottom: 2px; }
.d2 .d2-snapshot::-webkit-scrollbar { display: none; }
.d2 .d2-snap { flex: none; max-width: 260px; display: grid; gap: 2px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.d2 .d2-snap span { font-size: 12px; color: var(--faint); font-weight: 600; }
.d2 .d2-snap b { font-size: 14px; font-weight: 600; line-height: 1.35; }
.d2 .d2-vote-line { margin: -4px 20px 6px; font-size: 13px; color: var(--muted); }
.d2 .d2-kind { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; padding: 4px 20px 18px; align-items: start; }
@media (max-width: 640px) {
  .d2 .d2-kind { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 4px 12px 14px; }
  .d2 .d2-tile { padding: 10px 11px; }
  .d2 .d2-tile-top { flex-direction: column; align-items: flex-start; gap: 4px; }
  .d2 .d2-tile-big { font-size: 15px; }
  .d2 .d2-tile details[open] { grid-column: 1 / -1; }
  .d2 .d2-tile:has(details[open]) { grid-column: 1 / -1; }
}
.d2 .d2-tile { text-align: left; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: grid; gap: 4px; align-content: start; background: var(--surface); }
.d2 .d2-tile-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.d2 .d2-tile-name { font-size: 12.5px; font-weight: 600; color: var(--faint); }
.d2 .d2-tile-tag { font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 99px; background: var(--surface-3); color: var(--muted); white-space: nowrap; }
.d2 .d2-tile-tag.up { background: var(--up-soft); color: var(--up); }
.d2 .d2-tile-tag.down { background: var(--down-soft); color: var(--down); }
.d2 .d2-tile-big { margin: 0; font-size: 17px; font-weight: 600; line-height: 1.3; }
.d2 .d2-tile details { margin-top: 4px; }
.d2 .d2-tile summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--accent); list-style: none; display: inline-flex; gap: 6px; align-items: center; }
.d2 .d2-tile summary::-webkit-details-marker { display: none; }
.d2 .d2-tile summary::after { content: ""; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg) translateY(-2px); transition: transform .15s; }
.d2 .d2-tile details[open] summary::after { transform: rotate(-135deg) translateY(-2px); }
.d2 .d2-tile ul { margin: 8px 0 0; padding-left: 18px; display: grid; gap: 4px; font-size: 13.5px; color: var(--muted); line-height: 1.45; }

/* Phones: roomier table rows. */
@media (max-width: 640px) { .d2 table.data td { padding-top: 12px; padding-bottom: 12px; } }
/* The table keeps each seat's one-line read on phones too. */
@media (max-width: 640px) { .d2 .run-v2 .seat-text, .d2.run-v2 .seat-text, .d2 .seat .seat-text { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; font-size: 12.5px; } }

/* Wherever the tab bar shows (up to 1023px: phones, tablets, narrow windows):
   Run is the middle tab, drawn as the main button. */
@media (max-width: 1023px) {
  .d2 .tabbar a.tab-main { position: relative; color: var(--accent); }
  .d2 .tabbar a.tab-main svg { width: 26px; height: 26px; padding: 7px; box-sizing: content-box; border-radius: 50%;
    background: var(--accent); color: var(--accent-ink, #fff); margin-top: -18px; box-shadow: 0 4px 14px rgb(0 0 0 / .18);
    transition: transform .14s cubic-bezier(.2, .8, .2, 1); }
  .d2 .tabbar a.tab-main:active svg { transform: scale(.94); }
  .d2 .tabbar a.tab-main svg circle { stroke: transparent; }
  .d2 .tabbar a.tab-main span { font-weight: 600; }
}
/* A red dot on a new Research sub-tab (the Screener). */
.research-tabs a[data-dot] { position: relative; }
.research-tabs a[data-dot]::after { content: ""; position: absolute; top: 8px; right: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--down); }
/* The round Run button sits above the bar, so its dot would float: none needed there. */
