/* Business OS design system v2 (docs/architecture/design.md, user 2026-11-20).
 *
 * One stylesheet for every edge page and the overlay. Every rule is scoped
 * under html[data-bos-design="v2"], which design.js sets only for a member the
 * "עיצוב חדש" switch is on for: with the switch off, nothing here applies and
 * every page looks exactly as before. No new colours: the greys are Twenty's
 * own scale, the accent is the overlay's teal, the status colours are the
 * overlay's action and timer colours, and the chart series are the
 * dashboard's palette (design.md §2). Logical properties only, so the same
 * rules serve Hebrew (RTL) and English (LTR). Spacing on a 4px grid.
 */

/* Heebo (SIL Open Font License 1.1, fonts/OFL-Heebo.txt), self-hosted,
   variable weight. Its digits all share one width, so amounts line up. A
   face is fetched only when a page uses it. */
@font-face {
  font-family: "Heebo BOS";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("/_bos/edge/fonts/heebo-hebrew-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F;
}

@font-face {
  font-family: "Heebo BOS";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("/_bos/edge/fonts/heebo-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------------------------------------------------------------- tokens */

html[data-bos-design="v2"] {
  /* Surfaces and text: Twenty's grey scale (light). */
  --ds-bg: #f9f9f9;
  --ds-surface: #ffffff;
  --ds-surface-2: #f6f6f6;
  --ds-line: #ebebeb;
  --ds-line-strong: #d6d6d6;
  --ds-field-line: #838383;
  --ds-text: #333333;
  --ds-text-2: #666666;
  --ds-text-3: #999999;

  /* The one action colour: the overlay's teal. */
  --ds-accent: #0f766e;
  --ds-accent-fill: #0f766e;
  --ds-accent-fill-hover: #115e59;
  --ds-accent-soft: #e0f8f3;
  --ds-on-accent: #ffffff;

  /* Status: the overlay's action and timer colours, each with a soft
     background its own text reads on at 4.5:1 or more. */
  --ds-good: #18794e;
  --ds-good-soft: #e3f4ea;
  --ds-bad: #c4262c;
  --ds-bad-soft: #fdecec;
  --ds-warn: #c2410c;
  --ds-warn-soft: #fdeee4;
  --ds-info: #0b62c4;
  --ds-info-soft: #e6effb;
  --ds-purple: #7239ad;
  --ds-purple-soft: #f1eaf9;
  --ds-neutral-soft: #f1f1f1;

  /* Chart series, fixed meaning on every page (design.md §2.2). */
  --ds-series-revenue: #2f6fdb;
  --ds-series-cost: #b5581a;
  --ds-series-profit: #1f8a4c;
  --ds-series-4: #8e44ad;
  --ds-series-bad: #c2382f;
  --ds-series-neutral: #6b7280;

  /* Type. */
  --ds-font: "Heebo BOS", "Assistant BOS", system-ui, sans-serif;
  --ds-text-xs: 12px;
  --ds-text-sm: 13px;
  --ds-text-md: 14px;
  --ds-text-lg: 16px;
  --ds-text-xl: 20px;
  --ds-text-2xl: 24px;
  --ds-text-num: 28px;
  --ds-leading-xs: 16px;
  --ds-leading-sm: 20px;
  --ds-leading-md: 20px;
  --ds-leading-lg: 24px;
  --ds-leading-xl: 28px;
  --ds-leading-2xl: 32px;

  /* Spacing: the 4px grid. */
  --ds-space-1: 4px;
  --ds-space-2: 8px;
  --ds-space-3: 12px;
  --ds-space-4: 16px;
  --ds-space-5: 20px;
  --ds-space-6: 24px;
  --ds-space-8: 32px;
  --ds-space-10: 40px;
  --ds-space-12: 48px;

  /* Radius, as Twenty's sm and md. */
  --ds-radius-sm: 4px;
  --ds-radius-md: 6px;
  --ds-radius-lg: 8px;
  --ds-radius-pill: 999px;

  /* Two shadows only. */
  --ds-shadow-1: 0 1px 2px rgb(0 0 0 / 0.06);
  --ds-shadow-2: 0 4px 16px rgb(0 0 0 / 0.12), 0 0 0 1px var(--ds-line);

  --ds-focus: 0 0 0 2px var(--ds-surface), 0 0 0 4px var(--ds-accent);
  --ds-motion-fast: 120ms;
  --ds-motion: 180ms;
  --ds-card-pad: var(--ds-space-5);

  color-scheme: light;
}

/* Dark: the edge pages follow the system setting unless Twenty set .light;
   Twenty's own pages carry html.dark. */
@media (prefers-color-scheme: dark) {
  html[data-bos-design="v2"]:not(.light) {
    --ds-bg: #171717;
    --ds-surface: #1d1d1d;
    --ds-surface-2: #232323;
    --ds-line: #2e2e2e;
    --ds-line-strong: #484848;
    --ds-field-line: #818181;
    --ds-text: #ebebeb;
    --ds-text-2: #b3b3b3;
    --ds-text-3: #818181;
    --ds-accent: #0bd8b6;
    --ds-accent-fill: #0f766e;
    --ds-accent-fill-hover: #115e59;
    --ds-accent-soft: #0d2d2a;
    --ds-good: #3dd68c;
    --ds-good-soft: #11291c;
    --ds-bad: #fca5a5;
    --ds-bad-soft: #3a1717;
    --ds-warn: #fdba74;
    --ds-warn-soft: #36210f;
    --ds-info: #93c5fd;
    --ds-info-soft: #13253b;
    --ds-purple: #c4b5fd;
    --ds-purple-soft: #261c38;
    --ds-neutral-soft: #2a2a2a;
    --ds-series-revenue: #6ea2ff;
    --ds-series-cost: #f0a46a;
    --ds-series-profit: #4cc27f;
    --ds-series-4: #c39be0;
    --ds-series-bad: #f07067;
    --ds-series-neutral: #9aa3ad;
    --ds-shadow-1: 0 1px 2px rgb(0 0 0 / 0.4);
    --ds-shadow-2: 0 8px 24px rgb(0 0 0 / 0.5), 0 0 0 1px var(--ds-line-strong);
    color-scheme: dark;
  }
}

html[data-bos-design="v2"].dark {
  --ds-bg: #171717;
  --ds-surface: #1d1d1d;
  --ds-surface-2: #232323;
  --ds-line: #2e2e2e;
  --ds-line-strong: #484848;
  --ds-field-line: #818181;
  --ds-text: #ebebeb;
  --ds-text-2: #b3b3b3;
  --ds-text-3: #818181;
  --ds-accent: #0bd8b6;
  --ds-accent-fill: #0f766e;
  --ds-accent-fill-hover: #115e59;
  --ds-accent-soft: #0d2d2a;
  --ds-good: #3dd68c;
  --ds-good-soft: #11291c;
  --ds-bad: #fca5a5;
  --ds-bad-soft: #3a1717;
  --ds-warn: #fdba74;
  --ds-warn-soft: #36210f;
  --ds-info: #93c5fd;
  --ds-info-soft: #13253b;
  --ds-purple: #c4b5fd;
  --ds-purple-soft: #261c38;
  --ds-neutral-soft: #2a2a2a;
  --ds-series-revenue: #6ea2ff;
  --ds-series-cost: #f0a46a;
  --ds-series-profit: #4cc27f;
  --ds-series-4: #c39be0;
  --ds-series-bad: #f07067;
  --ds-series-neutral: #9aa3ad;
  --ds-shadow-1: 0 1px 2px rgb(0 0 0 / 0.4);
  --ds-shadow-2: 0 8px 24px rgb(0 0 0 / 0.5), 0 0 0 1px var(--ds-line-strong);
  color-scheme: dark;
}

/* ------------------------------------------------------------------ base */

/* Edge pages opt their body in with .ds-body; Twenty's own body is left to
   the overlay rules. */
html[data-bos-design="v2"] body.ds-body {
  margin: 0;
  background: var(--ds-bg);
  color: var(--ds-text);
  font-family: var(--ds-font);
  font-size: var(--ds-text-md);
  line-height: var(--ds-leading-md);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

html[data-bos-design="v2"] .ds-body *,
html[data-bos-design="v2"] .ds-body *::before,
html[data-bos-design="v2"] .ds-body *::after {
  box-sizing: border-box;
}

html[data-bos-design="v2"] .ds-num,
html[data-bos-design="v2"] .ds-kpi-value,
html[data-bos-design="v2"] .ds-table td,
html[data-bos-design="v2"] .ds-tip {
  font-variant-numeric: tabular-nums;
}

/* Visible keyboard focus, everywhere, the same ring. */
html[data-bos-design="v2"] .ds-body :focus-visible,
html[data-bos-design="v2"] [class^="ds-"]:focus-visible,
html[data-bos-design="v2"] [class*=" ds-"]:focus-visible {
  outline: 2px solid var(--ds-accent);
  outline-offset: 2px;
}

html[data-bos-design="v2"] .ds-body a,
html[data-bos-design="v2"] a.ds-link {
  color: var(--ds-accent);
  text-decoration: none;
  text-underline-offset: 3px;
}

html[data-bos-design="v2"] .ds-body a:hover,
html[data-bos-design="v2"] a.ds-link:hover {
  text-decoration: underline;
}

html[data-bos-design="v2"] .ds-visually-hidden {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------------------------------------------------------------- layout */

html[data-bos-design="v2"] .ds-page {
  max-inline-size: 1280px;
  margin-inline: auto;
  padding: var(--ds-space-6);
  display: flex;
  flex-direction: column;
  gap: var(--ds-space-6);
}

html[data-bos-design="v2"] .ds-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--ds-space-3) var(--ds-space-4);
  min-block-size: var(--ds-space-10);
}

html[data-bos-design="v2"] .ds-title {
  margin: 0;
  font-size: var(--ds-text-2xl);
  line-height: var(--ds-leading-2xl);
  font-weight: 600;
  letter-spacing: -0.01em;
}

html[data-bos-design="v2"] .ds-subtitle {
  margin: 0;
  color: var(--ds-text-2);
  font-size: var(--ds-text-sm);
  line-height: var(--ds-leading-sm);
}

html[data-bos-design="v2"] .ds-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--ds-space-2);
}

html[data-bos-design="v2"] .ds-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--ds-space-4);
  align-items: stretch;
}

html[data-bos-design="v2"] .ds-grid > * {
  grid-column: span 12;
  min-inline-size: 0;
}

html[data-bos-design="v2"] .ds-grid > .ds-span-3 { grid-column: span 3; }
html[data-bos-design="v2"] .ds-grid > .ds-span-4 { grid-column: span 4; }
html[data-bos-design="v2"] .ds-grid > .ds-span-6 { grid-column: span 6; }
html[data-bos-design="v2"] .ds-grid > .ds-span-8 { grid-column: span 8; }

@media (max-width: 1023px) {
  html[data-bos-design="v2"] .ds-grid > .ds-span-3,
  html[data-bos-design="v2"] .ds-grid > .ds-span-4 { grid-column: span 6; }
  html[data-bos-design="v2"] .ds-grid > .ds-span-6,
  html[data-bos-design="v2"] .ds-grid > .ds-span-8 { grid-column: span 12; }
}

@media (max-width: 639px) {
  html[data-bos-design="v2"] {
    --ds-card-pad: var(--ds-space-4);
  }
  html[data-bos-design="v2"] .ds-page {
    padding: var(--ds-space-4);
    gap: var(--ds-space-4);
  }
  html[data-bos-design="v2"] .ds-title {
    font-size: var(--ds-text-xl);
    line-height: var(--ds-leading-xl);
  }
  html[data-bos-design="v2"] .ds-grid {
    gap: var(--ds-space-3);
  }
  html[data-bos-design="v2"] .ds-grid > .ds-span-3,
  html[data-bos-design="v2"] .ds-grid > .ds-span-4 { grid-column: span 12; }
  html[data-bos-design="v2"] .ds-grid > .ds-kpi.ds-span-3 { grid-column: span 6; }
}

/* ----------------------------------------------------------------- cards */

html[data-bos-design="v2"] .ds-card {
  background: var(--ds-surface);
  border: 1px solid var(--ds-line);
  border-radius: var(--ds-radius-lg);
  padding: var(--ds-card-pad);
  display: flex;
  flex-direction: column;
  gap: var(--ds-space-4);
  min-inline-size: 0;
}

html[data-bos-design="v2"] .ds-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--ds-space-3);
  min-block-size: var(--ds-space-6);
}

html[data-bos-design="v2"] .ds-card-title {
  margin: 0;
  color: var(--ds-text-2);
  font-size: var(--ds-text-sm);
  line-height: var(--ds-leading-sm);
  font-weight: 600;
}

html[data-bos-design="v2"] .ds-card-body {
  min-inline-size: 0;
  overflow-x: auto;
}

/* A chart fits its card (user, 2026-11-21: a grey scrollbar showed inside
   the "רווח נקי" chart on its left edge): its axis labels may reach into the
   card's padding, which never scrolls. Tables still scroll in their own wrap. */
html[data-bos-design="v2"] .ds-card-body:has(> .ds-chart-box),
html[data-bos-design="v2"] .ds-card-body:has(> svg.ds-chart) {
  overflow: visible;
}

html[data-bos-design="v2"] a.ds-card,
html[data-bos-design="v2"] button.ds-card {
  color: inherit;
  text-decoration: none;
  text-align: start;
  font: inherit;
  cursor: pointer;
  transition: border-color var(--ds-motion-fast), box-shadow var(--ds-motion-fast);
}

html[data-bos-design="v2"] a.ds-card:hover,
html[data-bos-design="v2"] button.ds-card:hover {
  border-color: var(--ds-line-strong);
  box-shadow: var(--ds-shadow-1);
  text-decoration: none;
}

/* KPI: label, number, change. */
html[data-bos-design="v2"] .ds-kpi {
  gap: var(--ds-space-2);
}

html[data-bos-design="v2"] .ds-kpi-label {
  color: var(--ds-text-2);
  font-size: var(--ds-text-sm);
  line-height: var(--ds-leading-sm);
  font-weight: 600;
}

html[data-bos-design="v2"] .ds-kpi-value {
  font-size: var(--ds-text-num);
  line-height: var(--ds-leading-2xl);
  font-weight: 600;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

html[data-bos-design="v2"] .ds-kpi-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--ds-space-2);
  color: var(--ds-text-2);
  font-size: var(--ds-text-xs);
  line-height: var(--ds-leading-xs);
}

/* A change carries an arrow, never colour alone. */
html[data-bos-design="v2"] .ds-delta {
  display: inline-flex;
  align-items: center;
  gap: var(--ds-space-1);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

html[data-bos-design="v2"] .ds-delta::before {
  font-size: 10px;
  line-height: 1;
}

html[data-bos-design="v2"] .ds-delta[data-trend="up"] { color: var(--ds-good); }
html[data-bos-design="v2"] .ds-delta[data-trend="up"]::before { content: "▲"; }
html[data-bos-design="v2"] .ds-delta[data-trend="down"] { color: var(--ds-bad); }
html[data-bos-design="v2"] .ds-delta[data-trend="down"]::before { content: "▼"; }
html[data-bos-design="v2"] .ds-delta[data-trend="flat"] { color: var(--ds-text-2); }
html[data-bos-design="v2"] .ds-delta[data-trend="flat"]::before { content: "■"; }

/* Where up is bad (cost, overdue), the page sets data-good="down". */
html[data-bos-design="v2"] .ds-delta[data-good="down"][data-trend="up"] { color: var(--ds-bad); }
html[data-bos-design="v2"] .ds-delta[data-good="down"][data-trend="down"] { color: var(--ds-good); }

/* ---------------------------------------------------------------- tables */

html[data-bos-design="v2"] .ds-table {
  inline-size: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--ds-text-sm);
  line-height: var(--ds-leading-sm);
}

html[data-bos-design="v2"] .ds-table th,
html[data-bos-design="v2"] .ds-table td {
  block-size: 40px;
  padding-block: var(--ds-space-2);
  padding-inline: var(--ds-space-3);
  border-block-end: 1px solid var(--ds-line);
  text-align: start;
  vertical-align: middle;
  white-space: nowrap;
}

html[data-bos-design="v2"] .ds-table-dense th,
html[data-bos-design="v2"] .ds-table-dense td {
  block-size: 32px;
  padding-block: var(--ds-space-1);
}

html[data-bos-design="v2"] .ds-table thead th {
  position: sticky;
  inset-block-start: 0;
  z-index: 1;
  background: var(--ds-surface-2);
  color: var(--ds-text-2);
  font-size: var(--ds-text-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
}

html[data-bos-design="v2"] .ds-table thead th:first-child { border-start-start-radius: var(--ds-radius-sm); }
html[data-bos-design="v2"] .ds-table thead th:last-child { border-start-end-radius: var(--ds-radius-sm); }

html[data-bos-design="v2"] .ds-table .ds-num,
html[data-bos-design="v2"] .ds-table th.ds-num {
  text-align: end;
}

html[data-bos-design="v2"] .ds-table tbody tr {
  transition: background-color var(--ds-motion-fast);
}

html[data-bos-design="v2"] .ds-table tbody tr:hover {
  background: var(--ds-surface-2);
}

html[data-bos-design="v2"] .ds-table tfoot td {
  background: var(--ds-surface-2);
  font-weight: 600;
  border-block-end: 0;
}

html[data-bos-design="v2"] .ds-table tbody tr:last-child td {
  border-block-end-color: var(--ds-line-strong);
}

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

html[data-bos-design="v2"] .ds-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--ds-space-2);
  block-size: 32px;
  padding-inline: var(--ds-space-3);
  border: 1px solid var(--ds-field-line);
  border-radius: var(--ds-radius-md);
  background: var(--ds-surface);
  color: var(--ds-text);
  font: inherit;
  font-size: var(--ds-text-sm);
  font-weight: 600;
  line-height: var(--ds-leading-sm);
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--ds-motion-fast), border-color var(--ds-motion-fast), color var(--ds-motion-fast);
}

html[data-bos-design="v2"] .ds-btn:hover {
  background: var(--ds-surface-2);
  text-decoration: none;
}

html[data-bos-design="v2"] .ds-btn:disabled,
html[data-bos-design="v2"] .ds-btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
}

html[data-bos-design="v2"] .ds-btn-primary {
  background: var(--ds-accent-fill);
  border-color: var(--ds-accent-fill);
  color: var(--ds-on-accent);
}

html[data-bos-design="v2"] .ds-btn-primary:hover {
  background: var(--ds-accent-fill-hover);
  border-color: var(--ds-accent-fill-hover);
}

html[data-bos-design="v2"] .ds-btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--ds-text-2);
}

html[data-bos-design="v2"] .ds-btn-ghost:hover {
  background: var(--ds-surface-2);
  color: var(--ds-text);
}

html[data-bos-design="v2"] .ds-btn-danger {
  color: var(--ds-bad);
  border-color: var(--ds-field-line);
}

html[data-bos-design="v2"] .ds-btn-lg {
  block-size: 40px;
  padding-inline: var(--ds-space-4);
  font-size: var(--ds-text-md);
}

@media (pointer: coarse) {
  html[data-bos-design="v2"] .ds-btn {
    block-size: 40px;
  }
}

/* Selects and the segmented period picker. */
html[data-bos-design="v2"] .ds-select {
  block-size: 32px;
  padding-inline: var(--ds-space-3) var(--ds-space-8);
  border: 1px solid var(--ds-field-line);
  border-radius: var(--ds-radius-md);
  background: var(--ds-surface);
  color: var(--ds-text);
  font: inherit;
  font-size: var(--ds-text-sm);
}

html[data-bos-design="v2"] .ds-segmented {
  display: inline-flex;
  padding: 2px;
  gap: 2px;
  border: 1px solid var(--ds-line);
  border-radius: var(--ds-radius-md);
  background: var(--ds-surface-2);
  max-inline-size: 100%;
  overflow-x: auto;
}

html[data-bos-design="v2"] .ds-segmented > button {
  block-size: 28px;
  padding-inline: var(--ds-space-3);
  border: 0;
  border-radius: var(--ds-radius-sm);
  background: transparent;
  color: var(--ds-text-2);
  font: inherit;
  font-size: var(--ds-text-sm);
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

html[data-bos-design="v2"] .ds-segmented > button[aria-pressed="true"] {
  background: var(--ds-surface);
  color: var(--ds-text);
  box-shadow: var(--ds-shadow-1), 0 0 0 1px var(--ds-line);
}

/* ----------------------------------------------------------------- chips */

html[data-bos-design="v2"] .ds-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--ds-space-1);
  block-size: 20px;
  padding-inline: var(--ds-space-2);
  border-radius: var(--ds-radius-sm);
  background: var(--ds-neutral-soft);
  color: var(--ds-text-2);
  font-size: var(--ds-text-xs);
  line-height: var(--ds-leading-xs);
  font-weight: 600;
  white-space: nowrap;
}

html[data-bos-design="v2"] .ds-chip[data-tone="good"] { background: var(--ds-good-soft); color: var(--ds-good); }
html[data-bos-design="v2"] .ds-chip[data-tone="bad"] { background: var(--ds-bad-soft); color: var(--ds-bad); }
html[data-bos-design="v2"] .ds-chip[data-tone="warn"] { background: var(--ds-warn-soft); color: var(--ds-warn); }
html[data-bos-design="v2"] .ds-chip[data-tone="info"] { background: var(--ds-info-soft); color: var(--ds-info); }
html[data-bos-design="v2"] .ds-chip[data-tone="accent"] { background: var(--ds-accent-soft); color: var(--ds-accent); }
html[data-bos-design="v2"] .ds-chip[data-tone="purple"] { background: var(--ds-purple-soft); color: var(--ds-purple); }

/* A dot before the label, so a chip's meaning is not colour alone when the
   page adds a word; the dot is the same colour as the text. */
html[data-bos-design="v2"] .ds-chip[data-dot]::before {
  content: "";
  inline-size: 6px;
  block-size: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ------------------------------------------------- empty, loading, errors */

html[data-bos-design="v2"] .ds-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--ds-space-2);
  min-block-size: 120px;
  padding: var(--ds-space-6);
  border: 1px dashed var(--ds-line-strong);
  border-radius: var(--ds-radius-lg);
  color: var(--ds-text-2);
  font-size: var(--ds-text-sm);
  text-align: center;
}

html[data-bos-design="v2"] .ds-empty-title {
  color: var(--ds-text);
  font-weight: 600;
}

html[data-bos-design="v2"] .ds-skeleton {
  display: block;
  min-block-size: 12px;
  border-radius: var(--ds-radius-sm);
  background: var(--ds-surface-2);
  background-image: linear-gradient(90deg, transparent, var(--ds-line), transparent);
  background-size: 200% 100%;
  animation: ds-shimmer 1.4s ease-in-out infinite;
}

@keyframes ds-shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

html[data-bos-design="v2"] .ds-notice {
  padding: var(--ds-space-3) var(--ds-space-4);
  border: 1px solid var(--ds-line);
  border-inline-start: 4px solid var(--ds-info);
  border-radius: var(--ds-radius-md);
  background: var(--ds-surface);
  color: var(--ds-text);
  font-size: var(--ds-text-sm);
}

html[data-bos-design="v2"] .ds-notice[data-tone="bad"] { border-inline-start-color: var(--ds-bad); }
html[data-bos-design="v2"] .ds-notice[data-tone="warn"] { border-inline-start-color: var(--ds-warn); }
html[data-bos-design="v2"] .ds-notice[data-tone="good"] { border-inline-start-color: var(--ds-good); }

/* --------------------------------------------------------------- tooltip */

html[data-bos-design="v2"] .ds-tip,
html[data-bos-design="v2"] #bos-tip {
  position: fixed;
  z-index: 1000;
  max-inline-size: min(280px, calc(100vw - 16px));
  padding: var(--ds-space-2) var(--ds-space-3);
  border-radius: var(--ds-radius-md);
  background: var(--ds-text);
  color: var(--ds-surface);
  box-shadow: var(--ds-shadow-2);
  font-family: var(--ds-font);
  font-size: var(--ds-text-sm);
  line-height: var(--ds-leading-sm);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  white-space: pre-line;
}

html[data-bos-design="v2"] .ds-tip[hidden],
html[data-bos-design="v2"] #bos-tip[hidden] {
  display: none;
}

/* ---------------------------------------------------------------- legend */

html[data-bos-design="v2"] .ds-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ds-space-2) var(--ds-space-4);
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--ds-text-2);
  font-size: var(--ds-text-xs);
  line-height: var(--ds-leading-xs);
}

html[data-bos-design="v2"] .ds-legend li {
  display: inline-flex;
  align-items: center;
  gap: var(--ds-space-2);
}

html[data-bos-design="v2"] .ds-legend svg {
  flex: none;
}

/* ----------------------------------------------------------------- charts */

html[data-bos-design="v2"] .ds-chart {
  display: block;
  overflow: visible;
  color: var(--ds-text-2);
  font-family: var(--ds-font);
  font-variant-numeric: tabular-nums;
}

/* A chart without a fixed size fills its card and keeps its proportions. */
html[data-bos-design="v2"] svg.ds-chart:not([width]) {
  inline-size: 100%;
  block-size: auto;
}

html[data-bos-design="v2"] .ds-chart .ds-grid-line {
  stroke: var(--ds-line);
  stroke-width: 1;
  shape-rendering: crispEdges;
}

html[data-bos-design="v2"] .ds-chart .ds-axis-zero {
  stroke: var(--ds-line-strong);
  stroke-width: 1;
  shape-rendering: crispEdges;
}

html[data-bos-design="v2"] .ds-chart text {
  fill: var(--ds-text-2);
  font-size: 12px;
}

html[data-bos-design="v2"] .ds-chart .ds-label {
  fill: var(--ds-text);
  font-weight: 600;
}

/* A mark inside a chart, and a legend's swatch, which is itself a small
   svg.ds-chart carrying its series (batch 3, user 2026-11-23: the swatches
   were grey, the chart's text colour). */
html[data-bos-design="v2"] .ds-chart [data-series="revenue"], html[data-bos-design="v2"] .ds-chart[data-series="revenue"] { color: var(--ds-series-revenue); }
html[data-bos-design="v2"] .ds-chart [data-series="cost"], html[data-bos-design="v2"] .ds-chart[data-series="cost"] { color: var(--ds-series-cost); }
html[data-bos-design="v2"] .ds-chart [data-series="profit"], html[data-bos-design="v2"] .ds-chart[data-series="profit"] { color: var(--ds-series-profit); }
html[data-bos-design="v2"] .ds-chart [data-series="s4"], html[data-bos-design="v2"] .ds-chart[data-series="s4"] { color: var(--ds-series-4); }
html[data-bos-design="v2"] .ds-chart [data-series="bad"], html[data-bos-design="v2"] .ds-chart[data-series="bad"] { color: var(--ds-series-bad); }
html[data-bos-design="v2"] .ds-chart [data-series="neutral"], html[data-bos-design="v2"] .ds-chart[data-series="neutral"] { color: var(--ds-series-neutral); }

html[data-bos-design="v2"] .ds-chart [data-tip] {
  cursor: default;
  outline: none;
  transition: opacity var(--ds-motion-fast);
}

/* The mark in focus gets the ring; its siblings dim a little on hover. */
html[data-bos-design="v2"] .ds-chart [data-tip]:focus-visible {
  stroke: var(--ds-accent);
  stroke-width: 2px;
}

html[data-bos-design="v2"] .ds-chart:hover [data-tip]:not(:hover):not(:focus) {
  opacity: 0.72;
}

/* Ranked bars (HTML, so long Hebrew and English names wrap cleanly). Design
   round 2 (user, 2026-11-21): every bar of a list starts on the same edge (the
   reading side's start), is thick and solid in its series' colour (revenue
   unless the meaning says otherwise), with no grey track, and its value sits
   right at its end. */
html[data-bos-design="v2"] .ds-ranked {
  display: flex;
  flex-direction: column;
  gap: var(--ds-space-1);
  margin: 0;
  padding: 0;
  list-style: none;
}

html[data-bos-design="v2"] .ds-ranked-row {
  --ds-ranked-value-room: 128px;
  display: grid;
  grid-template-columns: var(--ds-space-6) minmax(0, 11rem) minmax(0, 1fr);
  grid-template-areas: "rank name track";
  align-items: center;
  gap: var(--ds-space-1) var(--ds-space-3);
  min-block-size: var(--ds-space-8);
  padding: var(--ds-space-1) 0;
  border-radius: var(--ds-radius-sm);
  color: inherit;
  text-decoration: none;
}

/* A row without a rank (a step of a funnel names its own order). */
html[data-bos-design="v2"] .ds-ranked-row:not(:has(> .ds-ranked-rank)) {
  grid-template-columns: minmax(0, 11rem) minmax(0, 1fr);
  grid-template-areas: "name track";
}

html[data-bos-design="v2"] a.ds-ranked-row:hover {
  text-decoration: none;
  background: var(--ds-surface-2);
}

html[data-bos-design="v2"] .ds-ranked-rank {
  grid-area: rank;
  color: var(--ds-text-2);
  font-size: var(--ds-text-xs);
  font-variant-numeric: tabular-nums;
  text-align: center;
}

html[data-bos-design="v2"] .ds-ranked-name {
  grid-area: name;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--ds-text-sm);
}

/* The bar and its value on one line: the bar grows from the start edge, the
   value follows it. */
html[data-bos-design="v2"] .ds-ranked-track {
  grid-area: track;
  display: flex;
  align-items: center;
  gap: var(--ds-space-2);
  min-inline-size: 0;
}

html[data-bos-design="v2"] .ds-ranked-bar {
  flex: none;
  inline-size: calc((100% - var(--ds-ranked-value-room)) * var(--ds-share, 0));
  min-inline-size: 4px;
  block-size: 16px;
  border-radius: var(--ds-radius-sm);
  background: var(--ds-series-revenue);
}

html[data-bos-design="v2"] .ds-ranked-row[data-series="cost"] .ds-ranked-bar { background: var(--ds-series-cost); }
html[data-bos-design="v2"] .ds-ranked-row[data-series="profit"] .ds-ranked-bar { background: var(--ds-series-profit); }
html[data-bos-design="v2"] .ds-ranked-row[data-series="s4"] .ds-ranked-bar { background: var(--ds-series-4); }
html[data-bos-design="v2"] .ds-ranked-row[data-series="bad"] .ds-ranked-bar { background: var(--ds-series-bad); }

html[data-bos-design="v2"] .ds-ranked-value {
  flex: none;
  font-size: var(--ds-text-sm);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* A phone: the name above, the bar and its value under it. */
@media (max-width: 639px) {
  html[data-bos-design="v2"] .ds-ranked-row {
    grid-template-columns: var(--ds-space-6) minmax(0, 1fr);
    grid-template-areas: "rank name" "rank track";
  }

  html[data-bos-design="v2"] .ds-ranked-row:not(:has(> .ds-ranked-rank)) {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "name" "track";
  }
}

/* Meter (collected of total): two solid parts, done in the profit colour and
   what is still open in the "waiting" colour. No grey track. */
html[data-bos-design="v2"] .ds-meter {
  block-size: 12px;
  border-radius: var(--ds-radius-sm);
  background: var(--ds-warn);
  overflow: hidden;
}

html[data-bos-design="v2"] .ds-meter > span {
  display: block;
  block-size: 100%;
  background: var(--ds-series-profit);
}

/* ------------------------------------------------- design round 2 parts */

/* The four key numbers on top: larger, two by two below 1024. */
html[data-bos-design="v2"] .ds-kpi-key .ds-kpi-value {
  font-size: 32px;
  line-height: 40px;
}

@media (max-width: 1023px) {
  html[data-bos-design="v2"] .ds-grid > .ds-kpi-key.ds-span-3 {
    grid-column: span 6;
  }
}

@media (max-width: 639px) {
  html[data-bos-design="v2"] .ds-kpis-key {
    gap: var(--ds-space-3);
  }

  html[data-bos-design="v2"] .ds-kpi-key {
    --ds-card-pad: var(--ds-space-3);
  }

  html[data-bos-design="v2"] .ds-kpi-key .ds-kpi-value {
    font-size: var(--ds-text-xl);
    line-height: var(--ds-leading-xl);
  }

  html[data-bos-design="v2"] .ds-kpi-key .ds-kpi-foot {
    flex-wrap: wrap;
  }
}

/* Smaller figures in a row (the detail area): label over number. */
html[data-bos-design="v2"] .ds-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
  gap: var(--ds-space-3);
}

html[data-bos-design="v2"] .ds-stat .ds-kpi-value {
  font-size: var(--ds-text-xl);
  line-height: var(--ds-leading-xl);
}

@media (max-width: 639px) {
  html[data-bos-design="v2"] .ds-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  html[data-bos-design="v2"] .ds-stat {
    --ds-card-pad: var(--ds-space-3);
  }

  html[data-bos-design="v2"] .ds-stat .ds-kpi-value {
    font-size: var(--ds-text-lg);
    line-height: var(--ds-leading-lg);
  }
}

/* A section heading between groups of cards. */
html[data-bos-design="v2"] .ds-section-title {
  margin: var(--ds-space-4) 0 0;
  font-size: var(--ds-text-lg);
  line-height: var(--ds-leading-lg);
  font-weight: 600;
}

/* Tabs: one group of cards at a time. */
html[data-bos-design="v2"] .ds-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ds-space-1);
  border-block-end: 1px solid var(--ds-line);
}

html[data-bos-design="v2"] .ds-tabs > [role="tab"] {
  appearance: none;
  min-block-size: 40px;
  margin-block-end: -1px;
  padding-inline: var(--ds-space-4);
  border: 0;
  border-block-end: 2px solid transparent;
  background: transparent;
  color: var(--ds-text-2);
  font: inherit;
  font-size: var(--ds-text-md);
  font-weight: 600;
  cursor: pointer;
  transition: color var(--ds-motion-fast), border-color var(--ds-motion-fast);
}

html[data-bos-design="v2"] .ds-tabs > [role="tab"]:hover {
  color: var(--ds-text);
}

html[data-bos-design="v2"] .ds-tabs > [role="tab"][aria-selected="true"] {
  border-block-end-color: var(--ds-accent);
  color: var(--ds-text);
}

html[data-bos-design="v2"] .ds-tabs > [role="tab"]:focus-visible {
  outline: 2px solid var(--ds-accent);
  outline-offset: -2px;
}

html[data-bos-design="v2"] [role="tabpanel"][hidden] {
  display: none;
}

/* A sortable table: each column header is a button; the sorted one says so
   (aria-sort) and shows its direction. */
html[data-bos-design="v2"] .ds-sort {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: var(--ds-space-1);
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

html[data-bos-design="v2"] .ds-sort:hover {
  color: var(--ds-text);
}

html[data-bos-design="v2"] .ds-sort:focus-visible {
  outline: 2px solid var(--ds-accent);
  outline-offset: 2px;
  border-radius: var(--ds-radius-sm);
}

html[data-bos-design="v2"] .ds-sort::after {
  content: "↕";
  color: var(--ds-text-2);
  font-size: 10px;
}

html[data-bos-design="v2"] th[aria-sort="ascending"] .ds-sort::after { content: "▲"; color: var(--ds-text); }
html[data-bos-design="v2"] th[aria-sort="descending"] .ds-sort::after { content: "▼"; color: var(--ds-text); }

html[data-bos-design="v2"] th[aria-sort] {
  color: var(--ds-text);
}

html[data-bos-design="v2"] .ds-table th.ds-num .ds-sort {
  flex-direction: row;
}

/* A small solid bar inside a number cell, from the cell's start edge, the
   value at the end. */
html[data-bos-design="v2"] .ds-cell-bar {
  display: flex;
  align-items: center;
  gap: var(--ds-space-2);
  min-inline-size: 160px;
}

html[data-bos-design="v2"] .ds-cell-bar > .ds-cell-fill {
  flex: none;
  inline-size: calc((100% - 96px) * var(--ds-share, 0));
  min-inline-size: 2px;
  block-size: 8px;
  border-radius: 2px;
  background: var(--ds-series-revenue);
}

html[data-bos-design="v2"] .ds-cell-bar > .ds-cell-value {
  flex: 1 0 auto;
  text-align: end;
}

/* A name cell that opens what is behind it. */
html[data-bos-design="v2"] .ds-table .ds-row-open {
  appearance: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ds-accent);
  font: inherit;
  font-weight: 600;
  text-align: start;
  cursor: pointer;
  white-space: normal;
}

html[data-bos-design="v2"] .ds-table .ds-row-open:hover {
  text-decoration: underline;
}

html[data-bos-design="v2"] .ds-table .ds-row-open:focus-visible {
  outline: 2px solid var(--ds-accent);
  outline-offset: 2px;
  border-radius: var(--ds-radius-sm);
}

html[data-bos-design="v2"] .ds-table tbody th {
  font-weight: 600;
}

/* "הצג הכול": a quiet control under a short list. */
html[data-bos-design="v2"] .ds-more {
  align-self: flex-start;
  margin-block-start: var(--ds-space-2);
}

/* --------------------------------------------------------- dialogs/popups */

html[data-bos-design="v2"] .ds-veil {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--ds-space-4);
  background: rgb(0 0 0 / 0.4);
}

html[data-bos-design="v2"] .ds-dialog {
  display: flex;
  flex-direction: column;
  inline-size: min(480px, 100%);
  max-block-size: 100%;
  overflow: auto;
  border-radius: var(--ds-radius-lg);
  background: var(--ds-surface);
  color: var(--ds-text);
  box-shadow: var(--ds-shadow-2);
  font-family: var(--ds-font);
}

html[data-bos-design="v2"] .ds-dialog-head {
  padding: var(--ds-space-5) var(--ds-space-5) var(--ds-space-3);
  font-size: var(--ds-text-lg);
  line-height: var(--ds-leading-lg);
  font-weight: 600;
}

html[data-bos-design="v2"] .ds-dialog-body {
  padding: 0 var(--ds-space-5) var(--ds-space-4);
}

html[data-bos-design="v2"] .ds-dialog-actions {
  position: sticky;
  inset-block-end: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--ds-space-2);
  padding: var(--ds-space-3) var(--ds-space-5);
  border-block-start: 1px solid var(--ds-line);
  background: var(--ds-surface);
}

/* --------------------------------------------------------- reduced motion */

@media (prefers-reduced-motion: reduce) {
  html[data-bos-design="v2"] *,
  html[data-bos-design="v2"] *::before,
  html[data-bos-design="v2"] *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  html[data-bos-design="v2"] .ds-skeleton {
    animation: none;
    background-image: none;
  }
}

/* ------------------------------------------------------------------ print */

@media print {
  html[data-bos-design="v2"] .ds-card {
    break-inside: avoid;
    border-color: #cccccc;
  }
  html[data-bos-design="v2"] .ds-toolbar,
  html[data-bos-design="v2"] .ds-tip,
  html[data-bos-design="v2"] #bos-tip {
    display: none;
  }
}

/* --------------------------------------------- additions for the pages (2) */
/* Added by the page rebuild (design.md §8): components the pages need that
   the first cut did not have. Same tokens, same grid, nothing new in colour. */

/* A column of cards that shares one grid cell (e.g. beside a chart). */
html[data-bos-design="v2"] .ds-stack {
  display: flex;
  flex-direction: column;
  gap: var(--ds-space-4);
  min-inline-size: 0;
}

html[data-bos-design="v2"] .ds-stack > .ds-card {
  flex: 1 1 auto;
}

/* A card or a row that is a button: it looks like the card, not a button. */
html[data-bos-design="v2"] button.ds-card,
html[data-bos-design="v2"] button.ds-ranked-row,
html[data-bos-design="v2"] button.ds-split-open,
html[data-bos-design="v2"] button.ds-chip {
  appearance: none;
  inline-size: 100%;
  margin: 0;
  font: inherit;
  color: inherit;
  text-align: start;
  cursor: pointer;
}

html[data-bos-design="v2"] button.ds-ranked-row,
html[data-bos-design="v2"] button.ds-split-open {
  border: 0;
  background: transparent;
  padding-inline: var(--ds-space-1);
}

html[data-bos-design="v2"] button.ds-ranked-row:hover,
html[data-bos-design="v2"] button.ds-split-open:hover {
  background: var(--ds-surface-2);
}

html[data-bos-design="v2"] button.ds-chip {
  inline-size: auto;
  border: 0;
}

html[data-bos-design="v2"] .ds-kpi > * {
  display: block;
}

html[data-bos-design="v2"] .ds-kpi .ds-kpi-foot {
  display: flex;
}

html[data-bos-design="v2"] .ds-kpi-extra,
html[data-bos-design="v2"] .ds-kpi-compare {
  color: var(--ds-text-2);
  font-size: var(--ds-text-xs);
  line-height: var(--ds-leading-xs);
}

html[data-bos-design="v2"] .ds-sparkline {
  flex: none;
}

/* A negative sum: the colour and the minus sign together. */
html[data-bos-design="v2"] .ds-negative {
  color: var(--ds-bad);
}

/* Two figures side by side with a meter under them. */
html[data-bos-design="v2"] .ds-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--ds-space-3) var(--ds-space-4);
  align-items: end;
}

html[data-bos-design="v2"] .ds-split > .ds-meter {
  grid-column: 1 / -1;
}

html[data-bos-design="v2"] .ds-split-value {
  font-size: var(--ds-text-xl);
  line-height: var(--ds-leading-xl);
}

/* A list of items with a main line, a sub line and a value at the end. */
html[data-bos-design="v2"] .ds-list {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
}

html[data-bos-design="v2"] .ds-list > li {
  display: flex;
  align-items: center;
  gap: var(--ds-space-3);
  min-block-size: 40px;
  padding-block: var(--ds-space-2);
  border-block-end: 1px solid var(--ds-line);
}

html[data-bos-design="v2"] .ds-list > li:last-child {
  border-block-end: 0;
}

html[data-bos-design="v2"] .ds-list-main {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-inline-size: 0;
}

html[data-bos-design="v2"] .ds-list-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--ds-text-sm);
  font-weight: 600;
}

html[data-bos-design="v2"] .ds-list-sub {
  color: var(--ds-text-2);
  font-size: var(--ds-text-xs);
  line-height: var(--ds-leading-xs);
}

html[data-bos-design="v2"] .ds-list-value {
  flex: none;
  font-size: var(--ds-text-sm);
  font-weight: 600;
}

/* A wide table scrolls inside its card, never the page. */
html[data-bos-design="v2"] .ds-table-wrap {
  max-inline-size: 100%;
  overflow-x: auto;
}

/* The drawer: a panel at the reading side's end over a veil, for the rows
   behind a figure. Full width on a phone. */
html[data-bos-design="v2"] .ds-drawer-veil {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  justify-content: flex-end;
  background: rgb(0 0 0 / 0.4);
}

html[data-bos-design="v2"] .ds-drawer {
  display: flex;
  flex-direction: column;
  inline-size: min(640px, 100%);
  block-size: 100%;
  overflow: auto;
  border-inline-start: 1px solid var(--ds-line);
  background: var(--ds-surface);
  color: var(--ds-text);
  box-shadow: var(--ds-shadow-2);
  font-family: var(--ds-font);
  animation: ds-drawer-in var(--ds-motion) ease-out;
}

html[data-bos-design="v2"] .ds-drawer-head {
  position: sticky;
  inset-block-start: 0;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--ds-space-3);
  padding: var(--ds-space-5) var(--ds-space-5) var(--ds-space-3);
  border-block-end: 1px solid var(--ds-line);
  background: var(--ds-surface);
}

html[data-bos-design="v2"] .ds-drawer-head .ds-dialog-head {
  padding: 0;
}

html[data-bos-design="v2"] .ds-drawer-kicker {
  margin: 0;
  color: var(--ds-text-2);
  font-size: var(--ds-text-xs);
  line-height: var(--ds-leading-xs);
  font-weight: 600;
}

html[data-bos-design="v2"] .ds-drawer-body {
  display: flex;
  flex-direction: column;
  gap: var(--ds-space-2);
  padding: var(--ds-space-4) var(--ds-space-5) var(--ds-space-6);
}

@keyframes ds-drawer-in {
  from { transform: translateX(var(--ds-drawer-from, 24px)); opacity: 0; }
  to { transform: none; opacity: 1; }
}

html[data-bos-design="v2"][dir="rtl"] .ds-drawer {
  --ds-drawer-from: -24px;
}

@media (max-width: 639px) {
  html[data-bos-design="v2"] .ds-drawer-head,
  html[data-bos-design="v2"] .ds-drawer-body {
    padding-inline: var(--ds-space-4);
  }
}

@media (prefers-reduced-motion: reduce) {
  html[data-bos-design="v2"] .ds-drawer {
    animation: none;
  }
}

/* The page shell of an edge page: the header above .ds-page, on the same
   width; the title first, the way back at the end, and the one sentence that
   says what the page answers right under the title. */
html[data-bos-design="v2"] body.ds-body > .ds-header {
  max-inline-size: 1280px;
  margin-inline: auto;
  padding: var(--ds-space-6) var(--ds-space-6) 0;
}

html[data-bos-design="v2"] body.ds-body > .ds-header ~ .ds-page {
  padding-block-start: var(--ds-space-4);
}

html[data-bos-design="v2"] .ds-header > .ds-title {
  order: 1;
  flex: 1 1 auto;
}

html[data-bos-design="v2"] .ds-header > .back {
  order: 2;
}

html[data-bos-design="v2"] .ds-header > .ds-subtitle {
  order: 3;
  flex: 1 0 100%;
  margin-block-start: calc(-1 * var(--ds-space-2));
}

@media (max-width: 639px) {
  html[data-bos-design="v2"] body.ds-body > .ds-header {
    padding: var(--ds-space-4) var(--ds-space-4) 0;
  }
}

/* Forms: labelled fields on a grid that wraps; the label above its field,
   the result line across the whole form. */
html[data-bos-design="v2"] .ds-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr));
  gap: var(--ds-space-3) var(--ds-space-4);
  align-items: end;
}

html[data-bos-design="v2"] .ds-form > label {
  display: flex;
  flex-direction: column;
  gap: var(--ds-space-1);
  min-inline-size: 0;
  color: var(--ds-text-2);
  font-size: var(--ds-text-sm);
  line-height: var(--ds-leading-sm);
  font-weight: 600;
}

html[data-bos-design="v2"] .ds-form > p,
html[data-bos-design="v2"] .ds-form > [role="status"],
html[data-bos-design="v2"] .ds-form > .result {
  grid-column: 1 / -1;
  margin: 0;
  font-size: var(--ds-text-sm);
}

html[data-bos-design="v2"] .ds-form .error {
  color: var(--ds-bad);
}

html[data-bos-design="v2"] .ds-input {
  block-size: 32px;
  min-inline-size: 0;
  padding-inline: var(--ds-space-3);
  border: 1px solid var(--ds-line-strong);
  border-radius: var(--ds-radius-md);
  background: var(--ds-surface);
  color: var(--ds-text);
  font: inherit;
  font-size: var(--ds-text-sm);
  font-weight: 400;
}

html[data-bos-design="v2"] .ds-input:disabled,
html[data-bos-design="v2"] .ds-select:disabled {
  background: var(--ds-surface-2);
  color: var(--ds-text-2);
  cursor: not-allowed;
}

@media (pointer: coarse) {
  html[data-bos-design="v2"] .ds-input,
  html[data-bos-design="v2"] .ds-select {
    block-size: 40px;
  }
}

/* A part of the markup that only the new design shows (the page's one-line
   purpose under its title): written with the hidden attribute, so the current
   look never shows it, and shown under the switch. */
html[data-bos-design="v2"] .ds-v2-only[hidden] {
  display: block;
}

/* A row a short list keeps folded until "הצג הכול". */
html[data-bos-design="v2"] .ds-list > li[hidden],
html[data-bos-design="v2"] .ds-table tr[hidden] {
  display: none;
}
