.case-body { padding-block: var(--case-space) 0; }
.case-frame { container: case-layout / inline-size; }
.spread { display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; gap: 24px var(--column-gap); }
.case-text h3, .fleet-story h3, .website-project h3, .operations-project h3, .telegram-intro h3 {
  font-size: var(--subheading-size);
  line-height: 1.2;
  letter-spacing: -.025em;
  font-weight: 550;
  text-wrap: balance;
}
.fleet-case .fleet-heading h3, .fleet-case noscript h3 {
  font-size: var(--interface-heading-size);
  line-height: 1.22;
  letter-spacing: -.025em;
  font-weight: 600;
  text-wrap: balance;
}
.case-text > p, .website-project > p, .operations-copy > p,
.case-board-intro, .store-functions dd {
  color: var(--soft);
  max-width: var(--prose-measure);
  line-height: var(--prose-leading);
}
.case-text > p { margin-top: 16px; }
.fleet-case {
  --fleet-inset: clamp(12px, 1.5vw, 24px);
  --fleet-kicker-line: 1.125rem;
  --fleet-kicker-gap: 4px;
  grid-template-areas: "story" "demo" "details";
}
.fleet-case > .fleet-page { grid-area: demo; padding: var(--fleet-inset); }
.fleet-case .fleet-heading {
  margin-block-start: calc(-1 * var(--fleet-inset));
  margin-inline: calc(-1 * var(--fleet-inset));
  padding: var(--fleet-inset);
  border-radius: 8px;
  background: color-mix(in srgb, var(--info) 8%, var(--paper));
}
.fleet-case .fleet-eyebrow { line-height: var(--fleet-kicker-line); margin-bottom: var(--fleet-kicker-gap); }
.fleet-story { grid-area: story; min-width: 0; }
.fleet-details {
  grid-area: details;
  display: grid;
  gap: var(--section-heading-gap);
  min-width: 0;
}
@container case-layout (min-width: 60rem) {
  .fleet-case {
    grid-template-columns: minmax(30rem, 5fr) minmax(23rem, 6fr);
    grid-template-areas: "demo story" "demo details";
    grid-template-rows: auto 1fr;
    row-gap: 12px;
  }
  .fleet-story, .fleet-details { padding-inline: var(--fleet-inset); }
  .fleet-case:has(.fleet-eyebrow) .fleet-story {
    padding-block-start: calc(var(--fleet-inset) + var(--fleet-kicker-line) + var(--fleet-kicker-gap));
  }
}
.fleet-story h3 {
  max-width: 19ch;
}
.fleet-details > p, .fleet-story-lead { color: var(--soft); max-width: var(--prose-measure); line-height: var(--prose-leading); }
.fleet-story-lead {
  margin-block-start: 12px;
  color: var(--ink);
  font-size: clamp(1rem, 1.4vw, 1.125rem);
  line-height: var(--prose-leading);
}
.fleet-story-example {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: var(--column-gap);
  align-items: center;
  padding: clamp(12px, 1.55vw, 20px);
  border-top: 1px solid var(--line);
  background: var(--danger-bg);
}
.fleet-story-duration { color: var(--danger); font-size: .875rem; line-height: 1.25rem; }
.fleet-story-duration strong {
  display: block;
  font-size: clamp(2.45rem, 4.4vw, 4.6rem);
  line-height: .93;
  letter-spacing: -.045em;
  font-weight: 550;
  font-variant-numeric: tabular-nums;
  margin-bottom: 4px;
}
.fleet-story-example-text { font-size: .875rem; line-height: 1.25rem; color: var(--soft); }
.fleet-story-example-text strong { display: block; color: var(--ink); font-weight: 620; margin-bottom: 4px; }
@media (max-width: 430px) {
  .fleet-story-example { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .fleet-story-duration { display: flex; align-items: baseline; gap: 8px; }
  .fleet-story-duration strong { margin-bottom: 0; }
}
.more-projects {
  --project-surface: color-mix(in srgb, var(--info) 8%, var(--paper));
  padding-block-start: var(--case-space);
  scroll-margin-block-start: var(--masthead-height);
}
.more-projects-heading { margin-bottom: var(--section-heading-gap); }
.more-projects-heading h2 { font-size: var(--heading-size); line-height: 1.1; text-wrap: balance; }
.more-projects-heading nav { display: flex; flex-wrap: wrap; column-gap: var(--column-gap); margin-top: 12px; }
.more-projects-heading nav a { display: inline-flex; align-items: center; min-height: 44px; color: var(--soft); font-size: var(--interface-text-size); line-height: 1.4; font-weight: 500; }
.more-projects-heading nav a:hover { color: var(--ink); }
.website-projects, .operations-projects {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--column-gap);
}
.website-project, .operations-project {
  min-width: 0;
  padding: var(--card-inset);
  background: var(--project-surface);
  scroll-margin-block-start: calc(var(--masthead-height) + 16px);
}
.website-project-image img { display: block; width: 100%; height: auto; background: var(--panel); }
.website-project-image figcaption { margin-bottom: 10px; color: var(--soft); font-size: var(--caption-size); line-height: 1.4; }
.fishing-cover, .prmserv-cover { border-radius: 8px; }
.fishing-cover {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #e8e9df;
}
.fishing-cover .fishing-cover-map {
  width: 65%;
  height: 100%;
  object-fit: cover;
  object-position: 96% center;
}
.fishing-cover .fishing-cover-dialog {
  position: absolute;
  top: 50%;
  right: 2%;
  width: 36%;
  transform: translateY(-50%);
  border-radius: clamp(6px, 1vw, 14px);
  box-shadow: 0 3px 14px #22232126;
}
.prmserv-cover {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}
.prmserv-cover .prmserv-cover-photo {
  height: 100%;
  object-fit: cover;
  filter: contrast(1.03) brightness(.92);
  transform: scale(1.3333);
  transform-origin: 14% 100%;
}
.prmserv-cover::after {
  content: "";
  position: absolute;
  top: 38%;
  left: 50%;
  width: 19.7%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  background: rgb(255 255 255 / .94);
  mask: url("prmserv-mark.svg") center / contain no-repeat;
  pointer-events: none;
}
.website-project h3 { margin: clamp(16px, 2vw, 24px) 0 12px; }
.website-project > p + p { margin-top: 12px; }
.website-project-link { display: inline-flex; align-items: center; min-height: 44px; margin-top: 8px; }

.operations-projects {
  --report-gap: clamp(16px, 2vw, 26px);
  margin-block-start: var(--column-gap);
}
.operations-project {
  display: grid;
  align-content: start;
  gap: var(--report-gap);
}
@media (min-width: 920px) {
  .website-projects, .operations-projects { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .operations-projects { row-gap: var(--report-gap); }
  .operations-project {
    grid-row: span 2;
    grid-template-rows: subgrid;
    align-items: start;
  }
}
.operations-copy h3 { max-width: 34ch; }
.operations-copy p { margin-top: 10px; }
.operations-visual {
  --report-inset: clamp(12px, 2vw, 28px);
  min-width: 0;
  padding: var(--report-inset);
}
.operations-visual figcaption {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 12px;
  color: var(--soft);
  font-size: var(--caption-size);
  line-height: 1.125rem;
}
.operations-visual figcaption strong {
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.375rem;
  font-weight: 600;
}
.pay-example {
  padding: 0;
  background: color-mix(in srgb, var(--surface) 55%, white);
}
.pay-example figcaption, .pay-example .operations-result {
  padding-inline: var(--report-inset);
}
.pay-example figcaption { padding-block-start: var(--report-inset); }
.operations-result {
  margin-block: clamp(14px, 1.7vw, 22px);
  color: var(--soft);
  font-size: var(--interface-text-size);
}
.operations-result strong {
  display: block;
  margin-block-end: 6px;
  color: var(--ink);
  font-size: clamp(1.75rem, 3.1vw, 3rem);
  line-height: 1;
  font-weight: 600;
  letter-spacing: -.045em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.pay-example-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-variant-numeric: tabular-nums;
  font-size: .9375rem;
  line-height: 1.25rem;
}
.pay-example-table :is(th, td) { padding: 8px clamp(3px, 1.1vw, 6px); }
.pay-example-table tbody tr + tr { border-top: 1px solid var(--line); }
.pay-example-table thead { background: var(--selection); color: var(--soft); }
.pay-example-table thead th { font-size: var(--interface-text-size); font-weight: 500; }
.pay-example-table :is(th, td):first-child { padding-inline-start: var(--report-inset); }
.pay-example-table :is(th, td):last-child { padding-inline-end: var(--report-inset); white-space: nowrap; text-align: right; }
.pay-example-table thead th:first-child { width: 12%; }
.pay-example-table tbody th { font-weight: 600; }
.pay-example-table tbody strong { display: block; font-weight: 600; }
.pay-example-table small { display: block; margin-top: 2px; color: var(--soft); font-size: var(--interface-text-size); line-height: 1.4; font-weight: 400; }
.pay-formula-term { display: inline-block; }
.pay-formula-rate { white-space: nowrap; }
.pay-example-pending { background: var(--warning-bg); }
.pay-example-pending strong { color: var(--warning); }
.diesel-example {
  container: diesel-example / inline-size;
  display: grid;
  grid-template-rows: auto auto 1fr;
  align-self: stretch;
  background: var(--surface);
  border-radius: 8px;
}
.diesel-comparison {
  display: grid;
  grid-template-rows: repeat(3, 1fr);
}
.diesel-price-row {
  display: grid;
  grid-template-columns: 5em minmax(0, 1fr) 7em;
  align-items: center;
  gap: clamp(8px, 1.4vw, 18px);
  padding-block: 12px;
  font-size: var(--interface-text-size);
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
}
.diesel-price-row { border-block-start: 1px solid var(--line); }
.diesel-reading span, .diesel-delta span { display: block; color: var(--soft); font-size: var(--caption-size); }
.diesel-delta { color: var(--plot-color); text-align: end; }
.diesel-track { position: relative; height: 22px; }
.diesel-track::before, .diesel-track::after { content: ""; position: absolute; }
.diesel-track::before { inset: 0 0 0 50%; border-inline-start: 1px solid var(--outline); }
.diesel-track::after {
  inset-block-start: 50%;
  inset-inline-start: var(--plot-start);
  inline-size: var(--plot-width);
  block-size: 6px;
  background: var(--plot-color);
  transform: translateY(-50%);
}
.diesel-below { --plot-start: 5%; --plot-width: 45%; --plot-color: var(--info); }
.diesel-above { --plot-start: 50%; --plot-width: 22.5%; --plot-color: var(--danger); }
.diesel-limited { grid-column: 2 / -1; color: var(--soft); }

@container diesel-example (max-width: 14rem) {
  .diesel-price-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow-wrap: anywhere;
  }
  .diesel-track { grid-area: 2 / 1 / 3 / -1; }
}

.case-board-intro { margin-top: 16px; }

.order-case { display: grid; align-items: start; gap: clamp(20px, 2.5vw, 32px); }
.order-preview img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.order-preview figcaption {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0 12px;
  padding-inline: 2px;
  color: var(--soft);
  font-size: var(--caption-size);
  line-height: 1.4;
}
.order-preview figcaption a { display: inline-flex; align-items: center; min-block-size: 44px; color: var(--ink); }
.order-preview figcaption a:hover { color: var(--accent); }

@container case-layout (min-width: 62rem) {
  .order-case {
    grid-template-columns: minmax(21rem, 5fr) minmax(36rem, 7fr);
  }
  .order-case .store-functions { grid-column: 1 / -1; }
}

.store-functions > div + div { margin-block-start: 16px; }
.store-functions > div + div::before {
  content: "";
  display: block;
  inline-size: clamp(36px, 4vw, 56px);
  margin-block-end: 14px;
  border-block-start: 1px solid var(--line);
}
.store-functions dt { font-weight: 600; }
.store-functions dd { margin-top: 4px; }

@media (min-width: 700px) {
  .order-case .store-functions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px var(--column-gap);
  }
  .order-case .store-functions > div { margin: 0; padding-block-start: 12px; border-block-start: 1px solid var(--line); }
  .order-case .store-functions > div::before { display: none; }
  .order-case .store-functions dd { font-size: .9375rem; line-height: 1.5; }
}

@container case-layout (min-width: 68rem) {
  .order-case { grid-template-rows: auto 1fr; }
  .order-preview { grid-column: 2; grid-row: 1 / 3; }
  .order-case .store-functions { grid-column: 1; }
}

html:has(.screenshot-dialog[open]) { overflow: hidden; scrollbar-gutter: stable; }
.screenshot-dialog {
  --dialog-inset: clamp(8px, 2vw, 24px);
  --viewer-height: min(870px, calc(100dvh - 2 * var(--dialog-inset) - 66px));
  inline-size: min(1202px, calc(100% - 2 * var(--dialog-inset)));
  max-inline-size: none;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
}
.screenshot-dialog::backdrop { background: rgb(36 33 30 / .76); }
.screenshot-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
  padding: 6px clamp(8px, 1.2vw, 16px);
  border-block-end: 1px solid var(--line);
}
.screenshot-toolbar h2 { flex: 1; font-size: .9375rem; font-weight: 600; }
.screenshot-toolbar button {
  min-block-size: 44px;
  padding-inline: clamp(6px, 1vw, 12px);
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--ink);
  font-size: var(--interface-text-size);
  white-space: nowrap;
}
.screenshot-toolbar button:is(:hover, [aria-pressed="true"]) { background: var(--selection); border-color: var(--line); }
.screenshot-toolbar [type="submit"] { border-color: var(--line); }
.screenshot-view { max-block-size: var(--viewer-height); overflow: auto; overscroll-behavior: contain; background: var(--selection); }
.screenshot-view:focus-visible { outline-offset: -3px; }
.screenshot-view img {
  display: block;
  inline-size: auto;
  block-size: auto;
  max-inline-size: 100%;
  max-block-size: var(--viewer-height);
  margin-inline: auto;
}
.screenshot-dialog[data-full-size] img { max-inline-size: none; max-block-size: none; }

@media (prefers-reduced-motion: no-preference) {
  .screenshot-dialog[open] { animation: screenshot-in 220ms var(--motion-ease) both; }
  @keyframes screenshot-in { from { opacity: 0; translate: 0 8px; } }
}

.debt-summary {
  padding: clamp(12px, 2vw, 24px);
  background: var(--surface);
  border-block-start: 2px solid var(--accent);
  font-variant-numeric: tabular-nums;
}
.debt-summary figcaption {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0 12px;
}
.debt-summary small { color: var(--soft); font-size: var(--caption-size); }
.debt-totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 7.5rem), 1fr)); gap: 12px; margin-block: 18px; }
.debt-totals dt { color: var(--soft); font-size: var(--interface-text-size); line-height: 1.4; }
.debt-totals dd { margin-block-start: 4px; font-size: clamp(1.125rem, 2.65vw, 2.5rem); font-weight: 600; letter-spacing: -.035em; line-height: 1.15; overflow-wrap: anywhere; }
.debt-totals > div:last-child dd { color: var(--danger); }
.table-scroll { overflow-x: auto; }
.table-scroll:focus-visible { outline-offset: -3px; }
.debt-summary table { inline-size: 100%; border-collapse: collapse; font-size: var(--interface-text-size); }
.debt-summary :is(th, td) { padding-block: 8px; border-block-start: 1px solid var(--line); text-align: end; white-space: nowrap; }
.debt-summary th { font-weight: 550; }
.debt-summary tr > :first-child { padding-inline-end: 8px; text-align: start; }
.debt-summary thead th { color: var(--soft); }
.debt-insights { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--column-gap); }
.debt-insights section { padding-block: clamp(14px, 2vw, 24px); border-block-start: 1px solid var(--line); }
.debt-insights h4 { font-size: var(--interface-heading-size); font-weight: 600; line-height: 1.25; }
.debt-insights p { margin-block-start: 8px; max-width: var(--prose-measure); color: var(--soft); line-height: var(--prose-leading); }
.debt-ai { padding-inline: clamp(14px, 2vw, 24px); background: var(--selection); }

.telegram-board {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 24px var(--column-gap);
  padding-block: var(--case-space) 0;
}
.telegram-intro h3 { max-width: 24ch; }
.telegram-intro .case-board-intro { max-width: 40ch; margin-top: 10px; }
.chat-switch {
  display: none;
  min-width: 0;
  max-width: 28rem;
  margin-top: clamp(16px, 2vw, 24px);
  padding: 0;
  border: 0;
}
.chat-switch legend {
  margin-bottom: 6px;
  padding: 0;
  color: var(--soft);
  font-size: var(--interface-text-size);
  font-weight: 500;
}
.chat-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: 1fr;
  gap: 6px 4px;
}
.chat-options label { position: relative; display: grid; cursor: pointer; }
.chat-options label span {
  display: grid;
  place-items: center;
  min-height: 44px;
  padding: 5px 2px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  font-size: .75rem;
  line-height: 1.25;
  font-weight: 500;
  text-align: center;
  overflow-wrap: anywhere;
}
.chat-options input:checked + span {
  border-color: var(--accent);
  background: var(--selection);
  color: var(--accent);
}
.chat-options input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
@media (hover: hover) and (pointer: fine) {
  .chat-options label:hover span { border-color: var(--accent); }
}
.chat-demo {
  display: grid;
  gap: clamp(12px, 1.6vw, 22px);
  min-width: 0;
  padding: max(12px, var(--card-inset));
  background: color-mix(in srgb, var(--info) 8%, var(--paper));
}
.chat-demo-caption { color: var(--soft); font-size: var(--caption-size); }
.chat-content { display: grid; align-items: center; min-width: 0; }
.chat-thread { display: grid; gap: 10px; min-width: 0; width: min(100%, 36rem); margin-inline: auto; overflow-wrap: anywhere; }

.chat-paper {
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--info) 14%, var(--surface));
  border-radius: 14px 14px 14px 3px;
  padding: clamp(12px, 2vw, 24px);
}
.chat-paper header { display: flex; align-items: center; gap: 12px; }
.chat-paper h4 { font-size: 1.125rem; font-weight: 600; line-height: 1.25; text-wrap: balance; }
.chat-paper time { font-size: var(--caption-size); line-height: 1.4; color: var(--soft); }
.chat-paper dl { margin: 12px 0; font-variant-numeric: tabular-nums; }
.chat-paper dl > div { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; border-top: 1px solid var(--line); padding: 8px 0; }
.chat-paper :is(dt, dd, p) { font-size: .9375rem; line-height: 1.4; }
.chat-paper :is(dt, dd) { min-inline-size: 0; }
.chat-paper dd { flex-shrink: 0; max-width: 60%; text-align: end; font-weight: 600; }
.chat-paper p { color: var(--soft); }
.chat-paper .chat-answer { margin-top: 12px; color: var(--ink); }
.chat-paper p + p { margin-top: 8px; }
.chat-request {
  justify-self: end;
  max-width: 90%;
  border-radius: 12px 12px 3px 12px;
  background: color-mix(in srgb, var(--info) 14%, var(--surface));
  padding: 8px 12px;
  font-size: .9375rem;
  line-height: 1.25rem;
}

@supports selector(:has(*)) {
  .chat-switch { display: block; }
  .chat-thread { grid-area: 1 / 1; visibility: hidden; opacity: 0; }
  .telegram-board:has(input[value="summary"]:checked) .summary-chat,
  .telegram-board:has(input[value="lead"]:checked) .lead-chat,
  .telegram-board:has(input[value="deadline"]:checked) .deadline-chat,
  .telegram-board:has(input[value="sales"]:checked) .sales-chat,
  .telegram-board:has(input[value="approval"]:checked) .approval-chat,
  .telegram-board:has(input[value="handbook"]:checked) .handbook-chat { visibility: visible; opacity: 1; }
}

@media (prefers-reduced-motion: no-preference) {
  .chat-thread { transition: opacity 200ms var(--motion-ease); }
  .chat-options label span { transition: border-color var(--control-duration) ease, background-color var(--control-duration) ease, color var(--control-duration) ease; }
}

@media (min-width: 992px) {
  .debt-case, .debt-insights, .telegram-board { grid-template-columns: minmax(320px, 5fr) minmax(0, 7fr); }
  .chat-switch { max-width: none; }
}

@media (max-width: 380px) {
  .debt-summary table { font-size: var(--caption-size); }
}
