/*! generated by scripts/build_css_bundle.py; sources=assets/legacy-app.css,import.css,legibility.css sha256=724df6a944e80902 */
/* ---- assets/legacy-app.css ---- */
/* Deadline 365 — interface concept v2
   Paper-and-ink system. One accent. No dashboard clichés. */

@font-face {
  font-family: "Newsreader";
  src: url("/fonts/subset/newsreader-400-normal.woff2") format("woff2");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("/fonts/subset/newsreader-400-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/fonts/subset/plex-sans-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: optional;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/fonts/subset/plex-sans-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: optional;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/fonts/subset/plex-sans-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: optional;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/fonts/subset/plex-mono-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/fonts/subset/plex-mono-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #f6f2e9;
  --surface: #fcfaf5;
  --surface-2: #efe9dc;
  --rail: #f1ecdf;
  --ink: #1c1a17;
  --body: #3a352d;
  --muted: #6e675c;
  --faint: #746c60;
  --line: #dcd4c5;
  --line-strong: #c4baa8;
  --accent: #b13a1e;
  --accent-hover: #963017;
  --accent-soft: #f2e2d9;
  --ok: #3e6b52;
  --ok-soft: #e6eee7;
  --warn: #8a5b13;
  --warn-soft: #f3e7d2;
  --ink-inverse: #f7f2e8;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --shadow: 0 30px 60px -38px rgba(28, 26, 23, 0.45);
}

html[data-theme="dark"] {
  --paper: #141311;
  --surface: #1b1916;
  --surface-2: #24211d;
  --rail: #181613;
  --ink: #f2ede3;
  --body: #d6cfc2;
  --muted: #a79e90;
  --faint: #8f8678;
  --line: #2e2a24;
  --line-strong: #443e35;
  --accent: #e2673f;
  --accent-hover: #ef7a52;
  --accent-soft: #35211a;
  --ok: #82af93;
  --ok-soft: #1e2c23;
  --warn: #d8a657;
  --warn-soft: #2f2718;
  --ink-inverse: #16130f;
  --shadow: 0 30px 60px -38px rgba(0, 0, 0, 0.65);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--body);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--accent-soft);
  color: var(--ink);
}

h1,
h2,
h3,
h4,
p,
ul,
ol,
dl,
dd,
figure {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: 0;
}

img,
svg {
  display: block;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.wrap {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 40px;
}

/* ---------- brand ---------- */

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.brand .mark {
  width: 30px;
  height: 30px;
  border-radius: 3px;
  background: var(--accent);
  color: #FFF8EF;
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  flex: none;
}
.brand .mark svg{ width:22px; height:22px; }

.brand .name {
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--ink);
  line-height: 1;
}

.brand .num {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--accent);
  line-height: 1;
  margin-left: 1px;
  transform: translateY(-1px);
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn svg {
  width: 15px;
  height: 15px;
  flex: none;
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.42;
  cursor: not-allowed;
  pointer-events: none;
}
.btn-primary:disabled,
.btn-primary[aria-disabled="true"] {
  background: var(--surface-2);
  color: var(--muted);
  border-color: var(--line-strong);
  opacity: 1;
}

.auth-wait {
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 30px 8px 26px;
  text-align: center;
}
.auth-wait strong { font-size: 14px; font-weight: 600; color: var(--ink); }
.auth-wait span:last-child { max-width: 300px; font-size: 11.5px; line-height: 1.5; color: var(--muted); }
.auth-spin {
  width: 22px;
  height: 22px;
  margin-bottom: 4px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: authspin 0.8s linear infinite;
}
@keyframes authspin { to { transform: rotate(360deg); } }

.btn-primary {
  background: var(--accent);
  color: #fffaf3;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-ink {
  background: var(--ink);
  color: var(--paper);
}

.btn-ink:hover {
  background: #37322a;
}

html[data-theme="dark"] .btn-ink:hover {
  background: #f7f2e8;
}

.btn-ghost {
  border-color: var(--line-strong);
  color: var(--ink);
  background: transparent;
}

.btn-ghost:hover {
  background: var(--surface-2);
  border-color: var(--ink);
}

.btn-quiet {
  height: 32px;
  padding: 0 6px;
  color: var(--muted);
  border-radius: 3px;
}

.btn-quiet:hover {
  color: var(--ink);
}

.btn-sm {
  height: 34px;
  padding: 0 12px;
  font-size: 12.5px;
}

.icon-btn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  color: var(--muted);
}

.icon-btn:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.icon-btn svg {
  width: 17px;
  height: 17px;
}

.link {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
}

.link:hover {
  text-decoration-color: var(--accent);
}

/* ---------- marketing header ---------- */

.site-head {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.site-head .wrap {
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 28px;
  margin-left: auto;
}

.site-nav a {
  font-size: 13px;
  color: var(--muted);
}

.site-nav a:hover {
  color: var(--ink);
}

.site-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 28px;
}

.site-actions .signin {
  font-size: 13px;
  color: var(--ink);
  padding: 0 10px;
}

.mobile-menu-btn {
  display: none;
}

.mobile-nav {
  display: none;
  border-top: 1px solid var(--line);
  background: var(--paper);
  padding: 10px 20px 18px;
}

.mobile-nav a {
  display: block;
  padding: 12px 4px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  color: var(--ink);
}

.mobile-nav .btn {
  margin-top: 14px;
  width: 100%;
}

/* ---------- hero ---------- */

.hero {
  padding: 84px 0 76px;
  border-bottom: 1px solid var(--line);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.02fr 0.98fr;
  gap: 76px;
  align-items: center;
}

.kicker {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 22px;
}

.kicker::before {
  content: "";
  width: 20px;
  height: 1px;
  background: var(--accent);
  flex: none;
}

.hero h1 {
  font-family: var(--serif);
  font-size: clamp(46px, 5vw, 68px);
  font-weight: 400;
  line-height: 1.02;
  letter-spacing: -0.028em;
  color: var(--ink);
  text-wrap: pretty;
  max-width: 13ch;
}

.hero h1 em {
  font-style: italic;
  color: var(--accent);
}

.lede {
  font-size: 16.5px;
  line-height: 1.6;
  color: var(--body);
  max-width: 47ch;
  margin-top: 24px;
  text-wrap: pretty;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 30px;
  flex-wrap: wrap;
}

.hero-fine {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-top: 20px;
  font-size: 12px;
  color: var(--muted);
}

.hero-fine span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.hero-fine svg {
  width: 13px;
  height: 13px;
  color: var(--ok);
}

/* ---------- brief artifact ---------- */

.brief-wrap {
  min-width: 0;
}

.brief {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.brief-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.brief-brand {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.brief-brand .mark {
  width: 16px;
  height: 16px;
  border-radius: 2px;
  background: var(--ink);
  color: var(--paper);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-family: var(--serif);
  font-weight: 600;
}

.brief-top .meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.brief-body {
  padding: 22px 20px 8px;
}

.brief-label {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 6px;
}

.brief-title {
  font-family: var(--serif);
  font-size: 27px;
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.brief-title em {
  font-style: italic;
}

.brief-list {
  margin-top: 16px;
}

.brief-row {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 13px 0;
  border-top: 1px solid var(--line);
}

.datebox {
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--paper);
  text-align: center;
  padding: 5px 0 4px;
}

.datebox .d {
  display: block;
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.1;
  color: var(--ink);
}

.datebox .m {
  display: block;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.2;
}

.brief-row .nm {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.3;
}

.brief-row .ty {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 2px;
}

.brief-row .amt {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--body);
  white-space: nowrap;
}

.brief-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 20px;
  background: var(--accent-soft);
  border-top: 1px solid var(--line);
}

.brief-foot .note {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.35;
}

.brief-foot .act {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  white-space: nowrap;
}

.brief-foot .act svg {
  width: 13px;
  height: 13px;
}

.brief-caption {
  margin-top: 14px;
  font-size: 11px;
  color: var(--muted);
  text-align: right;
}

/* ---------- sections ---------- */

.section {
  padding: 80px 0;
  border-bottom: 1px solid var(--line);
}

.sec-grid {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 64px;
  align-items: start;
}

.sec-label {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.55;
  max-width: 24ch;
}

.sec-label .idx {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
  margin-bottom: 8px;
}

.sec-main h2 {
  font-family: var(--serif);
  font-size: clamp(30px, 3.2vw, 42px);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.022em;
  color: var(--ink);
  max-width: 20ch;
}

.sec-main .intro {
  font-size: 15px;
  line-height: 1.65;
  color: var(--body);
  max-width: 58ch;
  margin-top: 16px;
}

/* ledger */

.ledger {
  margin-top: 40px;
  border-top: 1px solid var(--ink);
}

.lrow {
  display: grid;
  grid-template-columns: 2.15fr 0.8fr 1.15fr 1.1fr 0.75fr;
  gap: 20px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.lhead {
  font-size: 11.5px;
  color: var(--muted);
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.lrow .job {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
}

.lrow .job span {
  display: block;
  font-size: 11.5px;
  font-weight: 400;
  color: var(--muted);
  margin-top: 1px;
}

.lrow .cell {
  font-size: 12.5px;
  color: var(--body);
}

.lrow .num {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--body);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.status::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--faint);
  flex: none;
}

.status.hot {
  color: var(--accent);
}

.status.hot::before {
  background: var(--accent);
}

.status.ok {
  color: var(--ok);
}

.status.ok::before {
  background: var(--ok);
}

.ledger-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-top: 14px;
  font-size: 11.5px;
  color: var(--muted);
}

/* steps */

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px;
  margin-top: 40px;
}

.step {
  border-top: 1px solid var(--ink);
  padding-top: 18px;
}

.step .n {
  font-family: var(--serif);
  font-size: 30px;
  color: var(--faint);
  line-height: 1;
  margin-bottom: 14px;
}

.step h3 {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 7px;
}

.step p {
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
  max-width: 34ch;
}

/* kits list */

.kits {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 64px;
  margin-top: 38px;
  border-top: 1px solid var(--ink);
}

.kit-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: start;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.kit-row .nm {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
}

.kit-row .ds {
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
  max-width: 42ch;
}

.kit-row .ct {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  padding-top: 2px;
}

/* pricing */

.pricing {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  margin-top: 38px;
  border-top: 1px solid var(--ink);
}

.plan {
  padding: 24px 28px 28px 0;
  border-right: 1px solid var(--line);
}

.plan + .plan {
  padding-left: 28px;
}

.plan:last-child {
  border-right: 0;
}

.plan.rec {
  border-top: 3px solid var(--accent);
  margin-top: -1px;
  padding-top: 21px;
}

.plan .tag {
  font-size: 11px;
  font-weight: 500;
  color: var(--accent);
  height: 17px;
  margin-bottom: 4px;
}

.plan .nm {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.plan .price {
  font-family: var(--serif);
  font-size: 42px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 16px 0 2px;
}

.plan .price span {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0;
}

.plan .blurb {
  font-size: 12.5px;
  color: var(--muted);
  min-height: 38px;
  margin-bottom: 16px;
}

.plan ul {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 22px;
}

.plan li {
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--body);
  padding-left: 14px;
  position: relative;
}

.plan li::before {
  content: "·";
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 600;
}

.plan .btn {
  width: 100%;
}

/* faq */

.faq {
  max-width: 760px;
  margin-top: 32px;
  border-top: 1px solid var(--ink);
}

.faq details {
  border-bottom: 1px solid var(--line);
}

.faq summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 17px 0;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq summary::after {
  content: "+";
  font-family: var(--mono);
  font-size: 15px;
  color: var(--muted);
  line-height: 1;
}

.faq details[open] summary::after {
  content: "−";
}

.faq details p {
  font-size: 13px;
  line-height: 1.65;
  color: var(--muted);
  max-width: 68ch;
  padding: 0 32px 18px 0;
  margin-top: -2px;
}

/* footer */

.footer {
  background: var(--ink);
  color: #d6cfc2;
  padding: 64px 0 30px;
}

.footer .brand .mark {
  background: var(--paper);
  color: var(--ink);
}

.footer .brand .name {
  color: var(--paper);
}

.footer .brand .num {
  color: #e2673f;
}

.footer-line {
  font-family: var(--serif);
  font-size: clamp(28px, 3vw, 38px);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: #f7f2e8;
  max-width: 16ch;
  margin: 28px 0 48px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr repeat(3, 0.55fr);
  gap: 40px;
}

.footer-grid h4 {
  font-size: 11.5px;
  font-weight: 500;
  color: #a79e90;
  margin-bottom: 12px;
}

.footer-grid a {
  display: block;
  font-size: 12.5px;
  color: #d6cfc2;
  padding: 4px 0;
}

.footer-grid a:hover {
  color: #f7f2e8;
}

.footer-note {
  font-size: 12px;
  line-height: 1.6;
  color: #a79e90;
  max-width: 30ch;
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-top: 1px solid #2e2a24;
  margin-top: 48px;
  padding-top: 18px;
  font-size: 11.5px;
  color: #a79e90;
}

/* ---------- app shell ---------- */

body.app {
  background: var(--paper);
}

.shell {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  min-height: 100vh;
}

.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--rail);
  border-right: 1px solid var(--line);
  padding: 20px 14px 16px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.rail .brand {
  padding: 2px 8px 0;
}

.workspace {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 22px 0 20px;
  padding: 8px 8px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  min-height: 48px;
  color: var(--ink);
}

.workspace .wmark {
  width: 24px;
  height: 24px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  flex: none;
}

.workspace .wname {
  font-size: 12px;
  font-weight: 500;
  line-height: 1.25;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace .wrole {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
}

.workspace svg {
  width: 13px;
  height: 13px;
  color: var(--faint);
  margin-left: auto;
  flex: none;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.nav-label {
  font-size: 12px;
  color: var(--faint);
  padding: 0 9px;
  margin: 0 0 7px;
}

.nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 9px;
  border-radius: 6px;
  font-size: 14.5px;
  color: var(--body);
  min-width: 0;
}

.nav a svg {
  width: 16px;
  height: 16px;
  color: var(--muted);
  flex: none;
}

.nav a:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.nav a.active {
  background: var(--surface);
  color: var(--ink);
  font-weight: 500;
  box-shadow: 0 0 0 1px var(--line);
}

.nav a.active svg {
  color: var(--ink);
}

.nav a.active::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 9px;
  bottom: 9px;
  width: 2px;
  background: var(--accent);
}

.nav .count {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  font-weight: 400;
}

.rail-foot {
  margin-top: auto;
  padding-top: 18px;
}

.plan-mini {
  padding: 10px 8px 14px;
  border-top: 1px solid var(--line);
}

.plan-mini .pl {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 11.5px;
  color: var(--ink);
  font-weight: 500;
}

.plan-mini .pl span {
  font-weight: 400;
  color: var(--muted);
}

.meter {
  height: 3px;
  background: var(--line);
  border-radius: 2px;
  margin: 9px 0 7px;
  overflow: hidden;
}

.meter i {
  display: block;
  height: 100%;
  background: var(--ink);
}

.plan-mini .rn {
  font-size: 11px;
  color: var(--muted);
}

.user {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px 8px 0;
  border-top: 1px solid var(--line);
}

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  flex: none;
}

.user .un {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.3;
  min-width: 0;
}

.user .ur {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
}

.user .icon-btn {
  margin-left: auto;
  width: 26px;
  height: 26px;
}

.user .icon-btn svg {
  width: 15px;
  height: 15px;
}

/* app topbar */

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 58px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 40px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.crumb {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.crumb .sep {
  color: var(--faint);
}

.crumb .now {
  color: var(--ink);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.search-btn {
  height: 32px;
  min-width: 210px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
}

.search-btn:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.search-btn svg {
  width: 14px;
  height: 14px;
  flex: none;
}

.search-btn kbd {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 1px 4px;
  background: var(--paper);
}

.mobile-brand {
  display: none;
}

.page {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 34px 40px 72px;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 22px;
}

.eyebrow {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}

.page-title {
  font-family: var(--serif);
  font-size: 40px;
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: -0.025em;
  color: var(--ink);
  text-wrap: pretty;
}

.page-sub {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--muted);
  margin-top: 8px;
  max-width: 62ch;
}

.head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  padding-top: 6px;
}

.statusline {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
  padding: 0 0 18px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 26px;
}

.statusline svg {
  width: 14px;
  height: 14px;
  color: var(--ok);
  flex: none;
}

.statusline .sep {
  color: var(--faint);
  margin: 0 2px;
}

.statusline a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: var(--line-strong);
}

/* dashboard */

.dash {
  display: grid;
  grid-template-columns: minmax(0, 1.62fr) minmax(250px, 0.68fr);
  gap: 52px;
  align-items: start;
}

.dash-main {
  min-width: 0;
}

.dash-side {
  border-left: 1px solid var(--line);
  padding-left: 34px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
}

.sec-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.sec-head h2 {
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--ink);
}

.sec-head .meta {
  font-size: 11.5px;
  color: var(--muted);
  font-family: var(--mono);
  white-space: nowrap;
}

.sec-head .meta a {
  font-family: var(--sans);
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: var(--line-strong);
}

.task {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}

.task::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
}

.task-date {
  background: var(--paper);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 4px;
  min-height: 180px;
}

.task-date .d {
  font-family: var(--serif);
  font-size: 44px;
  font-weight: 400;
  line-height: 0.9;
  letter-spacing: -0.03em;
  color: var(--ink);
}

.task-date .m {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-top: 7px;
}

.task-date .dd {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
  white-space: nowrap;
}

.task-body {
  padding: 18px 22px 16px;
  min-width: 0;
}

.task-flag {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 11.5px;
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 7px;
}

.task-flag .kind {
  color: var(--muted);
  font-weight: 400;
}

.task-flag .kind::before {
  content: "·";
  margin-right: 7px;
  color: var(--faint);
}

.task h3 {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.012em;
  color: var(--ink);
  line-height: 1.25;
}

.task .loc {
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
}

.task .note {
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--body);
  margin-top: 12px;
  max-width: 55ch;
}

.task-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  margin-top: 14px;
}

.fact .k {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 1px;
}

.fact .v {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink);
}

.task-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.task-actions .open {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: var(--line-strong);
  white-space: nowrap;
}

.task-actions .open:hover {
  color: var(--ink);
}

/* agenda */

.agenda {
  margin-top: 26px;
  border-top: 1px solid var(--line);
}

.ag-row {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) 112px 92px;
  gap: 16px;
  align-items: center;
  padding: 13px 6px;
  border-bottom: 1px solid var(--line);
}

.ag-row:hover {
  background: var(--surface);
}

.ag-date {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  line-height: 1.3;
}

.ag-date b {
  display: block;
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 1px;
}

.ag-job {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.35;
  min-width: 0;
}

.ag-job span {
  display: block;
  font-size: 11.5px;
  font-weight: 400;
  color: var(--muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ag-type {
  font-size: 11.5px;
  color: var(--muted);
}

.ag-amt {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--body);
  text-align: right;
  white-space: nowrap;
}

/* side blocks */

.side-sec {
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.side-sec:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.side-h {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 11.5px;
  color: var(--muted);
}

.side-h a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: var(--line-strong);
}

.glance {
  display: flex;
  flex-direction: column;
}

.glance-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 6px 0;
  font-size: 12.5px;
  color: var(--body);
}

.glance-row .v {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink);
  white-space: nowrap;
}

.alert {
  border-left: 2px solid var(--warn);
  background: var(--warn-soft);
  padding: 11px 13px;
  border-radius: 0 3px 3px 0;
}

.alert .t {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.35;
}

.alert p {
  font-size: 11.5px;
  color: var(--body);
  line-height: 1.5;
  margin-top: 3px;
}

.alert a {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 2px;
  margin-top: 7px;
}

.side-line {
  font-size: 12px;
  line-height: 1.55;
  color: var(--body);
}

.side-line b {
  font-weight: 500;
  color: var(--ink);
}

.side-meta {
  font-size: 11px;
  color: var(--muted);
  margin-top: 5px;
}

.activity {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.act-row {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  gap: 10px;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--body);
}

.act-row time {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
  padding-top: 1px;
}

/* ---------- automations ---------- */

.toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin: 24px 0 0;
  border-bottom: 1px solid var(--line);
}

.tabs {
  display: flex;
  gap: 2px;
}

.tab {
  height: 38px;
  padding: 0 10px;
  font-size: 12.5px;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tab:hover {
  color: var(--ink);
}

.tab.active {
  color: var(--ink);
  font-weight: 500;
  border-bottom-color: var(--ink);
}

.tab .n {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
  font-weight: 400;
}

.tab.active .n {
  color: var(--muted);
}

.tool-search {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  width: 250px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  margin-bottom: 6px;
}

.tool-search svg {
  width: 14px;
  height: 14px;
  color: var(--faint);
  flex: none;
}

.tool-search input {
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 12px;
  width: 100%;
  min-width: 0;
  color: var(--ink);
}

.tool-search input::placeholder {
  color: var(--faint);
}

.kit {
  border-top: 1px solid var(--ink);
  padding: 16px 0 6px;
  margin-top: 30px;
}

.kit-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 8px;
}

.kit-head h2 {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.005em;
}

.kit-head p {
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
  max-width: 62ch;
}

.kit-head .kn {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  padding-top: 2px;
}

.check {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 104px 132px 82px;
  gap: 20px;
  align-items: center;
  padding: 13px 8px;
  border-top: 1px solid var(--line);
  cursor: pointer;
}

.check:hover {
  background: var(--surface);
}

.check-main {
  min-width: 0;
}

.check-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.35;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
  flex: none;
}

.check.off .dot {
  background: var(--faint);
}

.check-desc {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.45;
  margin-top: 3px;
  max-width: 58ch;
}

.check-sched,
.check-last {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.4;
}

.check-last b {
  display: block;
  font-weight: 400;
  color: var(--body);
}

.check-last span {
  display: block;
  margin-top: 1px;
}

.check.off .check-last b {
  color: var(--muted);
}

.check-state {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}

.check-state .sl {
  font-size: 11px;
  color: var(--muted);
  min-width: 18px;
  text-align: right;
}

.switch {
  position: relative;
  width: 32px;
  height: 19px;
  border-radius: 999px;
  background: var(--line-strong);
  flex: none;
  transition: background 0.15s ease;
}

.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s ease;
}

.switch[aria-checked="true"] {
  background: var(--ok);
}

.switch[aria-checked="true"]::after {
  transform: translateX(13px);
}

.empty {
  padding: 44px 0;
  font-size: 13px;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

/* ---------- detail ---------- */

.crumb-line {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 16px;
}

.crumb-line a:hover {
  color: var(--ink);
}

.crumb-line .sep {
  color: var(--faint);
}

.detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 8px;
}

.title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.title-row h1 {
  font-family: var(--serif);
  font-size: 37px;
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.025em;
  color: var(--ink);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.chip-ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.chip-off {
  background: var(--surface-2);
  color: var(--muted);
}

.chip-hot {
  background: var(--accent-soft);
  color: var(--accent);
}

.chip-warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.detail-sub {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 8px;
}

.detail-sub .sep {
  color: var(--line-strong);
  margin: 0 6px;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(250px, 0.65fr);
  gap: 52px;
  align-items: start;
  margin-top: 26px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.detail-main {
  min-width: 0;
}

.detail-side {
  border-left: 1px solid var(--line);
  padding-left: 32px;
  min-width: 0;
}

.match-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 5px;
  overflow: hidden;
}

.match-row {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr) auto 64px;
  gap: 14px;
  align-items: center;
  padding: 13px 16px;
  border-top: 1px solid var(--line);
}

.match-row:first-child {
  border-top: 0;
}

.match-date {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  line-height: 1.35;
}

.match-date b {
  display: block;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
}

.match-job {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.35;
  min-width: 0;
}

.match-job span {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
  margin-top: 2px;
}

.match-amt {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--body);
  white-space: nowrap;
}

.match-open {
  font-size: 11.5px;
  color: var(--ink);
  text-align: right;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: var(--line-strong);
  white-space: nowrap;
}

.rule-list {
  margin-top: 26px;
  border-top: 1px solid var(--line);
}

.rule {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  gap: 20px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
  line-height: 1.55;
}

.rule dt {
  color: var(--muted);
}

.rule dd {
  color: var(--body);
}

.rule code {
  font-family: var(--mono);
  font-size: 11px;
  background: var(--surface-2);
  padding: 1px 4px;
  border-radius: 2px;
}

.history {
  margin-top: 26px;
  border-top: 1px solid var(--ink);
}

.hrow {
  display: grid;
  grid-template-columns: 104px 1fr 72px 72px;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--body);
}

.hhead {
  color: var(--muted);
  font-size: 11px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.hrow .hm {
  text-align: right;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}

.hrow .ok {
  color: var(--ok);
}

.side-block {
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 22px;
}

.side-block:last-child {
  border-bottom: 0;
  margin-bottom: 0;
  padding-bottom: 0;
}

.side-title {
  font-size: 11.5px;
  color: var(--muted);
  margin-bottom: 9px;
}

.settings {
  display: flex;
  flex-direction: column;
}

.setting {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  gap: 12px;
  padding: 7px 0;
  font-size: 12px;
  line-height: 1.45;
  border-bottom: 1px solid var(--line);
}

.setting:last-child {
  border-bottom: 0;
}

.setting dt {
  color: var(--muted);
}

.setting dd {
  color: var(--ink);
}

.rule-note {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent);
  padding: 13px 14px;
  border-radius: 0 4px 4px 0;
}

.rule-note .q {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  margin-bottom: 5px;
}

.rule-note p {
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--body);
}

/* ---------- jobs ---------- */

.jobs-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 24px 0 18px;
}

.filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.filter {
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 3px;
  font-size: 11.5px;
  color: var(--muted);
  background: transparent;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.filter:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.filter.active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.filter .n {
  font-family: var(--mono);
  font-size: 11px;
  opacity: 0.7;
}

.jobs-table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 5px;
  overflow: hidden;
}

.jobs-table {
  width: 100%;
  border-collapse: collapse;
}

.jobs-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  white-space: nowrap;
}

.jobs-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  color: var(--body);
  vertical-align: middle;
}

.jobs-table tr:last-child td {
  border-bottom: 0;
}

.jobs-table tbody tr:hover {
  background: var(--paper);
}

.jobs-table .jn {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.35;
}

.jobs-table .jn span {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
  margin-top: 1px;
}

.jobs-table .money {
  font-family: var(--mono);
  font-size: 11.5px;
  white-space: nowrap;
}

.jobs-table .date {
  font-size: 11.5px;
  white-space: nowrap;
}

.jobs-table .date b {
  font-weight: 500;
  color: var(--ink);
}

.jobs-table .date span {
  display: block;
  font-size: 11px;
  color: var(--muted);
}

.jobs-table .status {
  font-size: 11.5px;
}

.jobs-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 14px;
  font-size: 11.5px;
  color: var(--muted);
}

/* ---------- responsive ---------- */

@media (max-width: 1120px) {
  .hero-grid {
    gap: 48px;
  }
  .hero h1 {
    font-size: 54px;
  }
  .dash {
    gap: 36px;
  }
  .detail-grid {
    gap: 36px;
  }
  .check {
    grid-template-columns: minmax(0, 1fr) 96px 112px 78px;
    gap: 14px;
  }
}

@media (max-width: 980px) {
  .wrap {
    padding: 0 28px;
  }
  .hero {
    padding: 64px 0 58px;
  }
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 44px;
  }
  .hero h1 {
    max-width: 16ch;
  }
  .brief-wrap {
    max-width: 580px;
  }
  .sec-grid {
    grid-template-columns: 1fr;
    gap: 22px;
  }
  .sec-label {
    max-width: none;
    display: flex;
    gap: 12px;
    align-items: baseline;
  }
  .sec-label .idx {
    margin: 0;
  }
  .dash {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .dash-side {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding-left: 0;
    padding-top: 24px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px 32px;
  }
  .side-sec {
    border-bottom: 0;
    padding-bottom: 0;
  }
  .detail-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .detail-side {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding-left: 0;
    padding-top: 24px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px 32px;
  }
  .side-block {
    border-bottom: 0;
    padding-bottom: 0;
    margin-bottom: 0;
  }
  .shell {
    grid-template-columns: 204px minmax(0, 1fr);
  }
  .topbar,
  .page {
    padding-left: 28px;
    padding-right: 28px;
  }
  .check {
    grid-template-columns: minmax(0, 1fr) 96px 78px;
  }
  .check-last {
    display: none;
  }
}

@media (max-width: 760px) {
  .wrap {
    padding: 0 20px;
  }
  .site-head .wrap {
    height: 60px;
    gap: 12px;
  }
  .site-nav {
    display: none;
  }
  .site-actions {
    display: flex;
    margin-left: auto;
    gap: 6px;
  }
  .site-actions .signin,
  .site-actions .icon-btn {
    display: none;
  }
  .site-actions .btn {
    height: 38px;
    padding: 0 13px;
    font-size: 12px;
  }
  .mobile-menu-btn {
    display: grid;
    margin-left: 0;
  }
  .mobile-nav.open {
    display: block;
  }
  .hero {
    padding: 48px 0 46px;
  }
  .kicker {
    margin-bottom: 18px;
  }
  .hero h1 {
    font-size: clamp(38px, 11vw, 48px);
    max-width: 14ch;
  }
  .lede {
    font-size: 15px;
    margin-top: 18px;
  }
  .hero-actions {
    margin-top: 24px;
    gap: 8px;
  }
  .hero-actions .btn {
    flex: 1;
    min-width: 0;
  }
  .hero-fine {
    font-size: 11px;
    gap: 6px 14px;
  }
  .brief-top {
    padding: 11px 14px;
  }
  .brief-top .meta {
    font-size: 11px;
  }
  .brief-body {
    padding: 18px 14px 6px;
  }
  .brief-title {
    font-size: 23px;
  }
  .brief-row {
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 10px;
  }
  .brief-row .amt {
    grid-column: 2;
    font-size: 11px;
    margin-top: -4px;
  }
  .brief-foot {
    padding: 12px 14px;
  }
  .brief-foot .act {
    font-size: 11px;
  }
  .section {
    padding: 56px 0;
  }
  .sec-main h2 {
    font-size: 30px;
  }
  .sec-main .intro {
    font-size: 13.5px;
  }
  .ledger {
    margin-top: 28px;
  }
  .lhead {
    display: none;
  }
  .lrow {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 14px;
    padding: 13px 0;
  }
  .lrow .job {
    grid-column: 1;
  }
  .lrow .cell:nth-child(2),
  .lrow .cell:nth-child(3) {
    display: none;
  }
  .lrow .cell:nth-child(4) {
    grid-column: 2;
    grid-row: 1;
    text-align: right;
    font-family: var(--mono);
    font-size: 11px;
  }
  .lrow .status {
    grid-column: 1;
    font-size: 11px;
  }
  .lrow .num {
    display: none;
  }
  .ledger-foot {
    font-size: 11px;
  }
  .steps {
    grid-template-columns: 1fr;
    gap: 24px;
    margin-top: 28px;
  }
  .step {
    padding-top: 14px;
  }
  .step .n {
    font-size: 24px;
    margin-bottom: 8px;
  }
  .kits {
    grid-template-columns: 1fr;
    margin-top: 28px;
  }
  .pricing {
    grid-template-columns: 1fr;
    margin-top: 28px;
    border-top: 0;
  }
  .plan,
  .plan + .plan {
    padding: 20px 0;
    border-right: 0;
    border-top: 1px solid var(--line);
  }
  .plan.rec {
    border-top: 3px solid var(--accent);
    margin-top: 0;
    padding-top: 18px;
  }
  .plan .blurb {
    min-height: 0;
  }
  .plan .price {
    font-size: 36px;
    margin-top: 12px;
  }
  .plan ul {
    margin-bottom: 16px;
  }
  .faq {
    margin-top: 24px;
  }
  .footer {
    padding: 46px 0 24px;
  }
  .footer-line {
    margin: 22px 0 34px;
  }
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 28px;
  }
  .footer-grid > div:first-child {
    grid-column: 1 / -1;
  }
  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-top: 32px;
  }

  /* app mobile */
  .shell {
    display: block;
  }
  .rail {
    display: none;
  }
  .topbar {
    height: 54px;
    padding: 0 16px;
    gap: 10px;
  }
  .crumb {
    display: none;
  }
  .mobile-brand {
    display: inline-flex;
    align-items: center;
  }
  .mobile-brand .brand .name {
    font-size: 18px;
  }
  .mobile-brand .brand .mark {
    width: 20px;
    height: 20px;
    font-size: 13px;
  }
  .search-btn {
    min-width: 0;
    width: 32px;
    padding: 0;
    justify-content: center;
    border-color: transparent;
    background: transparent;
  }
  .search-btn span,
  .search-btn kbd {
    display: none;
  }
  .top-actions {
    gap: 2px;
  }
  .page {
    padding: 24px 16px 72px;
  }
  .page-head {
    flex-direction: column;
    gap: 16px;
    margin-bottom: 18px;
  }
  .page-title {
    font-size: 32px;
  }
  .page-sub {
    font-size: 12.5px;
  }
  .head-actions {
    width: 100%;
    padding-top: 0;
  }
  .head-actions .btn {
    flex: 1;
  }
  .statusline {
    font-size: 11px;
    padding-bottom: 14px;
    margin-bottom: 20px;
  }
  .dash-side {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .task {
    grid-template-columns: 70px minmax(0, 1fr);
  }
  .task-date {
    min-height: 170px;
  }
  .task-date .d {
    font-size: 38px;
  }
  .task-body {
    padding: 15px 16px 14px;
  }
  .task h3 {
    font-size: 17px;
  }
  .task .note {
    font-size: 12px;
    margin-top: 9px;
  }
  .task-facts {
    gap: 14px;
    margin-top: 12px;
  }
  .task-actions {
    gap: 7px;
  }
  .task-actions .btn {
    height: 36px;
    padding: 0 11px;
    font-size: 12px;
  }
  .task-actions .open {
    margin-left: 0;
    width: 100%;
    text-align: right;
  }
  .ag-row {
    grid-template-columns: 78px minmax(0, 1fr) auto;
    gap: 10px;
    padding: 12px 4px;
  }
  .ag-type {
    display: none;
  }
  .ag-amt {
    font-size: 11px;
  }
  .toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }
  .tabs {
    overflow-x: auto;
  }
  .tool-search {
    width: 100%;
    margin: 12px 0;
  }
  .kit {
    margin-top: 24px;
  }
  .kit-head {
    gap: 12px;
  }
  .check {
    grid-template-columns: minmax(0, 1fr) 76px;
    gap: 10px;
    padding: 13px 4px;
  }
  .check-sched,
  .check-last {
    display: none;
  }
  .check-desc {
    font-size: 11px;
  }
  .check-state .sl {
    display: none;
  }
  .detail-head {
    flex-direction: column;
    gap: 14px;
  }
  .title-row h1 {
    font-size: 30px;
  }
  .match-row {
    grid-template-columns: 90px minmax(0, 1fr) auto;
    gap: 10px;
    padding: 12px 13px;
  }
  .match-open {
    display: none;
  }
  .match-date {
    font-size: 11px;
  }
  .match-amt {
    font-size: 11px;
  }
  .rule {
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 12px;
  }
  .hrow {
    grid-template-columns: 88px 1fr 52px;
  }
  .hrow .hm:nth-child(3) {
    display: none;
  }
  .hhead span:nth-child(3) {
    display: none;
  }
  .detail-side {
    grid-template-columns: 1fr;
  }
  .jobs-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .jobs-table-wrap {
    border: 0;
    background: transparent;
    border-radius: 0;
    overflow: visible;
  }
  .jobs-table thead {
    display: none;
  }
  .jobs-table,
  .jobs-table tbody,
  .jobs-table tr,
  .jobs-table td {
    display: block;
    width: 100%;
  }
  .jobs-table tr {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 5px;
    margin-bottom: 10px;
    padding: 12px 13px;
  }
  .jobs-table td {
    border: 0;
    padding: 2px 0;
  }
  .jobs-table td[data-label]::before {
    content: attr(data-label);
    display: inline-block;
    min-width: 92px;
    font-size: 11px;
    color: var(--muted);
  }
  .jobs-table td.c-name::before {
    display: none;
  }
  .jobs-table td.c-name {
    margin-bottom: 5px;
  }
  .jobs-table td.c-status {
    margin-top: 5px;
  }
  .jobs-table td.c-status::before {
    display: none;
  }

  /* app bottom nav */
  .mobile-tabs {
    display: flex !important;
  }
}

.mobile-tabs {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: var(--paper);
  border-top: 1px solid var(--line);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
}

.mobile-tabs a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 5px 2px;
  font-size: 11px;
  color: var(--muted);
  border-radius: 4px;
}

.mobile-tabs a svg {
  width: 18px;
  height: 18px;
}

.mobile-tabs a.active {
  color: var(--ink);
}

.mobile-tabs a.active svg {
  color: var(--accent);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}


/* ===== v2.1 polish — product finish ===== */

/* Stronger structure in dark mode; the cream footer was a light-only assumption. */
html[data-theme="dark"] {
  --line: #37322b;
  --line-strong: #4e473c;
  --faint: #9a9082;
}
html[data-theme="dark"] .footer {
  background: #0d0c0a;
  color: #d6cfc2;
}
html[data-theme="dark"] .footer .brand .mark {
  background: #f6f2e9;
  color: #141311;
}
html[data-theme="dark"] .footer .brand .name {
  color: #f7f2e8;
}

/* Marketing grid and hero: a little less empty rail, a little more proof. */
.sec-grid {
  grid-template-columns: 196px minmax(0, 1fr);
  gap: 56px;
}
.sec-label {
  font-size: 13px;
  color: var(--body);
}
.sec-label .idx {
  color: var(--muted);
  margin-bottom: 7px;
}
.hero-grid {
  grid-template-columns: 1fr 1.04fr;
  gap: 68px;
}
.site-nav a {
  font-size: 13.5px;
}
.hero-fine {
  font-size: 13px;
  color: var(--body);
  gap: 8px 22px;
}
.hero-fine svg {
  width: 14px;
  height: 14px;
}
.brief-body {
  padding: 23px 22px 8px;
}
.brief-title {
  font-size: 29px;
}
.brief-row {
  grid-template-columns: 56px minmax(0, 1fr) auto;
  padding: 14px 0;
}
.brief-row .nm {
  font-size: 14px;
}
.brief-row .ty {
  font-size: 12px;
}
.brief-row .amt {
  font-size: 12.5px;
}
.brief-caption {
  text-align: left;
  font-size: 11.5px;
  margin-top: 12px;
}
.kits {
  column-gap: 40px;
}
.kit-row .nm {
  font-size: 14px;
}
.kit-row .ds {
  font-size: 12.5px;
}
.faq summary {
  min-height: 56px;
  font-size: 14px;
}

/* Pricing: baseline the unit, even the columns. */
.plan {
  display: flex;
  flex-direction: column;
}
.plan .tag {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  height: 16px;
  margin-bottom: 5px;
}
.plan .price {
  display: flex;
  align-items: baseline;
  gap: 5px;
}
.plan .price span {
  font-size: 13px;
  line-height: 1;
}
.plan .blurb {
  font-size: 13px;
}
.plan ul {
  gap: 10px;
  margin-bottom: 24px;
}
.plan li {
  font-size: 13px;
}
.plan .btn {
  margin-top: auto;
}

/* App page header: object names, not campaign slogans. */
.page-title {
  font-size: 38px;
}
.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 9px;
}
.page-head {
  margin-bottom: 20px;
}
.page-sub {
  font-size: 13.5px;
  max-width: 66ch;
}

/* Status line: no dangling slash; the run link is its own target. */
.statusline {
  font-size: 12.5px;
  color: var(--body);
  gap: 8px 12px;
}
.statusline .run {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
  min-height: 28px;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
  white-space: nowrap;
}
.statusline .run svg {
  width: 13px;
  height: 13px;
  color: var(--ink);
}
.statusline .run:hover {
  text-decoration-color: var(--accent);
}

/* Dashboard: give the working column the width, and the rail a firmer voice. */
.dash {
  grid-template-columns: minmax(0, 1.72fr) minmax(256px, 0.58fr);
  gap: 44px;
}
.dash-side {
  padding-left: 30px;
}
.side-h {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}
.side-h a {
  font-family: var(--sans);
  font-size: 11.5px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
}
.ag-row {
  grid-template-columns: 86px minmax(0, 1fr) 186px 88px;
  gap: 14px;
  padding: 14px 6px;
}
.ag-type {
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ag-amt {
  font-size: 12px;
}
.glance-row {
  padding: 7px 0;
}
.glance-row .v,
.fact .v {
  font-variant-numeric: tabular-nums;
}
.activity {
  gap: 12px;
}
.act-row {
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 12px;
}

/* A ledger, not a chart: the next quarter in three ruled lines. */
.outlook {
  margin-top: 10px;
  border-top: 1px solid var(--line);
}
.ol-row {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: baseline;
  padding: 11px 6px;
  border-bottom: 1px solid var(--line);
}
.ol-month {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.ol-copy {
  font-size: 12.5px;
  color: var(--body);
}
.ol-amt {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink);
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* Automations: real column semantics for a 32-row operational list. */
.check-cols {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px 150px 64px 84px;
  gap: 20px;
  padding: 0 8px 9px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}
.check-cols span:nth-child(4) {
  text-align: right;
}
.check-cols span:last-child {
  text-align: right;
}
.check {
  grid-template-columns: minmax(0, 1fr) 150px 150px 64px 84px;
  gap: 20px;
  padding: 14px 8px;
}
.check-name {
  font-size: 13.5px;
}
.check-desc {
  font-size: 12px;
  margin-top: 4px;
}
.check-sched,
.check-last {
  font-size: 12px;
}
.check-found {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.check-meta-m { display: none; }
.check-found b {
  font-weight: 500;
  color: var(--ink);
}
.check-state {
  gap: 7px;
}
.kit-head h2 {
  font-size: 15px;
}
.kit-head p {
  font-size: 12.5px;
}

/* Jobs: a data table that reads as one. */
.jobs-table th {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 11px 16px;
}
.jobs-table th.num,
.jobs-table td.num {
  text-align: right;
}
.jobs-table th .sort {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  color: inherit;
  padding: 0;
}
.jobs-table th .sort:hover {
  color: var(--ink);
}
.jobs-table th .sort svg {
  width: 11px;
  height: 11px;
  color: var(--faint);
}
.jobs-table th[aria-sort="ascending"] .sort,
.jobs-table th[aria-sort="descending"] .sort {
  color: var(--ink);
}
.jobs-table th[aria-sort="ascending"] .sort svg,
.jobs-table th[aria-sort="descending"] .sort svg {
  color: var(--accent);
}
.jobs-table td {
  padding: 11px 16px;
  font-size: 12.5px;
}
.jobs-table .jn {
  font-size: 13px;
}
.jobs-table .jn span {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.01em;
}
.jobs-table .money {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.jobs-table .date {
  font-size: 12px;
}
.jobs-table .date b {
  font-variant-numeric: tabular-nums;
}
.jobs-table .date span {
  font-size: 11px;
}
.jobs-table .status {
  font-size: 11.5px;
}
.jobs-table-wrap {
  border-radius: 4px;
}
.jobs-foot {
  margin-top: 12px;
}

/* Detail: one breadcrumb, clear match columns, a real edit affordance. */
.detail-grid {
  grid-template-columns: minmax(0, 1.62fr) minmax(256px, 0.58fr);
  gap: 44px;
}
.match-head {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr) 112px 84px;
  gap: 14px;
  padding: 9px 16px;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}
.match-head span:nth-child(3),
.match-head span:nth-child(4) {
  text-align: right;
}
.match-row {
  grid-template-columns: 118px minmax(0, 1fr) 112px 84px;
  gap: 14px;
  padding: 14px 16px;
}
.match-date {
  font-size: 11px;
}
.match-amt {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.match-open {
  font-size: 11.5px;
}
.history {
  margin-top: 10px;
}
.hrow {
  grid-template-columns: 116px 1fr 76px 76px;
  font-size: 12px;
  padding: 11px 0;
}
.hrow .hm {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.hhead {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}
.hhead .hm {
  font-size: 11px;
}
.side-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.side-title .edit {
  font-family: var(--sans);
  font-size: 11.5px;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
}
.side-title .edit:hover {
  text-decoration-color: var(--accent);
}
.setting {
  padding: 8px 0;
  font-size: 12px;
}
.setting dd {
  font-variant-numeric: tabular-nums;
}

/* Settings dialog: functional mock, no dead buttons. */
dialog.settings-dialog {
  width: min(440px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}
dialog.settings-dialog::backdrop {
  background: rgba(20, 18, 15, 0.55);
}
.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 22px 14px;
  border-bottom: 1px solid var(--line);
}
.dialog-head h2 {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -0.015em;
}
.dialog-head p {
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
}
.dialog-close {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  color: var(--muted);
  border-radius: 4px;
}
.dialog-close:hover {
  background: var(--surface-2);
  color: var(--ink);
}
.dialog-body {
  display: grid;
  gap: 14px;
  padding: 18px 22px 8px;
}
.field {
  display: grid;
  gap: 5px;
}
.field label {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}
.field select,
.field input {
  height: 38px;
  width: 100%;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink);
  font-size: 13px;
}
.dialog-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 22px 22px;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 90;
  transform: translate(-50%, 8px);
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 10px 14px;
  font-size: 12px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* Responsive adjustments for the new columns and tap targets. */
@media (max-width: 1120px) {
  .check-cols,
  .check {
    grid-template-columns: minmax(0, 1fr) 96px 76px 78px;
  }
  .check-cols span:nth-child(3),
  .check-last {
    display: none;
  }
  .check-cols span:nth-child(4) {
    text-align: right;
  }
  .ag-row {
    grid-template-columns: 82px minmax(0, 1fr) 160px 82px;
    gap: 12px;
  }
}

@media (max-width: 980px) {
  .ag-row {
    grid-template-columns: 82px minmax(0, 1fr) 82px;
  }
  .ag-type {
    display: none;
  }
  .match-head,
  .match-row {
    grid-template-columns: 104px minmax(0, 1fr) 96px;
  }
  .match-head span:nth-child(4),
  .match-open {
    display: none;
  }
  .match-head span:nth-child(3) {
    text-align: right;
  }
}

@media (max-width: 760px) {
  .page {
    padding-bottom: calc(92px + env(safe-area-inset-bottom));
  }
  .statusline {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    gap: 4px 8px;
    align-items: start;
    font-size: 11.5px;
  }
  .statusline .run {
    grid-column: 2;
    margin-left: 0;
    min-height: 40px;
    align-items: center;
  }
  .statusline .sep {
    margin: 0 4px;
  }
  .mobile-tabs {
    background: var(--surface);
    padding: 4px 8px calc(4px + env(safe-area-inset-bottom));
  }
  .mobile-tabs a {
    min-height: 52px;
    font-size: 11px;
    padding: 6px 2px;
  }
  .mobile-tabs a svg {
    width: 19px;
    height: 19px;
  }
  .topbar {
    height: 56px;
  }
  .top-actions .icon-btn,
  .search-btn {
    width: 40px;
    height: 40px;
  }
  .head-actions .btn,
  .task-actions .btn {
    min-height: 44px;
  }
  .tool-search {
    height: 42px;
  }
  .check-cols {
    display: none;
  }
  .check {
    grid-template-columns: minmax(0, 1fr) 76px;
    gap: 10px;
    padding: 14px 4px;
  }
  .check-found {
    display: none;
  }
  .check-desc {
    font-size: 11.5px;
  }
  .check-meta-m {
    display: block;
    margin-top: 6px;
    font-size: 11px;
    line-height: 1.4;
    color: var(--muted);
  }
  .match-head {
    display: none;
  }
  .match-row {
    grid-template-columns: 92px minmax(0, 1fr) auto;
    gap: 10px;
    padding: 13px;
  }
  .match-open {
    display: none;
  }
  .toast {
    bottom: calc(76px + env(safe-area-inset-bottom));
    width: max-content;
    max-width: calc(100vw - 32px);
  }
  .dialog-foot .btn {
    min-height: 44px;
  }
}

@media (max-width: 380px) {
  .page-title {
    font-size: 29px;
  }
  .head-actions {
    flex-wrap: wrap;
  }
  .head-actions .btn {
    flex: 1 1 100%;
  }
}


/* Small semantic fixes that keep the new components honest. */
.crumb a {
  color: var(--muted);
}
.crumb a:hover {
  color: var(--ink);
}
.detail-sub {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 0;
}
.detail-sub > span {
  white-space: nowrap;
}
.detail-sub .sep {
  margin: 0 7px;
}
.detail-head {
  margin-bottom: 4px;
}
.dialog-close svg {
  width: 16px;
  height: 16px;
}
.check:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.jobs-table th .sort-mark {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
}
.jobs-table th[aria-sort="ascending"] .sort-mark,
.jobs-table th[aria-sort="descending"] .sort-mark {
  color: var(--accent);
}
@media (max-width: 760px) {
  .jobs-table td.c-amt {
    text-align: left;
  }
  .jobs-table td.c-amt::before {
    min-width: 92px;
  }
  .match-row .match-amt {
    text-align: right;
  }
}


/* The polish block above comes after the original media queries, so restate
   the structural collapses here. */
@media (max-width: 980px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 44px;
  }
  .sec-grid {
    grid-template-columns: 1fr;
    gap: 22px;
  }
  .dash {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .detail-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }
}

@media (max-width: 760px) {
  .page-title {
    font-size: 32px;
  }
  .page-sub {
    font-size: 12.5px;
  }
  .brief-title {
    font-size: 23px;
  }
  .brief-row {
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 10px;
  }
  .brief-row .amt {
    grid-column: 2;
    font-size: 11px;
    margin-top: -4px;
  }
  .brief-foot {
    flex-wrap: wrap;
    gap: 6px 12px;
  }
  .brief-foot .note {
    min-width: 0;
  }
  .ag-row {
    grid-template-columns: 78px minmax(0, 1fr) auto;
    gap: 10px;
    padding: 12px 4px;
  }
  .ag-type {
    display: none;
  }
  .ag-amt {
    font-size: 11px;
  }
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }
}


@media (max-width: 900px) {
  .search-btn {
    min-width: 34px;
    width: 34px;
    padding: 0;
    justify-content: center;
  }
  .search-btn > span,
  .search-btn kbd {
    display: none;
  }
}


.rule-note {
  border-left-color: var(--line-strong);
}
.rule-item + .rule-item {
  border-top: 1px solid var(--line);
  margin-top: 10px;
  padding-top: 10px;
}
.rule-item .q {
  margin-bottom: 4px;
}
.side-title .edit {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  text-decoration: none;
}
.side-title .edit:hover {
  border-color: var(--ink);
  text-decoration: none;
}


.ol-head {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  padding-top: 9px;
  padding-bottom: 7px;
}
.ol-head .ol-copy,
.ol-head .ol-amt {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.07em;
}


.brief-top .meta {
  font-size: 11px;
}
.brief-label {
  font-size: 11.5px;
}
.brief-row .ty {
  font-size: 12.5px;
}
.brief-row .amt {
  font-size: 13px;
}
.brief-foot .note {
  font-size: 12.5px;
}
.brief-caption {
  font-size: 11.5px;
}
.datebox .m {
  font-size: 11px;
}
.faq details p {
  font-size: 13.5px;
  color: var(--body);
  max-width: 62ch;
}
.faq summary::after {
  font-size: 18px;
  color: var(--body);
}


.jobs-table th.num .sort {
  width: 100%;
  justify-content: flex-end;
}
.jobs-table td {
  vertical-align: top;
  padding-top: 13px;
}
.jobs-table th {
  vertical-align: bottom;
}

[hidden] {
  display: none !important;
}


html[data-theme="dark"] .btn-primary:not(:disabled):not([aria-disabled="true"]) {
  color: #1b130f;
}
.statusline .st-body {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 8px;
  min-width: 0;
}
.statusline .st-meta {
  white-space: nowrap;
}
.task-flag .kind::before {
  content: "·";
}
.switch::before {
  content: "";
  position: absolute;
  inset: -12px;
  border-radius: 999px;
}
@media (max-width: 760px) {
  .page {
    padding-bottom: calc(104px + env(safe-area-inset-bottom));
  }
  .top-actions .icon-btn,
  .search-btn {
    width: 44px;
    height: 44px;
  }
  .statusline .run {
    min-height: 44px;
  }
  .statusline .st-meta {
    display: block;
    white-space: nowrap;
  }
  .detail-sub .sep {
    display: none;
  }
  .detail-sub {
    gap: 3px 12px;
  }
  .task-flag .kind::before {
    content: "";
  }
  .task-flag .kind {
    display: block;
    margin-top: 2px;
  }
  .check-state .sl {
    display: inline;
    font-size: 11px;
  }
  .switch {
    margin-right: 2px;
  }
  .tab {
    min-height: 44px;
  }
  .tool-search {
    height: 44px;
  }
  .task-actions .open {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
  }
  .alert a {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
  }
}

:root {
  --faint: #675f53;
}


@media (max-width: 760px) {
  .hero-fine {
    flex-wrap: nowrap;
    font-size: 11.5px;
    gap: 6px 12px;
  }
  .hero-fine svg {
    width: 13px;
    height: 13px;
  }
  .section {
    padding: 44px 0;
  }
  .ledger-foot {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .ledger-foot .link {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
  }
}
@media (max-width: 380px) {
  .hero-fine {
    flex-wrap: wrap;
    font-size: 11px;
  }
}

.sec-main h2 {
  text-wrap: balance;
}
.plan .price span {
  white-space: nowrap;
}
@media (max-width: 760px) {
  .plan ul {
    margin-bottom: 18px;
  }
}


/* Job drawer: a row should open something, not dead-end. */
.jobs-table tbody tr {
  cursor: pointer;
}
.jobs-table tbody tr:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.job-dialog .dialog-head h2 {
  font-size: 27px;
}
.job-dialog .dialog-head p .status {
  margin-left: 4px;
  font-size: 11.5px;
}
.job-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 22px;
  padding: 18px 22px 4px;
}
.job-fact {
  display: grid;
  gap: 2px;
}
.job-fact span {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.job-fact strong {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.job-note {
  margin: 10px 22px 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--body);
}
.job-dialog .dialog-foot {
  justify-content: space-between;
}
@media (max-width: 480px) {
  .job-facts {
    grid-template-columns: 1fr;
    gap: 0;
    padding: 6px 18px 2px;
  }
  .job-fact {
    grid-template-columns: 92px 1fr;
    align-items: baseline;
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px solid var(--line);
  }
  .job-fact:last-child { border-bottom: 0; }
  .job-fact span { padding-top: 0; }
  .job-fact strong { text-align: right; font-size: 13.5px; }
}


/* Tablet: rebalance before the layout breaks. */
@media (max-width: 1120px) {
  .ag-row {
    grid-template-columns: 82px minmax(0, 1fr) 82px;
  }
  .ag-type {
    display: none;
  }
  .detail-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .detail-side {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding-left: 0;
    padding-top: 24px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px 32px;
  }
  .jobs-table th:nth-child(2),
  .jobs-table td.c-loc,
  .jobs-table th:nth-child(3),
  .jobs-table td.c-stage {
    display: none;
  }
  .compact-meta {
    display: inline;
  }
}

@media (max-width: 900px) {
  .shell {
    display: block;
  }
  .rail {
    display: none;
  }
  .topbar {
    height: 56px;
    padding: 0 20px;
    gap: 12px;
  }
  .crumb {
    display: none;
  }
  .mobile-brand {
    display: inline-flex;
    align-items: center;
  }
  .mobile-brand .brand .name {
    font-size: 18px;
  }
  .mobile-brand .brand .mark {
    width: 20px;
    height: 20px;
    font-size: 13px;
  }
  .top-actions .icon-btn,
  .search-btn {
    width: 40px;
    height: 40px;
  }
  .mobile-tabs {
    display: flex !important;
  }
  .page {
    padding-bottom: calc(96px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 760px) {
  .detail-side {
    grid-template-columns: 1fr;
  }
}

.compact-meta {
  display: none;
  font-style: normal;
}


@media (max-width: 1120px) {
  .check-cols,
  .check {
    grid-template-columns: minmax(0, 1fr) 150px 60px 78px;
  }
  .check-desc {
    font-size: 12.5px;
  }
}

@media (max-width: 900px) {
  .page-title {
    font-size: 32px;
  }
  .check-cols {
    position: sticky;
    top: 56px;
    z-index: 5;
    background: var(--paper);
    padding-top: 8px;
  }
  .search-btn > span:not([data-icon]),
  .search-btn kbd {
    display: none;
  }
  .search-btn [data-icon] {
    display: inline-flex;
  }
}

@media (max-width: 760px) {
  .search-btn > span,
  .search-btn kbd {
    display: none;
  }
  .search-btn [data-icon] {
    display: inline-flex;
  }
}


@media (max-width: 1120px) {
  .detail-side > .side-block:last-child {
    grid-column: 1 / -1;
  }
}

.kit {
  scroll-margin-top: 76px;
}

@media (max-width: 760px) {
  .statusline .st-body .sep {
    display: none;
  }
}

.brief-title {
  text-wrap: balance;
}


/* ============================================================
   Connections + Documents — visual expansion
   ============================================================ */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- connections summary ---------- */
.conn-stats,
.doc-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--line);
  margin: 2px 0 26px;
}
.conn-stat,
.doc-stat {
  min-width: 0;
  padding: 14px 16px 15px;
  border-right: 1px solid var(--line);
}
.conn-stat:last-child,
.doc-stat:last-child { border-right: 0; }
.cs-num,
.ds-num {
  display: block;
  font-family: var(--serif);
  font-size: 30px;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--ink);
}
.cs-num.mono { font-family: var(--mono); font-size: 21px; letter-spacing: -0.02em; }
.cs-label,
.ds-label {
  display: block;
  margin-top: 7px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
}
.cs-note,
.ds-note {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  line-height: 1.35;
  color: var(--muted);
}
.conn-stat.is-warn .cs-num,
.doc-stat.is-hot .ds-num { color: var(--accent); }

/* ---------- connection hero / flow ---------- */
.conn-hero {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 48px;
  align-items: center;
  padding: 8px 0 30px;
  border-bottom: 1px solid var(--line);
}
.conn-hero-copy h2 {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 500;
  line-height: 1.12;
  letter-spacing: -0.025em;
  color: var(--ink);
  max-width: 15ch;
  text-wrap: balance;
}
.conn-hero-copy > p:not(.kicker):not(.conn-hero-fine) {
  margin-top: 12px;
  max-width: 47ch;
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
}
.kicker {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--faint);
}
.conn-hero-fine {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 16px;
  font-size: 11.5px;
  color: var(--muted);
}
.conn-hero-fine svg { width: 14px; height: 14px; color: var(--ok); flex: none; }

.conn-flow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 26px 154px 26px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 18px 18px 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  min-height: 172px;
}
.flow-col,
.flow-out { min-width: 0; }
.flow-tiles {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 10px 0 9px;
  max-width: 176px;
}
.flow-tile { width: 31px; height: 31px; flex: none; }
.flow-empty {
  display: grid;
  place-items: center;
  min-height: 31px;
  padding: 0 9px;
  border: 1px dashed var(--line-strong);
  border-radius: 7px;
  font-size: 11px;
  color: var(--faint);
  white-space: nowrap;
}
.flow-tile svg,
.flow-tile img { width: 100%; height: 100%; }
.flow-more {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: 7px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}
.flow-caption { font-size: 11px; color: var(--faint); }
.flow-rail {
  position: relative;
  height: 76px;
}
.flow-rail i {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  border-top: 1px dashed var(--line-strong);
}
.flow-rail i:nth-child(2) { top: 37%; }
.flow-rail i:nth-child(3) { top: 63%; }
.flow-rail::after {
  content: "";
  position: absolute;
  right: 0;
  top: calc(50% - 2.5px);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}
.flow-core {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  align-self: stretch;
  min-height: 136px;
  border: 1px solid var(--ink);
  background: var(--paper);
  text-align: center;
}
.flow-mark {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid var(--ink);
  border-radius: 50%;
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
}
.flow-core strong {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 500;
  color: var(--ink);
}
.flow-core span:last-child {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.flow-brief {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin: 10px 0 8px;
  padding: 9px 9px;
  border: 1px solid var(--line);
  background: var(--paper);
}
.fb-dot {
  width: 6px;
  height: 6px;
  margin-top: 4px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
}
.flow-brief strong {
  display: block;
  font-size: 11px;
  line-height: 1.3;
  color: var(--ink);
}
.flow-brief span:not(.fb-dot) {
  display: block;
  font-size: 11px;
  color: var(--muted);
}

/* ---------- connection toolbar, groups, cards ---------- */
.conn-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 22px;
}
.conn-toolbar .tool-search { margin-bottom: 0; }
.conn-group { margin-top: 28px; }
.conn-group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line-strong);
}
.conn-group-head h2 {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ink);
}
.conn-group-head span {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}
.conn-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.conn-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 190px;
  padding: 15px 15px 0;
  border: 1px solid var(--line);
  background: var(--surface);
  transition: border-color 0.16s ease, transform 0.16s ease;
}
.conn-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-2px);
}
.conn-card.attention { border-left: 2px solid var(--warn); }
.conn-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.conn-icon {
  width: 34px;
  height: 34px;
  flex: none;
  display: inline-block;
  vertical-align: middle;
  border-radius: 7px;
  overflow: hidden;
}
.conn-icon svg,
.conn-icon img { width: 100%; height: 100%; }
.conn-logo { display: block; object-fit: contain; }
.conn-icon.lg { width: 44px; height: 44px; border-radius: 9px; }
.conn-state {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
  padding-top: 1px;
}
.conn-state i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}
.conn-state.connected { color: var(--ok); }
.conn-state.attention { color: var(--warn); }
.conn-state.available { color: var(--faint); }
.conn-card h3 {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 4px 6px;
  margin-top: 13px;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  line-height: 1.3;
}
.conn-desc {
  margin-top: 5px;
  font-size: 11.5px;
  line-height: 1.48;
  color: var(--muted);
}
.conn-data {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}
.conn-data .cd-record { color: var(--muted); }
.conn-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: calc(100% + 30px);
  min-height: 34px;
  margin: 10px -15px 0;
  padding: 0 15px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink);
  text-align: left;
}
.conn-action:hover { background: var(--surface-2); color: var(--accent); }
.conn-action svg { width: 13px; height: 13px; color: var(--faint); }
.conn-action.attention { color: var(--warn); }
.conn-action.available { color: var(--muted); }

.conn-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 46px 16px;
  border-top: 1px solid var(--line);
  text-align: center;
}
.conn-empty > span[data-illustration] { width: 118px; opacity: 0.75; }
.conn-empty > span[data-illustration] svg { width: 100%; height: auto; }
.conn-empty h3 { font-family: var(--serif); font-size: 21px; font-weight: 500; color: var(--ink); }
.conn-empty p { font-size: 12px; color: var(--muted); }
.conn-empty .btn { margin-top: 6px; }

.conn-note {
  display: grid;
  grid-template-columns: 122px minmax(0, 1fr) auto;
  gap: 24px;
  align-items: center;
  margin-top: 40px;
  padding: 22px 0;
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line);
}
.conn-note-art { width: 112px; color: var(--muted); }
.conn-note-art svg { width: 100%; height: auto; }
.conn-note h2 {
  margin-top: 5px;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.conn-note p:not(.kicker) {
  margin-top: 5px;
  max-width: 64ch;
  font-size: 12px;
  line-height: 1.55;
  color: var(--muted);
}
.conn-mocknote,
.doc-mocknote {
  margin-top: 16px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--faint);
}

/* ---------- connection dialog ---------- */
dialog.conn-dialog {
  width: min(590px, calc(100vw - 32px));
  max-height: min(86vh, 760px);
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
  overflow: auto;
}
dialog.conn-dialog::backdrop { background: rgba(20, 18, 15, 0.55); }
.conn-dialog .dialog-body { gap: 16px; }
.conn-dialog-head {
  display: flex;
  align-items: center;
  gap: 12px;
}
.cd-health {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
}
.cd-since { font-size: 11px; color: var(--muted); margin-top: 2px; }
.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--line-strong);
  display: inline-block;
}
.dot.ok { background: var(--ok); }
.conn-perm h4 {
  margin-bottom: 7px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.perm-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.perm-chip {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 3px;
  font-size: 11px;
  color: var(--body);
  background: var(--paper);
}
.perm-chip.off { color: var(--muted); border-style: dashed; }
.conn-blurb { font-size: 12.5px; line-height: 1.55; color: var(--muted); }
.conn-alert {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px;
  border: 1px solid var(--warn);
  background: var(--warn-soft);
  color: var(--warn);
}
.conn-alert svg { width: 16px; height: 16px; flex: none; margin-top: 1px; }
.conn-alert strong { display: block; font-size: 12px; }
.conn-alert p { margin-top: 3px; font-size: 11.5px; line-height: 1.45; color: var(--body); }
.conn-history { border-top: 1px solid var(--line); }
.conn-hrow {
  display: grid;
  grid-template-columns: 1.4fr 1fr 48px;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  color: var(--muted);
}
.conn-hrow .mono { text-align: right; color: var(--faint); }
.conn-none { font-size: 11.5px; color: var(--muted); }
.conn-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  font-size: 11px;
  line-height: 1.4;
  color: var(--muted);
}
.conn-check input { margin-top: 2px; accent-color: var(--accent); }
.dialog-note { font-size: 11px; line-height: 1.45; color: var(--faint); }
.btn-quiet.danger { color: var(--accent); }
.btn-quiet.danger:hover { background: var(--accent-soft); }
.perm-row {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.perm-row:last-child { border-bottom: 0; }
.perm-n { font-family: var(--mono); font-size: 11px; color: var(--accent); padding-top: 2px; }
.perm-row strong { display: block; font-size: 12px; color: var(--ink); }
.perm-row p { margin-top: 2px; font-size: 11.5px; line-height: 1.45; color: var(--muted); }

/* ---------- document summary, register ---------- */
.docs-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(360px, 0.98fr);
  gap: 36px;
  align-items: start;
  margin-top: 4px;
}
.docs-panel { min-width: 0; border-top: 1px solid var(--ink); }
.docs-toolbar { padding: 12px 0 0; }
.doc-search { width: 100%; margin: 10px 0 8px; }
.doc-list { border-top: 1px solid var(--line); }
.doc-row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 11px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}
.doc-row:hover { background: var(--surface); }
.doc-row.active {
  background: var(--surface);
  box-shadow: inset 2px 0 0 var(--accent);
}
.doc-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 3px;
  flex: none;
}
.doc-icon svg { width: 17px; height: 17px; }
.doc-icon.notice { color: var(--accent); background: var(--accent-soft); }
.doc-icon.affidavit { color: var(--warn); background: var(--warn-soft); }
.doc-icon.release { color: var(--ok); background: var(--ok-soft); }
.doc-icon.closeout { color: var(--muted); background: var(--surface-2); }
.doc-row-main { min-width: 0; }
.doc-row-main strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink);
}
.doc-row-main small {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  color: var(--muted);
}
.doc-row-meta { display: grid; justify-items: end; gap: 4px; }
.doc-amt { font-family: var(--mono); font-size: 11px; color: var(--body); }
.doc-state {
  display: inline-flex;
  align-items: center;
  height: 19px;
  padding: 0 6px;
  border-radius: 2px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}
.doc-state.hot { background: var(--accent-soft); color: var(--accent); }
.doc-state.ok { background: var(--ok-soft); color: var(--ok); }
.doc-state.muted { background: var(--surface-2); color: var(--muted); }
.docs-foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-top: 10px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
}

/* ---------- document stage / paper ---------- */
.doc-stage {
  position: sticky;
  top: 20px;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  background: var(--surface);
}
.doc-stage-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.doc-stage-head h2 {
  margin-top: 4px;
  font-family: var(--serif);
  font-size: 23px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.paper {
  position: relative;
  margin: 14px 0 12px;
  padding: 20px 20px 16px;
  overflow: hidden;
  background: #fffdf7;
  border: 1px solid #d8cfbe;
  color: #1c1a17;
  box-shadow: 0 20px 34px -32px rgba(28, 26, 23, 0.65);
}
.paper-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.paper-brand {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--serif);
  font-size: 13px;
  font-weight: 600;
  color: #1c1a17;
}
.paper-brand .mark {
  width: 17px;
  height: 17px;
  display: grid;
  place-items: center;
  border: 1px solid #1c1a17;
  border-radius: 2px;
  font-family: var(--serif);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}
.paper-kicker {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #5a5143;
}
.paper-rule { height: 2px; background: #1c1a17; margin: 9px 0 12px; }
.paper-meta {
  display: grid;
  grid-template-columns: 1.2fr 1.2fr;
  gap: 7px 12px;
  margin-bottom: 18px;
}
.paper-meta span { font-size: 11px; line-height: 1.4; color: #4d463b; }
.paper-meta b {
  display: block;
  margin-bottom: 1px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #5a5143;
}
.paper > .paper-kicker { margin-bottom: 4px; color: #b13a1e; }
.paper h3 {
  font-family: var(--serif);
  font-size: 23px;
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: -0.02em;
  color: #1c1a17;
}
.paper-body {
  margin-top: 11px;
  font-family: var(--serif);
  font-size: 11.5px;
  line-height: 1.62;
  color: #3f392f;
}
.paper-dates {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-top: 15px;
  padding-top: 9px;
  border-top: 1px solid #ded5c5;
}
.paper-dates dt {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #5a5143;
}
.paper-dates dd { margin-top: 2px; font-size: 11px; line-height: 1.35; color: #1c1a17; }
.paper-sign {
  display: grid;
  grid-template-columns: 1.6fr 0.8fr;
  gap: 18px;
  margin-top: 28px;
}
.sig-line {
  padding-top: 5px;
  border-top: 1px solid #1c1a17;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #5a5143;
}
.paper-stamp {
  position: absolute;
  right: 16px;
  bottom: 49px;
  padding: 4px 6px;
  border: 1.5px solid #b13a1e;
  color: #b13a1e;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transform: rotate(-7deg);
  opacity: 0.82;
}
.paper-foot {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 18px;
  padding-top: 8px;
  border-top: 1px solid #ded5c5;
  font-family: var(--mono);
  font-size: 11px;
  color: #4f4638;
}
.doc-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.doc-actions .btn-quiet { margin-left: auto; }
.doc-actions .btn:disabled { opacity: 0.45; cursor: default; }
.doc-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.doc-facts span {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
}
.doc-facts strong { display: block; margin-top: 2px; font-size: 11px; font-weight: 500; color: var(--body); }

/* ---------- templates ---------- */
.doc-templates { margin-top: 42px; scroll-margin-top: 76px; }
.template-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.template-card {
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-height: 176px;
  padding: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
}
.template-icon {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  color: var(--accent);
  background: var(--accent-soft);
}
.template-icon svg { width: 17px; height: 17px; }
.template-card h3 { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.template-card p { margin-top: 3px; font-size: 11px; line-height: 1.45; color: var(--muted); }
.template-card .btn { margin-top: auto; align-self: flex-start; }
.docs-empty { margin-top: 0; }

/* ---------- responsive ---------- */
@media (max-width: 1120px) {
  .conn-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .template-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .docs-layout { grid-template-columns: 1fr; gap: 26px; }
  .doc-stage { position: static; }
  .paper { max-width: 560px; }
}
@media (max-width: 980px) {
  .conn-hero { grid-template-columns: 1fr; gap: 22px; }
  .conn-note { grid-template-columns: 92px minmax(0, 1fr); }
  .conn-note .btn { grid-column: 2; justify-self: start; }
  .conn-note-art { width: 86px; }
}
@media (max-width: 760px) {
  .conn-stats,
  .doc-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .conn-stat:nth-child(2),
  .doc-stat:nth-child(2) { border-right: 0; }
  .conn-stat:nth-child(-n + 2),
  .doc-stat:nth-child(-n + 2) { border-bottom: 1px solid var(--line); }
  .conn-flow {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 15px;
    min-height: 0;
  }
  .flow-rail { display: none; }
  .flow-tiles { max-width: none; }
  .flow-core { min-height: 94px; }
  .flow-out { border-top: 1px solid var(--line); padding-top: 11px; }
  .conn-toolbar { flex-direction: column; align-items: stretch; gap: 10px; }
  .conn-toolbar .tool-search { width: 100%; }
  .conn-grid { grid-template-columns: 1fr; }
  .conn-card { min-height: 0; }
  .conn-note { grid-template-columns: 1fr; gap: 12px; }
  .conn-note-art { width: 74px; }
  .conn-note .btn { grid-column: auto; }
  .conn-dialog { max-height: 88vh; }
  .doc-stage { padding: 13px; }
  .paper { padding: 17px 16px 14px; }
  .paper h3 { font-size: 21px; }
  .paper-meta { grid-template-columns: 1fr 1fr; }
  .paper-dates { grid-template-columns: 1fr 1fr; }
  .paper-dates div:last-child { grid-column: 1 / -1; }
  .paper-stamp { right: 12px; bottom: 44px; font-size: 8.5px; }
  .doc-actions .btn { flex: 1 1 auto; }
  .doc-actions .btn-quiet { margin-left: 0; flex: 1 1 100%; }
  .doc-facts { grid-template-columns: 1fr 1fr; }
  .template-grid { grid-template-columns: 1fr; }
  .template-card { min-height: 0; }
  .docs-foot { flex-direction: column; gap: 4px; }
  .doc-row { grid-template-columns: 30px minmax(0, 1fr) auto; padding: 10px 5px; }
  .doc-row-main strong { font-size: 12px; }
  .doc-row-meta { gap: 3px; }
  .doc-state { font-size: 11px; padding: 0 5px; }
  .doc-amt { font-size: 11px; }
}
@media (max-width: 380px) {
  .cs-num, .ds-num { font-size: 25px; }
  .conn-stat, .doc-stat { padding: 11px 10px 12px; }
  .doc-row-meta .doc-amt { display: none; }
}


/* ---------- marketing: works-with strip ---------- */
.works-band {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--rail);
}
.works-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 86px;
  padding-top: 14px;
  padding-bottom: 14px;
}
.works-copy { flex: none; }
.works-title {
  margin-top: 3px;
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 500;
  color: var(--ink);
}
.works-icons {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.works-icons > span:not(.works-more) {
  width: 30px;
  height: 30px;
  flex: none;
}
.works-icons > span svg { width: 100%; height: 100%; }
.works-more {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: 7px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}
.works-note {
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--muted);
  max-width: 26ch;
}
.works-note b { color: var(--ink); font-weight: 500; }
.works-link { margin-left: auto; flex: none; }

/* ---------- dashboard: horizon + sources ---------- */
.horizon-strip {
  display: grid;
  grid-template-columns: minmax(210px, 0.8fr) minmax(260px, 1.2fr) auto;
  gap: 26px;
  align-items: center;
  padding: 15px 0 16px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
}
.horizon-title {
  margin-top: 5px;
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.25;
  color: var(--ink);
}
.horizon-title b { font-weight: 500; color: var(--accent); }
.horizon-sub {
  margin-top: 3px;
  font-size: 11px;
  line-height: 1.4;
  color: var(--muted);
}
.horizon-art { color: var(--muted); min-width: 0; }
.horizon-art svg { width: 100%; height: auto; max-height: 78px; }
.horizon-link {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink);
  border-bottom: 1px solid var(--line-strong);
  padding-bottom: 2px;
  white-space: nowrap;
}
.horizon-link:hover { color: var(--accent); border-color: var(--accent); }
.side-conn-icons {
  display: flex;
  gap: 5px;
  align-items: center;
  margin: 9px 0 8px;
  flex-wrap: wrap;
}
.side-conn-icons > span:not(.side-conn-more) {
  width: 24px;
  height: 24px;
  flex: none;
}
.side-conn-icons > span svg,
.side-conn-icons > span img { width: 100%; height: 100%; }
.side-conn-more {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: 5px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}
.side-line .dot { margin-right: 3px; }
.side-warn { color: var(--warn); }
@media (max-width: 980px) {
  .works-inner { flex-wrap: wrap; gap: 14px 20px; }
  .works-link { margin-left: 0; }
  .works-note { max-width: none; }
  .horizon-strip { grid-template-columns: 1fr minmax(220px, 1fr); }
  .horizon-link { grid-column: 1 / -1; justify-self: start; }
}
@media (max-width: 760px) {
  .works-inner { flex-direction: column; align-items: flex-start; gap: 10px; padding: 16px 20px; }
  .works-icons { gap: 8px; }
  .works-icons > span:not(.works-more) { width: 27px; height: 27px; }
  .works-more { width: 27px; height: 27px; }
  .works-note { font-size: 11px; }
  .horizon-strip {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 13px 0 14px;
    margin-bottom: 20px;
  }
  .horizon-art { display: none; }
  .horizon-link { grid-column: auto; }
}


/* ---------- command palette ---------- */
.search-btn {
  appearance: none;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}
.palette {
  width: min(620px, calc(100vw - 32px));
  max-width: 620px;
  margin: 11vh auto auto;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 24px 80px rgba(30, 24, 16, 0.22);
  overflow: hidden;
}
.palette::backdrop {
  background: rgba(28, 24, 18, 0.38);
  backdrop-filter: blur(2px);
}
.palette-box { display: flex; flex-direction: column; }
.palette-field {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 54px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}
.palette-field input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: 400 15px/1.2 var(--sans);
}
.palette-field input::placeholder { color: var(--faint); }
.palette-field kbd,
.palette-foot kbd {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 1px 4px;
  background: var(--surface);
}
.palette-results {
  max-height: min(53vh, 430px);
  overflow-y: auto;
  padding: 6px;
}
.palette-row {
  width: 100%;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto 18px;
  gap: 9px;
  align-items: center;
  padding: 8px 8px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.palette-row.active { background: var(--surface); }
.pr-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--paper);
  color: var(--ink);
}
.pr-copy { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.pr-copy strong {
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pr-copy span {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pr-kind {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}
.pr-enter { color: var(--faint); font-family: var(--mono); font-size: 11px; opacity: 0; }
.palette-row.active .pr-enter { opacity: 1; }
.palette-empty {
  padding: 26px 18px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}
.palette-foot {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 14px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 11px;
}
.palette-foot span:last-child { margin-left: auto; }
.palette-foot kbd { margin-right: 2px; }
@media (max-width: 760px) {
  .palette { margin-top: 7vh; width: calc(100vw - 20px); }
  .palette-field { height: 50px; }
  .palette-results { max-height: 62vh; }
  .palette-foot span:last-child { display: none; }
  .pr-kind { display: none; }
  .palette-row { grid-template-columns: 30px minmax(0, 1fr) 18px; }
}


/* ---------- Calendar + Reports (visual expansion, 2026-10-25) ---------- */

.cal-stats,
.rep-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--line);
  margin: 2px 0 22px;
}

.cal-stat {
  min-width: 0;
  padding: 14px 16px 15px;
  border-right: 1px solid var(--line);
}

.cal-stat:first-child { padding-left: 0; }
.cal-stat:last-child { border-right: 0; padding-right: 0; }

.cal-stat .cs-num { display: block; font-family: var(--serif); font-size: 30px; line-height: 1; letter-spacing: -0.03em; color: var(--ink); }
.cal-stat .cs-money { font-family: var(--mono); font-size: 21px; letter-spacing: -0.03em; }
.cal-stat .cs-label { display: block; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-bottom: 7px; }
.cal-stat .cs-note { display: block; margin-top: 7px; font-size: 11px; color: var(--muted); line-height: 1.35; }

.cal-toolbar,
.rep-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.cal-monthnav { display: flex; align-items: center; gap: 4px; }
.cal-monthnav .btn-quiet { margin-left: 8px; }
.cal-monthlabel { font-family: var(--serif); font-size: 20px; font-weight: 500; letter-spacing: -0.02em; margin: 0 6px; min-width: 148px; }
.cal-monthnav .icon-btn .flip { transform: rotate(180deg); }
.cal-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.seg { display: inline-flex; align-items: center; gap: 2px; border: 1px solid var(--line); border-radius: 3px; padding: 2px; background: var(--surface); }
.segbtn { height: 26px; padding: 0 10px; font-size: 11px; color: var(--muted); border-radius: 2px; white-space: nowrap; }
.segbtn:hover { color: var(--ink); }
.segbtn.active { background: var(--ink); color: var(--paper); }

.cal-layout { display: grid; grid-template-columns: minmax(0, 1fr) 292px; gap: 26px; align-items: start; }
.cal-month { border: 1px solid var(--line); border-radius: 5px; background: var(--surface); overflow: hidden; }
.cal-weekdays { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-bottom: 1px solid var(--line); background: var(--rail); }
.cal-weekdays span { font-family: var(--mono); font-size: 11px; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); padding: 9px 8px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-cell { min-height: 106px; padding: 7px 8px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 5px; text-align: left; background: transparent; color: var(--ink); position: relative; }
.cal-cell:nth-child(7n) { border-right: 0; }
.cal-cell:nth-last-child(-n + 7) { border-bottom: 0; }
.cal-cell:hover { background: var(--surface-2); }
.cal-cell.out { color: var(--faint); background: var(--paper); }
.cal-cell.out .cal-daynum { opacity: 0.55; }
.cal-cell.today .cal-daynum { color: var(--paper); background: var(--accent); }
.cal-cell.selected { box-shadow: inset 0 0 0 2px var(--ink); }
.cal-cell.selected.today { box-shadow: inset 0 0 0 2px var(--accent); }
.cal-daynum { width: 20px; height: 20px; display: grid; place-items: center; font-family: var(--mono); font-size: 11px; border-radius: 50%; flex: none; }
.cal-events { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-event { display: flex; align-items: center; gap: 5px; min-width: 0; padding: 2.5px 5px; border-radius: 2px; font-size: 11px; line-height: 1.25; color: var(--ink); }
.cal-event i { width: 4px; height: 4px; border-radius: 50%; background: currentColor; flex: none; }
.cal-event span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-event.lien { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.cal-event.notice { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); }
.cal-event.insurance { color: #315b7d; background: color-mix(in srgb, #315b7d 12%, transparent); }
.cal-event.license { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.cal-event.signature { color: #625088; background: color-mix(in srgb, #625088 12%, transparent); }
.cal-more { font-family: var(--mono); font-size: 11px; color: var(--muted); padding-left: 4px; }
.cal-list { display: flex; flex-direction: column; }
.cal-list-date { font-family: var(--mono); font-size: 11px; letter-spacing: 0.05em; color: var(--muted); text-transform: uppercase; padding: 13px 14px 6px; border-top: 1px solid var(--line); }
.cal-list-date:first-child { border-top: 0; }
.cal-list-row { display: grid; grid-template-columns: 92px minmax(0, 1fr) 58px 14px; align-items: center; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--line); text-align: left; }
.cal-list-row:hover { background: var(--surface-2); }
.clr-title { display: grid; gap: 2px; min-width: 0; }
.clr-title strong { font-size: 12.5px; font-weight: 500; }
.clr-title span { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clr-amt { font-family: var(--mono); font-size: 11px; text-align: right; }
.cal-empty { padding: 34px 18px; display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12.5px; }
.cal-empty svg { width: 18px; height: 18px; }

.cal-side { border-top: 1px solid var(--ink); padding-top: 14px; }
.cal-side-head h2 { font-family: var(--serif); font-size: 24px; font-weight: 500; letter-spacing: -0.025em; line-height: 1.1; }
.cal-side-head p:not(.kicker) { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.cal-side-head .kicker { margin-bottom: 8px; font-size: 11px; }
.cal-day-list { margin: 14px 0 0; }
.day-event { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 11px 0; border-top: 1px solid var(--line); width: 100%; text-align: left; }
.day-event:hover strong { color: var(--accent); }
.day-event strong { font-size: 12.5px; font-weight: 500; line-height: 1.3; }
.day-event > span:not(.cal-kind):not(.day-amt) { font-size: 11px; color: var(--muted); }
.day-amt { font-family: var(--mono); font-size: 11px; color: var(--ink); }
.day-event .link { font-size: 11px; display: inline-flex; align-items: center; gap: 4px; margin-top: 1px; }
.cal-empty-copy { font-size: 11.5px; color: var(--muted); padding: 10px 0 4px; }
.cal-kind { display: inline-flex; align-items: center; gap: 5px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.cal-kind i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.cal-kind.lien { color: var(--accent); }
.cal-kind.notice { color: var(--warn); }
.cal-kind.insurance { color: #315b7d; }
.cal-kind.license { color: var(--ok); }
.cal-kind.signature { color: #625088; }
.cal-legend { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.cal-legend-title { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 2px; }
.cal-legend span { display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--body); }
.cal-legend .lg { width: 7px; height: 7px; border-radius: 50%; }
.lg.lien { background: var(--accent); }
.lg.notice { background: var(--warn); }
.lg.insurance { background: #315b7d; }
.lg.license { background: var(--ok); }
.cal-side-note { display: flex; gap: 9px; align-items: flex-start; margin-top: 16px; padding: 11px 12px; background: var(--surface-2); border-radius: 3px; color: var(--muted); }
.cal-side-note svg { width: 15px; height: 15px; flex: none; margin-top: 1px; }
.cal-side-note p { font-size: 11px; line-height: 1.45; }
.cal-side-note b { color: var(--ink); font-weight: 500; }

.cal-types { margin-top: 38px; border-top: 1px solid var(--ink); padding-top: 18px; }
.cal-types-head,
.rep-sec-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 14px; }
.cal-types-head h2,
.rep-sec-head h2 { font-family: var(--serif); font-size: 25px; font-weight: 500; letter-spacing: -0.025em; }
.cal-types-head .kicker,
.rep-sec-head .kicker { margin-bottom: 7px; font-size: 11px; }
.cal-types-head .link { font-size: 11.5px; white-space: nowrap; padding-top: 3px; }
.cal-type-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.cal-type { padding: 15px 16px 16px; border-right: 1px solid var(--line); }
.cal-type:first-child { padding-left: 0; }
.cal-type:last-child { border-right: 0; padding-right: 0; }
.ct-mark { font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; }
.ct-mark.lien { color: var(--accent); }
.ct-mark.notice { color: var(--warn); }
.ct-mark.insurance { color: #315b7d; }
html[data-theme="dark"] .ct-mark.insurance { color: #8fc3e8; }
.ct-mark.license { color: var(--ok); }
.cal-type h3 { font-size: 13px; font-weight: 500; margin: 7px 0 5px; }
.cal-type p { font-size: 11.5px; line-height: 1.5; color: var(--muted); min-height: 50px; }
.ct-meta { display: block; margin-top: 9px; font-family: var(--mono); font-size: 11px; color: var(--faint); border-top: 1px solid var(--line); padding-top: 7px; }
.cal-mocknote { margin-top: 18px; font-size: 11px; color: var(--faint); max-width: 72ch; }

/* Calendar dialog fields */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field > span { font-size: 11px; font-weight: 500; color: var(--muted); }

/* Reports */
.rep-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.rep-card { border: 1px solid var(--line); border-radius: 5px; background: var(--surface); padding: 15px 15px 13px; min-height: 272px; display: flex; flex-direction: column; gap: 7px; cursor: pointer; transition: border-color 0.15s ease, transform 0.15s ease; }
.rep-card:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.rep-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.rc-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rc-tag { font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.rc-open { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; color: var(--muted); opacity: 0; transition: opacity 0.15s ease; }
.rc-open svg { width: 11px; height: 11px; }
.rep-card:hover .rc-open { opacity: 1; }
.rep-card h3 { font-family: var(--serif); font-size: 20px; font-weight: 500; letter-spacing: -0.02em; line-height: 1.15; }
.rep-card > p { font-size: 11.5px; line-height: 1.45; color: var(--muted); min-height: 34px; }
.rc-viz { flex: 1; display: flex; flex-direction: column; align-items: stretch; justify-content: flex-end; min-height: 104px; color: var(--ink); }
.rc-bars { display: flex; align-items: flex-end; gap: 7px; width: 100%; height: 104px; }
.rc-bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 5px; }
.rc-bar b { display: block; width: 100%; background: color-mix(in srgb, var(--ink) 12%, var(--surface)); border-top: 2px solid color-mix(in srgb, var(--ink) 46%, var(--line-strong)); min-height: 8px; }
.rc-bar.now b { background: color-mix(in srgb, var(--accent) 24%, var(--surface)); border-top-color: var(--accent); }
.rc-bar i { font-family: var(--mono); font-size: 11px; font-weight: 500; font-style: normal; color: var(--body); }
.rc-line { width: 100%; height: 104px; display: block; }
.rc-axis { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 11px; color: var(--muted); margin-top: 2px; }
.rc-hbars { width: 100%; display: flex; flex-direction: column; gap: 7px; }
.rc-hrow { display: grid; grid-template-columns: 86px minmax(0, 1fr) 30px; align-items: center; gap: 6px; }
.rc-hrow i { font-size: 11px; font-style: normal; color: var(--body); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rc-hrow b { height: 7px; background: var(--surface-2); display: block; }
.rc-hrow u { display: block; height: 100%; background: var(--ink); text-decoration: none; }
.rc-hrow em { font-family: var(--mono); font-size: 11px; font-style: normal; text-align: right; color: var(--muted); }
.rc-donut { display: flex; align-items: center; gap: 16px; width: 100%; }
.rc-donut svg { width: 96px; height: 96px; color: var(--accent); flex: none; }
.rc-donut div { display: flex; flex-direction: column; gap: 3px; }
.rc-donut b { font-family: var(--serif); font-size: 28px; font-weight: 500; letter-spacing: -0.03em; line-height: 1; }
.rc-donut span { font-size: 11px; color: var(--muted); max-width: 12ch; line-height: 1.35; }
.rc-list { width: 100%; display: flex; flex-direction: column; }
.rc-list > div { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); }
.rc-list > div:first-child { border-top: 0; }
.rc-list span { display: grid; gap: 1px; min-width: 0; }
.rc-list b { font-size: 11px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rc-list i { font-size: 11px; font-style: normal; color: var(--muted); }
.rc-list em { font-family: var(--mono); font-size: 11px; font-style: normal; white-space: nowrap; }
.rc-foot { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; border-top: 1px solid var(--line); padding-top: 8px; margin-top: 2px; }
.rc-foot strong { font-family: var(--serif); font-size: 23px; font-weight: 500; letter-spacing: -0.03em; line-height: 1; }
.rc-foot span { font-family: var(--mono); font-size: 11px; color: var(--muted); text-align: right; }

.rep-sec-note { font-size: 11px; color: var(--faint); padding-top: 4px; }
.scheduled { margin-top: 34px; }
.sched-table { border-top: 1px solid var(--ink); }
.sched-row { display: grid; grid-template-columns: 22px minmax(0, 1.5fr) minmax(0, 1fr) 110px 38px; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.sched-mark { color: var(--muted); display: flex; }
.sched-mark svg { width: 15px; height: 15px; }
.sched-name { display: grid; gap: 2px; min-width: 0; }
.sched-name strong { font-size: 12.5px; font-weight: 500; }
.sched-name span { font-size: 11px; color: var(--muted); }
.sched-to { font-size: 11px; color: var(--body); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sched-next { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.sched-row .switch { border: 0; padding: 0; cursor: pointer; background: var(--line-strong); }

.library { margin-top: 34px; }
.lib-search { display: flex; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 3px; padding: 0 9px; background: var(--surface); height: 32px; min-width: 200px; }
.lib-search svg { width: 13px; height: 13px; color: var(--muted); }
.lib-search input { border: 0; background: transparent; font: inherit; font-size: 11.5px; width: 100%; outline: none; color: var(--ink); }
.lib-table { border-top: 1px solid var(--ink); }
.lib-head,
.lib-row { display: grid; grid-template-columns: minmax(0, 2fr) 92px 105px 112px 62px 28px; align-items: center; gap: 10px; }
.lib-head { padding: 8px 0; border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: 11px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }
.lib-row { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 11.5px; color: var(--body); }
.lib-name { display: grid; gap: 2px; min-width: 0; }
.lib-name b { font-size: 12px; font-weight: 500; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-name i { font-family: var(--mono); font-size: 11px; font-style: normal; color: var(--muted); }
.lib-size { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.lib-dl { width: 26px; height: 26px; }
.lib-dl svg { width: 14px; height: 14px; }

.rep-dialog { width: min(720px, calc(100vw - 32px)); }
.rep-dialog .dialog-body { max-height: 62vh; overflow: auto; }
.rd-big { height: 210px; display: flex; align-items: flex-end; border-bottom: 1px solid var(--line); padding: 8px 0 14px; color: var(--ink); }
.rd-big .rc-bars { height: 190px; }
.rd-big .rc-line { height: 190px; }
.rd-big .rc-donut { justify-content: center; }
.rd-big .rc-donut svg { width: 150px; height: 150px; }
.rd-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.rd-facts > div { padding: 11px 14px 12px; border-right: 1px solid var(--line); }
.rd-facts > div:first-child { padding-left: 0; }
.rd-facts > div:last-child { border-right: 0; }
.rd-facts span { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 4px; }
.rd-facts b { font-family: var(--serif); font-size: 20px; font-weight: 500; letter-spacing: -0.02em; }
.rd-table { margin-top: 14px; }
.rd-head,
.rd-row { display: grid; grid-template-columns: 90px minmax(0, 1fr) 52px 72px; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 11px; }
.rd-head { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.rd-row span:last-child { font-family: var(--mono); font-size: 11px; text-align: right; }

@media (max-width: 1180px) {
  .cal-layout { grid-template-columns: minmax(0, 1fr) 260px; gap: 18px; }
  .rep-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cal-type-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cal-type:nth-child(2) { border-right: 0; }
  .cal-type:nth-child(3) { padding-left: 0; border-top: 1px solid var(--line); }
  .cal-type:nth-child(4) { border-top: 1px solid var(--line); }
}

@media (max-width: 980px) {
  .cal-layout { grid-template-columns: 1fr; }
  .cal-side { border-top: 0; border-left: 1px solid var(--line); padding: 0 0 0 16px; }
  .cal-side-head { border-top: 1px solid var(--ink); padding-top: 12px; }
  .cal-day-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; }
  .cal-legend { flex-direction: row; flex-wrap: wrap; gap: 6px 16px; }
  .cal-legend-title { width: 100%; }
  .cal-side-note { max-width: 420px; }
}

@media (max-width: 760px) {
  .cal-stats,
  .rep-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cal-stat { padding: 12px 10px; }
  .cal-stat:nth-child(2n) { border-right: 0; }
  .cal-stat:nth-child(n + 3) { border-top: 1px solid var(--line); }
  .cal-stat:nth-child(odd) { padding-left: 0; }
  .cal-stat .cs-num { font-size: 26px; }
  .cal-stat .cs-money { font-size: 18px; }
  .cal-toolbar { gap: 10px; }
  .cal-monthnav { width: 100%; justify-content: space-between; }
  .cal-monthlabel { min-width: 0; font-size: 18px; }
  .cal-controls { width: 100%; justify-content: space-between; }
  .cal-controls .filters { flex: 1; }
  .cal-view { flex: none; }
  .cal-cell { min-height: 74px; padding: 5px 4px; gap: 4px; }
  .cal-weekdays span { font-size: 11px; padding: 7px 2px; text-align: center; letter-spacing: 0.04em; }
  .cal-daynum { width: 17px; height: 17px; font-size: 11px; }
  .cal-events { flex-direction: row; flex-wrap: wrap; gap: 3px; }
  .cal-event { padding: 0; background: none !important; width: auto; }
  .cal-event i { width: 6px; height: 6px; }
  .cal-event span { display: none; }
  .cal-more { font-size: 11px; padding: 0; }
  .cal-side { border-left: 0; border-top: 1px solid var(--ink); padding: 12px 0 0; }
  .cal-day-list { grid-template-columns: 1fr; }
  .cal-type-grid { grid-template-columns: 1fr; }
  .cal-type { padding: 13px 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .cal-type:first-child { padding-left: 0; }
  .cal-type:nth-child(3) { border-top: 0; }
  .cal-type p { min-height: 0; }
  .cal-types-head { flex-direction: column; gap: 8px; }
  .rep-grid { grid-template-columns: 1fr; }
  .rep-card { min-height: 250px; }
  .rep-sec-head { flex-direction: column; gap: 8px; }
  .sched-row { grid-template-columns: 18px minmax(0, 1fr) 38px; gap: 8px; }
  .sched-to,
  .sched-next { display: none; }
  .lib-head { display: none; }
  .lib-row { grid-template-columns: minmax(0, 1fr) 28px; gap: 6px; }
  .lib-row > span:not(.lib-name),
  .lib-row > button { display: none; }
  .lib-row > button { display: flex; }
  .lib-search { width: 100%; }
  .rd-facts { grid-template-columns: 1fr; }
  .rd-facts > div { padding: 8px 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .rd-facts > div:last-child { border-bottom: 0; }
  .rd-big { height: 160px; }
  .rd-big .rc-bars,
  .rd-big .rc-line { height: 150px; }
  .rd-big .rc-donut svg { width: 120px; height: 120px; }
  .rd-head,
  .rd-row { grid-template-columns: 70px minmax(0, 1fr) 42px 58px; }
}

/* Calendar + Reports refinements after visual review */
.cal-view { margin-left: 6px; }
.cal-view .segbtn.active { background: transparent; color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); }
.cal-event { align-items: flex-start; font-size: 11px; }
.cal-event i { margin-top: 3px; }
.cal-event span { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.2; }
.cal-events { overflow: hidden; }
.cal-upnext { display: none; }
.cal-next { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.cal-next-title { font-family: var(--mono); font-size: 11px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); margin-bottom: 5px; }
.cal-next-row { display: flex; align-items: baseline; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); width: 100%; text-align: left; }
.cal-next-row:first-of-type { border-top: 0; }
.cal-next-row b { font-family: var(--mono); font-size: 11px; font-weight: 500; flex: none; width: 46px; }
.cal-next-row span { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-next-row:hover span { color: var(--ink); }

.lg.today { background: var(--accent); }

.rc-open { opacity: 0.55; }
.rep-card:hover .rc-open { opacity: 1; }
.rc-plot { display: flex; gap: 7px; width: 100%; height: 104px; align-items: stretch; }
.rc-scale { display: flex; flex-direction: column; justify-content: space-between; font-family: var(--mono); font-size: 11px; font-weight: 500; color: var(--body); padding: 1px 0 17px; flex: none; text-align: right; }
.rc-scale span:first-child { color: var(--ink); font-weight: 600; }
.rc-plot .rc-bars { height: auto; }
.rc-axis { justify-content: space-between; gap: 8px; }
.rc-axis span:nth-child(2) { color: var(--faint); }
.rc-line { overflow: visible; }
.sched-head { display: grid; grid-template-columns: 22px minmax(0, 1.5fr) minmax(0, 1fr) 110px 38px; align-items: center; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: 11px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }

@media (max-width: 760px) {
  .cal-page .page-head,
  .rep-page .page-head { flex-direction: column; gap: 12px; margin-bottom: 14px; }
  .cal-page .page-title,
  .rep-page .page-title { font-size: 28px; line-height: 1.1; }
  .cal-page .page-sub,
  .rep-page .page-sub { display: none; }
  .cal-page .head-actions,
  .rep-page .head-actions { width: 100%; padding-top: 0; gap: 8px; }
  .cal-page .head-actions .btn,
  .rep-page .head-actions .btn { flex: 1; justify-content: center; height: 40px; }
  .cal-page .cal-stat .cs-note { display: none; }
  .cal-page .cal-stat { padding: 9px 10px 10px; }
  .cal-page .cal-stat .cs-num { font-size: 23px; }
  .cal-page .cal-stat .cs-label { font-size: 11px; margin-bottom: 4px; }
  .cal-page .cal-stats { margin-bottom: 12px; }
  .cal-page .cal-monthnav { display: grid; grid-template-columns: 34px minmax(0, 1fr) 34px auto auto; align-items: center; gap: 2px; }
  .cal-page .cal-monthlabel { text-align: center; font-size: 17px; margin: 0; }
  .cal-page .cal-monthnav .btn-quiet { margin-left: 0; padding: 0 6px; }
  .cal-page .cal-view { margin-left: 2px; }
  .cal-page .cal-controls { width: 100%; }
  .cal-page .cal-controls .filters { width: 100%; flex-wrap: wrap; overflow-x: visible; row-gap: 6px; }
  .cal-page .cal-controls .filter { flex: none; min-height: 36px; }
  .cal-page .cal-upnext { display: flex; gap: 5px; overflow-x: auto; scrollbar-width: none; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 7px 0; margin-bottom: 10px; align-items: stretch; }
  .cal-page .cal-upnext::-webkit-scrollbar { display: none; }
  .upnext-label { font-family: var(--mono); font-size: 11px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); white-space: nowrap; align-self: center; padding-right: 3px; }
  .upnext-item { display: grid; grid-template-columns: auto auto; gap: 1px 5px; align-items: center; border-left: 1px solid var(--line); padding: 2px 8px; min-width: 150px; text-align: left; }
  .upnext-item:first-of-type { border-left: 0; }
  .upnext-item .cal-kind { grid-column: 1 / -1; }
  .upnext-item b { font-family: var(--mono); font-size: 11px; font-weight: 500; }
  .upnext-item > span:last-child { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .cal-next { display: none !important; }
  .cal-page .cal-cell { min-height: 70px; }
  .rep-page .rep-stats { margin-bottom: 12px; }
  .rep-page .cal-stat .cs-note { display: none; }
  .rep-page .cal-stat { padding: 9px 10px 10px; }
  .rep-page .cal-stat .cs-num { font-size: 23px; }
  .rep-page .rep-toolbar { gap: 8px; margin-bottom: 12px; }
  .rep-page .rep-toolbar .filters { width: 100%; flex-wrap: wrap; overflow-x: visible; row-gap: 6px; }
  .rep-page .rep-toolbar .filter { flex: none; min-height: 36px; }
  .rep-page .rep-toolbar .filters { gap: 4px; }
  .rep-page .rep-toolbar .filter { padding: 0 8px; font-size: 11px; }
  .rep-page .rep-toolbar .seg { align-self: flex-end; }
  .rep-page .rep-card { min-height: 0; }
  .rep-page .rc-viz { min-height: 110px; margin: 2px 0; }
  .sched-head { grid-template-columns: 18px minmax(0, 1fr) 38px; gap: 8px; }
  .sched-head span:nth-child(3),
  .sched-head span:nth-child(4) { display: none; }
}

/* Mobile tab bar: six destinations incl. Calendar + More */
.mobile-tabs button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 5px 2px;
  font-size: 11px;
  color: var(--muted);
  border-radius: 4px;
  background: transparent;
  border: 0;
}
.mobile-tabs button svg { width: 18px; height: 18px; }
.mobile-tabs button.active { color: var(--ink); }
.mobile-tabs button.active svg { color: var(--accent); }
.mobile-tabs a, .mobile-tabs button { min-width: 0; }
.mobile-tabs a { font-size: 11px; }
.mobile-tabs button { font-size: 11px; }

.sched-row .switch[aria-checked="true"] { background: var(--ok); }

@media (max-width: 760px) {
  .upnext-item { min-width: 178px; }
  .upnext-item > span:last-child { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.2; }
  .upnext-item { align-items: start; }
  .mobile-tabs { padding-left: 4px; padding-right: 4px; }
  .mobile-tabs a, .mobile-tabs button { gap: 2px; padding: 5px 0; }
  .mobile-tabs a svg, .mobile-tabs button svg { width: 17px; height: 17px; }
}

@media (max-width: 760px) {
  .cal-page .cal-event span { display: none !important; }
  .cal-page .cal-event { background: none !important; padding: 0; width: auto; gap: 0; }
  .cal-page .cal-event i { width: 6px; height: 6px; margin-top: 0; }
  .cal-page .cal-events { flex-direction: row; flex-wrap: wrap; gap: 3px; align-items: center; }
  .cal-page .cal-more { font-size: 11px; padding: 0; }
  .rep-page .rc-axis { font-size: 11px; color: var(--body); }
  .rep-page .rc-scale { font-size: 11px; color: var(--body); }
  .rep-page .rc-bar i { font-size: 11px; }
  .rep-page .rc-hrow i { font-size: 11px; }
  .rep-page .rc-open { opacity: 0.75; font-size: 11px; }
}

.cal-cell.today .cal-daynum { background: var(--ink); color: var(--paper); }
.cal-cell.selected.today { box-shadow: inset 0 0 0 2px var(--ink); }
.lg.today { background: var(--ink); }

/* Dark-mode readability for the new surfaces */
html[data-theme="dark"] .cal-event.insurance,
html[data-theme="dark"] .cal-kind.insurance { color: #83b7da; }
html[data-theme="dark"] .cal-event.license,
html[data-theme="dark"] .cal-kind.license { color: #9bd4ae; }
html[data-theme="dark"] .cal-event.signature,
html[data-theme="dark"] .cal-kind.signature { color: #c0ace9; }
html[data-theme="dark"] .cal-event.lien,
html[data-theme="dark"] .cal-kind.lien { color: #f0835d; }
html[data-theme="dark"] .cal-event.notice,
html[data-theme="dark"] .cal-kind.notice { color: #ecc06f; }
html[data-theme="dark"] .rc-bar b { background: #383229; border-top-color: #8f8475; }
html[data-theme="dark"] .rc-bar.now b { background: color-mix(in srgb, var(--accent) 22%, transparent); border-top-color: var(--accent); }
html[data-theme="dark"] .cal-cell.out { background: #12110f; }
html[data-theme="dark"] .cal-weekdays { background: #1e1b17; }
html[data-theme="dark"] .cal-stat .cs-label,
html[data-theme="dark"] .cs-label { color: #bdb3a3; }
html[data-theme="dark"] .rc-axis,
html[data-theme="dark"] .rc-scale,
html[data-theme="dark"] .rc-bar i,
html[data-theme="dark"] .rc-hrow i,
html[data-theme="dark"] .rc-hrow em { color: #b8ae9f; }

/* Notification centre */
.notif-btn { position: relative; }
.notif-dot { position: absolute; top: 7px; right: 7px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--paper); }
.notif-dialog { width: min(510px, calc(100vw - 28px)); padding: 0; border: 1px solid var(--line-strong); border-radius: 5px; background: var(--surface); color: var(--body); box-shadow: var(--shadow); }
.notif-dialog::backdrop { background: rgba(28, 24, 18, 0.36); backdrop-filter: blur(2px); }
.notif-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 18px 20px 14px; border-bottom: 1px solid var(--line); }
.notif-head .kicker { margin-bottom: 5px; font-size: 11px; }
.notif-head h2 { font-family: var(--serif); font-size: 24px; font-weight: 500; letter-spacing: -0.025em; line-height: 1.1; color: var(--ink); }
.notif-list { display: flex; flex-direction: column; }
.notif-row { display: grid; grid-template-columns: 48px minmax(0, 1fr) 74px; align-items: start; gap: 10px; padding: 13px 20px; border-bottom: 1px solid var(--line); text-decoration: none; }
.notif-row:hover { background: var(--surface-2); }
.notif-row > span:nth-child(2) { display: grid; gap: 2px; min-width: 0; }
.notif-row b { font-size: 12.5px; font-weight: 500; color: var(--ink); line-height: 1.3; }
.notif-row i { font-size: 11px; font-style: normal; color: var(--muted); line-height: 1.4; }
.notif-row time { font-family: var(--mono); font-size: 11px; color: var(--faint); text-align: right; padding-top: 2px; }
.notif-row:not(.unread) b { color: var(--body); font-weight: 400; }
.notif-kind { font-family: var(--mono); font-size: 11px; letter-spacing: 0.05em; text-transform: uppercase; padding-top: 3px; }
.notif-kind.lien { color: var(--accent); }
.notif-kind.notice { color: var(--warn); }
.notif-kind.insurance { color: #315b7d; }
.notif-kind.license { color: var(--ok); }
html[data-theme="dark"] .notif-kind.insurance { color: #83b7da; }
.notif-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 20px 13px; }
.notif-count { font-family: var(--mono); font-size: 11px; color: var(--muted); }
@media (max-width: 760px) {
  .notif-row { grid-template-columns: 40px minmax(0, 1fr); padding: 12px 16px; }
  .notif-row time { grid-column: 2; text-align: left; padding-top: 0; }
  .notif-head { padding: 16px 16px 12px; }
  .notif-foot { padding: 10px 16px 12px; }
}

@media (max-width: 360px) {
  .topbar { padding-left: 10px; padding-right: 10px; }
  .top-actions { gap: 4px; }
  .top-actions .icon-btn { width: 32px; height: 32px; min-width: 32px; min-height: 32px; }
  .top-actions .search-btn { width: 32px; min-width: 32px; }
  .top-actions a.icon-btn[aria-label="Help"] { display: none; }
}

.works-app { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 46px; }
.works-app > span:first-child { width: 28px; height: 28px; display: block; }
.works-app svg,
.works-app img { width: 100%; height: 100%; }
.works-app i { font-family: var(--mono); font-size: 11px; font-style: normal; color: var(--muted); letter-spacing: 0.01em; white-space: nowrap; }
.works-icons { align-items: flex-start; gap: 10px; }
.works-more { align-self: center; margin-top: 0; }
@media (max-width: 980px) { .works-app i { font-size: 11px; } }
@media (max-width: 760px) { .works-icons { gap: 8px; } .works-app { min-width: 44px; } }

.works-app i { font-size: 11px; color: var(--body); }
.works-note { font-size: 12px; }
.works-link { font-size: 12px; }

html[data-theme="dark"] .notif-row i { color: #c9bfaf; }
html[data-theme="dark"] .notif-row time { color: #b2a898; }
html[data-theme="dark"] .notif-count { color: #c2b8a8; }
html[data-theme="dark"] .notif-head .kicker { color: #bdb3a3; }

.lg.selected { background: transparent; border: 1px solid var(--ink); }
.rc-bar i { font-size: 11px; }
.rc-hrow { grid-template-columns: 86px minmax(0, 1fr) 34px; }


/* ============================================================
   POLISH PASS 2 — 2026-10-25
   Topbar alignment, tighter connections, legible documents.
   ============================================================ */

/* topbar content aligns with the 1240px page grid */
.topbar {
  padding-left: max(40px, calc((100vw - 232px - 1240px) / 2 + 40px));
  padding-right: max(40px, calc((100vw - 232px - 1240px) / 2 + 40px));
}

/* active nav mark sits inside the pill, not on the rail border */
.nav a.active::before {
  left: 0;
  top: 8px;
  bottom: 8px;
  border-radius: 2px;
}

/* ---------- connections: summary controls + urgency ---------- */
.conn-stats { margin: 2px 0 18px; }
button.conn-stat {
  appearance: none;
  font: inherit;
  color: inherit;
  text-align: left;
  background: transparent;
  border: 0;
  border-right: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}
button.conn-stat:hover { background: var(--surface); }
button.conn-stat:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }
button.conn-stat[aria-pressed="true"] {
  background: var(--surface);
  box-shadow: inset 0 -2px 0 var(--accent);
}
.conn-urgent {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  margin: 0 0 4px;
  padding: 11px 13px;
  border: 1px solid var(--warn);
  background: var(--warn-soft);
}
.conn-urgent[hidden] { display: none !important; }
.cu-icon { color: var(--warn); display: grid; place-items: center; }
.cu-icon svg { width: 17px; height: 17px; }
.cu-copy strong { display: block; font-size: 12px; color: var(--ink); }
.cu-copy p { margin-top: 2px; font-size: 11.5px; line-height: 1.4; color: var(--body); }
.conn-urgent .btn { flex: none; }

/* keep filters in reach on a long list */
.conn-toolbar {
  position: sticky;
  top: 58px;
  z-index: 18;
  margin-top: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.conn-toolbar .tool-search { height: 32px; }

/* compact, four-up cards; attention cards explain themselves */
.conn-hero {
  grid-template-columns: minmax(0, 0.86fr) minmax(0, 1.14fr);
  gap: 40px;
  padding: 2px 0 24px;
}
.conn-hero-copy h2 { font-size: 27px; max-width: 17ch; }
.conn-hero-copy > p:not(.kicker):not(.conn-hero-fine) { margin-top: 10px; font-size: 12.5px; }
.conn-hero-fine { margin-top: 12px; }
.conn-flow { min-height: 156px; padding: 14px 16px; }
.conn-group { margin-top: 22px; }
.conn-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.conn-card {
  min-height: 0;
  padding: 14px 14px 0;
}
.conn-card.attention {
  border-left: 2px solid var(--warn);
  background: linear-gradient(180deg, var(--warn-soft), var(--surface) 58%);
}
.conn-desc { flex: 1; min-height: 34px; }
.conn-data { margin-top: 10px; }
.conn-why {
  margin-top: 7px;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.35;
  letter-spacing: 0.02em;
  color: var(--warn);
}
.conn-action {
  width: calc(100% + 28px);
  margin-left: -14px;
  margin-right: -14px;
  padding-left: 14px;
  padding-right: 14px;
}
.conn-action.attention {
  color: var(--warn);
  font-weight: 600;
  background: color-mix(in srgb, var(--warn-soft) 55%, transparent);
}
.conn-action.attention svg { color: var(--warn); }

/* ---------- documents: due dates, expandable paper, history ---------- */
.doc-stage { top: 78px; }
.dsh-right { display: flex; align-items: center; gap: 7px; flex: none; }
.doc-zoom-btn { width: 28px; height: 28px; }
.doc-zoom-btn svg { width: 14px; height: 14px; }
.doc-row-due {
  color: var(--faint) !important;
  font-family: var(--mono);
  letter-spacing: 0.01em;
}
.doc-row-due.hot { color: var(--accent) !important; }
.doc-row-main small + small { margin-top: 1px; }
.doc-row-meta { gap: 5px; }
.doc-history {
  margin-top: 16px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
}
.dh-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.dh-head h3 {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.dh-head span { font-size: 11px; color: var(--faint); }
.dh-list { margin-top: 9px; }
.dh-list li {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  position: relative;
  min-height: 25px;
  font-size: 11px;
  color: var(--body);
}
.dh-list li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 18px;
  bottom: -7px;
  width: 1px;
  background: var(--line);
}
.dh-list li:last-child::before { display: none; }
.dh-list li i {
  width: 7px;
  height: 7px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  z-index: 1;
}
.dh-list li.now i { background: var(--accent); border-color: var(--accent); }
.dh-list li.now span { color: var(--ink); font-weight: 500; }
.dh-list li em { font-style: normal; font-family: var(--mono); font-size: 11px; color: var(--faint); white-space: nowrap; }

/* the paper itself gets a little more presence */
.paper { padding: 22px 22px 17px; }
.paper-brand { font-size: 14px; }
.paper-brand .mark { font-size: 9px; }
.paper h3 { font-size: 24px; }
.paper-body { font-size: 12px; line-height: 1.58; }
.paper-meta span { font-size: 10px; }
.paper-dates dd { font-size: 10px; }
.paper-foot { font-size: 8.5px; }

/* status sits in the paper header, never over the legal text */
.paper-top-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.paper-stamp {
  position: static;
  max-width: none;
  padding: 2px 5px;
  border: 1px solid var(--line-strong);
  font-family: var(--mono);
  font-size: 8.5px;
  line-height: 1.2;
  text-align: center;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 1;
  transform: none;
  pointer-events: none;
}
.paper-stamp.signature { color: var(--accent); border-color: var(--accent); }
.paper-stamp.filed { color: var(--ok); border-color: var(--ok); }
.paper-stamp.ready { color: var(--ok); border-color: var(--line-strong); }

/* full-size preview dialog */
dialog.doc-zoom-dialog {
  width: min(780px, calc(100vw - 30px));
  max-height: 92vh;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 30px 90px rgba(20, 18, 15, 0.4);
  overflow: auto;
}
dialog.doc-zoom-dialog::backdrop { background: rgba(20, 18, 15, 0.58); backdrop-filter: blur(2px); }
.dz-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 15px 18px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.dz-head h2 { margin-top: 3px; font-family: var(--serif); font-size: 24px; font-weight: 500; color: var(--ink); }
.dz-body { padding: 18px; background: var(--paper); }
.dz-body .paper { max-width: none; margin: 0; padding: 34px 36px 26px; }
.dz-body .paper h3 { font-size: 34px; }
.dz-body .paper-body { font-size: 15px; line-height: 1.6; }
.dz-body .paper-meta span { font-size: 12px; }
.dz-body .paper-dates dd { font-size: 12px; }
.dz-body .paper-brand { font-size: 17px; }
.dz-body .paper-brand .mark { width: 22px; height: 22px; font-size: 11px; }
.dz-body .paper-kicker { font-size: 9px; }
.dz-body .paper-foot { font-size: 9px; color: #332e26; font-weight: 500; }
.dz-body .paper-stamp { font-size: 9px; padding: 3px 7px; }
.dz-foot { padding: 0 18px 14px; font-family: var(--mono); font-size: 11px; color: var(--faint); }

@media (max-width: 1120px) {
  .conn-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .topbar { padding-left: 28px; padding-right: 28px; }
}
@media (max-width: 900px) {
  .topbar { padding-left: max(28px, calc((100vw - 1240px) / 2 + 28px)); padding-right: max(28px, calc((100vw - 1240px) / 2 + 28px)); }
}
@media (max-width: 980px) {
  .conn-hero { grid-template-columns: 1fr; gap: 22px; }
  .conn-urgent { grid-template-columns: 18px minmax(0, 1fr); }
  .conn-urgent .btn { grid-column: 2; justify-self: start; }
}
@media (max-width: 760px) {
  .topbar { padding-left: 16px; padding-right: 16px; }
  .conn-toolbar { position: static; padding: 8px 0; }
  .conn-grid { grid-template-columns: 1fr; }
  .conn-card { min-height: 0; }
  .conn-hero { padding-top: 0; }
  .conn-hero-copy h2 { font-size: 25px; }
  .conn-urgent { align-items: start; padding: 10px 11px; }
  .conn-urgent .btn { grid-column: 2; margin-top: 2px; }
  .doc-zoom-dialog { width: calc(100vw - 18px); }
  .dz-body { padding: 10px; }
  .dz-body .paper { padding: 20px 17px 16px; }
  .dz-body .paper h3 { font-size: 25px; }
  .dz-body .paper-body { font-size: 12.5px; }
  .dz-body .paper-meta { grid-template-columns: 1fr 1fr; }
  .dz-body .paper-stamp { font-size: 8.5px; }
  .doc-stage .doc-row-due { font-size: 11px; }
}


/* clickable document stats, list header, action gate */
button.doc-stat {
  appearance: none;
  font: inherit;
  color: inherit;
  text-align: left;
  background: transparent;
  border: 0;
  border-right: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}
button.doc-stat:hover { background: var(--surface); }
button.doc-stat:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }
button.doc-stat[aria-pressed="true"] { background: var(--surface); box-shadow: inset 0 -2px 0 var(--accent); }

.doc-list-head {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  gap: 10px;
  padding: 7px 8px;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--faint);
}
.doc-list-head span:nth-child(3) { text-align: right; }

.doc-actions { margin: 12px 0 0; }
.doc-gate {
  min-height: 14px;
  margin: 6px 0 0;
  font-size: 11px;
  line-height: 1.4;
  color: var(--muted);
}
.doc-actions .btn:disabled { cursor: not-allowed; }
.doc-stage .paper { margin-top: 12px; }
.fact-wide { grid-column: 1 / -1; }
.dh-current {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
  font-size: 11px;
  color: var(--body);
}
.dh-current span {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--faint);
}
.dh-current strong { font-weight: 500; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dh-current em { font-style: normal; font-family: var(--mono); font-size: 11px; color: var(--accent); }

@media (max-width: 900px) {
  .doc-list-head { display: none; }
}
@media (max-width: 760px) {
  .paper-top-right { max-width: 55%; }
  .paper-stamp { font-size: 8.5px; padding: 1px 4px; }
  .doc-actions { margin-top: 9px; }
  .doc-actions .btn-quiet { margin-left: 0; }
  .doc-gate { font-size: 11px; }
}


/* document register: four real columns */
.doc-row {
  grid-template-columns: 32px minmax(0, 1fr) 96px auto;
  grid-template-areas: "icon main due meta";
  align-items: center;
}
.doc-icon { grid-area: icon; }
.doc-row-main { grid-area: main; }
.doc-row-due {
  grid-area: due;
  align-self: center;
  color: var(--faint) !important;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.doc-row-due.hot { color: var(--accent) !important; }
.doc-row-meta { grid-area: meta; }
.doc-list-head { grid-template-columns: 32px minmax(0, 1fr) 96px auto; }
.doc-list-head span:nth-child(3) { text-align: left; }
.doc-list-head span:nth-child(4) { text-align: right; }
.doc-state.ready { background: color-mix(in srgb, var(--line) 55%, transparent); color: var(--body); }

/* filing confirmation */
dialog.file-dialog {
  width: min(410px, calc(100vw - 28px));
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 30px 90px rgba(20, 18, 15, 0.4);
}
dialog.file-dialog::backdrop { background: rgba(20, 18, 15, 0.5); backdrop-filter: blur(2px); }
.fd-body { padding: 20px; }
.fd-body h2 { margin-top: 4px; font-family: var(--serif); font-size: 25px; font-weight: 500; letter-spacing: -0.02em; }
.fd-body > p:not(.eyebrow) { margin-top: 8px; font-size: 12px; line-height: 1.5; color: var(--body); }
.fd-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

@media (max-width: 900px) {
  .doc-list-head { display: none; }
}
@media (max-width: 760px) {
  .doc-row {
    grid-template-columns: 32px minmax(0, 1fr) auto;
    grid-template-areas: "icon main meta" "icon due meta";
    align-items: start;
  }
  .doc-row-due { margin-top: 2px; font-size: 11px; }
  .doc-row-meta { align-self: center; }
}


/* final content polish — metadata labels, clickable stats, expand label */
.conn-data b {
  display: block;
  margin-bottom: 2px;
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}
.conn-hero {
  margin-top: 40px;
  padding-top: 26px;
  border-top: 1px solid var(--ink);
}
button.doc-stat { position: relative; padding-bottom: 26px; }
button.doc-stat::after {
  content: "Filter";
  position: absolute;
  left: 12px;
  bottom: 7px;
  padding: 1px 4px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: var(--surface);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  opacity: 0.85;
}
button.doc-stat:hover::after, button.doc-stat[aria-pressed="true"]::after { opacity: 1; }
.doc-amt { justify-self: end; }
.doc-zoom-btn { width: auto; height: 30px; padding: 0 8px; gap: 5px; font-size: 11px; }
.doc-zoom-btn svg { width: 12px; height: 12px; }
.page-sub { max-width: 68ch; text-wrap: pretty; }
.paper-body { font-size: 13px; }
@media (max-width: 760px) {
  .conn-hero { margin-top: 28px; padding-top: 18px; }
  button.doc-stat { padding-bottom: 22px; }
  .doc-zoom-btn { font-size: 11px; }
}


/* dark-mode readability pass */
html[data-theme="dark"] {
  --body: #ddd6c9;
  --muted: #d0c5b4;
  --faint: #c4b9a8;
  --line: #3a342c;
  --line-strong: #5a5043;
}
html[data-theme="dark"] .filter.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: #f0b7a2;
}
html[data-theme="dark"] .filter.active .n { color: inherit; }
html[data-theme="dark"] .conn-urgent {
  background: #332917;
  border-color: #8a642e;
}
html[data-theme="dark"] .conn-card.attention {
  border-left-color: var(--warn);
  background: linear-gradient(180deg, #2c2416, var(--surface) 58%);
}
html[data-theme="dark"] .paper {
  background: #f4efe4;
  border-color: #4f473a;
  box-shadow: none;
}
html[data-theme="dark"] .paper-body { color: #332f28; }
html[data-theme="dark"] .doc-state.ready { background: #3b352c; color: #d8d1c4; }
html[data-theme="dark"] .doc-stat::after { background: var(--surface-2); }


/* dark-mode small-text floor */
html[data-theme="dark"] .cs-note,
html[data-theme="dark"] .ds-note { color: #d8cdbc; }
html[data-theme="dark"] .conn-data b,
html[data-theme="dark"] .conn-group-head span,
html[data-theme="dark"] .conn-state.available { color: #d4c9b8; }
html[data-theme="dark"] .conn-note p,
html[data-theme="dark"] .conn-hero-copy > p,
html[data-theme="dark"] .conn-hero-fine { color: #d0c5b4; }
html[data-theme="dark"] .conn-mocknote,
html[data-theme="dark"] .doc-mocknote,
html[data-theme="dark"] .doc-list-head,
html[data-theme="dark"] .docs-foot,
html[data-theme="dark"] .doc-gate { color: #c9bead; }
html[data-theme="dark"] .doc-facts span,
html[data-theme="dark"] .dh-head h3,
html[data-theme="dark"] .dh-list li em,
html[data-theme="dark"] .dh-current span { color: #cdc2b1; }
html[data-theme="dark"] .filter {
  background: #24211d;
  border-color: #4a4339;
  color: #d0c5b4;
}
html[data-theme="dark"] .filter .n { opacity: 0.9; }
html[data-theme="dark"] .filter.active { background: var(--accent-soft); border-color: var(--accent); color: #f0b7a2; }


/* mobile control sizing and single-line filter rails */
@media (max-width: 760px) {
  /* Chips wrap instead of scrolling off-screen: every filter stays visible. */
  .filters {
    flex-wrap: wrap;
    overflow-x: visible;
    max-width: 100%;
    row-gap: 6px;
    padding-bottom: 0;
  }
  .filters { gap: 6px; }
  .filter {
    flex: none;
    min-height: 36px;
    padding: 0 8px;
    font-size: 11px;
  }
  .doc-state { height: 22px; font-size: 11px; font-weight: 600; }
  .doc-row { padding: 12px 8px; }
  .doc-stage { scroll-margin-top: 68px; }
  .doc-zoom-btn { min-height: 40px; }
  .conn-action { min-height: 40px; }
  .conn-note .btn, .conn-urgent .btn { min-height: 40px; }
  .doc-stat::after { font-size: 11px; }
}

@media (max-width: 760px) {
  button.doc-stat::after { display: none; }
  button.doc-stat { padding-bottom: 16px; }
}

.doc-stage .paper-foot { font-size: 9px; color: #332e26; font-weight: 500; }

.horizon-art svg text { font-size: 11px; }
.side-meta.side-warn { color: var(--warn); }

@media (max-width: 760px) {
  .page-head .head-actions { flex-wrap: wrap; }
  .page-head .head-actions .btn { flex: 1 1 auto; min-width: 0; }
  .conn-toolbar .filters { flex-wrap: wrap; overflow: visible; row-gap: 6px; }
  .doc-stage { scroll-margin-top: 84px; }
  .paper-foot { flex-wrap: wrap; gap: 4px 10px; }
}

/* ---------- Automations: dense controls, popovers, bulk edit ---------- */
.auto-toolbar {
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 18px;
  padding-bottom: 0;
}
.auto-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  padding-bottom: 6px;
}
.auto-tools .tool-search {
  margin-bottom: 0;
}
.tool-menu-wrap {
  position: relative;
}
.filter-ctl {
  height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  color: var(--body);
  font-size: 12px;
}
.filter-ctl .fcount {
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 16px;
  text-align: center;
}
.filter-ctl .chev svg {
  width: 12px;
  height: 12px;
  transform: rotate(90deg);
}
.filter-pop {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 60;
  width: 244px;
  padding: 10px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface);
  box-shadow: 0 16px 40px rgba(34, 30, 24, 0.14);
}
.pop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 1px 2px 8px;
  font-size: 12px;
}
.pop-head strong {
  font-weight: 500;
  color: var(--ink);
}
.pop-field {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 5px 2px;
  font-size: 11px;
  color: var(--muted);
}
.pop-field select {
  height: 30px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--paper);
  color: var(--ink);
  font-size: 11.5px;
  padding: 0 6px;
}
.pop-radio {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 2px 2px;
  border-top: 1px solid var(--line);
  margin-top: 6px;
  font-size: 11.5px;
  color: var(--body);
  cursor: pointer;
}
.pop-radio input {
  accent-color: var(--ink);
}
.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}
.active-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--body);
  font-size: 11px;
}
.active-chip svg {
  width: 11px;
  height: 11px;
  color: var(--faint);
}
.bulkbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface);
  font-size: 11.5px;
}
.bulkbar strong {
  font-weight: 500;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.bulkbar .link {
  font-size: 11px;
}
.bulk-sep {
  width: 1px;
  height: 18px;
  background: var(--line);
  margin: 0 2px;
}
.btn-xs {
  height: 28px;
  padding: 0 8px;
  font-size: 11px;
  gap: 4px;
}
.btn-xs svg {
  width: 12px;
  height: 12px;
}
.bulk-sched select {
  height: 28px;
  max-width: 164px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--paper);
  color: var(--body);
  font-size: 11px;
  padding: 0 5px;
}
.bulkbar .tiny {
  width: 28px;
  height: 28px;
  margin-left: auto;
}
.bulkbar .tiny svg {
  width: 13px;
  height: 13px;
}
.check.bulk-mode {
  cursor: default;
}
.bulk-check {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  accent-color: var(--ink);
}
.check.bulk-mode {
  position: relative;
  padding-left: 32px;
}
.check.selected {
  background: var(--warn-soft);
}
.check-menu {
  width: 22px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  color: var(--faint);
  opacity: 0.55;
}
.check:hover .check-menu,
.check-menu:focus-visible,
.check-menu[aria-expanded="true"] {
  opacity: 1;
  background: var(--warn-soft);
  color: var(--ink);
}
.check-menu svg {
  width: 15px;
  height: 15px;
}
.check-state {
  gap: 5px;
}
.popmenu {
  position: fixed;
  z-index: 120;
  min-width: 188px;
  padding: 4px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface);
  box-shadow: 0 18px 48px rgba(30, 26, 20, 0.2);
}
.popmenu [role="menuitem"] {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 32px;
  padding: 0 8px;
  border-radius: 3px;
  color: var(--body);
  font-size: 12px;
  text-align: left;
}
.popmenu [role="menuitem"]:hover,
.popmenu [role="menuitem"]:focus-visible {
  background: var(--warn-soft);
  color: var(--ink);
}
.popmenu [role="menuitem"] svg {
  width: 14px;
  height: 14px;
  color: var(--muted);
  flex: none;
}
.pop-sep {
  height: 1px;
  margin: 4px 3px;
  background: var(--line);
}
#check-pop {
  min-width: 196px;
}

/* Detail page: tabs, quick controls, overflow menu */
.detail-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.dtab {
  height: 34px;
  padding: 0 10px;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.dtab span {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
}
.dtab.active {
  color: var(--ink);
  font-weight: 500;
  border-bottom-color: var(--ink);
}
.dtab.active span {
  color: var(--muted);
}
.state-chip {
  display: inline-flex;
  border-radius: 999px;
  padding: 0;
  min-height: 28px;
}
.state-chip .chip {
  cursor: pointer;
}
.state-chip:hover .chip {
  filter: brightness(0.96);
}
.check-more {
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
}
.check-more:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}
.check-more svg {
  width: 16px;
  height: 16px;
}
.side-more {
  margin-top: 8px;
}
.side-more summary {
  cursor: pointer;
  font-size: 11px;
  color: var(--muted);
  list-style: none;
  padding: 6px 0;
}
.side-more summary::-webkit-details-marker {
  display: none;
}
.side-more summary::before {
  content: "+ ";
  font-family: var(--mono);
}
.side-more[open] summary::before {
  content: "− ";
}
.quick-controls {
  border-top: 1px solid var(--line);
}
.qc-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.qc-row b {
  display: block;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.35;
}
.qc-row small {
  display: block;
  margin-top: 1px;
  font-size: 11px;
  color: var(--muted);
}
.qc-row .switch {
  width: 28px;
  height: 17px;
}
.qc-row .switch::after {
  width: 13px;
  height: 13px;
}
.qc-row .switch[aria-checked="true"]::after {
  transform: translateX(11px);
}
.sd-check-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 0 14px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.sd-check-icon {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--warn-soft);
  border-radius: 3px;
  color: var(--ink);
  flex: none;
}
.sd-check-icon svg {
  width: 17px;
  height: 17px;
}
.sd-check-copy {
  min-width: 0;
  flex: 1;
}
.sd-check-copy strong {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}
.sd-check-copy p {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}
@media (max-width: 1120px) {
  .check-cols,
  .check {
    grid-template-columns: minmax(0, 1fr) 108px 62px 84px;
  }
  .check-last,
  .check-cols span:nth-child(3) {
    display: none;
  }
}
@media (max-width: 760px) {
  .auto-toolbar {
    align-items: stretch;
  }
  .tabs {
    order: 1;
    width: 100%;
    overflow-x: auto;
  }
  .auto-tools {
    order: 2;
    width: 100%;
    margin-left: 0;
    gap: 6px;
  }
  .auto-tools .tool-search {
    flex: 1 1 auto;
    width: auto;
  }
  .filter-ctl {
    height: 42px;
  }
  .filter-pop {
    right: auto;
    left: 0;
    width: min(280px, calc(100vw - 40px));
  }
  .bulkbar {
    position: sticky;
    bottom: calc(66px + env(safe-area-inset-bottom));
    z-index: 30;
    gap: 6px;
  }
  .bulkbar .bulk-sep,
  .bulkbar .link {
    display: none;
  }
  .bulk-sched select {
    max-width: 128px;
  }
  .check {
    grid-template-columns: minmax(0, 1fr) 96px;
  }
  .check-state {
    gap: 3px;
  }
  .check-menu {
    width: 24px;
    opacity: 0.8;
  }
  .check.bulk-mode {
    padding-left: 30px;
  }
  .detail-tabs {
    overflow-x: auto;
  }
  .dtab {
    min-height: 42px;
    white-space: nowrap;
  }
  .check-more {
    width: 34px;
    height: 34px;
  }
}

/* Dark mode floors for the new chrome */
[data-theme="dark"] .filter-pop,
[data-theme="dark"] .popmenu,
[data-theme="dark"] .bulkbar {
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
}
[data-theme="dark"] .active-chip,
[data-theme="dark"] .filter-ctl {
  background: var(--surface);
}
/* Detail page hierarchy: one settings entry point, mobile back, urgency */
.back-btn {
  display: none;
}
.match-row.urgent .match-date .left {
  color: var(--accent);
  font-weight: 500;
}
.match-row.urgent .match-date b::after {
  content: "";
  display: inline-block;
  width: 4px;
  height: 4px;
  margin-left: 5px;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: 2px;
}
#dpanel-rules .rule-note {
  margin-top: 2px;
}
@media (max-width: 760px) {
  .back-btn {
    display: inline-flex;
    order: -1;
    margin-right: auto;
  }
  .detail-head .head-actions {
    width: 100%;
  }
  #customize {
    margin-left: auto;
  }
}
.compact-rows .check-desc,
.compact-rows .kit-head p {
  display: none;
}
.compact-rows .check {
  padding-top: 9px;
  padding-bottom: 9px;
}
.compact-rows .check-name {
  line-height: 1.3;
}
/* ---------- Connections: density, per-app menus, paused/default states ---------- */
.conn-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}
.density-toggle {
  height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.density-toggle svg {
  width: 13px;
  height: 13px;
}
.density-toggle.active {
  color: var(--ink);
  border-color: var(--line-strong);
  background: var(--surface-2);
}
.conn-card-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}
.conn-default {
  flex: none;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--line));
  border-radius: 999px;
  padding: 2px 5px;
  line-height: 1;
}
.conn-menu {
  width: 22px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  color: var(--faint);
  opacity: 0.55;
}
.conn-menu svg {
  width: 15px;
  height: 15px;
}
.conn-card:hover .conn-menu,
.conn-menu:focus-visible,
.conn-menu[aria-expanded="true"] {
  opacity: 1;
  color: var(--ink);
  background: var(--warn-soft);
}
.conn-card.is-default {
  border-color: var(--line-strong);
}
.conn-card.paused {
  background: var(--surface);
}
.conn-card.paused h3,
.conn-card.paused .conn-desc {
  opacity: 0.66;
}
.conn-state.paused {
  color: var(--muted);
}
.conn-card.paused .conn-state i {
  background: var(--faint);
}
.conn-compact .conn-grid {
  gap: 8px;
}
.conn-compact .conn-card {
  min-height: 0;
  padding: 12px 14px 0;
}
.conn-compact .conn-desc {
  display: none;
}
.conn-compact .conn-card h3 {
  margin-top: 9px;
}
.conn-compact .conn-data {
  margin-top: 8px;
  padding-top: 7px;
}
.conn-compact .conn-action {
  margin-top: 8px;
}
.conn-compact .conn-group {
  margin-top: 20px;
}
.conn-pop {
  width: 268px;
  padding: 5px;
}
.conn-pop-head {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 7px 9px;
  margin-bottom: 3px;
  border-bottom: 1px solid var(--line);
}
.conn-pop-head .conn-icon {
  width: 30px;
  height: 30px;
  border-radius: 6px;
}
.conn-pop-head div {
  min-width: 0;
}
.conn-pop-head strong {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.conn-pop-head small {
  display: block;
  margin-top: 1px;
  font-size: 11px;
  color: var(--muted);
}
.conn-pop .pop-field {
  grid-template-columns: 42px minmax(0, 1fr);
  padding: 6px 8px;
  border-top: 1px solid var(--line);
  margin-top: 3px;
}
.conn-pop .pop-field select {
  height: 27px;
  font-size: 11px;
}
.pop-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 40px;
  padding: 6px 8px;
  border-radius: 3px;
  text-align: left;
}
.pop-toggle:hover,
.pop-toggle:focus-visible {
  background: var(--warn-soft);
}
.pop-toggle .pt-copy {
  min-width: 0;
}
.pop-toggle b {
  display: block;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink);
}
.pop-toggle small {
  display: block;
  margin-top: 1px;
  font-size: 11px;
  line-height: 1.3;
  color: var(--muted);
}
.pop-toggle .switch {
  width: 28px;
  height: 17px;
}
.pop-toggle .switch::after {
  width: 13px;
  height: 13px;
}
.pop-toggle .switch[aria-checked="true"]::after {
  transform: translateX(11px);
}
.danger-item {
  color: var(--accent) !important;
}
.danger-item svg {
  color: var(--accent) !important;
}
[data-theme="dark"] .conn-pop-head strong,
[data-theme="dark"] .pop-toggle b {
  color: var(--ink);
}
[data-theme="dark"] .conn-pop {
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
}
@media (max-width: 760px) {
  .conn-tools {
    width: 100%;
  }
  .conn-tools .tool-search {
    flex: 1 1 auto;
  }
  .density-toggle {
    height: 42px;
  }
  .conn-menu {
    width: 30px;
    height: 30px;
    opacity: 0.9;
  }
  .conn-pop {
    width: min(300px, calc(100vw - 24px));
  }
}
@media (max-width: 760px) {
  .conn-tools .density-toggle {
    padding: 0 9px;
    font-size: 11px;
  }
  .conn-menu {
    position: relative;
    width: 32px;
    height: 32px;
  }
  #sync-all {
    min-height: 44px;
  }
}
/* Customize dialog: field grid, switch stack, advanced disclosure */
#settings-dialog {
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
}
#settings-dialog[open] {
  display: flex;
  flex-direction: column;
}
#settings-dialog .dialog-head,
#settings-dialog .dialog-foot {
  flex: none;
}
#settings-dialog .dialog-body {
  min-height: 0;
  overflow-y: auto;
}
.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.switch-stack {
  display: grid;
  margin-top: 2px;
  border-top: 1px solid var(--line);
}
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 48px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.switch-row > span {
  display: block;
  min-width: 0;
}
.switch-row b {
  display: block;
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.35;
  color: var(--ink);
}
.switch-row small {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  line-height: 1.35;
  color: var(--muted);
}
.switch-row .switch {
  width: 32px;
  height: 19px;
}
.switch-row .switch::after {
  width: 15px;
  height: 15px;
}
.switch-row .switch[aria-checked="true"]::after {
  transform: translateX(13px);
}
.advanced {
  border-top: 1px solid var(--line);
  padding-top: 2px;
}
.advanced summary {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  cursor: pointer;
  font-size: 11.5px;
  color: var(--muted);
  list-style: none;
}
.advanced summary::-webkit-details-marker {
  display: none;
}
.advanced summary .adv-chev {
  display: inline-flex;
  width: 14px;
  height: 14px;
  margin-left: auto;
  color: var(--faint);
}
.advanced summary .adv-chev svg {
  width: 14px;
  height: 14px;
  transform: rotate(90deg);
  transition: transform 0.15s ease;
}
.advanced[open] summary .adv-chev svg {
  transform: rotate(-90deg);
}
.advanced summary [data-icon] {
  display: inline-flex;
  width: 15px;
  height: 15px;
  color: var(--muted);
}
.advanced summary svg {
  width: 15px;
  height: 15px;
}
.advanced[open] summary {
  color: var(--ink);
}
.advanced .field-grid {
  padding: 4px 0 10px;
}
@media (max-width: 760px) {
  .field-grid {
    grid-template-columns: 1fr;
  }
  #settings-dialog {
    width: calc(100vw - 20px);
    max-height: calc(100dvh - 20px);
  }
}
/* Mobile detail polish */
a.match-row {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}
a.match-row:hover,
a.match-row:focus-visible {
  background: var(--surface-2);
}
.back-btn svg {
  transform: rotate(180deg);
}
.side-more summary {
  min-height: 34px;
  display: flex;
  align-items: center;
}
@media (max-width: 760px) {
  .back-btn {
    width: 44px;
    height: 44px;
  }
  .check-more {
    width: 40px;
    height: 40px;
  }
  .dtab {
    min-height: 44px;
  }
  .side-more summary {
    min-height: 44px;
  }
}
/* Paused rows read as paused at a glance, not just an off switch. */
.check.off {
  background: color-mix(in srgb, var(--warn-soft) 26%, transparent);
}
.check.off .check-name,
.check.off .check-sched {
  color: var(--muted);
}
.check-menu {
  opacity: 0.72;
}


/* imported source summary (connections detail) */
.conn-source-file {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-2);
  margin: 0 0 16px;
}
.conn-source-file .conn-icon { width: 26px; height: 26px; border-radius: 5px; }
.conn-source-file > div { min-width: 0; }
.conn-source-file span:not(.conn-icon) {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted);
}
.conn-source-file strong {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.conn-source-file small { display: block; font-size: 11px; color: var(--muted); }

/* consent hint */
.conn-hint {
  margin: 7px 0 0;
  font-size: 11px;
  color: var(--warn);
  min-height: 16px;
}

/* connected source name on cards */
.conn-source-name {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: -3px 0 9px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.conn-source-name svg { width: 11px; height: 11px; flex: none; }
/* custom checkbox for review options */
.checkline input {
  appearance: none;
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: var(--surface);
  display: inline-grid;
  place-content: center;
  margin: 0;
  flex: none;
}
.checkline input:checked {
  background: var(--accent);
  border-color: var(--accent);
}
.checkline input:checked::after {
  content: "";
  width: 7px;
  height: 4px;
  border-left: 1.5px solid #fff;
  border-bottom: 1.5px solid #fff;
  transform: rotate(-45deg) translate(0, -1px);
}

/* ---------- Final polish: readable labels, compact calendar, stable logos ---------- */

/* The tool strip used to squeeze every app into a 30px box, so labels sat on top
   of each other. Let each app take the space its label needs and wrap cleanly. */
.works-icons {
  height: auto;
  min-height: 46px;
  align-items: flex-start;
  row-gap: 12px;
}
.works-icons > span.works-app {
  width: auto;
  height: auto;
  min-width: 58px;
}
.works-app i {
  font-size: 11px;
  line-height: 1.2;
  text-align: center;
}

/* Table headers carry real reading weight. */
.jobs-table th {
  font-size: 11px;
  letter-spacing: 0.055em;
  color: var(--body);
}
.jobs-table .c-status { white-space: nowrap; }

/* Connection states need to be legible at a glance. */
.conn-state {
  font-size: 11px;
  letter-spacing: 0.025em;
}
.conn-state.available { color: var(--muted); }
.conn-default {
  color: var(--muted);
  border-color: var(--line-strong);
  background: var(--surface-2);
}
.conn-menu { opacity: 0.72; }

/* The stat cards are filters; keep the row quiet and let hover/press show it. */
button.doc-stat { padding-bottom: 14px; }
button.doc-stat::after { display: none; }
.doc-list-head {
  font-size: 11px;
  color: var(--muted);
}

/* Supporting copy under tables and settings. */
.side-meta { color: var(--body); }

/* Calendar: the whole month should be visible at 1440 x 900. One event chip
   plus a count keeps every row the same height and makes the dots scannable. */
@media (min-width: 900px) and (min-height: 760px) {
  .cal-page .page-head { margin-bottom: 14px; }
  .cal-page .page-title { font-size: clamp(32px, 3.2vw, 42px); line-height: 1.08; }
  .cal-page .page-sub { font-size: 12.5px; line-height: 1.5; max-width: 720px; }
  .cal-page .cal-stats { padding: 12px 0; margin-bottom: 16px; }
  .cal-page .cal-stat .cs-num { font-size: 24px; }
  .cal-page .cal-stat .cs-label { margin-bottom: 4px; }
  .cal-page .cal-stat .cs-note { margin-top: 4px; font-size: 11px; }
  .cal-page .cal-toolbar { margin-bottom: 12px; }
  .cal-page .cal-grid { grid-auto-rows: 74px; }
  .cal-page .cal-cell {
    height: 74px;
    min-height: 0;
    overflow: hidden;
    padding: 6px 8px;
    gap: 4px;
  }
  .cal-page .cal-weekdays span { font-size: 11px; color: var(--body); }
  .cal-page .cal-event { font-size: 11px; padding: 2px 4px; }
  .cal-page .cal-event span { line-height: 1.15; }
  .cal-page .cal-legend {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 12px;
    margin-top: 12px;
    padding-top: 10px;
  }
  .cal-page .cal-legend-title { grid-column: 1 / -1; margin-bottom: 0; }
  .cal-page .cal-next { margin-top: 10px; padding-top: 8px; }
  .cal-page .cal-next-row { padding: 5px 0; }
  .cal-page .cal-side-note { margin-top: 10px; padding: 9px 10px; }
}

@media (max-width: 760px) {
  .cal-page .cal-grid { grid-auto-rows: 72px; }
  .cal-page .cal-cell { height: 72px; min-height: 0; overflow: hidden; }
  .cal-page .cal-upnext { scroll-snap-type: x proximity; }
  .cal-page .upnext-item { scroll-snap-align: start; }

  .works-icons {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px 8px;
    width: 100%;
  }
  .works-icons > span.works-app { width: 100%; min-width: 0; }
  .works-more { justify-self: start; align-self: center; }

  /* Four filters become a deliberate 2 x 2 block instead of an orphaned row. */
  .conn-toolbar .filters {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    gap: 6px;
    overflow: visible;
  }
  .conn-toolbar .filters .filter {
    justify-content: center;
    width: 100%;
    min-height: 36px;
  }
}

@media (max-width: 520px) {
  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .hero-actions .btn {
    flex: none;
    width: 100%;
    height: 46px;
    min-height: 46px;
    padding: 0 18px;
    justify-content: center;
  }
}

/* Dark mode: lift the quiet labels without flattening the hierarchy. */
html[data-theme="dark"] .cal-daynum { color: #e7decf; opacity: 1; }
html[data-theme="dark"] .cal-cell.out .cal-daynum { opacity: 0.42; }
html[data-theme="dark"] .cal-cell.selected { box-shadow: inset 0 0 0 2px var(--accent); }
html[data-theme="dark"] .cal-cell.selected.today { box-shadow: inset 0 0 0 2px var(--accent); }
html[data-theme="dark"] .cal-weekdays span { color: #cfc4b2; }
html[data-theme="dark"] .cal-more { color: #d4c9b8; }
html[data-theme="dark"] .cal-next-row span { color: #cfc4b2; }
html[data-theme="dark"] .conn-state.available { color: #d8cdbb; }
html[data-theme="dark"] .qc-row small,
html[data-theme="dark"] .side-meta { color: #c9bfae; }
html[data-theme="dark"] .jobs-table th { color: #d8cdbb; }
html[data-theme="dark"] button.doc-stat::after { color: #f0a177; border-color: #6b6153; }

/* live report empty state */
.rc-empty {
  display: flex;
  text-wrap: pretty;
  align-items: center;
  justify-content: center;
  min-height: 112px;
  padding: 14px;
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.5;
  text-align: center;
}

/* --- automation settings dialog: real controls only --- */
.dialog-group { padding: 16px 0; border-top: 1px solid var(--line); }
.dialog-group:first-child { border-top: 0; padding-top: 4px; }
.dialog-group h3 { margin: 0 0 10px; font: 600 11px/1.2 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.set-note { margin: 0 0 4px; font-size: 12px; line-height: 1.5; color: var(--muted); }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 9px 0; }
.set-row b { display: block; font-size: 13px; font-weight: 550; color: var(--ink); }
.set-row small { display: block; margin-top: 2px; font-size: 11px; line-height: 1.45; color: var(--muted); }
.set-val { font-size: 12.5px; font-weight: 600; color: var(--ink); text-align: right; white-space: nowrap; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 10px; }
.dialog-group .lead-chips { display: flex; flex-wrap: wrap; gap: 7px; padding: 10px 0 2px; }
.dialog-group .lead { height: 30px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); color: var(--body); font: 500 11.5px/1 var(--sans); cursor: pointer; }
.dialog-group .lead:hover { border-color: var(--ink); color: var(--ink); }
.dialog-group .lead[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
@media (max-width: 640px) { .dialog-group .lead { height: 40px; } }
/* Automation detail history holds the one real server run: three columns. */
@media (min-width: 761px) {
  #dpanel-history .hrow { grid-template-columns: 104px minmax(0, 1fr) 72px; }
}
.qc-row .link { font-size: 11px; white-space: nowrap; }
.set-note a { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }

/* Mobile touch targets: keep icon and compact actions tappable at 390px */
@media (max-width: 640px) {
  .icon-btn, .search-btn, .theme-btn, .conn-menu { min-width: 44px; min-height: 44px; }
  .btn, .btn-sm, .filter, .conn-action { min-height: 44px; }
  .segbtn, .dialog-group .lead { height: 44px; }
  .brand { min-height: 44px; display: inline-flex; align-items: center; }
  .switch::before { inset: -13px -6px; }
  .rw-mark::before { content: ""; position: absolute; inset: -7px -5px; }
  .mobile-tabs a, .mobile-tabs button { min-height: 52px; font-size: 11px; color: var(--body); }
  .mobile-tabs a.active, .mobile-tabs button.active { color: var(--ink); }
}

/* Phone reading floor for live metadata: nothing decision-bearing below 10.5px */
@media (max-width: 640px) {
  .kicker { font-size: 11px; letter-spacing: .12em; }
  .eyebrow { font-size: 11px; }
  .ts-label, .ts-sub { font-size: 11.5px; }
  .tc-head .tc-meta { font-size: 11px; }
  .tc-head .tc-badge { font-size: 11px; }
  .tc-foot, .tc-foot .link, .qc-row .link { font-size: 11px; }
  .rw-axis .rw-axis-label { font-size: 11px; }
  .rw-pin .rw-days { font-size: 11px; }
  .rw-row-copy, .rw-row-date { font-size: 11px; }
  .pulse-name { font-size: 11px; }
  .pulse-state { font-size: 11px; }
  .pulse-warn .link { font-size: 11px; min-height: 36px; display: inline-flex; align-items: center; }
  .act-row { font-size: 11px; }
  .docwait-copy, .need-copy { font-size: 11.5px; }
  .need-date { font-size: 11px; }
  .missing-row .link { font-size: 11.5px; min-height: 44px; display: inline-flex; align-items: center; }
  .ring-copy { font-size: 11.5px; }
  .brand .num { font-size: 11px; }
  .link { font-size: 11.5px; }
}

/* ---- phone: inner pages, final shared pass (390px) ---------------------- */
@media (max-width: 640px) {
  /* Every control is a real 44px target, not a padded illusion. */
  main.page button,
  main.page .btn,
  main.page .filter,
  main.page .segbtn,
  main.page .lead,
  main.page .state-chip,
  main.page .check-menu {
    min-height: 44px;
  }
  /* Width only for icon-only or segmented controls; text buttons keep their own width. */
  main.page .icon-btn,
  main.page .search-btn,
  main.page .theme-btn,
  main.page .conn-menu,
  main.page .doc-zoom-btn,
  main.page .dialog-close,
  main.page .dfy-close,
  main.page .filter,
  main.page .segbtn,
  main.page .check-menu {
    min-width: 44px;
  }
  main.page button { touch-action: manipulation; }
  main.page input:not([type="checkbox"]):not([type="radio"]),
  main.page select,
  main.page textarea {
    min-height: 44px;
  }
  main.page .link,
  main.page .link.small,
  main.page .u-next a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
  }
  main.page .upnext-item { min-height: 44px; }
  main.page .filters .filter { min-height: 44px; }

  /* The switch keeps its 32x19 visual track, with a 44x44 hit area. */
  main.page .switch {
    width: 44px;
    height: 44px;
    background: transparent !important;
    border-radius: 12px;
  }
  main.page .switch::before {
    content: "";
    position: absolute;
    left: 6px;
    top: 50%;
    width: 32px;
    height: 19px;
    margin-top: -9.5px;
    border-radius: 999px;
    background: var(--line-strong);
    transition: background 0.15s ease;
  }
  main.page .switch[aria-checked="true"]::before { background: var(--ok); }
  main.page .switch::after {
    top: 50%;
    left: 8px;
    margin-top: -7.5px;
    z-index: 1;
  }
  main.page .switch[aria-checked="true"]::after { transform: translateX(13px); }

  /* Metadata floor: nothing operational renders below 10.5px. */
  main.page .kicker,
  main.page .sl,
  main.page .n,
  main.page .chip,
  main.page .avatar,
  main.page .cal-weekdays span,
  main.page .cal-daynum,
  main.page .cal-kind,
  main.page .cal-more,
  main.page .cal-legend-title,
  main.page .cal-stats .cs-label,
  main.page .qc-row small,
  main.page .doc-zoom-btn,
  main.page .doc-gate,
  main.page .doc-facts span,
  main.page .doc-history h3,
  main.page .dh-head .mono,
  main.page .dh-current span,
  main.page .dh-current strong,
  main.page .conn-state,
  main.page .conn-default,
  main.page .conn-why,
  main.page .conn-note-art text,
  main.page .jn,
  main.page .c-name .jn,
  main.page .jobs-table .jn span,
  main.page .rc-axis span,
  main.page .rc-bar i,
  main.page .rc-list i,
  main.page .rc-open,
  main.page .cs-label,
  main.page .ct-meta,
  main.page .ct-mark,
  main.page .upnext-label,
  main.page .upnext-item b,
  main.page .upnext-item span,
  main.page .doc-amt,
  main.page .doc-row-due,
  main.page .doc-state,
  main.page .filter .n,
  main.page .dh-list em,
  main.page .dh-current em,
  main.page .docs-foot span,
  main.page .conn-group-head span,
  main.page .conn-data b,
  main.page .conn-data span,
  main.page .flow-core span,
  main.page .flow-brief span,
  main.page .flow-caption,
  main.page .rc-hrow i,
  main.page .rc-hrow em,
  main.page .rc-tag,
  main.page .rc-foot span,
  main.page .rc-bar i,
  main.page .rc-scale span,
  main.page .dtab span,
  main.page .tc-badge,
  main.page .ring-copy span,
  main.page .need-copy p,
  main.page .set-row small {
    font-size: 11px;
  }

  /* Keep the last row clear of the fixed tab bar on every inner page. */
  main.page {
    padding-bottom: calc(124px + env(safe-area-inset-bottom));
    scroll-padding-bottom: calc(88px + env(safe-area-inset-bottom));
  }
}

/* ---------- Explainability: spreadsheet → deadlines ---------- */
.how-strip {
  margin: 34px 0 30px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--paper);
  overflow: hidden;
}
.how-head {
  padding: 26px 26px 0;
  max-width: 720px;
}
.how-head h2 {
  margin: 6px 0 8px;
  font-size: clamp(21px, 2.4vw, 27px);
  letter-spacing: -0.015em;
}
.how-head > p:last-child {
  margin: 0;
  color: var(--ink-soft, var(--ink));
  opacity: .78;
  font-size: 14.5px;
  line-height: 1.55;
}
.how-grid {
  list-style: none;
  margin: 20px 0 0;
  padding: 0 26px 26px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.how-card {
  position: relative;
  padding: 20px 18px 18px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--line-strong);
  border-radius: 14px;
  background: color-mix(in srgb, var(--paper) 86%, #fff 14%);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.how-card h3 { margin: 0; font-size: 15.5px; letter-spacing: -0.01em; }
.how-card p { margin: 0; font-size: 13.5px; line-height: 1.5; opacity: .82; }
.how-n {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 999px;
  font: 600 12px/1 "IBM Plex Mono", monospace;
  color: var(--ink-inverse);
  background: var(--line-strong);
}
.how-tag {
  margin-top: auto;
  align-self: flex-start;
  padding: 3px 9px;
  border-radius: 999px;
  font: 500 11px/1.5 "IBM Plex Sans", sans-serif;
  letter-spacing: .04em;
  text-transform: uppercase;
  border: 1px solid currentColor;
  opacity: .9;
}
.how-card.tone-connect { border-top-color: var(--accent); }
.how-card.tone-connect .how-n { background: var(--accent); }
.how-card.tone-connect .how-tag { color: var(--accent); }
.how-card.tone-map { border-top-color: var(--warn); }
.how-card.tone-map .how-n { background: var(--warn); }
.how-card.tone-map .how-tag { color: var(--warn); }
.how-card.tone-run { border-top-color: var(--ok); }
.how-card.tone-run .how-n { background: var(--ok); }
.how-card.tone-run .how-tag { color: var(--ok); }
.how-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600;
  color: var(--ok); text-decoration: none;
  border-bottom: 1px solid currentColor;
  align-self: flex-start;
}
.how-link svg, .how-link [data-icon] { width: 13px; height: 13px; }

/* Source strip on Automations */
.source-strip {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 22px;
  align-items: center;
  margin: 18px 0 22px;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 16px;
  background: linear-gradient(100deg, var(--accent-soft) 0%, transparent 62%);
}
.source-strip h2 { margin: 4px 0 6px; font-size: 20px; letter-spacing: -0.015em; }
.source-strip p { margin: 0; font-size: 13.5px; line-height: 1.55; opacity: .8; max-width: 58ch; }
.source-strip-side { display: grid; gap: 10px; }
.source-chip {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  text-decoration: none; color: inherit;
}
.source-chip > [data-icon] {
  width: 30px; height: 30px; padding: 7px;
  border-radius: 9px; flex: 0 0 auto;
}
.source-chip div { display: grid; gap: 1px; min-width: 0; }
.source-chip b { font-size: 11px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.source-chip span { font-size: 13px; }
.source-chip.tone-connect > [data-icon] { background: var(--accent-soft); color: var(--accent); }
.source-chip.tone-map > [data-icon] { background: var(--warn-soft); color: var(--warn); }
.source-chip:hover { border-color: var(--line-strong); }
.source-chip .chip-go {
  margin-left: auto; flex: 0 0 auto;
  font-size: 11.5px; font-weight: 650; letter-spacing: .01em;
  color: #b4470e;
}
.source-chip.tone-map .chip-go { color: var(--ink); }
.source-chip:hover .chip-go { text-decoration: underline; }

/* Edit-columns affordances */
.conn-edit {
  margin-left: auto;
  font-size: 12px; font-weight: 600;
  color: var(--accent); text-decoration: none;
  border-bottom: 1px solid transparent;
  white-space: nowrap;
}
.conn-edit:hover { border-bottom-color: currentColor; }
.conn-source-name .csn-name {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Import: edit banner + how-it-works */
.import-editbar {
  display: flex; align-items: flex-start; gap: 12px;
  margin: 0 0 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 12px;
  background: var(--accent-soft);
}
.import-editbar .ie-dot {
  width: 9px; height: 9px; margin-top: 6px; border-radius: 999px;
  background: var(--accent); flex: 0 0 auto;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
}
.import-editbar div { display: grid; gap: 3px; }
.import-editbar strong { font-size: 14px; }
.import-editbar span { font-size: 12.5px; line-height: 1.45; opacity: .78; }
.import-editbar a {
  margin-left: auto; align-self: center;
  font-size: 12.5px; font-weight: 600; color: var(--accent); text-decoration: none;
  white-space: nowrap;
}
.map-how {
  list-style: none; display: flex; flex-wrap: wrap; gap: 8px 22px;
  margin: 0 0 16px; padding: 0;
}
.map-how li { display: flex; align-items: baseline; gap: 7px; font-size: 12.5px; opacity: .78; }
.map-how b {
  font: 600 11px/1 "IBM Plex Mono", monospace;
  width: 18px; height: 18px; border-radius: 999px;
  display: inline-grid; place-items: center;
  background: var(--warn-soft); color: var(--warn);
}
.import-loading {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 320px; font-size: 14px; opacity: .8;
}
.import-loading .spin {
  width: 16px; height: 16px; border-radius: 999px;
  border: 2px solid var(--line-strong); border-top-color: var(--accent);
  animation: d365spin .8s linear infinite;
}
@keyframes d365spin { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
  .how-grid { grid-template-columns: 1fr; }
  .source-strip { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .how-strip { margin: 24px 0 22px; border-radius: 14px; }
  .how-head, .how-grid { padding-left: 18px; padding-right: 18px; }
  .source-strip { padding: 18px; }
  .import-editbar { flex-wrap: wrap; }
  .import-editbar a { margin-left: 21px; }
  .map-how { display: grid; gap: 6px; }
}

/* Import success screen */
.import-success {
  max-width: 760px; margin: 38px auto 0; text-align: center;
  padding: clamp(26px, 4vw, 46px) clamp(20px, 4vw, 44px);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 20px; box-shadow: var(--shadow);
}
.success-mark {
  width: 56px; height: 56px; margin: 0 auto 16px; border-radius: 999px;
  display: grid; place-items: center;
  background: var(--ok-soft); color: var(--ok);
}
.success-mark svg { width: 26px; height: 26px; }
.import-success h2 {
  margin: 0 0 8px; font-family: var(--serif); font-weight: 500;
  font-size: clamp(26px, 3.4vw, 38px); line-height: 1.08;
  letter-spacing: -0.02em; color: var(--ink);
}
.success-sub { margin: 0 auto; max-width: 52ch; font-size: 14.5px; line-height: 1.55; color: var(--muted); }
.success-stats {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px; margin: 26px 0 22px; text-align: left;
}
.success-stats > div {
  display: flex; flex-direction: column; gap: 2px;
  padding: 14px 16px; border-radius: 14px;
  background: var(--paper); border: 1px solid var(--line);
  border-top: 3px solid var(--line-strong);
}
.success-stats strong {
  font-family: var(--serif); font-weight: 500; font-size: 26px;
  line-height: 1.1; color: var(--ink);
}
.success-stats span { font-size: 12.5px; color: var(--muted); }
.success-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 4px; }
.success-actions .btn { flex: 0 1 auto; }
.success-actions svg { width: 15px; height: 15px; }

@media (max-width: 560px) {
  .success-stats { grid-template-columns: 1fr; }
  .success-actions .btn { flex: 1 1 100%; justify-content: center; }
}


/* Connections: visible primary action on every card (2026-10-27) */
.conn-cta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 12px 0 0;
}
.conn-action {
  width: auto;
  min-height: 34px;
  margin: 0;
  padding: 0 13px;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-weight: 600;
  justify-content: flex-start;
}
.conn-action:hover { background: var(--surface-2); border-color: var(--line-strong, var(--line)); }
.conn-action.available {
  color: #fff;
  background: var(--accent);
  border-color: transparent;
}
.conn-action.available:hover { background: var(--accent-hover); color: #fff; }
.conn-action.available svg { color: #fff; }
.conn-action.attention { background: var(--warn-soft); border-color: transparent; }
.conn-edit-btn {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink);
}
.conn-edit-btn:hover { border-color: var(--accent); color: var(--accent); }
.conn-compact .conn-action { margin-top: 0; }

/* ==========================================================================
   Colour language + genuine platform logo system (2026-10)
   One meaning per colour, reused everywhere:
     red   = overdue / broken        amber = needs attention soon
     blue  = waiting on someone else green = healthily on track
     rust  = the one thing to act on now (brand accent)
   ========================================================================== */

:root {
  --danger: #8f1d10;
  --danger-soft: #f7e2dc;
  --info: #2b5b84;
  --info-soft: #e2ecf5;
  --logo-tile: #ffffff;
  --logo-ring: rgba(28, 26, 23, 0.13);
}

html[data-theme="dark"] {
  --danger: #f0997f;
  --danger-soft: #3a1c15;
  --info: #9dc0e0;
  --info-soft: #1a2733;
  --logo-tile: #fbf8f1;
  --logo-ring: rgba(0, 0, 0, 0.45);
}

/* Genuine logos are drawn for white paper — give every one the same tile so a
   Google mark and an Excel mark read at the same weight in a list. */
.conn-icon,
.conn,
.works-icons > span:not(.works-more),
.source-logo,
.flow-tile.logo-tile {
  background: var(--logo-tile);
  border: 1px solid var(--logo-ring);
  box-sizing: border-box;
}

.conn-icon {
  padding: 4px;
  border-radius: 8px;
}

.conn-icon > svg,
.conn-icon > img {
  border-radius: 4px;
}

.conn-icon.xs { width: 20px; height: 20px; padding: 2px; border-radius: 5px; }
.conn-icon.sm { width: 26px; height: 26px; padding: 3px; border-radius: 6px; }

/* Status: word first, colour second, dot third — readable in greyscale. */
.status { font-size: 11.5px; font-weight: 500; letter-spacing: 0.005em; }
.status.over { color: var(--danger); font-weight: 600; }
.status.over::before { background: var(--danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 16%, transparent); }
.status.warn { color: var(--warn); }
.status.warn::before { background: var(--warn); }
.status.info { color: var(--info); }
.status.info::before { background: var(--info); }
.status.ok { font-weight: 500; }

/* When a status sits in a card or dialog it earns a soft tinted chip. */
.status.chip {
  padding: 3px 9px 3px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 11px;
}
.status.chip.over { background: var(--danger-soft); }
.status.chip.hot { background: var(--accent-soft); }
.status.chip.warn { background: var(--warn-soft); }
.status.chip.info { background: var(--info-soft); }
.status.chip.ok { background: var(--ok-soft); }

/* A source logo that sits inline with a workbook name. */
.inline-src {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}
.inline-src .conn-icon { flex: none; }

.src-name {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.01em;
}

/* Legend: tells the reader what the colours mean, once, where statuses start. */
.status-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 14px;
  margin: 0 0 10px;
  font-size: 11px;
  color: var(--muted);
}
.status-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.status-legend i {
  width: 6px; height: 6px; border-radius: 50%; flex: none; background: currentColor;
}
.status-legend > span { color: var(--muted); }
.status-legend .lg-over i { background: var(--danger); }
.status-legend .lg-hot i { background: var(--accent); }
.status-legend .lg-warn i { background: var(--warn); }
.status-legend .lg-info i { background: var(--info); }
.status-legend .lg-ok i { background: var(--ok); }

@media (max-width: 640px) {
  .status-legend { gap: 3px 10px; font-size: 11px; margin-bottom: 8px; }
}

.jobs-table .jn-main {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}
.jobs-table .jn-main b {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.jobs-table .jn-main .conn-icon { flex: none; }

/* inline connector mark inside a notification line */
.notif-row .n-logo { width: 22px; height: 22px; vertical-align: -6px; margin-right: 6px; border-radius: 5px; }

/* attention list: real connector mark before each affected tool */
#conn-urgent-text .cu-item { display: inline-flex; align-items: center; gap: 6px; margin-right: 12px; }
#conn-urgent-text .cu-item > img,
#conn-urgent-text .cu-item > svg { width: 18px; height: 18px; flex: none; border-radius: 4px; }

/* ── Status palette v2: brand orange is reserved for actions, urgency gets its own scale ── */
:root { --amber: #b8791a; --amber-soft: rgba(184, 121, 26, .13); }
html[data-theme="dark"] { --amber: #e2a851; --amber-soft: rgba(226, 168, 81, .17); }

.status.hot { color: var(--amber); }
.status.hot::before { background: var(--amber); }
.status.chip.hot { background: var(--amber-soft); }
/* unknown date = hollow dot, not another colour */
.status.warn { color: var(--muted); }
.status.warn::before { background: transparent; box-shadow: inset 0 0 0 1.5px var(--muted); }

.status-legend .lg-hot i { background: var(--amber); }
.status-legend .lg-warn i { background: transparent; box-shadow: inset 0 0 0 1.5px var(--muted); }
.status-legend { font-size: 11.5px; }
@media (max-width: 640px) { .status-legend { font-size: 11.5px; gap: 4px 12px; } }
.jobs-table th { font-size: 11px; }
.filter .n { font-size: 11px; opacity: .85; }
.filter[data-jfilter="action"]:not(.active) .n { color: var(--amber); }
.filter[data-jfilter="tracked"]:not(.active) .n { color: var(--ok); }
.filter[data-jfilter="missing"]:not(.active) .n { color: var(--muted); }
.filter.active .n { color: inherit; opacity: 1; }

/* ── Readability floor for prose and data labels (nothing meaningful below 11px) ── */
.docs-foot { font-size: 11px; }
.paper-kicker { font-size: 10px; letter-spacing: 0.1em; }
.doc-gate, .cs-note, .rep-sec-note, .dialog-note, .bill-note { font-size: 11.5px; }
.filter .n { font-size: 11px; }
.conn-source-name { font-size: 11.5px; }
/* specificity-safe readability floor */
body .kicker { font-size: 11px; }
body .cs-note, body .bill-note, body .rep-sec-note, body .dialog-note,
body .doc-gate, body .conn-why { font-size: 11.5px; line-height: 1.5; }
body .docs-foot { font-size: 11px; }
body .paper-kicker { font-size: 10px; }
body .conn-source-name { font-size: 11.5px; }
body .tc-foot { font-size: 11px; }
body .cal-stat .cs-note { font-size: 11px; }
body .cs-label { font-size: 11px; letter-spacing: .1em; }
body .today-head .kicker, body .tc-head .kicker { font-size: 11px; }
body .ds-note { font-size: 11.5px; line-height: 1.45; }

/* ── Status legibility v3: distinct size + shape per state, not hue alone ── */
body .status::before { width: 6px; height: 6px; }
body .status.over::before {
  width: 8px; height: 8px; background: var(--danger);
  box-shadow: 0 0 0 2.5px color-mix(in srgb, var(--danger) 20%, transparent);
}
body .status.hot::before { width: 6.5px; height: 6.5px; background: var(--amber); }
body .status.warn::before {
  width: 7px; height: 7px; background: transparent;
  box-shadow: inset 0 0 0 1.6px var(--muted);
}
body .status.info::before { background: var(--info); }
body .status.ok::before { background: var(--ok); }

body .status-legend { font-size: 11.5px; }
body .status-legend > span { color: var(--ink-2, var(--muted)); font-weight: 500; }
body .status-legend i { width: 7px; height: 7px; }
body .status-legend .lg-over i {
  width: 8px; height: 8px; background: var(--danger);
  box-shadow: 0 0 0 2.5px color-mix(in srgb, var(--danger) 20%, transparent);
}
body .status-legend .lg-hot i { background: var(--amber); }
body .status-legend .lg-warn i {
  background: transparent; box-shadow: inset 0 0 0 1.6px var(--muted);
}
body .status-legend .lg-info i { background: var(--info); }
body .status-legend .lg-ok i { background: var(--ok); }

/* the one overdue row must out-shout the CTA */
body .jobs-table tbody tr:has(.status.over) > td:first-child {
  box-shadow: inset 3px 0 0 var(--danger);
}
body .jobs-table tbody tr:has(.status.over) > td {
  background: color-mix(in srgb, var(--danger) 4%, transparent);
}

/* filter counts as real badges */
body .filter .n {
  min-width: 19px; padding: 1px 6px; border-radius: 99px; text-align: center;
  background: color-mix(in srgb, currentColor 12%, transparent);
  font-variant-numeric: tabular-nums; font-size: 11px; line-height: 1.5;
}
body .filter.active .n { background: color-mix(in srgb, #fff 22%, transparent); }

/* numeric columns align on the digit */
body .jobs-table th.num, body .jobs-table td.num {
  text-align: right; font-variant-numeric: tabular-nums;
}
body .jobs-table th.num .sort { justify-content: flex-end; }

/* dark mode: pull overdue back from salmon so it never reads as amber */
html[data-theme="dark"] body .status.over::before,
html[data-theme="dark"] body .status-legend .lg-over i {
  background: #ff5a45;
  box-shadow: 0 0 0 2.5px color-mix(in srgb, #ff5a45 24%, transparent);
}
html[data-theme="dark"] body .jobs-table tbody tr:has(.status.over) > td:first-child {
  box-shadow: inset 3px 0 0 #ff5a45;
}

/* ── Colour-coded filters: each pill carries its own state hue ── */
body .filter { --fc: var(--ink-2, var(--muted)); }
body .filter[data-jfilter="action"] { --fc: var(--amber); }
body .filter[data-jfilter="tracked"] { --fc: var(--ok); }
body .filter[data-jfilter="missing"] { --fc: var(--muted); }
body .filter .n {
  color: var(--fc);
  background: color-mix(in srgb, var(--fc) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--fc) 26%, transparent);
  font-weight: 600;
}
body .filter.active {
  color: var(--fc);
  border-color: color-mix(in srgb, var(--fc) 45%, transparent);
  background: color-mix(in srgb, var(--fc) 10%, transparent);
}
body .filter.active .n {
  color: #fff; background: var(--fc); border-color: transparent;
}
html[data-theme="dark"] body .filter.active .n { color: #1b1712; }

/* legend sits tight against the filters and every dot earns its colour */
body .status-legend { gap: 4px 16px; margin: 2px 0 12px; }
body .status-legend i { width: 8px; height: 8px; }
body .status-legend .lg-over i { width: 9px; height: 9px; }
body .status-legend .lg-warn i {
  background: transparent;
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--muted) 85%, transparent);
}
body .filter:not(.active) { color: var(--fc); }
body .filter:not(.active):hover { border-color: color-mix(in srgb, var(--fc) 40%, transparent); }

/* table text at reading size, headers legible */
body .jobs-table th {
  font-size: 11.5px; font-weight: 600; color: var(--body);
  letter-spacing: .02em; padding-top: 11px; padding-bottom: 11px;
}
body .jobs-table td { font-size: 13px; }
body .jobs-table .jn-main { font-size: 13.5px; }
body .jobs-table .jn-sub, body .jobs-table .cell-sub { font-size: 11.5px; }

/* ── Stat tiles: one tone per meaning, reused across every screen ───────────
   Uses the documented colour language: red = broken, amber = soon, blue =
   waiting on someone else, green = healthy, rust = act now, grey = plain fact. */
body .conn-stat, body .doc-stat, body .cal-stat {
  --tc: var(--muted);
  --tcs: color-mix(in srgb, var(--muted) 10%, transparent);
  position: relative;
  box-shadow: inset 0 3px 0 var(--tc);
  background: color-mix(in srgb, var(--tc) 4%, transparent);
}
body .tc-hot    { --tc: var(--danger); --tcs: var(--danger-soft); }
body .tc-warn   { --tc: var(--warn);   --tcs: var(--warn-soft); }
body .tc-info   { --tc: var(--info);   --tcs: var(--info-soft); }
body .tc-ok     { --tc: var(--ok);     --tcs: var(--ok-soft); }
body .tc-accent { --tc: var(--accent); --tcs: var(--accent-soft); }
body .tc-muted  { --tc: var(--faint);  --tcs: var(--surface-2); }

body .conn-stat .cs-num,
body .doc-stat .ds-num,
body .cal-stat .cs-num { color: var(--tc); }

body .conn-stat .cs-label::before,
body .doc-stat .ds-label::before,
body .cal-stat .cs-label::before {
  content: ""; display: inline-block; width: 7px; height: 7px;
  border-radius: 2px; margin-right: 6px; vertical-align: 1px;
  background: var(--tc);
}

/* hover/focus tells the whole tile it is clickable */
body button.conn-stat:hover, body button.doc-stat:hover {
  background: color-mix(in srgb, var(--tc) 9%, transparent);
}
body button.conn-stat[aria-pressed="true"], body button.doc-stat[aria-pressed="true"] {
  background: color-mix(in srgb, var(--tc) 12%, transparent);
  box-shadow: inset 0 3px 0 var(--tc), inset 0 0 0 1px color-mix(in srgb, var(--tc) 40%, transparent);
}
/* the old single-tone rules must not fight the new tokens */
body .conn-stat.is-warn .cs-num, body .doc-stat.is-hot .ds-num { color: var(--tc); }

/* mobile: document state chips were 7px — illegible */
@media (max-width: 720px) {
  body .doc-state { font-size: 11px; padding: 2px 6px; }
}

/* last sub-11px holdouts on documents + connections */
body .doc-row-main small { font-size: 11.5px; line-height: 1.35; }
body .how-head .kicker { font-size: 11px; }
body .conn-card .conn-why { font-size: 11.5px; line-height: 1.5; }
body .flow-caption { font-size: 11px; }
@media (max-width: 720px) {
  body .how-head .kicker { font-size: 11px; }
  body .conn-card .conn-why { font-size: 11.5px; }
}

/* metadata <small> lines are real text, not fine print */
body main small { font-size: 11.5px; line-height: 1.4; }
body .compact-meta { font-size: 11px; }

/* document drawer facts + history are real content */
body .doc-facts span, body .doc-facts strong { font-size: 11.5px; }
body .doc-facts strong { color: var(--ink); }
body .doc-history, body .doc-history span, body .doc-history strong, body .doc-history em { font-size: 11.5px; }
body .dh-current strong { font-size: 11.5px; }

/* urgent banner CTA was ghost-on-dark: invisible. Make it the primary action. */
body .conn-urgent .btn-ghost {
  color: #1b1712;
  background: #f7f2e8;
  border-color: #f7f2e8;
  font-weight: 600;
}
body .conn-urgent .btn-ghost:hover {
  background: #fff;
  border-color: #fff;
  color: #1b1712;
}
/* ==========================================================================
   VIBRANT PASS — brand colour system, colour-coded chrome, livelier surface
   Rules here are additive and body-prefixed so they win the cascade without
   !important. Brand hues are the official provider colours; they tint tiles,
   rails and chips, never the logo artwork itself.
   ========================================================================== */

/* 1. Brand tokens ---------------------------------------------------------- */
[data-brand] {
  --brand: #8a8172;
  --brand-tint: color-mix(in srgb, var(--brand) 11%, #fbf8f1);
  --brand-ring: color-mix(in srgb, var(--brand) 30%, transparent);
  --brand-wash: color-mix(in srgb, var(--brand) 9%, transparent);
}
[data-brand="quickbooks"], [data-connector-icon="quickbooks"] { --brand: #2ca01c; }
[data-brand="xero"], [data-connector-icon="xero"] { --brand: #13b5ea; }
[data-brand="freshbooks"], [data-connector-icon="freshbooks"] { --brand: #0075dd; }
[data-brand="google-sheets"], [data-connector-icon="google-sheets"] { --brand: #0f9d58; }
[data-brand="dropbox"], [data-connector-icon="dropbox"] { --brand: #0061ff; }
[data-brand="microsoft-excel"], [data-connector-icon="microsoft-excel"] { --brand: #217346; }
[data-brand="box"], [data-connector-icon="box"] { --brand: #0061d5; }
[data-brand="outlook"], [data-connector-icon="outlook"] { --brand: #0f6cbd; }
[data-brand="gmail"], [data-connector-icon="gmail"] { --brand: #ea4335; }
[data-brand="slack"], [data-connector-icon="slack"] { --brand: #611f69; }
[data-brand="teams"], [data-connector-icon="teams"] { --brand: #6264a7; }
[data-brand="docusign"], [data-connector-icon="docusign"] { --brand: #e8b900; }
[data-brand="adobe-sign"], [data-connector-icon="adobe-sign"] { --brand: #fa0f00; }
[data-brand="signnow"], [data-connector-icon="signnow"] { --brand: #00a693; }
[data-brand="zapier"], [data-connector-icon="zapier"] { --brand: #ff4f00; }
[data-brand="make"], [data-connector-icon="make"] { --brand: #6d00cc; }

/* 2. Logo tiles carry a whisper of the brand colour ------------------------ */
body .conn-icon,
body .pulse-logo,
body .source-logo,
body .works-icons > span {
  background: var(--brand-tint, #fbf8f1);
  border-color: var(--brand-ring, rgba(0, 0, 0, 0.28));
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}
body .conn-icon[data-brand],
body .pulse-logo[data-brand] {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 14%, transparent);
}
body a:hover > .conn-icon { transform: translateY(-1px); }

/* 3. Connector cards: brand rail, brand hover, filled state chips ---------- */
body .conn-card { position: relative; transition: border-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease; }
body .conn-card[data-brand] { box-shadow: inset 0 3px 0 var(--brand); }
body .conn-card[data-brand]:hover {
  border-color: color-mix(in srgb, var(--brand) 44%, var(--line));
  box-shadow: inset 0 3px 0 var(--brand), 0 18px 30px -24px color-mix(in srgb, var(--brand) 75%, transparent);
}
body .conn-card[data-brand].attention { border-left: 3px solid var(--warn); }

body .conn-state {
  font-size: 11px;
  letter-spacing: 0.02em;
  padding: 3px 8px 3px 7px;
  border-radius: 999px;
  border: 1px solid transparent;
}
body .conn-state i { width: 6px; height: 6px; }
body .conn-state.connected {
  color: var(--ok);
  background: color-mix(in srgb, var(--ok) 12%, var(--surface));
  border-color: color-mix(in srgb, var(--ok) 32%, transparent);
}
body .conn-state.attention {
  color: var(--warn);
  background: color-mix(in srgb, var(--warn) 14%, var(--surface));
  border-color: color-mix(in srgb, var(--warn) 36%, transparent);
}
body .conn-state.available {
  color: var(--muted);
  background: color-mix(in srgb, var(--muted) 8%, var(--surface));
  border-color: color-mix(in srgb, var(--muted) 22%, transparent);
}
body .conn-state.paused {
  color: var(--muted);
  background: var(--surface-2);
  border-color: var(--line);
}

/* Category headings own a colour too */
body .conn-group-head h2 {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
body .conn-group-head h2::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--cat, var(--accent));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--cat, var(--accent)) 16%, transparent);
}
body .conn-group[data-cat="accounting"] { --cat: #2ca01c; }
body .conn-group[data-cat="files"] { --cat: #2563eb; }
body .conn-group[data-cat="communication"] { --cat: #7c3aed; }
body .conn-group[data-cat="signatures"] { --cat: #b45309; }
body .conn-group[data-cat="automation"] { --cat: #ea580c; }

/* 4. Sidebar: every section has its own hue ------------------------------- */
body .nav a { --nc: var(--muted); }
body .nav a[href$="dashboard"] { --nc: #c2410c; }
body .nav a[href$="jobs"] { --nc: #1d4ed8; }
body .nav a[href$="automations"] { --nc: #7c3aed; }
body .nav a[href$="calendar"] { --nc: #0e7490; }
body .nav a[href$="documents"] { --nc: #b45309; }
body .nav a[href$="connections"] { --nc: #15803d; }
body .nav a[href$="workbooks"] { --nc: #0f9d58; }
body .nav a[href$="reports"] { --nc: #be185d; }
body .nav a[href*="#kits"] { --nc: #ea580c; }
body .nav a[href$="billing"] { --nc: #a16207; }
body .nav a[href$="settings"] { --nc: #57534e; }

body .nav a svg { color: var(--nc); opacity: 0.9; }
body .nav a:hover { background: color-mix(in srgb, var(--nc) 8%, transparent); color: var(--ink); }
body .nav a:hover svg { opacity: 1; }
body .nav a.active {
  background: color-mix(in srgb, var(--nc) 11%, var(--surface));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--nc) 30%, transparent);
}
body .nav a.active svg { color: var(--nc); opacity: 1; }
body .nav a.active::before { width: 3px; border-radius: 2px; background: var(--nc); }
body .nav-label { font-size: 11px; letter-spacing: 0.12em; color: var(--faint); }

/* 5. Semantic palette: same meanings, more life --------------------------- */
:root {
  --accent: #c2410c;
  --accent-hover: #9a3412;
  --accent-soft: #fbe3d4;
  --ok: #14784a;
  --ok-soft: #d9efe2;
  --warn: #a45c07;
  --warn-soft: #fbeacb;
  --danger: #c0341d;
  --danger-soft: #fbe2da;
  --info: #2563eb;
  --info-soft: #e4edfd;
}
html[data-theme="dark"] {
  --accent: #f97316;
  --accent-hover: #fb8a3c;
  --accent-soft: #3a2114;
  --ok: #4ade80;
  --ok-soft: #14301f;
  --warn: #fbbf24;
  --warn-soft: #332612;
  --danger: #ff6b52;
  --danger-soft: #3a1a13;
  --info: #7aa7ff;
  --info-soft: #17233d;
}

/* 6. Paper gets a soft wash of colour instead of flat beige --------------- */
body {
  background-image:
    radial-gradient(1100px 520px at 8% -12%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 62%),
    radial-gradient(900px 460px at 96% -4%, color-mix(in srgb, var(--info) 7%, transparent), transparent 60%),
    radial-gradient(760px 420px at 50% 108%, color-mix(in srgb, var(--ok) 6%, transparent), transparent 62%);
  background-attachment: fixed;
}
html[data-theme="dark"] body {
  background-image:
    radial-gradient(1100px 520px at 8% -12%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 62%),
    radial-gradient(900px 460px at 96% -4%, color-mix(in srgb, var(--info) 10%, transparent), transparent 60%);
}

/* 7. Stat tiles: brighter wash, thicker bar, coloured number -------------- */
body .conn-stat,
body .doc-stat,
body .cal-stat,
body .tstat {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--tc, var(--accent)) 10%, var(--surface)), var(--surface) 72%);
  box-shadow:
    inset 0 4px 0 var(--tc, var(--accent)),
    0 10px 22px -20px color-mix(in srgb, var(--tc, var(--accent)) 80%, transparent);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}
body .conn-stat:hover,
body .doc-stat:hover,
body .cal-stat:hover,
body .tstat:hover { transform: translateY(-1px); }
body .conn-stat .cs-num,
body .doc-stat .ds-num,
body .cal-stat .cs-num,
body .tstat b { color: var(--tc, var(--accent)); }

/* 8. Charts in Reports: a real colour story ------------------------------- */
body .rc-bar b {
  background: linear-gradient(180deg, var(--c1, #c2410c), var(--c2, #f59e0b));
  border-top: 2px solid var(--c1, #c2410c);
  border-radius: 2px 2px 0 0;
}
body .rc-bars .rc-bar:nth-child(4n+1) { --c1: #c2410c; --c2: #f59e0b; }
body .rc-bars .rc-bar:nth-child(4n+2) { --c1: #1d4ed8; --c2: #60a5fa; }
body .rc-bars .rc-bar:nth-child(4n+3) { --c1: #0f9d58; --c2: #4ade80; }
body .rc-bars .rc-bar:nth-child(4n+4) { --c1: #b45309; --c2: #fbbf24; }
body .rc-bar.now b {
  background: linear-gradient(180deg, #f97316, #c2410c);
  border-top-color: #9a3412;
  box-shadow: 0 0 0 1px color-mix(in srgb, #f97316 45%, transparent), 0 6px 16px -10px #c2410c;
}
body .rc-bar i { font-size: 11px; color: var(--muted); font-style: normal; }
body .rc-hrow i { font-size: 11px; }
body .rc-hrow b { border-radius: 999px; overflow: hidden; background: color-mix(in srgb, var(--ink) 8%, var(--surface)); }
body .rc-hrow u { border-radius: 999px; background: linear-gradient(90deg, #2563eb, #0f9d58); }
body .rc-hrow:nth-child(2) u { background: linear-gradient(90deg, #c2410c, #f59e0b); }
body .rc-hrow:nth-child(3) u { background: linear-gradient(90deg, #7c3aed, #2563eb); }
body .rc-hrow:nth-child(4) u { background: linear-gradient(90deg, #0f9d58, #84cc16); }
body .rc-donut circle:last-of-type { stroke: var(--accent); }
body .rc-line polyline { stroke: var(--accent); }
body .rc-line circle { fill: var(--accent); }

/* 9. Buttons and links: a warmer, livelier primary ------------------------ */
body .btn-primary {
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 86%, #fff), var(--accent));
  box-shadow: 0 10px 20px -14px color-mix(in srgb, var(--accent) 80%, transparent);
}
body .btn-primary:hover {
  background: linear-gradient(180deg, var(--accent), var(--accent-hover));
  box-shadow: 0 12px 24px -14px color-mix(in srgb, var(--accent) 85%, transparent);
}
body a.link { text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent); }

/* 10. Small type floors that the earlier sweep missed (short labels) ------ */
body .rc-hrow i,
body .rc-bar i,
body .conn-state,
body .nav-label { font-size: 11px; }
body .doc-row-main small { display: flex; align-items: center; gap: 5px; }
body .conn-icon.xxs { width: 15px; height: 15px; padding: 1px; border-radius: 4px; }
body .conn-icon.xxs img,
body .conn-icon.xxs svg { border-radius: 2px; }
body .fact-src { display: inline-flex; align-items: center; gap: 6px; }

/* 11. Rows answer on hover ------------------------------------------------ */
body .jobs-table tbody tr:hover > td { background: color-mix(in srgb, var(--accent) 4%, transparent); }
body .doc-row:hover { background: color-mix(in srgb, var(--accent) 4%, transparent); }
body .rw-row:hover { background: color-mix(in srgb, var(--accent) 4%, transparent); }

/* 12. Dark theme keeps logos on light tiles so marks stay legible ---------- */
html[data-theme="dark"] body .conn-icon,
html[data-theme="dark"] body .pulse-logo,
html[data-theme="dark"] body .source-logo,
html[data-theme="dark"] body .works-icons > span {
  background: color-mix(in srgb, var(--brand, #8a8172) 14%, #f7f2e8);
  border-color: color-mix(in srgb, var(--brand, #8a8172) 38%, rgba(0, 0, 0, 0.35));
}
html[data-theme="dark"] body .conn-state.available {
  background: color-mix(in srgb, var(--muted) 14%, var(--surface));
  border-color: color-mix(in srgb, var(--muted) 30%, transparent);
}

/* 13. Readable-meta floor, part 2 — short labels the 20-char sweep could not see.
   Same rule as before: 11px minimum for anything a person has to read. */
html body .notif-row time,
html body .notif-count,
html body .notif-foot,
html body .c-due,
html body .c-due span,
html body .wrole,
html body .rn,
html body .palette-foot,
html body .palette-foot span,
html body .kn,
html body .rc-tag,
html body .rc-foot span,
html body .eyebrow,
html body .conn-group-head span,
html body .doc-row-due,
html body .doc-state,
html body .doc-amt,
html body .doc-list-head span,
html body .cs-label,
html body .cal-stat .cs-note,
html body .cal-list-date,
html body .cal-event,
html body .cal-event span,
html body .cal-event i,
html body .cal-event b,
html body .cal-type,
html body .ct-meta,
html body .cal-legend-title,
html body .cal-next-title,
html body .link,
html body .lead-cap,
html body .wb-tag,
html body .wb-flag,
html body .wb-sync,
html body .dz-foot { font-size: 11px !important; }

html body .doc-row-due,
html body .doc-amt { font-size: 11.5px !important; }
html body .doc-state { font-size: 11px !important; }

/* 14. Readable-meta floor, part 3 — sidebar, connector data, stat labels, builder. */
html body .rail-foot .wrole,
html body .wname .wrole,
html body .rail-foot .rn,
html body .plan-mini .rn,
html body .conn-data b,
html body .cal-stat .cs-label,
html body .cal-stat .cs-note,
html body .rep-stats .cs-label,
html body .rep-stats .cs-note,
html body .bz-eyebrow,
html body .bz-p-t small,
html body .bz-plat-t small,
html body .flow-core span { font-size: 11px !important; }
html body .conn-data b { letter-spacing: 0.06em; }


/* 15. Readable-meta floor, part 4 — page stylesheets load after app.css, so
   every floor rule needs one more element of specificity to win. */
html body .link,
html body .kicker,
html body .c-due,
html body .c-due span,
html body .rc-city,
html body .rc-tag,
html body .cs-label,
html body .cs-note,
html body .cal-stat .cs-note,
html body .doc-row-due,
html body .doc-state,
html body .doc-amt,
html body .wb-sync,
html body .wb-tag,
html body .wb-flag,
html body .check-cols span,
html body span.flow-core,
html body .conn-stat strong,
html body .conn-stat span,
html body label { font-size: 11px !important; }
html body .doc-row-due,
html body .doc-amt { font-size: 11.5px !important; }

/* 16. Readable-meta floor, part 5 — last stragglers. */
html body .flow-brief strong,
html body .flow-brief span,
html body .flow-caption,
html body .rc-list i,
html body .rc-list span,
html body .cal-side-note b,
html body .cal-side-note p,
html body .upnext-item span,
html body .wb-chip span,
html body .wb-chips span,
html body .docs-foot span,
html body .doc-gate,
html body .doc-gate span { font-size: 11px !important; }

/* 17. Readable-meta floor, part 6 — mobile-only fact labels. */
html body .doc-facts span,
html body .fact-src span,
html body .doc-history .mono,
html body .doc-history span,
html body .rc-hrow span,
html body .rc-hrow i { font-size: 11px !important; }

/* 18. Emphasis never shrinks below the meta floor. */
html body .docs-panel em,
html body .docs-panel strong,
html body .doc-gate em,
html body .doc-gate strong,
html body .doc-facts em,
html body .doc-facts strong { font-size: 11px !important; }

/* 19. Document history + current-step emphasis. */
html body .dh-list em,
html body .dh-list li,
html body .dh-current strong { font-size: 11px !important; }

/* 20. Stat-tile colour language: red = needs you, amber = soon, blue = waiting, green = healthy. */
html body .tstat.tone-hot { border-color: color-mix(in srgb, #dc2626 42%, var(--line)); background: linear-gradient(180deg, var(--surface), color-mix(in srgb, #dc2626 9%, var(--surface))); }
html body .tstat.tone-hot .ts-icon { color: #dc2626; border-color: color-mix(in srgb, #dc2626 30%, var(--line)); }
html body .tstat.tone-hot .ts-num { color: #dc2626; }
html body .tstat.tone-warn .ts-num { color: var(--warn); }
html body .tstat.tone-info .ts-progress i { background: var(--info); }
html body .tstat .ts-sub { color: var(--muted); opacity: 1; }
html[data-theme="dark"] body .tstat.tone-hot { background: linear-gradient(180deg, var(--surface), #33191a); }

/* 21. Readable-meta floor, part 7 — dashboard today cards (they were hidden while a JS error blanked the page). */
html body .tstat .ts-label { font-size: 11px !important; }
html body .today-card .tc-meta { font-size: 11px !important; letter-spacing: 0.04em; }
html body .rw-row-copy b { font-size: 11.5px !important; }
html body .rw-row-copy span { font-size: 11px !important; }
html body .rw-row-date b { font-size: 11.5px !important; font-weight: 700; }
html body .rw-row-date span { font-size: 11px !important; }
html body .docwait-copy b { font-size: 11.5px !important; }
html body .docwait-copy span { font-size: 11px !important; }
html body .docwait-pill { font-size: 11px !important; }
html body .missing-row b { font-size: 11.5px !important; }
html body .missing-row span span { font-size: 11px !important; }
html body .need-copy p { font-size: 11px !important; }
html body .pulse-name b { font-size: 11.5px !important; }
html body .pulse-name span { font-size: 11px !important; }
html body .pulse-warn b { font-size: 11.5px !important; }
html body .pulse-warn span span { font-size: 11px !important; }
html body .ring-copy > span { font-size: 11px !important; }
html body .act-row span { font-size: 11px !important; }
html body .act-row time { font-size: 11px !important; }

/* 22. Secondary dashboard copy: readable size is not enough, keep the contrast up. */
html body .rw-row-copy span, html body .rw-row-date span, html body .docwait-copy span,
html body .pulse-name span, html body .act-row time, html body .ring-copy > span,
html body .today-card .tc-meta, html body .pulse-warn span span { color: var(--muted) !important; }
html body .tstat .ts-sub { color: var(--muted) !important; }

/* ── Jobs: filter chips double as the legend, plus a live hint line ── */
body .filter[data-jfilter="over"] { --fc: var(--danger); }
body .filter[data-jfilter="hot"] { --fc: var(--amber); }
body .filter[data-jfilter="info"] { --fc: var(--info); }
body .filter[data-jfilter="ok"] { --fc: var(--ok); }
body .filter[data-jfilter="missing"] { --fc: var(--muted); }
body .filters { gap: 7px; }
body .filter { min-height: 32px; }

/* a small state dot inside each chip, same shape rules as the status pills */
body .filter .fd { display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--fc); margin-right: 6px; vertical-align: 1px; flex: none; }
body .filter[data-jfilter="missing"] .fd { background: transparent; box-shadow: inset 0 0 0 1.6px var(--muted); }
body .filter[data-jfilter="over"] .fd { width: 8px; height: 8px;
  box-shadow: 0 0 0 2.5px color-mix(in srgb, var(--danger) 20%, transparent); }
html[data-theme="dark"] body .filter[data-jfilter="over"] .fd { background: #ff5a45;
  box-shadow: 0 0 0 2.5px color-mix(in srgb, #ff5a45 24%, transparent); }

body .jobs-hint {
  margin: 0 0 10px; font-size: 11.5px; line-height: 1.45; color: var(--body);
  padding-left: 9px; border-left: 2px solid var(--line);
}
body .jobs-hint:empty { display: none; }

/* the money column and the status pill both stay on one line at every width */
body .jobs-table td.c-amt { white-space: nowrap; }
body .jobs-table tbody tr[data-job] { cursor: pointer; }

/* --- Mobile filter fold (see filters-fold.js) --- */
.filters-fold { display: none; }
@media (max-width: 760px) {
  .filters-fold {
    display: inline-flex; align-items: center; gap: 8px;
    min-height: 40px; padding: 0 12px; margin-bottom: 8px;
    font: inherit; font-size: 12.5px; font-weight: 600; color: var(--ink);
    background: var(--surface); border: 1px solid var(--line-strong);
    border-radius: 10px; cursor: pointer; max-width: 100%;
  }
  .filters-fold .ff-kicker { font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
  .filters-fold .ff-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 44vw; }
  .filters-fold .ff-chev { margin-left: auto; font-size: 12px; color: var(--ink-2); }
  .filters-fold .ff-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
  .filters-fold .ff-chev { font-size: 11px; color: var(--muted); transition: transform .15s; }
  .filters-fold.is-open .ff-chev { transform: rotate(180deg); }
  .filters-fold:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  .filters.has-fold { display: none; }
  .filters.has-fold.fold-open { display: flex; }
}

/* ── Readability floor: every label on the document preview stays ≥11px ── */
.paper-kicker,
.paper-meta span,
.paper-meta b,
.paper-dates dt,
.paper-dates dd,
.paper-foot,
.paper-stamp,
.paper-sign,
.paper-brand .mark,
.dz-body .paper-kicker,
.dz-body .paper-foot,
.dz-body .paper-stamp,
.dz-body .paper-meta span,
.dz-body .paper-dates dt,
.dz-body .paper-dates dd {
  font-size: max(11px, 0.7rem);
}
.paper-dates dt { line-height: 1.35; }
.paper-stamp { line-height: 1.25; }

/* ---------- Journey clarity: grouped nav, folds ---------- */
.rail { overflow-y: auto; }
.nav + .nav { margin-top: 14px; }
.nav-label { margin: 0 0 5px; }
.nav a { border-radius: 8px; }
.nav a.active { font-weight: 600; }

details.fold {
  margin: 24px 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper);
}
details.fold > .fold-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 15px 20px;
  list-style: none;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
}
details.fold > .fold-summary::-webkit-details-marker { display: none; }
details.fold > .fold-summary::after {
  content: "";
  margin-left: auto;
  width: 9px;
  height: 9px;
  flex: none;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform .18s ease;
}
details.fold[open] > .fold-summary::after { transform: rotate(225deg) translate(-2px, -2px); }
details.fold[open] > .fold-summary { border-bottom: 1px solid var(--line); }
.fold-title { flex: none; }
.fold-hint { font-weight: 400; color: var(--muted); font-size: 13.5px; }

.how-fold .how-strip {
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  overflow: visible;
}
.how-fold .how-head { padding: 18px 20px 0; }
.how-fold .how-grid { padding: 16px 20px 20px; }
.how-fold[open] > .fold-summary { border-radius: 16px 16px 0 0; }

@media (max-width: 560px) {
  .fold-hint { display: none; }
  details.fold > .fold-summary { padding: 14px 16px; }
  .how-fold .how-grid { grid-template-columns: 1fr; }
}

/* mobile: keep the last card clear of the tab bar */
@media (max-width: 860px) {
  .workspace { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
}

/* fold affordance: a word beside the chevron, so the row reads as clickable */
.fold-cue { color: var(--muted); font-size: 13px; font-weight: 500; }
details[open] > .fold-summary .fold-cue { display: none; }
details.fold > .fold-summary .fold-hint { margin-right: auto; }
details.fold > .fold-summary::after { width: 10px; height: 10px; }
.how-foot { padding: 0 20px 20px; }
.conn-stats .conn-stat.cs-plain { background: transparent; border-color: transparent; cursor: default; }
.conn-stats .conn-stat.cs-plain:hover { border-color: transparent; }
/* Older eyes: the four summary cards and the morning-email line are read, not decoration. */
html body .today-card .tc-meta,
html body .today-card .tc-badge { font-size: 12.5px !important; letter-spacing: 0.01em; }
html body .statusline { font-size: 13px; }
html body .statusline .run { font-size: 13px; font-weight: 600; }
@media (max-width: 860px) {
  main.page { padding-bottom: calc(100px + env(safe-area-inset-bottom)); }
}
/* Sidebar section labels must be readable, not whisper-small. */
html body .rail .nav-label { font-size: 12px !important; letter-spacing: .06em; color: var(--muted); opacity: 1; font-weight: 700; }
html body .rail .nav a { font-size: 15px; }

/* five primary tabs on a phone; Settings stays in the menu */
@media(max-width:600px){
  .tabbar a[href^="/settings"]{display:none}
}
@media(max-width:600px){
  body.chrome-port .tabbar a[href^="/settings"]{display:none}
}

/* Toast links inherit the inverse toast text colour. */
.toast a{color:inherit;text-decoration:underline;text-underline-offset:2px}

/* Legacy workspace toast links use .ws-toast, not .toast. */
.ws-toast a{color:inherit;text-decoration:underline;text-underline-offset:2px}

.ws-toast .link{color:inherit!important;text-decoration:underline;text-underline-offset:2px}

/* ---- import.css ---- */
/* ---------- file import journey ---------- */
.import-page {
  max-width: 1320px;
  padding-top: 24px;
}
.import-shell { max-width: 1160px; margin: 0 auto; }
.import-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 18px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--line);
}
.backlink {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--muted);
}
.backlink:hover { color: var(--ink); }
.backlink svg { width: 14px; height: 14px; transform: rotate(180deg); }
.import-account {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--muted);
}
.import-account small {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 6px;
  border: 1px solid color-mix(in srgb, var(--ok) 34%, var(--line));
  border-radius: 3px;
  color: var(--ok);
  background: var(--ok-soft);
}
.dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--faint);
  flex: none;
}
.dot.ok { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }

.import-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 48px;
  align-items: start;
  margin-bottom: 28px;
}
.import-compact-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin: 2px 0 22px;
}
.import-compact-head .kicker { margin-bottom: 4px; }
.compact-title {
  font-family: var(--serif);
  font-size: 33px;
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -0.025em;
  color: var(--ink);
}
.compact-file {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 7px 10px;
  font-size: 11px;
  color: var(--muted);
  background: var(--surface);
  min-width: 0;
  max-width: 340px;
  white-space: nowrap;
}
.compact-file > span:last-child { overflow: hidden; text-overflow: ellipsis; }
.compact-file .conn-icon { width: 20px; height: 20px; border-radius: 4px; }
.compact-file .folder-glyph { width: 18px; height: 14px; }
.import-head .eyebrow { margin-bottom: 10px; }
.import-head .page-title { font-size: clamp(34px, 3.2vw, 46px); max-width: 20ch; }
.import-head .page-sub { max-width: 66ch; font-size: 13.5px; }
.import-source-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 6px;
  min-width: 0;
}
.import-source-card > div { min-width: 0; flex: 1; }
.import-source-card strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.import-source-card span:not(.conn-icon):not(.import-secure):not(.dot) {
  display: block;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.import-secure {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--ok);
  background: var(--ok-soft);
  border: 1px solid color-mix(in srgb, var(--ok) 34%, var(--line));
  border-radius: 3px;
  padding: 3px 6px;
  white-space: nowrap;
}
.import-secure svg { width: 11px; height: 11px; }

/* stepper */
.import-steps {
  display: flex;
  align-items: center;
  gap: 0;
  margin: 0 0 30px;
  padding: 0 0 22px;
  border-bottom: 1px solid var(--line);
}
.import-step {
  display: flex;
  align-items: center;
  flex: 0 1 auto;
  min-width: 0;
}
.step-btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--faint);
  font-size: 12px;
  white-space: nowrap;
}
.step-btn:disabled { cursor: default; }
.step-btn:not(:disabled):hover .step-label { color: var(--ink); }
.step-n {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  background: transparent;
  flex: none;
}
.step-n svg { width: 13px; height: 13px; }
.import-step.current .step-n {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}
.import-step.current .step-label { color: var(--ink); font-weight: 600; }
.import-step.done .step-n {
  background: var(--ok-soft);
  border-color: var(--ok);
  color: var(--ok);
}
.import-step.done .step-label { color: var(--body); }
.step-line {
  width: 54px;
  height: 1px;
  background: var(--line);
  margin: 0 14px;
  flex: none;
}
.import-step.done .step-line { background: var(--line-strong); }

/* step one */
.source-layout {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 26px;
  align-items: stretch;
}
.source-list {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 6px;
  padding: 18px;
  min-width: 0;
}
.source-list-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.kicker {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 7px;
}
.source-list-head h2,
.map-topbar h2,
.review-head h2,
.import-success h2 {
  font-family: var(--serif);
  font-size: 25px;
  font-weight: 500;
  line-height: 1.12;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.source-account {
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.compact-stepnote {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--faint);
  padding-bottom: 4px;
}
.source-count {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
  white-space: nowrap;
  margin-top: 5px;
}
.source-search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 10px;
  margin: 16px 0 10px;
  color: var(--faint);
  background: var(--paper);
}
.source-search svg { width: 14px; height: 14px; flex: none; }
.source-search input {
  border: 0;
  outline: 0;
  background: transparent;
  width: 100%;
  min-width: 0;
  color: var(--ink);
  font: inherit;
  font-size: 12px;
}
.source-search input::placeholder { color: var(--faint); }
.source-list-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 286px;
  overflow: auto;
  padding-right: 2px;
}
.source-row {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto 12px;
  align-items: center;
  gap: 9px;
  padding: 10px 8px;
  border: 1px solid transparent;
  border-radius: 4px;
  text-align: left;
  color: var(--body);
  background: transparent;
  min-width: 0;
}
.source-row:hover { background: var(--surface-2); }
.source-row.selected {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 26%, transparent);
}
.source-row-icon { width: 26px; height: 26px; display: grid; place-items: center; }
.source-row-icon .conn-icon { width: 22px; height: 22px; border-radius: 5px; }
.source-row-copy { min-width: 0; }
.source-row-copy strong {
  display: block;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.source-row-copy small {
  display: block;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.source-row-meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
  white-space: nowrap;
}
.source-row-arrow { color: var(--faint); display: grid; place-items: center; }
.source-row-arrow svg { width: 12px; height: 12px; }
.source-row.selected .source-row-arrow { color: var(--ok); }
.source-row.selected .source-row-arrow svg { width: 14px; height: 14px; }
.source-empty { padding: 22px 8px; font-size: 12px; color: var(--muted); }
.source-note {
  display: flex;
  gap: 7px;
  align-items: flex-start;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  line-height: 1.45;
  color: var(--muted);
}
.source-note svg { width: 12px; height: 12px; margin-top: 1px; flex: none; color: var(--ok); }

.folder-glyph {
  width: 22px;
  height: 17px;
  display: inline-block;
  position: relative;
  border: 1.5px solid var(--muted);
  border-radius: 2px;
  margin-top: 3px;
}
.folder-glyph::before {
  content: "";
  position: absolute;
  left: -1.5px;
  top: -5px;
  width: 10px;
  height: 5px;
  border: 1.5px solid var(--muted);
  border-bottom: 0;
  border-radius: 2px 2px 0 0;
  background: var(--surface);
}
.folder-glyph.lg { width: 34px; height: 25px; border-width: 1.5px; margin-top: 0; }
.folder-glyph.lg::before { width: 14px; height: 7px; top: -7px; }

.source-preview {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 6px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.preview-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}
.preview-file { display: flex; align-items: center; gap: 11px; min-width: 0; }
.preview-file > div { min-width: 0; }
.preview-file .kicker { margin-bottom: 3px; }
.preview-file h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.preview-file > div > span {
  display: block;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.preview-badge {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 4px 7px;
  white-space: nowrap;
}
.sheet-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}
.sheet-tab {
  padding: 11px 12px 9px;
  font-size: 11px;
  color: var(--faint);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.sheet-tab.active { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.sheet-tabs-note {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
  white-space: nowrap;
}
.sheet-preview-table { position: relative; overflow: auto; max-height: 292px; }
.sheet-preview-table table { width: 100%; border-collapse: collapse; font-size: 11px; }
.sheet-preview-table th {
  position: sticky;
  top: 0;
  background: var(--surface-2);
  text-align: left;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  z-index: 1;
}
.sheet-preview-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--body);
  white-space: nowrap;
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sheet-preview-table td strong { color: var(--ink); font-weight: 500; }
.sheet-preview-table td.mono { font-family: var(--mono); font-size: 11px; }
.sheet-preview-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.sheet-preview-table tbody tr:last-child td { border-bottom: 0; }
.sheet-preview-fade {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 26px;
  background: linear-gradient(to bottom, transparent, var(--surface));
  pointer-events: none;
}
.sheet-preview-cards { display: none; }
.preview-foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 18px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.preview-facts { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.preview-facts span { font-size: 11px; color: var(--muted); }
.preview-facts b { font-family: var(--mono); font-weight: 500; color: var(--ink); font-size: 11px; }

/* document preview */
.doc-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid var(--line);
}
.doc-summary > div {
  padding: 12px 18px;
  border-right: 1px solid var(--line);
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.doc-summary > div:last-child { border-right: 0; }
.doc-sum-n {
  font-family: var(--serif);
  font-size: 24px;
  line-height: 1;
  color: var(--ink);
}
.doc-summary span:last-child { font-size: 11px; color: var(--muted); }
.doc-preview-list { padding: 6px 18px; }
.doc-preview-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.doc-preview-row:last-child { border-bottom: 0; }
.pdf-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 32px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.03em;
  color: var(--accent);
  background: var(--paper);
  flex: none;
}
.pdf-badge.lg { width: 38px; height: 44px; font-size: 11px; }
.doc-preview-copy { min-width: 0; flex: 1; }
.doc-preview-copy strong {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.doc-preview-copy span { display: block; font-size: 11px; color: var(--muted); }
.doc-preview-more {
  margin: 0 18px 12px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--faint);
}
.doc-preview-date {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}
.preview-note {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin: 2px 18px 14px;
  padding: 9px 10px;
  background: var(--ok-soft);
  border-radius: 4px;
  font-size: 11px;
  line-height: 1.45;
  color: var(--ok);
}
.preview-note svg { width: 12px; height: 12px; flex: none; margin-top: 1px; }

.import-assurance {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 18px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 5px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--muted);
  background: var(--surface);
}
.import-assurance svg { width: 13px; height: 13px; color: var(--ok); flex: none; margin-top: 1px; }
.import-assurance strong { color: var(--body); font-weight: 600; }

/* step two */
.map-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}
.map-topbar p:not(.kicker) {
  margin-top: 7px;
  font-size: 12.5px;
  color: var(--muted);
  max-width: 76ch;
}
.map-filebar {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-2);
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 16px;
  min-width: 0;
}
.map-file-icon .conn-icon { width: 20px; height: 20px; border-radius: 4px; }
.map-file-icon .folder-glyph { width: 18px; height: 14px; }
.map-filebar strong {
  font-size: 11px;
  color: var(--ink);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.filebar-divider { width: 1px; height: 14px; background: var(--line-strong); flex: none; }
.map-filebar > span:not(.map-file-icon):not(.filebar-divider) { white-space: nowrap; }
.map-filebar .text-btn { margin-left: auto; }
.text-btn {
  color: var(--ink);
  font-size: 11px;
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
  white-space: nowrap;
}
.text-btn:hover { text-decoration-color: var(--accent); }
.map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 318px;
  gap: 24px;
  align-items: start;
}
.map-table-wrap {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  overflow: hidden;
}
.map-table-head,
.map-row {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.25fr) minmax(0, 1fr) 96px;
  gap: 12px;
  align-items: center;
}
.map-table-head {
  padding: 9px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}
.map-row {
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  min-height: 52px;
}
.map-row:last-child { border-bottom: 0; }
.map-row.todo { background: color-mix(in srgb, var(--warn-soft) 38%, transparent); }
.map-row.ignored { opacity: 0.58; }
.map-row.just-linked { animation: map-linked 1.3s ease-out; }
@keyframes map-linked {
  0% { background: color-mix(in srgb, var(--ok-soft) 85%, transparent); }
  100% { background: transparent; }
}
.map-source { display: flex; align-items: center; gap: 9px; min-width: 0; }
.map-source > div { min-width: 0; }
.map-source strong {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.map-source span:not(.col-type) {
  display: block;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.col-type {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 3px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  flex: none;
  background: var(--paper);
}
.col-type.date { color: var(--accent); }
.map-sample { min-width: 0; }
.map-sample span {
  display: block;
  font-size: 11px;
  color: var(--body);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.map-sample small { display: block; font-size: 11px; color: var(--faint); }
.map-target { min-width: 0; }
.map-target select {
  width: 100%;
  height: 32px;
  padding: 0 24px 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background-color: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 11px;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 12px) 13px, calc(100% - 8px) 13px;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
}
.map-target select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
html[data-theme="dark"] .map-target select { border-color: #5b5346; background-color: #1b1916; }
html[data-theme="dark"] .map-calc { background: #35211a; }
html[data-theme="dark"] .map-preview-card .conn-icon { background: #fff; }
.map-row.todo .map-target select { border-color: var(--warn); }
.map-status { display: flex; justify-content: flex-start; }
.match-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--muted);
  padding: 3px 5px;
  border-radius: 3px;
  background: var(--surface-2);
}
.match-pill.matched { color: var(--ok); background: var(--ok-soft); }
.match-pill.todo { color: var(--warn); background: var(--warn-soft); }
.match-pill.ignored { color: var(--faint); background: transparent; padding-left: 0; }
.pill-dot { width: 5px; height: 5px; border-radius: 999px; background: currentColor; }
.map-table-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--faint);
  background: var(--surface-2);
}
.map-table-foot > span { display: inline-flex; align-items: center; gap: 5px; }
.map-table-foot svg { width: 10px; height: 10px; }
.map-preview {
  position: sticky;
  top: 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  padding: 15px;
}
.map-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.map-preview-head .kicker { margin: 0; }
.preview-dot {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}
.preview-dot i { width: 5px; height: 5px; border-radius: 999px; background: var(--ok); }
.map-preview-card {
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 15px;
  background: var(--paper);
}
.map-preview-card > h3 {
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.12;
  font-weight: 500;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin-top: 12px;
}
.map-preview-card > p { font-size: 11px; color: var(--muted); margin-top: 4px; }
.map-preview-card .state-chip {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 6px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--body);
  margin-top: 9px;
}
.map-calc {
  margin-top: 14px;
  padding: 10px 11px;
  border-left: 2px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 3px 3px 0;
}
.map-calc.pending { border-left-color: var(--warn); background: var(--warn-soft); }
.map-calc span {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}
.map-calc strong {
  display: block;
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.1;
  margin: 3px 0 2px;
}
.map-calc small { display: block; font-size: 11px; color: var(--muted); }
.map-mini-fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  margin-top: 10px;
}
.map-mini-fields > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}
.map-mini-fields > div:last-child { border-bottom: 0; }
.map-mini-fields span { font-size: 11px; color: var(--muted); }
.map-mini-fields strong { font-size: 11px; font-weight: 500; color: var(--ink); text-align: right; }
.map-mini-fields strong.unmapped { color: var(--warn); font-family: var(--mono); font-size: 11px; text-transform: uppercase; }
.map-preview-note {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-top: 11px;
  font-size: 11px;
  line-height: 1.4;
  color: var(--muted);
}
.map-preview-note svg { width: 11px; height: 11px; color: var(--ok); flex: none; margin-top: 1px; }
.map-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 18px;
  padding: 12px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface);
  box-shadow: 0 20px 40px -30px rgba(0, 0, 0, 0.55);
}
.map-footer-copy strong { display: block; font-size: 11.5px; font-weight: 600; color: var(--ink); }
.map-footer-copy span { display: block; font-size: 11px; color: var(--muted); margin-top: 1px; }

/* step three */
.review-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}
.review-head p:not(.kicker) { margin-top: 7px; font-size: 12.5px; color: var(--muted); max-width: 80ch; }
.review-file {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 4px 7px;
  white-space: nowrap;
  margin-top: 4px;
}
.review-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}
.review-stats > div {
  display: flex;
  align-items: baseline;
  gap: 9px;
  padding: 13px 16px;
  border-right: 1px solid var(--line);
}
.review-stats > div:last-child { border-right: 0; }
.review-num {
  font-family: var(--serif);
  font-size: 30px;
  line-height: 1;
  color: var(--ink);
}
.review-stats .ok .review-num { color: var(--ok); }
.review-stats .warn .review-num { color: var(--warn); }
.review-stats span:last-child { font-size: 11px; color: var(--muted); }
.review-alert {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 13px;
  border: 1px solid color-mix(in srgb, var(--warn) 32%, var(--line));
  background: var(--warn-soft);
  border-radius: 4px;
  margin-bottom: 16px;
}
.review-alert svg { width: 14px; height: 14px; color: var(--warn); flex: none; margin-top: 1px; }
.review-alert p { font-size: 11px; line-height: 1.45; color: var(--body); }
.review-alert strong { color: var(--ink); font-weight: 600; }
.review-table-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 2px 7px;
}
.review-table-wrap {
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: auto;
  max-height: 356px;
  background: var(--surface);
}
.review-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.review-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  text-align: left;
  padding: 9px 12px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
}
.review-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  color: var(--body);
  white-space: nowrap;
}
.review-table tbody tr:last-child td { border-bottom: 0; }
.review-cards { display: none; }
.review-card {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
}
.review-card.attention { background: color-mix(in srgb, var(--warn-soft) 30%, var(--surface)); border-color: color-mix(in srgb, var(--warn) 25%, var(--line)); }
.rc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.rc-head strong { font-size: 11px; font-weight: 600; color: var(--ink); line-height: 1.3; }
.rc-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 4px; font-size: 11px; color: var(--muted); }
.rc-meta span + span::before { content: "·"; margin-right: 10px; color: var(--faint); }
.rc-foot { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-top: 7px; padding-top: 7px; border-top: 1px solid var(--line); }
.rc-foot span { font-family: var(--mono); font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.rc-foot strong { font-family: var(--mono); font-size: 11px; font-weight: 500; color: var(--ink); }
.review-scroll-note {
  margin: 6px 2px 0;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--faint);
}
.review-table td:first-child { min-width: 210px; }
.review-table td strong { display: block; font-size: 11px; font-weight: 500; color: var(--ink); }
.row-sub { display: block; font-family: var(--mono); font-size: 11px; color: var(--faint); margin-top: 1px; }
.review-table tr.attention { background: color-mix(in srgb, var(--warn-soft) 30%, transparent); }
.review-pill {
  display: inline-flex;
  align-items: center;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}
.review-pill.ready { color: var(--ok); }
.review-pill.attention { color: var(--warn); }
.review-table .state-chip {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 5px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--body);
}
.review-options {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 22px;
  padding: 14px 2px 0;
}
.review-policy {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.review-policy svg { width: 13px; height: 13px; color: var(--ok); flex: none; margin-top: 1px; }
.review-policy p { font-size: 11px; line-height: 1.45; color: var(--muted); }
.review-policy strong { color: var(--body); font-weight: 600; }
.checkline {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  color: var(--body);
  cursor: pointer;
}
.checkline input { accent-color: var(--accent); width: 13px; height: 13px; }
.review-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 18px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
}
.review-action { display: flex; align-items: center; gap: 14px; }
.review-action > span { font-size: 11px; color: var(--body); }

/* success */
.import-shell-success { max-width: 830px; }
.import-success {
  padding: 30px 0 40px;
  text-align: center;
}
.success-mark {
  width: 54px;
  height: 54px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
  background: var(--ok-soft);
  border: 1px solid color-mix(in srgb, var(--ok) 40%, transparent);
  color: var(--ok);
}
.success-mark svg { width: 26px; height: 26px; }
.import-success .kicker { justify-content: center; }
.import-success .kicker::before { display: none; }
.import-success h2 {
  font-size: clamp(32px, 4vw, 44px);
  max-width: 20ch;
  margin: 0 auto;
}
.success-sub {
  max-width: 58ch;
  margin: 12px auto 0;
  font-size: 12.5px;
  color: var(--muted);
}
.success-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin: 26px 0;
}
.success-stats > div {
  padding: 14px 10px;
  border-right: 1px solid var(--line);
}
.success-stats > div:last-child { border-right: 0; }
.success-stats strong {
  display: block;
  font-family: var(--serif);
  font-size: 28px;
  line-height: 1;
  font-weight: 500;
  color: var(--ink);
}
.success-stats span { display: block; margin-top: 4px; font-size: 11px; color: var(--muted); }
.success-next {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  text-align: left;
  overflow: hidden;
}
.success-next-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.success-next-head .kicker { margin: 0; }
.success-next-head > span { font-size: 11px; color: var(--faint); }
.success-row {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.success-row:last-child { border-bottom: 0; }
.success-date {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}
.success-row strong { display: block; font-size: 11px; font-weight: 500; color: var(--ink); }
.success-row div span { display: block; font-size: 11px; color: var(--muted); }
.success-tag {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ok);
  border: 1px solid color-mix(in srgb, var(--ok) 30%, transparent);
  border-radius: 3px;
  padding: 3px 5px;
  white-space: nowrap;
}
.success-tag.action { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.success-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 24px;
}

@media (max-width: 1100px) {
  .import-head { grid-template-columns: 1fr 280px; gap: 28px; }
  .source-layout { grid-template-columns: 300px minmax(0, 1fr); gap: 18px; }
  .map-layout { grid-template-columns: minmax(0, 1fr) 286px; gap: 18px; }
  .map-table-head, .map-row { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.1fr) minmax(0, 1fr) 84px; gap: 9px; }
}
@media (max-width: 900px) {
  .import-head { grid-template-columns: 1fr; gap: 18px; }
  .import-source-card { max-width: 390px; }
  .source-layout, .map-layout { grid-template-columns: 1fr; }
  .source-list-body { max-height: 220px; }
  .map-preview { position: static; }
  .map-footer { position: static; }
  .map-table-head, .map-row { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) 92px; }
  .map-sample { display: none; }
  .map-table-head span:nth-child(2) { display: none; }
}
@media (max-width: 720px) {
  .import-topline { align-items: flex-start; flex-direction: column; gap: 9px; }
  .import-compact-head { align-items: flex-start; flex-direction: column; gap: 6px; }
  .compact-stepnote { padding-bottom: 0; }
  .import-steps { overflow-x: auto; padding-bottom: 14px; }
  .step-line { width: 6px; margin: 0 6px; }
  .step-btn { gap: 5px; font-size: 11px; }
  .step-n { width: 22px; height: 22px; font-size: 11px; }
  .step-label { font-size: 11px; }
  .review-head, .map-topbar { flex-direction: column; gap: 10px; }
  .review-file { margin-top: 0; }
  .review-stats > div { flex-direction: column; gap: 2px; padding: 10px 12px; }
  .review-num { font-size: 24px; }
  .review-table-wrap { overflow-x: auto; }
  .review-table { min-width: 620px; }
  .review-table-wrap { display: none; }
  .review-cards { display: flex; flex-direction: column; gap: 6px; max-height: 356px; overflow: auto; padding-right: 2px; }
  .review-options { grid-template-columns: 1fr; gap: 8px; }
  .review-footer { flex-direction: column; align-items: stretch; }
  .review-action { justify-content: space-between; }
  .map-table-head, .map-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 72px; padding-left: 10px; padding-right: 10px; }
  .map-status { justify-content: flex-start; }
  .map-footer { flex-direction: column; align-items: stretch; gap: 10px; }
  .map-footer .btn { width: 100%; }
  .success-row { grid-template-columns: 86px minmax(0, 1fr); }
  .success-tag { display: none; }
  .success-actions { flex-direction: column; }
  .success-actions .btn { width: 100%; }
}
@media (max-width: 520px) {
  .import-page { padding-left: 18px; padding-right: 18px; }
  .import-head .page-title { font-size: 32px; }
  .sheet-preview-table { display: none; }
  .sheet-preview-cards { display: grid; gap: 6px; padding: 10px 12px; }
  .sheet-tabs { flex-wrap: wrap; overflow: visible; padding: 0 12px; }
  .sheet-tab { padding: 8px 8px 7px; font-size: 11px; }
  .sheet-tabs-note { display: none; }
  .sheet-preview-card { padding: 9px 10px; border: 1px solid var(--line); border-radius: 4px; background: var(--paper); }
  .spc-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
  .spc-head strong { font-size: 11px; font-weight: 600; color: var(--ink); }
  .spc-head span { font-family: var(--mono); font-size: 11px; color: var(--muted); }
  .spc-meta { display: flex; flex-wrap: wrap; gap: 2px 8px; margin-top: 3px; font-size: 11px; color: var(--muted); }
  .spc-meta span + span::before { content: "·"; margin-right: 8px; color: var(--faint); }
  .source-layout { gap: 14px; }
  .source-list { padding: 14px; }
  .preview-foot { flex-direction: column; align-items: stretch; }
  .preview-foot .btn { width: 100%; }
  .sheet-tabs { overflow-x: auto; }
  .sheet-tabs-note { display: none; }
  .map-row { grid-template-columns: 1fr; gap: 7px; padding: 11px 10px; }
  .map-table-head { display: none; }
  .map-status { display: flex; justify-content: flex-start; }
  .map-source { align-items: flex-start; }
  .map-target select { height: 38px; width: 100%; }
  .map-select-look { width: 100%; min-height: 38px; justify-content: space-between; }
  .map-select-look::after {
    content: ""; width: 7px; height: 7px; margin-left: 8px;
    border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted);
    transform: rotate(45deg) translateY(-2px); flex: 0 0 auto;
  }
  .map-target::before {
    content: "Maps to"; display: block; font-family: var(--mono);
    font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--muted); margin-bottom: 4px;
  }
  .map-filebar > span:not(.map-file-icon):not(.filebar-divider):not(.map-filebar strong) { display: none; }
  .map-footer-copy span { font-size: 11px; }
  .review-action { flex-direction: column; align-items: stretch; }
  .review-action > span { text-align: center; }
  .success-stats > div { padding: 10px 4px; }
  .success-stats strong { font-size: 22px; }
  .success-stats span { font-size: 11px; }
}

/* Keep the next step reachable on a phone: the file list is long, so the
   primary action stays anchored above the safe area instead of living below
   the preview. It disappears on steps 2 and 3 because those have their own footers. */
@media (max-width: 760px) {
  .import-page { padding-bottom: 120px; }
  .preview-foot {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 70;
    margin: 0;
    padding: 10px 18px calc(10px + env(safe-area-inset-bottom));
    background: var(--paper);
    border-top: 1px solid var(--line-strong);
    box-shadow: 0 -14px 34px rgba(24, 20, 14, 0.14);
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }
  .preview-foot .preview-facts { display: none; }
  .preview-foot .btn {
    width: 100%;
    min-height: 42px;
    justify-content: center;
  }
  .source-list-body { padding-bottom: 6px; }

  /* Steps 2 and 3 already say where they are in the stepper; the extra
     "Import job list" block only pushes the real work down. */
  .import-compact-head { display: none; }
  .map-footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 70;
    margin: 0;
    padding: 9px 18px calc(9px + env(safe-area-inset-bottom));
    background: var(--paper);
    border-top: 1px solid var(--line-strong);
    box-shadow: 0 -14px 34px rgba(24, 20, 14, 0.14);
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }
  .map-footer-copy strong { font-size: 11px; }
  .map-footer-copy span { font-size: 11px; }
  .map-footer .btn {
    width: 100%;
    min-height: 42px;
    justify-content: center;
  }
}

/* live import additions */
.paste-box {
  width: 100%;
  min-height: 180px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  font: 12px/1.55 var(--mono);
  resize: vertical;
  outline: none;
}
.paste-box:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.map-error {
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
  border-radius: 5px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
}
.map-state-fix {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 12px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  font-size: 11.5px;
  color: var(--body);
}
.map-state-fix input {
  width: 90px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface);
  color: var(--ink);
  font: 12px var(--mono);
  text-transform: uppercase;
}
.map-state-fix label { flex: 1 1 260px; }
.success-table { margin-top: 26px; border-top: 1px solid var(--line); }
.success-table-head,
.success-row-job {
  display: grid;
  grid-template-columns: 54px minmax(0, 1.6fr) 130px 130px;
  gap: 12px;
  align-items: center;
}
.success-table-head {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font: 500 11px/1 var(--mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.success-row-job { padding: 10px 0; border-bottom: 1px solid var(--line); }
.success-row-job .success-date { font: 500 11px/1 var(--mono); color: var(--ink); }
.success-row-job > div strong { display: block; font-size: 12px; color: var(--ink); }
.success-row-job > div span { display: block; font-size: 11px; color: var(--muted); }
.success-row-job .success-tag { justify-self: start; }
@media (max-width: 640px) {
  .success-table-head { display: none; }
  .success-row-job { grid-template-columns: 44px minmax(0, 1fr); gap: 8px 10px; }
  .success-row-job .success-tag { display: none; }
  .success-row-job > div { grid-column: 2; }
}
.success-table-note { margin: 10px 0 0; font-size: 11px; color: var(--muted); }
.success-table-note a { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }

/* genuine platform mark beside each source panel title */
.slh-title { display: flex; align-items: center; gap: 11px; min-width: 0; }
.slh-title > .conn-icon { width: 32px; height: 32px; flex: none; border-radius: 8px; }
.slh-title h2 { margin: 0; }

/* source header: genuine mark sits on the same baseline as the step title */
.slh-title { display: flex; align-items: center; gap: 11px; }
.slh-title > .conn-icon { width: 34px; height: 34px; border-radius: 8px; flex: none; }
.slh-title > div { min-width: 0; }
.slh-title h2 { margin: 0; }

/* ── Demo import preview (anonymous visitors, ?demo=1) ── */
.demo-import { display: flex; flex-direction: column; gap: 14px; }
.demo-import-note { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--info, #2f6fbe) 28%, transparent);
  background: color-mix(in srgb, var(--info, #2f6fbe) 7%, transparent); }
.demo-import-note span[data-icon] { width: 20px; height: 20px; flex: 0 0 20px; color: var(--info, #2f6fbe); }
.demo-import-note strong { display: block; font-size: 13.5px; color: var(--ink); }
.demo-import-note span:not([data-icon]) { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.map-select-look { display: inline-flex; align-items: center; min-height: 34px; padding: 0 12px; border-radius: 9px;
  border: 1px solid var(--line-strong); background: var(--surface-2, #fff); font-size: 13px; color: var(--ink); }
.map-row.matched .map-select-look { border-color: color-mix(in srgb, var(--ok, #1f7a4d) 40%, transparent); }
.demo-import-foot { display: flex; flex-wrap: wrap; gap: 10px; padding-top: 4px; }
.demo-import-foot .btn { min-height: 42px; }
@media (max-width: 560px) { .demo-import-foot .btn { width: 100%; justify-content: center; } }

/* Keep the selected-source card readable in its narrow header column. */
.import-source-card strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.import-source-card .import-secure {
  width: 28px; height: 28px; min-width: 28px; padding: 0;
  display: inline-grid; place-items: center; border-radius: 50%;
}
.import-source-card .import-secure svg { width: 12px; height: 12px; }

/* ---- legibility.css ---- */
/* ─────────────────────────────────────────────────────────────
   Legibility floor — nothing a contractor must read sits below 11px.
   Paper facsimiles (the A4 previews) obey the same floor: people read
   the preview to check the letter, so it is a reading surface too.
   ───────────────────────────────────────────────────────────── */

/* calendar: day numbers are the content, not decoration */
body .cal-daynum { font-size: 12px; font-weight: 600; }

/* filter counts and switch states */
body .filter .n,
body span.n { font-size: 11px; }
body .sl { font-size: 11px; }

/* small labels, tags, eyebrows, axis ticks, step numbers */
body .cov-tag,
body .plan-tag,
body .plan-inherit,
body .sec-eyebrow,
body .panel-kicker,
body .final-kicker,
body .paper-kicker,
body .pick-best,
body .chip,
body .tc-badge,
body .rw-axis-label,
body .rw-days,
body .rw-name,
body .dfy-step,
body .dfy-strip-tag,
body .exp-num,
body .exp-url,
body .how-n,
body .step-label,
body .step-n,
body .mark,
body .sig-line { font-size: 11px; }

body .how-n,
body .step-n { font-size: 11px; letter-spacing: .02em; }

/* supporting copy */
body .empty-note,
body .source-account,
body .docs-foot,
body .conn-why,
body .cs-note,
body .bill-note,
body .rep-sec-note,
body .dialog-note,
body .doc-gate { font-size: 11.5px; line-height: 1.5; }

body dt { font-size: 11px; }
body dd { font-size: 11.5px; }
body small { font-size: 11px; }
body .doc-meta dt { font-size: 11px; }
body .doc-meta dd { font-size: 11.5px; }

/* paper previews: same 11px floor as the rest of the app */
body .paper small,
body .paper dt,
body .paper dd,
body .paper b,
body .paper em,
body .paper span,
body .paper p,
body .paper li { font-size: max(11px, 0.75em); }
body .paper .sig-line { font-size: 11px; }

/* the legal footer line on marketing pages */
body footer small,
body footer span,
body .legal-foot { font-size: 11px; }
