/* serv365.ai — design system
   Tokens first; light is the base, dark overrides via media query.
   Type: Inter (UI) + JetBrains Mono (identifiers). Motion 150ms, reduced-motion aware. */

:root {
  /* brand */
  --navy: #0b3d6f;
  --blue: #0a66c2;
  --dot-blue: #00a2e8; --dot-red: #f04e23; --dot-green: #6cb52d; --dot-yellow: #ffb400;
  --dot-purple: #b04fc4; --dot-teal: #00b39b; --dot-cobalt: #0071dc; --dot-pink: #f2808a;

  /* surfaces & ink */
  --bg: #fdfdfc;
  --bg-raised: #ffffff;
  --bg-sunken: #f4f6f8;
  --ink: #101828;
  --ink-2: #475467;
  --ink-3: #98a2b3;
  --line: #e4e7ec;
  --line-strong: #d0d5dd;

  /* semantic */
  --link: #0a5bb5;
  --accent: var(--blue);
  --focus: #0a66c2;
  --hit: #d64524;         /* default change — attention, not error */
  --hit-bg: #fdeee8;
  --hit-line: #f6c6b4;
  --warn: #935a00;
  --warn-bg: #fdf3d9;
  --warn-line: #edd9a3;
  --quiet-bg: #eef1f5;
  --soon: #b8410a;
  --good: #1a7f37;
  --good-bg: #e6f4ea;
  --good-line: #b9e0c3;
  --info: #0a5bb5;
  --info-bg: #e7f0fb;
  --info-line: #bcd7f3;

  --radius: 10px;
  --radius-sm: 7px;
  --max: 1140px;
  --shadow-1: 0 1px 2px rgb(16 24 40 / 0.04);
  --shadow-2: 0 1px 2px rgb(16 24 40 / 0.05), 0 4px 16px -4px rgb(16 24 40 / 0.09);
  --header-h: 64px;
  --ease: cubic-bezier(0.2, 0, 0, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c1116;
    --bg-raised: #131a22;
    --bg-sunken: #0a0e13;
    --ink: #ecf1f7;
    --ink-2: #9daebe;
    --ink-3: #64748b;
    --line: #202b37;
    --line-strong: #2d3b4a;

    --link: #6cb3f2;
    --accent: #4c9ce8;
    --focus: #6cb3f2;
    --hit: #ff8a63;
    --hit-bg: #33170e;
    --hit-line: #57291a;
    --warn: #e4b14a;
    --warn-bg: #2e230d;
    --warn-line: #4d3c17;
    --quiet-bg: #1c2631;
    --soon: #ff9d6e;
    --good: #4ac26b;
    --good-bg: #10291a;
    --good-line: #1d4a2c;
    --info: #6cb3f2;
    --info-bg: #12253a;
    --info-line: #1e3f5f;
    --shadow-1: 0 1px 2px rgb(0 0 0 / 0.4);
    --shadow-2: 0 1px 2px rgb(0 0 0 / 0.4), 0 6px 20px -6px rgb(0 0 0 / 0.5);
  }
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--header-h) + 12px); }
body {
  margin: 0;
  overflow-x: clip;
  background: var(--bg);
  color: var(--ink);
  font: 15.5px/1.6 "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { background: color-mix(in oklab, var(--accent) 25%, transparent); }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
code, .mono { font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.86em; }
code { background: var(--quiet-bg); padding: 2px 6px; border-radius: 5px; }
h1, h2, h3 { letter-spacing: -0.015em; text-wrap: balance; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 24px; }
.muted { color: var(--ink-2); }
.small { font-size: 0.86rem; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in oklab, var(--bg) 78%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { height: var(--header-h); display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { display: inline-flex; align-items: center; flex-shrink: 0; }
.logo { height: 30px; width: auto; display: block; }
.logo-dark { display: none; }
@media (prefers-color-scheme: dark) { .logo-light { display: none; } .logo-dark { display: block; } }
.nav { display: flex; gap: 4px; align-items: center; font-weight: 500; font-size: 0.94rem; }
.nav a { color: var(--ink-2); padding: 7px 12px; border-radius: 8px; transition: color .15s var(--ease), background .15s var(--ease); }
.nav a:hover { color: var(--ink); background: var(--quiet-bg); text-decoration: none; }
.nav a.active { color: var(--ink); background: var(--quiet-bg); }
.nav a.muted { color: var(--ink-3); }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); margin-top: 96px; padding: 28px 0 44px; color: var(--ink-3); font-size: 0.82rem; }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; line-height: 1.7; }

/* ---------- hero ---------- */
.hero { position: relative; padding: 84px 0 40px; }
.hero::before {
  content: ""; position: absolute; z-index: -1; pointer-events: none;
  top: calc(-1 * var(--header-h)); bottom: 0; left: 50%; width: 100vw; transform: translateX(-50%);
  background:
    radial-gradient(560px 300px at 12% 0%, color-mix(in oklab, var(--dot-blue) 9%, transparent), transparent 70%),
    radial-gradient(480px 280px at 88% 8%, color-mix(in oklab, var(--dot-purple) 7%, transparent), transparent 70%),
    radial-gradient(400px 240px at 55% 100%, color-mix(in oklab, var(--dot-teal) 6%, transparent), transparent 70%);
}
.hero .eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 0.78rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-2); background: var(--bg-raised); border: 1px solid var(--line);
  padding: 5px 12px; border-radius: 999px; box-shadow: var(--shadow-1); margin-bottom: 22px;
}
.hero .eyebrow .dots { display: inline-flex; gap: 3px; }
.hero .eyebrow .dots i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.hero h1 {
  font-size: clamp(2rem, 4.4vw, 3.2rem); line-height: 1.08; font-weight: 700;
  letter-spacing: -0.03em; margin: 0 0 18px; max-width: 21ch;
}
.hero h1 .grad {
  background: linear-gradient(92deg, var(--dot-cobalt), var(--dot-blue) 55%, var(--dot-teal));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lede { font-size: 1.12rem; color: var(--ink-2); margin: 0 0 30px; max-width: 56ch; line-height: 1.65; }

.search { display: flex; gap: 10px; max-width: 620px; }
.search input {
  flex: 1; font: inherit; font-size: 1rem; color: var(--ink);
  padding: 13px 16px; border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--bg-raised); box-shadow: var(--shadow-1);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.search input::placeholder { color: var(--ink-3); }
.search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3.5px color-mix(in oklab, var(--accent) 22%, transparent); }
button, .btn {
  font: inherit; font-size: 0.95rem; font-weight: 600; color: #fff;
  padding: 12px 20px; border-radius: var(--radius); border: 1px solid transparent;
  background: var(--accent); cursor: pointer; white-space: nowrap;
  transition: filter .15s var(--ease), transform .15s var(--ease);
}
button:hover, .btn:hover { filter: brightness(1.09); }
button:active, .btn:active { transform: translateY(1px); }

/* ---------- stat tiles ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin: 44px 0 56px; }
.stat {
  position: relative; display: flex; flex-direction: column; gap: 2px;
  padding: 18px 20px 16px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--bg-raised); box-shadow: var(--shadow-1); color: var(--ink); overflow: hidden;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease), transform .15s var(--ease);
}
.stat::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2.5px; background: var(--stat-accent, var(--line)); opacity: .9; }
.stat strong { font-size: 1.72rem; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.25; }
.stat span { color: var(--ink-2); font-size: 0.84rem; font-weight: 500; }
a.stat:hover { text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow-2); border-color: var(--line-strong); }

/* ---------- section blocks ---------- */
.grid-2 { display: grid; grid-template-columns: 1.35fr 1fr; gap: 48px; }
@media (max-width: 860px) { .grid-2 { grid-template-columns: 1fr; } }
.section-title {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--ink-2); margin: 0 0 14px; padding-bottom: 10px; border-bottom: 1px solid var(--line);
}
.section-title a { color: inherit; }
.section-title .more { text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--link); font-size: 0.84rem; }

.list { list-style: none; margin: 0 0 36px; padding: 0; }
.list > li { padding: 14px 0; border-bottom: 1px solid var(--line); }
.list > li:last-child { border-bottom: 0; }
.list a { color: var(--ink); font-weight: 550; }
.list a:hover { color: var(--link); }
.list .meta { color: var(--ink-3); font-size: 0.82rem; margin-top: 3px; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.list .summary { margin: 7px 0 0; color: var(--ink-2); font-size: 0.92rem; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.list.compact > li { display: flex; gap: 14px; padding: 9px 0; font-size: 0.92rem; align-items: baseline; }
.list.compact .date { color: var(--ink-3); white-space: nowrap; min-width: 88px; font-variant-numeric: tabular-nums; font-size: 0.82rem; }
.empty { padding: 40px 32px; border: 1px dashed var(--line-strong); border-radius: var(--radius); color: var(--ink-2); background: var(--bg-raised); }

/* ---------- badges & chips ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.76rem; font-weight: 600; padding: 3px 10px; border-radius: 999px;
  white-space: nowrap; border: 1px solid transparent;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-default { background: var(--hit-bg); color: var(--hit); border-color: var(--hit-line); }
.badge-unclear { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-line); }
.badge-muted { background: var(--quiet-bg); color: var(--ink-2); border-color: var(--line); }
.badge-muted::before { background: var(--ink-3); }
.badge-good { background: var(--good-bg); color: var(--good); border-color: var(--good-line); }
.badge-info { background: var(--info-bg); color: var(--info); border-color: var(--info-line); }

.chip {
  display: inline-flex; align-items: center; font-size: 0.74rem; font-weight: 500;
  padding: 2.5px 9px; border-radius: 999px; background: var(--quiet-bg); color: var(--ink-2);
  border: 1px solid transparent; transition: border-color .15s var(--ease), color .15s var(--ease);
}
.chip-major { background: var(--hit-bg); color: var(--hit); }
.chip-sev { background: var(--warn-bg); color: var(--warn); text-transform: capitalize; }
.chip-plain { background: transparent; border-color: var(--line); }
a.chip:hover { text-decoration: none; border-color: var(--accent); color: var(--link); }

/* ---------- filters ---------- */
.filters {
  display: flex; flex-wrap: wrap; gap: 9px; align-items: center;
  margin-bottom: 20px; padding: 14px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--bg-raised); box-shadow: var(--shadow-1);
}
.filters input[type="search"], .filters select {
  font: inherit; font-size: 0.92rem; color: var(--ink);
  padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--bg); transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.filters input[type="search"]:focus, .filters select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 20%, transparent); }
.filters input[type="search"] { min-width: 230px; flex: 1; }
.filters .check { display: inline-flex; gap: 7px; align-items: center; font-size: 0.9rem; color: var(--ink-2); }
.filters .check input { accent-color: var(--accent); width: 15px; height: 15px; }
.filters button { padding: 9px 16px; font-size: 0.9rem; border-radius: var(--radius-sm); }
.filters .clear { color: var(--ink-3); font-size: 0.88rem; margin-left: 2px; }

/* ---------- table ---------- */
.page-title { font-size: 1.55rem; font-weight: 700; margin: 40px 0 18px; letter-spacing: -0.02em; }
.page-title .count { color: var(--ink-3); font-weight: 500; font-size: 1rem; margin-left: 8px; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-raised); box-shadow: var(--shadow-1); }
table.messages { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
table.messages th {
  position: sticky; top: 0; z-index: 1;
  text-align: left; font-weight: 600; color: var(--ink-3); font-size: 0.72rem;
  text-transform: uppercase; letter-spacing: 0.06em;
  padding: 11px 14px; background: var(--bg-sunken); border-bottom: 1px solid var(--line);
}
table.messages td { padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.messages tbody tr { transition: background .12s var(--ease); }
table.messages tbody tr:hover { background: color-mix(in oklab, var(--accent) 4%, transparent); }
table.messages tr:last-child td { border-bottom: 0; }
.cell-id { white-space: nowrap; font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 0.8rem; }
.cell-id a { color: var(--ink-2); }
.cell-id a:hover { color: var(--link); }
.cell-title a { color: var(--ink); font-weight: 550; }
.cell-title a:hover { color: var(--link); }
.cell-title .meta { margin-top: 5px; display: flex; flex-wrap: wrap; gap: 4px; }
.cell-date { white-space: nowrap; color: var(--ink-2); font-variant-numeric: tabular-nums; font-size: 0.86rem; }
.soon { color: var(--soon); font-weight: 600; }
.pager { display: flex; gap: 20px; align-items: center; justify-content: center; margin: 26px 0; color: var(--ink-2); font-size: 0.92rem; }
.pager a { font-weight: 550; }

/* ---------- detail ---------- */
.message { max-width: 880px; }
.crumbs { margin-top: 32px; color: var(--ink-3); font-size: 0.86rem; }
.crumbs a { color: var(--ink-2); }
.message h1 { font-size: clamp(1.4rem, 3vw, 1.85rem); line-height: 1.25; margin: 10px 0 14px; letter-spacing: -0.02em; }
.meta-row { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; margin-bottom: 22px; }
.facts {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px 24px;
  margin: 0 0 24px; padding: 18px 20px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--bg-raised); box-shadow: var(--shadow-1);
}
.facts div { display: flex; flex-direction: column; gap: 1px; }
.facts dt { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); font-weight: 600; }
.facts dd { margin: 0; font-size: 0.94rem; font-variant-numeric: tabular-nums; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin: 0 0 28px; background: var(--bg-raised); box-shadow: var(--shadow-1); }
.panel h2, .body h2, .revisions h2 { font-size: 0.95rem; font-weight: 650; margin: 0 0 10px; }
.body h2, .revisions h2 {
  margin-top: 40px; padding-top: 18px; border-top: 1px solid var(--line);
  font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--ink-2);
}
details summary { cursor: pointer; color: var(--link); font-size: 0.92rem; }
details summary:hover { text-decoration: underline; }
table.signals { width: 100%; border-collapse: collapse; font-size: 0.86rem; margin-top: 12px; }
table.signals th { text-align: left; font-weight: 600; color: var(--ink-3); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; padding: 6px 10px; border-bottom: 1px solid var(--line); }
table.signals td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); }
table.signals tr:last-child td { border-bottom: 0; }
table.signals .num { text-align: right; font-variant-numeric: tabular-nums; }
.post-body { line-height: 1.7; font-size: 0.98rem; }
.post-body :is(h1, h2, h3, h4) {
  font-size: 1.02rem; margin: 26px 0 8px; color: var(--ink); letter-spacing: -0.01em;
  text-transform: none; border: 0; padding: 0; font-weight: 650;
}
.post-body p { margin: 0 0 12px; }
.post-body img { max-width: 100%; height: auto; border-radius: var(--radius-sm); }
.post-body a { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: color-mix(in oklab, var(--link) 40%, transparent); }
.post-body table { border-collapse: collapse; max-width: 100%; overflow-x: auto; display: block; font-size: 0.92rem; }
.post-body td, .post-body th { border: 1px solid var(--line); padding: 6px 10px; }
.revisions ol { padding-left: 20px; color: var(--ink-2); font-size: 0.9rem; line-height: 1.9; }

/* ---------- prose ---------- */
.prose { max-width: 720px; margin-top: 44px; font-size: 1rem; line-height: 1.7; }
.prose h1 { font-size: 2rem; letter-spacing: -0.025em; margin-bottom: 18px; }
.prose h2 { font-size: 1.15rem; margin-top: 36px; letter-spacing: -0.01em; }
.prose li { margin-bottom: 6px; }

/* ---------- responsive ---------- */
@media (max-width: 720px) {
  .hero { padding: 44px 0 24px; }
  .wrap { padding: 0 16px; }
  .site-header .wrap { height: auto; min-height: 56px; flex-wrap: wrap; padding: 10px 16px; row-gap: 2px; }
  .logo { height: 24px; }
  .nav { gap: 0; font-size: 0.87rem; flex-wrap: wrap; }
  .nav a { padding: 6px 8px; white-space: nowrap; }
  .hero .eyebrow { max-width: 100%; }
  .hero h1 { max-width: none; }
  .search { flex-direction: column; }
  .stats { grid-template-columns: 1fr 1fr; margin: 32px 0 40px; }
  table.messages .cell-date:nth-of-type(5) { display: none; }
}

/* ---------- tenant CTA ---------- */
.cta-panel {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  margin: 0 0 44px; padding: 22px 26px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background:
    radial-gradient(400px 160px at 100% 0%, color-mix(in oklab, var(--dot-teal) 8%, transparent), transparent 70%),
    var(--bg-raised);
  box-shadow: var(--shadow-1);
}
.cta-panel h2 { margin: 0 0 6px; font-size: 1.05rem; letter-spacing: -0.01em; display: flex; align-items: center; gap: 10px; }
.cta-panel p { margin: 0; max-width: 72ch; font-size: 0.95rem; line-height: 1.6; }

/* ---------- kb ---------- */
.code-block {
  background: var(--bg-sunken); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 14px 16px; overflow-x: auto; font-size: 0.85rem; line-height: 1.55; margin: 0 0 8px;
}
.code-block code { background: none; padding: 0; }
.message h1.mono { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 1.45rem; letter-spacing: 0; }
.timeline-post { border-left: 2px solid var(--line); padding: 2px 0 14px 16px; margin-left: 4px; }
.timeline-post > p { margin: 0 0 4px; }

/* ---------- tenant matrix ---------- */
.matrix-wrap { max-height: 78vh; overflow: auto; }
table.matrix { border-collapse: separate; border-spacing: 0; }
table.matrix th { position: sticky; top: 0; z-index: 2; }
table.matrix .sticky-col { position: sticky; left: 0; background: var(--bg-raised); z-index: 1; min-width: 240px; max-width: 340px; overflow-wrap: anywhere; }
table.matrix thead .sticky-col { z-index: 3; background: var(--bg-sunken); }
table.matrix th.baseline { color: var(--ink); }
table.matrix td { border-right: 1px solid var(--line); white-space: nowrap; max-width: 300px; overflow: hidden; text-overflow: ellipsis; }
table.matrix .cell-diff { background: var(--hit-bg); color: var(--hit); font-weight: 600; }
table.matrix .row-differs .sticky-col { box-shadow: inset 3px 0 0 var(--hit); }
