/* D365 BC Feeds: a lite take on the blog.wingate365.com style (Figtree, navy
   ink, #0b71c7 accent, gradient strip under the header). Chart colours follow
   the dataviz reference palette: one blue series, reserved status colours. */
:root {
  --font: "Figtree", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "SFMono-Regular", "Cascadia Code", Consolas, "Liberation Mono", Menlo, monospace;
  --bg: #ffffff;
  --bg-subtle: #f4f7fa;
  --card: #ffffff;
  --border: #e2e8ee;
  --grid: #eaeff3;
  --text: #1a2530;
  --heading: #0f1e2a;
  --muted: #5a6b78;
  --faint: #8494a0;
  --accent: #0b71c7;
  --accent-strong: #095ca3;
  --on-accent: #ffffff;
  --series: #2a78d6;
  --good: #0ca30c;
  --warning: #fab219;
  --critical: #d03b3b;
  --neutral: #a7b3bc;
  --shadow: 0 1px 2px rgba(15, 30, 42, .06), 0 4px 12px rgba(15, 30, 42, .04);
  --strip: linear-gradient(90deg, #0f1e2a 0%, #0b71c7 32%, #37bef3 64%, #2e7d5a 100%);
  --radius: 10px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1720;
    --bg-subtle: #16232f;
    --card: #131f2a;
    --border: #24333f;
    --grid: #1e2c38;
    --text: #d7e0e7;
    --heading: #f1f6f9;
    --muted: #8fa3b1;
    --faint: #6f8391;
    --accent: #37bef3;
    --accent-strong: #94efff;
    --on-accent: #0b0b0b;
    --series: #3987e5;
    --neutral: #4f6271;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 18px rgba(0, 0, 0, .3);
    --strip: linear-gradient(90deg, #16232f 0%, #0b71c7 32%, #37bef3 64%, #3fa876 100%);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.6 var(--font); -webkit-font-smoothing: antialiased;
}
::selection { background: #cfe7fb; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-strong); text-decoration: underline; }
code { font: 13px/1.4 var(--mono); }
.wrap { max-width: 64rem; margin: 0 auto; padding: 0 1.5rem; }

/* header: sticky, gradient strip, wordmark */
.site-header { position: sticky; top: 0; z-index: 20; background: var(--bg); border-bottom: 1px solid var(--border); }
.site-header::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; background: var(--strip); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding-block: .85rem; }
.brand { font-weight: 700; font-size: 1.35rem; letter-spacing: -.02em; color: var(--heading); }
.brand:hover { text-decoration: none; color: var(--heading); }
.brand-accent { color: var(--accent); }
.site-header nav { display: flex; gap: 1.1rem; flex-wrap: wrap; }
.site-header nav a { color: var(--muted); font-size: .92rem; font-weight: 600; }
.site-header nav a:hover { color: var(--accent); text-decoration: none; }
.site-header nav a.external { padding-left: 1.1rem; border-left: 1px solid var(--border); }
.site-footer { margin-top: 4rem; padding: 1.6rem 0 2rem; border-top: 1px solid var(--border); background: var(--bg-subtle); color: var(--muted); font-size: .88rem; }

/* type */
h1, h2, h3 { color: var(--heading); font-weight: 600; letter-spacing: -.015em; line-height: 1.25; }
h1 { font-size: 2.1rem; margin: .5rem 0 .5rem; }
h2 { font-size: 1.2rem; margin: 0 0 .75rem; }
.lede { color: var(--muted); font-size: 1.06rem; max-width: 46rem; margin: 0 0 1.25rem; }
.note, .sub { color: var(--faint); font-size: .82rem; }
.crumb { margin: 1.75rem 0 0; font-size: .9rem; font-weight: 600; }
section { margin-top: 2.75rem; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; flex-wrap: wrap; margin-bottom: .75rem; }
.section-head h2 { margin: 0; }
.section-head > a { font-size: .9rem; font-weight: 600; }
.count { color: var(--faint); font-weight: 500; font-size: 1rem; margin-left: .25rem; }

/* hero + cards */
.hero { margin-top: 2.75rem; }
.hero h1 { font-size: 2.5rem; max-width: 20ch; font-weight: 700; letter-spacing: -.02em; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 1rem; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.card h2 { font-size: 1.2rem; margin-bottom: .35rem; }
.card h2 a { color: var(--heading); }
.card h2 a:hover { color: var(--accent); text-decoration: none; }
.card-desc { color: var(--muted); margin: 0 0 1rem; font-size: .93rem; flex-grow: 1; }
.card-links { margin: .85rem 0 0; font-size: .92rem; font-weight: 600; }
.mini { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin: 0 0 1rem; }
.mini dt { color: var(--faint); font-size: .75rem; font-weight: 500; }
.mini dd { margin: 0; font-weight: 600; color: var(--heading); font-variant-numeric: tabular-nums; }

/* subscribe box */
.subscribe { display: flex; align-items: center; gap: .5rem; background: var(--bg-subtle); border: 1px solid var(--border); border-radius: 8px; padding: .35rem .35rem .35rem .75rem; max-width: 40rem; }
.subscribe code { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--accent-strong); }
@media (prefers-color-scheme: dark) { .subscribe code { color: var(--accent); } }
button { font: inherit; }
.copy { border: 1px solid var(--border); background: var(--card); color: var(--heading); border-radius: 6px; padding: .2rem .75rem; font-size: .8rem; font-weight: 600; cursor: pointer; }
.copy:hover { border-color: var(--accent); color: var(--accent); }
.copy.done { color: var(--good); border-color: var(--good); }
.button { display: inline-block; background: var(--accent); color: var(--on-accent); padding: .55rem 1.1rem; border-radius: 8px; font-weight: 600; font-size: .92rem; }
.button:hover { background: var(--accent-strong); color: var(--on-accent); text-decoration: none; }

/* pills (source group labels) */
.pill { display: inline-block; font-size: .7rem; font-weight: 600; color: var(--accent); background: var(--bg-subtle); border: 1px solid var(--border); border-radius: 999px; padding: .02rem .5rem; margin-top: .2rem; }

/* stat tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .75rem; margin-top: 1.5rem; }
.tile { background: var(--bg-subtle); border: 1px solid var(--border); border-radius: var(--radius); padding: .85rem 1rem; }
.tile-label { color: var(--muted); font-size: .82rem; font-weight: 500; }
.tile-value { font-size: 1.8rem; font-weight: 700; color: var(--heading); font-variant-numeric: tabular-nums; line-height: 1.25; letter-spacing: -.01em; }
.tile-value .of { font-size: 1rem; color: var(--faint); font-weight: 500; }
.tile-sub { color: var(--faint); font-size: .75rem; }

/* chart */
.chart { width: 100%; height: auto; display: block; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: .5rem .25rem 0; }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--border); stroke-width: 1; }
.chart .bar { fill: var(--series); }
.chart text { font-family: var(--font); }
.chart .axis { fill: var(--faint); font-size: 11px; }
.chart .value { fill: var(--muted); font-size: 11px; font-weight: 600; }
.chart .hit { fill: transparent; outline: none; }
.chart .hit:hover, .chart .hit:focus-visible { fill: var(--heading); fill-opacity: .05; }
.tooltip { position: fixed; z-index: 30; pointer-events: none; background: var(--heading); color: var(--bg); font-size: .78rem; font-weight: 600; padding: .3rem .6rem; border-radius: 6px; transform: translate(-50%, calc(-100% - 10px)); white-space: nowrap; }
.table-view { margin-top: .5rem; font-size: .85rem; }
.table-view summary, details.disabled summary { cursor: pointer; color: var(--muted); font-weight: 500; }
.table-view .table-wrap { margin-top: .5rem; max-width: 18rem; }

/* tables */
.filter { width: 100%; max-width: 20rem; padding: .5rem .75rem; border: 1px solid var(--border); border-radius: 8px; background: var(--card); color: var(--text); font: inherit; font-size: .92rem; margin-bottom: .6rem; }
.filter:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); }
table.data { border-collapse: collapse; width: 100%; font-size: .9rem; }
.data th, .data td { text-align: left; padding: .6rem .9rem; border-bottom: 1px solid var(--grid); vertical-align: top; }
.data tbody tr:last-child td { border-bottom: 0; }
.data th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; white-space: nowrap; background: var(--bg-subtle); }
.data th button { all: unset; cursor: pointer; }
.data th button::after { content: ""; display: inline-block; width: 1em; }
.data th[aria-sort="ascending"] button::after { content: " ↑"; }
.data th[aria-sort="descending"] button::after { content: " ↓"; }
.data th button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
.data .num { text-align: right; font-variant-numeric: tabular-nums; }
.data tbody tr:hover { background: var(--bg-subtle); }
.data td a { font-weight: 600; }
.feedlink { font-size: .75rem; font-weight: 700; }
details.disabled { margin-top: .75rem; font-size: .85rem; }
details.disabled ul { margin: .5rem 0 0; padding-left: 1.1rem; }
details.disabled li { margin: .15rem 0; }

/* status badges: dot + label, never colour alone */
.badge { display: inline-flex; align-items: center; gap: .4rem; font-size: .8rem; font-weight: 600; color: var(--muted); white-space: nowrap; }
.badge .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--neutral); flex: none; }
.badge.ok .dot { background: var(--good); }
.badge.warn .dot { background: var(--warning); }
.badge.bad .dot { background: var(--critical); }
.badge.quiet .dot { background: transparent; box-shadow: inset 0 0 0 2px var(--neutral); }
.badge.off { color: var(--faint); }
.legend { display: flex; gap: .9rem; flex-wrap: wrap; }

/* post lists (like the blog's post cards) */
.items { list-style: none; margin: 0; padding: 0 1.1rem; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); }
.items li { padding: .85rem 0; border-bottom: 1px solid var(--border); }
.items li:last-child { border-bottom: 0; }
.item-title { font-weight: 600; line-height: 1.4; }
.item-title a { color: var(--heading); }
.item-title a:hover { color: var(--accent); text-decoration: none; }
.item-meta { color: var(--muted); font-size: .85rem; margin-top: .15rem; }
.item-meta .sep { opacity: .5; margin: 0 .35rem; }
.more { font-size: .92rem; font-weight: 600; }

.suggest { background: var(--bg-subtle); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; }
.suggest p { color: var(--muted); margin: 0 0 .9rem; }
.suggest p:last-child { margin: 0; }

/* join page */
.groups { list-style: none; padding: 0; margin: 0 0 1.75rem; display: grid; gap: .5rem; max-width: 46rem; }
.groups li { display: flex; flex-direction: column; background: var(--bg-subtle); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 8px; padding: .6rem .9rem; }
.groups strong { color: var(--heading); }
.groups span { color: var(--muted); font-size: .9rem; }
.join { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.5rem; max-width: 46rem; }
.join label { display: block; font-weight: 600; color: var(--heading); margin-bottom: .6rem; }
.join-row { display: flex; gap: .5rem; flex-wrap: wrap; }
.join-row input { flex: 1; min-width: 12rem; padding: .55rem .8rem; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); font: inherit; }
.join-row input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.join .button { border: 0; cursor: pointer; }
.join-thanks { margin-top: 0; font-weight: 600; color: var(--heading); }
.join-grid { display: flex; gap: 2rem; align-items: flex-start; flex-wrap: wrap; }
.join h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
.join-scan { flex: 0 0 auto; }
.join-scan .note { margin: .5rem 0 0; }
.join-tap { flex: 1; min-width: 16rem; }
.join-tap > .note { margin-bottom: 0; }
.qr { display: inline-block; background: #ffffff; border-radius: 8px; padding: .5rem; line-height: 0; border: 1px solid var(--border); }
.qr svg { width: 220px; height: 220px; }

@media (max-width: 640px) {
  h1 { font-size: 1.7rem; }
  .hero h1 { font-size: 1.9rem; }
  .site-header { position: relative; }
  .data th, .data td { padding: .5rem .6rem; }
}
.suggest.has-icon { display: grid; grid-template-columns: 1fr 4rem; gap: 1.5rem; align-items: center; }
.suggest-icon { width: 4rem; height: 4rem; display: block; order: 2; }
