/*
 * Codeliance Design System — product component layer.
 * ============================================================================
 * Token-based visual vocabulary for an obligation's state (COD-232). Every
 * value here reads from a named token in design-system-tokens.css — no raw hex
 * or pixel numbers. Load order (see base.html): tokens.css FIRST, then this.
 *
 * Three components, built to the Lean naming model
 * (design/Specs/product-naming-conventions-lean.md):
 *   .ds-status-pill  — Obligation Status (Open / Completed), + combined form.
 *   .ds-substate-tag — Status sub-state (Action Needed / In Progress).
 *   .ds-type-tag     — Obligation Type (immutable category axis).
 *
 * Namespaced `ds-` on purpose: core/static/css/main.css already owns a legacy
 * `.status-pill` (hardcoded radius, a different system). These do not touch it.
 *
 * Design intent: a status pill and a type tag must be tellable apart at a
 * glance. So status pills are SANS + fully-round (--r-pill) + a leading colour
 * dot; type tags are MONO + tight-radius (--r-xs) + neutral. Different shape,
 * different type family, different colour role.
 *
 * NOTE: --sans / --mono resolve to DM Sans / Roboto Mono, now self-hosted via
 * core/static/css/fonts.css (COD-233) and loaded on every page by the base
 * template — so these render in the real faces, not a system fallback.
 * ============================================================================
 */

/* ── Status pill — Obligation Status (top level, binary) ──────────────────── */
.ds-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.34rem;
  font-family: var(--sans);
  font-size: var(--fs-label);
  font-weight: 600;
  line-height: 1.2;
  padding: 0.2rem 0.6rem;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  white-space: nowrap;
}

/* Leading dot inherits the pill's text colour, so it tracks each variant. */
.ds-status-pill__dot {
  flex-shrink: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* Open → amber (work outstanding). Matches --amber's "action needed" role. */
.ds-status-pill--open {
  background: var(--amber-bg);
  color: var(--amber-text);
  border-color: var(--amber-border);
}

/* Completed → teal (requirement satisfied). Border is teal at low alpha —
   the token layer ships --teal-bg but no --teal-border. */
.ds-status-pill--completed {
  background: var(--teal-bg);
  color: var(--teal);
  border-color: rgba(13, 122, 112, 0.28);
}

/* ── Sub-state tag — Status sub-state (rolls up to Open) ──────────────────── */
.ds-substate-tag {
  display: inline-flex;
  align-items: center;
  font-family: var(--sans);
  font-size: var(--fs-label);
  font-weight: 600;
  line-height: 1.2;
  padding: 0.16rem 0.55rem;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  white-space: nowrap;
}

/* Action Needed → amber (not started; owner must act). */
.ds-substate-tag--action-needed {
  background: var(--amber-bg);
  color: var(--amber-text);
  border-color: var(--amber-border);
}

/* In Progress → blue (work underway) — visibly distinct from amber's "act now". */
.ds-substate-tag--in-progress {
  background: var(--blue-pale);
  color: var(--blue);
  border-color: var(--blue-light);
}

/* ── Obligation Type tag — immutable category axis ────────────────────────── */
/* Mono + tight radius + neutral fill: reads as a category, never as a status.
   All four types share one treatment; per-type modifier hooks below are empty
   by design (kept for future differentiation without a markup change). */
.ds-type-tag {
  display: inline-flex;
  align-items: center;
  font-family: var(--mono);
  font-size: var(--fs-label);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.01em;
  padding: 0.16rem 0.5rem;
  background: var(--gray-bg);
  color: var(--text-muted);
  border: 1px solid var(--border-solid);
  border-radius: var(--r-xs);
  white-space: nowrap;
}

/* ════════════════════════════════════════════════════════════════════════════
 * CORE COMPONENT LIBRARY (COD-231)
 * ----------------------------------------------------------------------------
 * The shared, non-product UI primitives every screen reuses: buttons, form
 * fields, the toggle switch, and the modal / drawer shells. Namespaced .ds-*
 * for the same reason as the product components above — Bootstrap and main.css
 * own bare .btn / .form-* / .modal, and these must not collide with them, so
 * the handoff's bare class names map to .ds-* here (mapping noted per block).
 *
 * Colour / type / radius / spacing / shadow / motion values read from a token
 * in design-system-tokens.css; geometry (px sizes, knob offsets) stays literal,
 * verbatim from the handoff — same convention as the product layer above.
 * Source: design/new-design/Codeliance Design System (decoded).html.
 *
 * SCOPE (COD-231, "specified half"): only components with a complete visual
 * spec in the handoff are built. Deliberately NOT built here — no design spec,
 * see the COD-231 spec-request comment:
 *   · button DISABLED state — the handoff defines none; a conservative derived
 *     treatment is included below, flagged PROVISIONAL pending Einat's sign-off.
 *   · modal / drawer OVERLAY, slide-in animation and focus-trap — described in
 *     prose only. The shells are complete; the interaction layer is deferred,
 *     and the gallery shows both shells inline exactly as the handoff does.
 * ════════════════════════════════════════════════════════════════════════════ */

/* ── Buttons ──────────────────────────────────────────────────────────────── */
/* Handoff: .btn / .btn-primary / .btn-ghost / .btn-xs(→ --compact) / .btn-micro
   / .btn-row(.green|.amber|.muted). "Five roles, two size tiers." primary &
   ghost are .ds-btn + a role modifier; micro and row are standalone roles. */
.ds-btn {
  font-family: var(--sans);
  font-size: var(--fs-body);
  font-weight: 600;
  border-radius: var(--r-sm);
  padding: 0.5rem 1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all var(--dur-base);
  white-space: nowrap;
}
.ds-btn--primary {
  background: var(--blue);
  color: #fff;
  border: 1px solid var(--blue);
}
.ds-btn--primary:hover {
  background: var(--blue-dark);
}
.ds-btn--ghost {
  background: var(--white);
  color: var(--dark);
  border: 1px solid var(--border-solid);
}
.ds-btn--ghost:hover {
  border-color: rgba(11, 69, 255, 0.3);
  color: var(--blue);
}

/* Compact size tier — combine with a role: .ds-btn.ds-btn--ghost.ds-btn--compact */
.ds-btn--compact {
  font-size: var(--fs-meta);
  padding: 0.36rem 0.7rem;
}

/* Micro — standalone smallest button (in-table actions). No .ds-btn base. */
.ds-btn-micro {
  font-family: var(--sans);
  font-weight: 600;
  font-size: var(--fs-label);
  padding: 0.24rem 0.58rem;
  border-radius: var(--r-xs);
  cursor: pointer;
  border: 1px solid var(--border-solid);
  background: var(--white);
  color: var(--dark);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
}

/* Row — in-list tinted action. Standalone; semantic tint modifiers. */
.ds-btn-row {
  font-family: var(--sans);
  font-weight: 600;
  font-size: var(--fs-meta);
  padding: 0.28rem 0.68rem;
  border-radius: var(--r-xs);
  cursor: pointer;
  border: 1px solid var(--blue-light);
  background: var(--blue-pale);
  color: var(--blue);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
}
.ds-btn-row--green {
  border-color: var(--green-border);
  background: var(--green-bg);
  color: var(--green);
}
.ds-btn-row--amber {
  border-color: var(--amber-border);
  background: var(--amber-bg);
  color: var(--amber-text);
}
.ds-btn-row--muted {
  border-color: var(--border-solid);
  background: var(--white);
  color: var(--text-muted);
}

/* Disabled — PROVISIONAL. The handoff specifies no button disabled state; this
   is a conservative, non-inventive fallback (dim + not-allowed, hover reset to
   the resting look) so disabled buttons are usable now. Pending Einat's spec. */
.ds-btn:disabled,
.ds-btn[disabled],
.ds-btn-micro:disabled,
.ds-btn-micro[disabled],
.ds-btn-row:disabled,
.ds-btn-row[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}
.ds-btn--primary:disabled:hover,
.ds-btn--primary[disabled]:hover {
  background: var(--blue);
}
.ds-btn--ghost:disabled:hover,
.ds-btn--ghost[disabled]:hover {
  border-color: var(--border-solid);
  color: var(--dark);
}

/* Keyboard focus ring — matches the handoff's global :focus-visible (2px blue,
   2px offset). Scoped to the .ds-* controls so focus is correct regardless of
   whatever global rule main.css does or doesn't ship. */
.ds-btn:focus-visible,
.ds-btn-micro:focus-visible,
.ds-btn-row:focus-visible,
.ds-modal__close:focus-visible,
.ds-drawer__close:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

/* ── Form field ───────────────────────────────────────────────────────────── */
/* Handoff: .form-group / .form-label / .form-input / .form-hint → .ds-field /
   .ds-label / .ds-input / .ds-hint. "One standard: blue uppercase" labels; the
   input shows focus with a blue border (no ring). select/checkbox/radio/
   textarea/error states are NOT specified — omitted, pending Einat. */
.ds-field {
  display: flex;
  flex-direction: column;
  gap: 0.32rem;
}
.ds-label {
  font-size: var(--fs-meta);
  font-weight: 600;
  color: var(--blue);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.ds-input {
  font-family: var(--sans);
  font-size: var(--fs-body);
  color: var(--dark);
  background: var(--white);
  border: 1px solid var(--border-solid);
  border-radius: var(--r-sm);
  padding: 0.45rem 0.75rem;
  outline: none;
  transition: border-color var(--dur-fast);
  width: 100%;
}
.ds-input:focus {
  border-color: var(--blue);
}
.ds-input::placeholder {
  color: var(--text-sub);
}
.ds-input:disabled {
  background: var(--gray-bg);
  color: var(--text-muted);
  cursor: not-allowed;
}
.ds-hint {
  font-size: var(--fs-meta);
  color: var(--text-muted);
}

/* ── Toggle switch ────────────────────────────────────────────────────────── */
/* Handoff: .toggle / .toggle-track → .ds-toggle / .ds-toggle__track. 36×20px,
   off-track is --border-solid, blue when the hidden checkbox is :checked; the
   knob is a ::before that translates 16px on check. */
.ds-toggle {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}
.ds-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}
.ds-toggle__track {
  position: absolute;
  inset: 0;
  background: var(--border-solid);
  border-radius: var(--r-pill);
  transition: background var(--dur-base);
  cursor: pointer;
}
.ds-toggle__track::before {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  transition: transform var(--dur-base);
}
.ds-toggle input:checked + .ds-toggle__track {
  background: var(--blue);
}
.ds-toggle input:checked + .ds-toggle__track::before {
  transform: translateX(16px);
}
.ds-toggle input:focus-visible + .ds-toggle__track {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

/* ── Modal (centered dialog shell) ────────────────────────────────────────── */
/* Handoff: .modal-demo / .panel-top / .panel-title-lg / .panel-close → .ds-modal*.
   Shadow uses the --shadow-modal token (the same value the handoff hard-codes).
   Overlay / entrance animation / focus-trap are prose-only — deferred (see the
   scope note); .ds-modal__body and __footer promote the handoff's inline demo
   styles to reusable classes. */
.ds-modal {
  background: var(--white);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-modal);
  width: 100%;
  max-width: min(560px, 95vw);
  overflow: hidden;
}
.ds-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.35rem;
  border-bottom: 1px solid var(--border-solid);
}
.ds-modal__title {
  font-size: var(--fs-section);
  font-weight: 800;
  color: var(--dark);
}
.ds-modal__subtitle {
  font-size: var(--fs-meta);
  color: var(--text-muted);
  margin-top: 0.15rem;
}
.ds-modal__close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border-solid);
  background: var(--gray-bg);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}
.ds-modal__body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.ds-modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding-top: 0.25rem;
  border-top: 1px solid var(--border-solid);
}

/* ── Drawer (right-edge side panel shell) ─────────────────────────────────── */
/* Handoff: .side-panel-demo / .ssp-* → .ds-drawer*. Same deferral of the
   overlay / slide-in / focus-trap layer as the modal; the shell is complete. */
.ds-drawer {
  background: var(--white);
  border: 1px solid var(--border-solid);
  border-radius: var(--r-lg);
  overflow: hidden;
  width: 100%;
  max-width: 370px;
}
.ds-drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--border-solid);
}
.ds-drawer__title {
  font-size: var(--fs-body);
  font-weight: 700;
  color: var(--dark);
}
.ds-drawer__close {
  width: 24px;
  height: 24px;
  border-radius: var(--r-xs);
  border: 1px solid var(--border-solid);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: var(--fs-body);
  display: flex;
  align-items: center;
  justify-content: center;
}
.ds-drawer__body {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
.ds-drawer__section {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.ds-drawer__label {
  font-family: var(--mono);
  font-size: var(--fs-label);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.ds-drawer__text {
  font-size: var(--fs-body);
  color: var(--dark);
  line-height: 1.55;
}

/* ════════════════════════════════════════════════════════════════════════════
 * CORE COMPONENT LIBRARY — DEFERRED HALF (COD-231)
 * ----------------------------------------------------------------------------
 * The eleven components that had no visual spec when the first half shipped, now
 * built from Einat's approved additions spec (2026-07-22):
 *   design/new-design/codeliance-additions.css  (the source of these values).
 * Same conventions as the specified half above: colour / type / radius /
 * spacing / shadow / motion read from a token in design-system-tokens.css;
 * geometry (px sizes) stays literal, verbatim from the spec. The spec's bare
 * class names (.select, .checkbox, .tooltip, .pagination…) are mapped to .ds-*
 * for the same reason as the specified half — Bootstrap and main.css own bare
 * .select / .checkbox / .tooltip / .pagination, and these must not collide.
 *
 * These are custom, JS-driven controls (a div-based select, a div-based
 * checkbox), so visual state rides on .is-* classes the app toggles — not the
 * native :checked/:disabled the specified half uses on real <input>s.
 * ════════════════════════════════════════════════════════════════════════════ */

/* ── Select / dropdown ────────────────────────────────────────────────────── */
/* Spec: .select / .select-chevron / .select-menu / .select-option. The trigger
   reuses the input geometry; the open menu and options are div-based rows. */
.ds-select {
  font-family: var(--sans);
  font-size: var(--fs-body);
  color: var(--dark);
  background: var(--white);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  padding: 0.45rem 0.75rem;
  width: 100%;
  cursor: pointer;
  outline: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
@media (prefers-reduced-motion: no-preference) {
  .ds-select { transition: border-color var(--dur-base) var(--ease-ui); }
}
.ds-select__chevron { color: var(--text-sub); flex-shrink: 0; }
.ds-select.is-open,
.ds-select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-light); }
.ds-select.is-open .ds-select__chevron { color: var(--blue); }
.ds-select.is-error { border-color: var(--border-strong); }  /* border unchanged; error shown via .ds-form-error */
.ds-select.is-placeholder { color: var(--text-sub); }
.ds-select:disabled,
.ds-select.is-disabled { background: var(--gray-bg); color: var(--text-muted); cursor: not-allowed; }

.ds-select-menu {
  background: var(--white);
  border: 1px solid var(--border-solid);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-modal);
  padding: 0.25rem;
  margin-top: 4px;
  z-index: var(--z-overlay);
  overflow: hidden;
}
.ds-select-option {
  font-size: var(--fs-body);
  color: var(--dark);
  padding: 0.45rem 0.6rem;
  border-radius: var(--r-xs);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.ds-select-option:hover { background: var(--blue-pale); }
.ds-select-option.is-selected { background: var(--blue-pale); color: var(--blue); font-weight: 600; }

/* ── Checkbox ─────────────────────────────────────────────────────────────── */
/* Spec: .checkbox with an inline 12px check svg (.checkbox-glyph) and a 9×2 bar
   (.checkbox-bar) for the indeterminate state. */
.ds-checkbox {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  box-sizing: border-box;
  border: 1px solid var(--border-solid);
  border-radius: var(--r-xs);
  background: var(--white);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
}
@media (prefers-reduced-motion: no-preference) {
  .ds-checkbox { transition: background var(--dur-fast) var(--ease-ui), border-color var(--dur-fast) var(--ease-ui); }
}
.ds-checkbox.is-checked,
.ds-checkbox.is-indeterminate { background: var(--blue); border-color: var(--blue); }
.ds-checkbox__glyph { color: #fff; display: none; }
.ds-checkbox.is-checked .ds-checkbox__glyph { display: inline-flex; }
.ds-checkbox__bar { display: none; width: 9px; height: 2px; border-radius: var(--r-bar); background: #fff; }
.ds-checkbox.is-indeterminate .ds-checkbox__bar { display: block; }
.ds-checkbox.is-focused,
.ds-checkbox:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--blue-light); }
.ds-checkbox.is-disabled { background: var(--gray-bg); border-color: var(--border-solid); opacity: 0.6; cursor: not-allowed; }
.ds-checkbox-label { display: inline-flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-body); color: var(--dark); cursor: pointer; }

/* ── Radio ────────────────────────────────────────────────────────────────── */
.ds-radio {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  box-sizing: border-box;
  border: 1px solid var(--border-solid);
  border-radius: 50%;
  background: var(--white);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
@media (prefers-reduced-motion: no-preference) {
  .ds-radio { transition: border-color var(--dur-fast) var(--ease-ui); }
}
.ds-radio::after { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--blue); transform: scale(0); }
@media (prefers-reduced-motion: no-preference) {
  .ds-radio::after { transition: transform var(--dur-fast) var(--ease-ui); }
}
.ds-radio.is-selected { border-color: var(--blue); }
.ds-radio.is-selected::after { transform: scale(1); }
.ds-radio.is-focused,
.ds-radio:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--blue-light); }
.ds-radio.is-disabled { background: var(--gray-bg); border-color: var(--border-solid); opacity: 0.6; cursor: not-allowed; }
.ds-radio-label { display: inline-flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-body); color: var(--dark); cursor: pointer; }
.ds-radio-group { display: flex; flex-direction: column; gap: var(--sp-3); }

/* ── Textarea ─────────────────────────────────────────────────────────────── */
.ds-textarea {
  font-family: var(--sans);
  font-size: var(--fs-body);
  color: var(--dark);
  background: var(--white);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  padding: 0.45rem 0.75rem;
  width: 100%;
  min-height: 84px;
  line-height: var(--lh-base);
  outline: none;
  resize: vertical;  /* vertical only — protects dense columns */
}
@media (prefers-reduced-motion: no-preference) {
  .ds-textarea { transition: border-color var(--dur-base) var(--ease-ui); }
}
.ds-textarea::placeholder { color: var(--text-sub); }
.ds-textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-light); }
.ds-textarea:disabled { background: var(--gray-bg); color: var(--text-muted); cursor: not-allowed; resize: none; }

/* ── Form error — shared across .ds-input / .ds-select / .ds-textarea ─────────
   Field border stays default; the message carries the signal. No icon. */
.ds-form-error {
  font-size: var(--fs-meta);
  color: var(--red-text);
  line-height: var(--lh-base);
  margin-top: var(--sp-2);
}

/* ── Toast / notification ─────────────────────────────────────────────────── */
/* .ds-toast-stack is the fixed bottom-right rail; each .ds-toast is a normal
   block, so a toast can also be rendered inline (as the gallery does). */
.ds-toast-stack {
  position: fixed;
  right: var(--sp-8);
  bottom: var(--sp-8);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}
.ds-toast {
  width: 360px;
  max-width: calc(100vw - 2 * var(--sp-5));
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  background: var(--white);
  border: 1px solid var(--border-solid);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-modal);
  padding: 0.85rem 0.9rem;
}
@media (prefers-reduced-motion: no-preference) {
  .ds-toast { animation: ds-toast-in var(--dur-slow) var(--ease-ui); }
}
@keyframes ds-toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
.ds-toast__icon { width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; }
.ds-toast__body { flex: 1; min-width: 0; }
.ds-toast__title { font-size: var(--fs-body); font-weight: 700; color: var(--dark); }
.ds-toast__text { font-size: var(--fs-meta); color: var(--text-muted); line-height: var(--lh-base); margin-top: 0.1rem; }
.ds-toast__close { width: 22px; height: 22px; flex-shrink: 0; border: none; background: none; color: var(--text-sub); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.ds-toast--success .ds-toast__icon { background: var(--green-bg); color: var(--green); }
.ds-toast--error   .ds-toast__icon { background: var(--red-bg);   color: var(--red); }
.ds-toast--info    .ds-toast__icon { background: var(--blue-pale); color: var(--blue); }
.ds-toast--warning .ds-toast__icon { background: var(--amber-bg); color: var(--amber); }

/* ── Confirmation dialog — narrow variant of the modal ────────────────────── */
.ds-confirm-scrim {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
  background: rgba(13, 30, 58, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-5);
}
@media (prefers-reduced-motion: no-preference) {
  .ds-confirm-scrim { animation: ds-scrim-in var(--dur-base) var(--ease-ui); }
}
@keyframes ds-scrim-in { from { opacity: 0; } to { opacity: 1; } }
.ds-confirm-dialog {
  width: 400px;
  max-width: 100%;
  z-index: var(--z-modal);
  background: var(--white);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-modal);
  overflow: hidden;
}
@media (prefers-reduced-motion: no-preference) {
  .ds-confirm-dialog { animation: ds-dialog-in var(--dur-slow) var(--ease-ui); }
}
@keyframes ds-dialog-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}
.ds-confirm__head { padding: var(--sp-6) var(--sp-6) var(--sp-4); display: flex; gap: var(--sp-3); }
.ds-confirm__icon { width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; background: var(--red-bg); color: var(--red); }
.ds-confirm__title { font-size: var(--fs-section); font-weight: 800; color: var(--dark); }
.ds-confirm__text { font-size: var(--fs-read); color: var(--text-muted); line-height: var(--lh-read); margin-top: var(--sp-3); }
.ds-confirm__foot { display: flex; justify-content: flex-end; gap: var(--sp-3); padding: var(--sp-4) var(--sp-6); border-top: 1px solid var(--border-solid); }

/* Destructive action button — pairs with .ds-btn (spec: .btn-danger). The .ds-btn
   base carries no border of its own (unlike the handoff's .btn), so set the full
   border here rather than only its colour. */
.ds-btn--danger { background: var(--red); color: #fff; border: 1px solid var(--red); }
.ds-btn--danger:hover { background: var(--red-dark); border-color: var(--red-dark); }

/* ── Tooltip — light gray-blue with a caret ───────────────────────────────── */
.ds-tooltip {
  position: relative;
  max-width: 240px;
  z-index: var(--z-overlay);
  background: var(--blue-pale);
  color: var(--dark);
  border: 1px solid var(--blue-light);
  font-size: var(--fs-meta);
  line-height: var(--lh-base);
  padding: 0.4rem 0.6rem;
  border-radius: var(--r-xs);
  box-shadow: 0 4px 14px rgba(11, 69, 255, 0.12);
}
@media (prefers-reduced-motion: no-preference) {
  .ds-tooltip { animation: ds-tooltip-in var(--dur-fast) var(--ease-ui); }
}
@keyframes ds-tooltip-in { from { opacity: 0; } to { opacity: 1; } }
.ds-tooltip::after { content: ''; position: absolute; width: 8px; height: 8px; background: var(--blue-pale); }
.ds-tooltip--top::after    { bottom: -5px; left: 50%; transform: translateX(-50%) rotate(45deg); border-right: 1px solid var(--blue-light); border-bottom: 1px solid var(--blue-light); }
.ds-tooltip--bottom::after { top: -5px;    left: 50%; transform: translateX(-50%) rotate(45deg); border-left: 1px solid var(--blue-light); border-top: 1px solid var(--blue-light); }
.ds-tooltip--right::after  { left: -5px;   top: 50%;  transform: translateY(-50%) rotate(45deg); border-left: 1px solid var(--blue-light); border-bottom: 1px solid var(--blue-light); }
.ds-tooltip--left::after   { right: -5px;  top: 50%;  transform: translateY(-50%) rotate(45deg); border-right: 1px solid var(--blue-light); border-top: 1px solid var(--blue-light); }

/* ── Data table ───────────────────────────────────────────────────────────── */
/* The handoff's `.dt` base table (decoded handoff lines 601–605), mapped to
   .ds-table; Einat's additions layer the sortable-header affordance on top. */
.ds-table { width: 100%; border-collapse: collapse; }
.ds-table th {
  text-align: left;
  font-size: var(--fs-label);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--border-solid);
  white-space: nowrap;
  background: var(--gray-bg);
}
.ds-table td {
  padding: 0.55rem 0.6rem;
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-meta);
  vertical-align: middle;
  color: var(--dark);
}
.ds-table tbody tr:last-child td { border-bottom: none; }
.ds-table tbody tr:hover td { background: var(--gray-bg); }

/* Column sort — the sortable-header affordance (spec: .dt th.sortable). */
.ds-table th.ds-sortable { cursor: pointer; }
.ds-table th.ds-sortable .ds-sort-label { display: inline-flex; align-items: center; gap: 0.3rem; }
.ds-table th.ds-sortable .ds-sort-icon { color: var(--text-sub); flex-shrink: 0; }
.ds-table th.ds-sortable:hover .ds-sort-icon { color: var(--dark); }
.ds-table th.ds-sortable.is-sorted { color: var(--blue); }
.ds-table th.ds-sortable.is-sorted .ds-sort-icon { color: var(--blue); }

/* ── Empty state ──────────────────────────────────────────────────────────── */
.ds-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--sp-4);
  padding: var(--sp-8);
  background: var(--gray-bg);
  border: 1px dashed var(--border-solid);
  border-radius: var(--r-md);
}
.ds-empty-state__icon { width: 52px; height: 52px; border-radius: 50%; background: var(--blue-pale); border: 1px solid var(--blue-light); color: var(--blue); display: inline-flex; align-items: center; justify-content: center; }
.ds-empty-state__title { font-size: var(--fs-section); font-weight: 800; color: var(--dark); }
.ds-empty-state__text { font-size: var(--fs-body); color: var(--text-muted); line-height: var(--lh-base); max-width: 340px; }
.ds-empty-state--compact { padding: var(--sp-6); }
.ds-empty-state--compact .ds-empty-state__icon { display: none; }

/* ── Pagination ───────────────────────────────────────────────────────────── */
.ds-pagination { display: flex; align-items: center; gap: var(--sp-2); }
.ds-page-btn {
  min-width: 32px;
  height: 32px;
  padding: 0 0.5rem;
  box-sizing: border-box;
  border: 1px solid var(--border-solid);
  border-radius: var(--r-sm);
  background: var(--white);
  color: var(--dark);
  font-family: var(--mono);
  font-size: var(--fs-meta);
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
@media (prefers-reduced-motion: no-preference) {
  .ds-page-btn { transition: border-color var(--dur-fast) var(--ease-ui), background var(--dur-fast) var(--ease-ui); }
}
.ds-page-btn:hover { border-color: rgba(11, 69, 255, 0.3); background: var(--gray-bg); }
.ds-page-btn.is-current { background: var(--blue); border-color: var(--blue); color: #fff; font-weight: 700; }
.ds-page-btn:disabled { color: var(--text-sub); opacity: 0.55; cursor: not-allowed; background: var(--white); }
.ds-page-btn:disabled:hover { border-color: var(--border-solid); }
.ds-page-ellipsis { font-family: var(--mono); font-size: var(--fs-meta); color: var(--text-sub); padding: 0 0.2rem; }
.ds-page-summary { font-size: var(--fs-meta); color: var(--text-muted); }
.ds-page-summary .ds-num { font-family: var(--mono); color: var(--dark); }
