/* Structure only: layout, grid areas, responsive behaviour. No colours or fonts —
   every visual decision lives in skins/<name>.css so the look can be swapped in one file. */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* header */
.top { position: sticky; top: 0; z-index: 10; padding: 10px 16px; }
.top-row, .search-row, .filters { max-width: 1320px; margin: 0 auto; }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark { display: block; flex: none; width: 26px; height: 26px; }
.brand-name, .clock { white-space: nowrap; }
@media (max-width: 480px) { .clock .tz { display: none; } }
.top-meta { display: flex; align-items: center; gap: 8px; flex: none; }
.icon-btn { background: none; border: 0; padding: 4px 8px; line-height: 1; }
.lang-btn { font-size: .8em; letter-spacing: .04em; }
.search-row { margin-top: 10px; }
#q { width: 100%; }
/* One row per axis with its own label: Region / Type / Focus. Each row scrolls on its own
   so a long axis never pushes the others out of view on a phone. */
.filters { position: relative; margin-top: 10px; display: grid; gap: 5px; }
.filter-row { display: flex; align-items: center; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.filter-row::-webkit-scrollbar { display: none; }
.filter-label { flex: none; width: 52px; }
.flag-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.flag { width: 15px; height: 10px; flex: none; vertical-align: -1px; }
.chip .flag { margin-right: 5px; }
.chip .flag + .flag { margin-left: -3px; }
.filter-controls { display: flex; align-items: center; gap: 8px; flex: none; }
/* on a phone the Focus row wraps under its own label instead of scrolling Clear out of reach */
@media (max-width: 560px) {
  .filters .filter-row:last-child { overflow-x: visible; }
  .filter-controls { flex: 1 1 auto; min-width: 0; flex-wrap: wrap; row-gap: 6px; }
}
.chip-group { display: flex; gap: 6px; flex: none; }
.chip { flex: none; white-space: nowrap; }
.sep { width: 1px; height: 20px; flex: none; }
.select-wrap { position: relative; flex: none; }
select { appearance: none; }

/* page grid */
.grid {
  max-width: 1320px; margin: 0 auto; padding: 16px; display: grid; gap: 20px; align-items: start;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  grid-template-areas: "deals digest" "filings filings" "contact contact";
}
.p-filings { grid-area: filings; min-width: 0; }
.p-contact { grid-area: contact; min-width: 0; }
/* Contact is a footnote to the page, not one of its sections. Each skin drops the panel chrome and sets it
   apart with a dashed rule; here it only gets a narrower, shorter form. */
.p-contact .panel-head, .contact-form { max-width: 760px; }
.contact-form { display: grid; gap: 6px; }
.contact-form textarea { width: 100%; resize: vertical; min-height: 44px; }
.contact-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.contact-row input[type=email] { flex: 1 1 240px; min-width: 0; }
#contact-website { position: absolute; left: -9999px; width: 1px; height: 1px; }
.contact-status:empty { display: none; }
.contact-status { margin: 0; }
/* the cards scroll sideways: a filing is a small card, and a row of them reads as a shelf */
.filing-strip { list-style: none; margin: 0; padding: 0; display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x proximity; }
.filing-strip::-webkit-scrollbar { height: 8px; }
.filing-card { flex: 0 0 265px; scroll-snap-align: start; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.fc-head { display: flex; align-items: center; gap: 6px; }
.fc-target { overflow-wrap: anywhere; }
.fc-line { display: flex; gap: 6px; min-width: 0; }
.fc-line span:last-child { min-width: 0; overflow-wrap: anywhere; }
.fc-terms { margin: 2px 0 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 10px; }
.fc-terms dt { grid-column: 1; }
.fc-terms dd { grid-column: 2; margin: 0; overflow-wrap: anywhere; }
.fc-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.p-deals { grid-area: deals; }
.p-digest { grid-area: digest; }
.p-search, .p-follow, .p-companies { grid-area: 1 / 1 / 2 / -1; }
body:not([data-view="home"]) .p-contact, body:not([data-view="home"]) .p-filings, body:not([data-view="home"]) .p-reference,
body[data-view="search"] .p-deals, body[data-view="search"] .p-digest,
body[data-view="follow"] .p-deals, body[data-view="follow"] .p-digest,
body[data-view="companies"] .p-deals, body[data-view="companies"] .p-digest { display: none; }
.panel { min-width: 0; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.panel-head h2 { margin: 0; display: flex; align-items: center; gap: 8px; }
.panel-head-right { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }

/* rows: one template for deals, stories, search results and saved */
.rows, .digest-list { list-style: none; margin: 0; padding: 0; }
/* the digest is capped to the deal board's height in script; it scrolls inside that cap */
.digest-list { overflow-y: auto; overscroll-behavior: contain; }
.board-cols, .row {
  display: grid; align-items: start; column-gap: 10px;
  grid-template-columns: 58px 88px 64px minmax(0, 1fr) 82px;
  grid-template-areas: "time reg type main act";
}
.board-cols span:last-child { grid-column: main / act; }
.c-time { grid-area: time; }
.c-types { grid-area: type; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.c-reg { grid-area: reg; display: flex; align-items: center; justify-content: center; gap: 4px; }
.c-reg .flag { width: 13px; height: 9px; }
.c-reg .flag + .flag { margin-left: -2px; }
.c-main { grid-area: main; min-width: 0; } .c-act { grid-area: act; display: flex; gap: 2px; justify-content: flex-end; }
.c-title { display: block; overflow-wrap: anywhere; text-decoration: none; }
.c-title:hover { text-decoration: underline; }
.c-snip { margin: 4px 0 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.c-snip:empty { display: none; }
.c-meta { display: flex; flex-wrap: wrap; gap: 2px 10px; margin-top: 4px; }
.c-meta span:empty { display: none; }
.row.compact .c-meta .ago, .row.compact .c-meta .sector { display: none; }
.act { border: 0; background: none; width: 26px; height: 26px; line-height: 1; padding: 0; }
.more { display: block; margin: 12px auto; }
.empty { list-style: none; padding: 20px 0; }
.rows > li.empty.fallback { padding-top: 10px; padding-bottom: 10px; }
.digest-list li { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 8px; }
.digest-list li.empty { display: block; }   /* the message is one cell, not a numbered story */
.digest-list h3 { margin: 0; }
.digest-list p { margin: 4px 0 0; }

/* tab bar only on narrow screens */
.tabbar { display: none; }

/* pages: in the header line on wide screens; phones use the tab bar */
.top-meta { margin-left: auto; }
.views { display: flex; align-self: stretch; margin: -10px 0 -10px 28px; }
.vtab { background: none; border: 0; padding: 0 14px; cursor: pointer; white-space: nowrap; color: var(--ink-3); box-shadow: inset 0 -3px 0 transparent; }
.vtab:hover { color: var(--ink); }
.vtab.active { color: var(--amber, var(--gold, var(--accent, var(--ink)))); box-shadow: inset 0 -3px 0 currentColor; }
.vcount:not(:empty) { margin-left: 6px; padding: 1px 5px; border-radius: 2px; font-size: .78em; vertical-align: 1px;
  background: var(--line, var(--rule, var(--edge))); color: var(--ink-2); }

/* Deals (followed stories) and Companies: one row per item, left to right: the thing followed,
   what came before, what has come since. Rows share one height; each column scrolls inside it. */
/* each followed story or company is its own card: a gap, a frame and an accent bar on the left,
   so one item never runs into the next */
.fl-list { list-style: none; margin: 0; padding: 12px 14px 4px; display: grid; gap: 14px; }
.fl-row { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr) 20px minmax(0, 1fr); column-gap: 14px; }
.co-row { grid-template-columns: minmax(0, .75fr) 20px minmax(0, 2fr); }
.fl-row { height: 340px; padding: 12px 14px 12px 16px; align-items: stretch; border-radius: 4px;
  border: 1px solid var(--line, var(--rule, var(--edge)));
  border-left: 3px solid var(--amber, var(--gold, var(--accent, var(--ink-3))));
  background: color-mix(in srgb, var(--ink-3) 5%, transparent); }
.fl-list > li.empty { display: block; }
.fl-story, .co-card { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
/* the followed story keeps its board row, stacked the way phones show it: tags above the headline */
.fl-story .row { padding: 0; border: 0; background: none; grid-template-columns: auto auto auto minmax(0, 1fr) auto;
  grid-template-areas: "time reg type . act" "main main main main main"; row-gap: 8px; }
.fl-story .c-snip { -webkit-line-clamp: 6; }
body[data-view="follow"] .filters, body[data-view="companies"] .filters { display: none; }
.fl-col { display: flex; flex-direction: column; min-height: 0; }
.fl-head { margin: 0 0 4px; }
.digest-list.fl-items { display: block; padding: 0; flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }   /* one column in every skin */
.fl-items li.fl-item, .fl-items li.empty { display: block; padding: 8px 0; }
.fl-items h3 { font-size: 13.5px; line-height: 1.35; margin: 2px 0 0; }
.fl-items .d-sum { font-size: 12.5px; margin: 3px 0 0; }
.fl-meta { margin: 0; }
.fl-arrow { align-self: center; text-align: center; font-size: 18px; color: var(--ink-3); }
/* Companies: a plain vertical rule between the company and its headlines, in the card's colour */
.co-rule { justify-self: center; align-self: stretch; width: 1px; background: color-mix(in srgb, var(--kind) 55%, transparent); }
.co-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) auto; gap: 8px; padding: 12px 14px; max-width: 1040px; }
.co-status:empty { display: none; }
.co-name { margin: 0 0 4px; }
.co-card p { margin: 4px 0 0; }
.co-kw { display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 0 2px; }
.co-chip { cursor: default; font-size: 11px; padding: 3px 8px; }

/* funds and corporates in two colours: the card's bar, its label and the keyword boxes in its headlines */
.co-row.kind-fund { --kind: #2f6cb3; }   /* deep blue */
.co-row.kind-corp { --kind: #1f8a53; }   /* deep green */
.fl-row.co-row { border-left-color: var(--kind); background: color-mix(in srgb, var(--kind) 9%, transparent); }   /* a tint well under the rule, so the rule stays visible */
.co-chip { display: inline-flex; align-items: center; gap: 4px; border-color: var(--kind); }
.co-chip-x { background: none; border: 0; padding: 0 0 0 2px; cursor: pointer; color: inherit; opacity: .6; font-size: 1.1em; line-height: 1; }
.co-chip-x:hover { opacity: 1; color: var(--kind); }
.co-kw-add { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; margin: 8px 0 2px; max-width: 280px; }
.co-kw-add input { min-width: 0; padding: 5px 8px; font-size: 12px; background: transparent; color: inherit;
  border: 1px solid color-mix(in srgb, var(--kind) 60%, transparent); border-radius: 3px; }
.co-kw-add input:focus { outline: 1px solid var(--kind); }
.co-kw-go { background: none; cursor: pointer; padding: 4px 9px; border-radius: 3px; border: 1px solid var(--kind); color: var(--kind);
  font: 700 11px/1.2 var(--mono, monospace); letter-spacing: .06em; white-space: nowrap; }
.co-kw-go:hover { background: color-mix(in srgb, var(--kind) 15%, transparent); }
.co-acts { display: flex; gap: 14px; margin: 8px 0 0; }
/* listing: ticker beside the name, sector and filed figures under it, then the outbound links */
.co-ticker { margin-left: 8px; padding: 1px 6px; border-radius: 2px; vertical-align: 2px; white-space: nowrap;
  border: 1px solid var(--kind); color: var(--kind); font: 700 10.5px/1.4 var(--mono, monospace); letter-spacing: .04em; }
.co-facts p { margin: 3px 0 0; font-size: 12.5px; color: var(--ink-2); }
.co-facts .co-src { font-size: 10.5px; color: var(--ink-3); }
.co-links { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 8px 0 0; font-size: 11.5px; }
.co-links a { color: var(--kind); text-decoration: none; border-bottom: 1px dotted currentColor; }
.co-links a:hover { border-bottom-style: solid; }
.co-link-pick { margin: 8px 0 0; max-width: 280px; }
.co-link-pick input { width: 100%; padding: 5px 8px; font-size: 12px; background: transparent; color: inherit;
  border: 1px dashed color-mix(in srgb, var(--kind) 60%, transparent); border-radius: 3px; }
/* suggestions under a company box */
.co-suggest-wrap { position: relative; min-width: 0; }
.co-suggest-wrap > input { width: 100%; }
.co-suggest { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 2px); margin: 0; padding: 4px 0; list-style: none;
  min-width: 300px; max-height: 320px; overflow-y: auto; border-radius: 4px;
  background: var(--panel, var(--surface, var(--bg, #fff))); border: 1px solid var(--line, var(--rule, var(--edge, #ccc)));
  box-shadow: 0 8px 24px rgba(0, 0, 0, .25); }
.co-suggest li { display: grid; grid-template-columns: 58px minmax(0, 1fr); column-gap: 10px; padding: 6px 10px; cursor: pointer; }
.co-suggest li.on, .co-suggest li:hover { background: color-mix(in srgb, var(--ink-3) 18%, transparent); }
.sg-t { grid-row: 1 / 3; font: 700 12px/1.4 var(--mono, monospace); color: var(--ink); }
.sg-n { font-size: 13px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sg-m { font-size: 10.5px; color: var(--ink-3); }

/* 5% stake: the change in the holding, and the proposal-intent flag */
.fc-chg { font-weight: 700; }
.fc-chg.up { color: #2fa36b; } .fc-chg.down { color: #d9534f; }
.fc-purpose { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.fc-proposal { padding: 1px 5px; border-radius: 2px; border: 1px solid #e0913a; color: #e0913a;
  font: 700 9.5px/1.3 var(--mono, monospace); letter-spacing: .08em; text-transform: uppercase; }

/* Sources & reliability: a quiet reference at the foot of Home */
.panel.p-reference { grid-column: 1 / -1; }
.ref-tiers { list-style: none; margin: 10px 0 12px; padding: 0 14px; display: grid; gap: 5px; font-size: 12.5px; color: var(--ink-2); }
.ref-tier { display: inline-block; min-width: 76px; margin-right: 8px; padding: 1px 6px; border-radius: 2px; text-align: center;
  font: 700 10px/1.5 var(--mono, monospace); letter-spacing: .06em; text-transform: uppercase; border: 1px solid currentColor; }
.t-official { color: #2fa36b; } .t-issuer { color: #3f8fd8; } .t-press { color: #8b8fd9; }
.t-aggregated { color: #d9a23a; } .t-machine { color: #d9607a; }
.ref-scroll { overflow-x: auto; padding: 0 14px; }
.ref-table { width: 100%; border-collapse: collapse; font-size: 12.5px; color: var(--ink-2); min-width: 640px; }
.ref-table th { text-align: left; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); padding: 6px 8px; }
.ref-table td { padding: 6px 8px; vertical-align: top; border-top: 1px solid var(--line, var(--rule, var(--edge))); }
.ref-table td.sec { color: var(--ink); font-weight: 600; white-space: nowrap; }
.ref-note { padding: 10px 14px 4px; }
.kw-tag { display: inline-block; margin-left: 8px; padding: 0 5px; border-radius: 2px; vertical-align: 1px;
  border: 1px solid var(--kind); color: var(--kind); font-size: .92em; line-height: 1.5; text-transform: none; letter-spacing: .02em; }
.co-kw-msg { grid-column: 1 / -1; margin: 0; }
.co-kw-msg:empty { display: none; }

/* settings */
dialog { padding: 0; width: min(520px, calc(100vw - 32px)); }
.settings { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.settings h2 { margin: 0; }
.field { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.profile .bar { display: inline-block; height: 6px; vertical-align: middle; margin-left: 6px; }
.row-btns { display: flex; justify-content: space-between; }

@media (max-width: 999px) {
  .grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "digest" "deals" "filings" "contact"; padding: 10px 12px 90px; }
  body[data-view="deals"] .p-digest { display: none; }
  .filing-card { flex-basis: 78vw; }
  .brand-sub { display: none; }
  .brand { gap: 7px; }
  .brand-mark { width: 22px; height: 22px; }
  .board-cols { display: none; }
  .c-types { flex-direction: row; }
  .row {
    grid-template-columns: auto auto auto minmax(0, 1fr) auto;
    grid-template-areas: "time reg type . act" "main main main main main";
    row-gap: 4px;
  }
  .tabbar { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); }
  .views, .fl-arrow, .co-rule { display: none; }
  .fl-list { padding: 10px 10px 4px; gap: 12px; }
  .fl-row, .co-row { grid-template-columns: minmax(0, 1fr); height: auto; row-gap: 10px; padding: 12px 12px 12px 14px; }
  .fl-col { max-height: 300px; }
  .co-form { grid-template-columns: minmax(0, 1fr); }
  .tab { flex: 1; border: 0; padding: 8px 0; }
}

/* digest editions, archive, permalinks, sign-up */
.p-archive { grid-area: 1 / 1 / 2 / -1; }
body[data-view="archive"] .p-deals, body[data-view="archive"] .p-digest { display: none; }
.edition-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.edition-tabs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ed-tab, .link-btn, .d-share { background: none; border: 0; padding: 0; }
.ed-tab { padding: 4px 10px; }
.d-badge { display: inline-block; margin-bottom: 4px; }
.digest-list li.pinned { scroll-margin-top: 170px; }
.archive-list { list-style: none; margin: 0; padding: 0; }
.arch-day h3 { margin: 0; }
.arch-ed { display: grid; grid-template-columns: 58px minmax(0, 1fr) auto; gap: 12px; align-items: baseline; text-decoration: none; }
.arch-heads { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.field.col { flex-direction: column; align-items: stretch; gap: 6px; }
#sub-email { width: 100%; }
.sub-copy, .sub-fine, .sub-status { margin: 0; }
.sub-status:empty { display: none; }
@media (max-width: 999px) {
  body[data-view="archive"] .p-digest { display: none; }
  .arch-ed { grid-template-columns: 50px minmax(0, 1fr); }
  .arch-n { display: none; }
  .arch-heads { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
}
