/* ============================================================
   dashboard.css — shared responsive override layer
   Loaded LAST on every canonical page so its mobile rules win.
   Additive: does not replace existing per-page styles on desktop.
   ============================================================ */

/* ------------------------------------------------------------
   Slice 5.8: grouped permission-aware nav.
   The renderer in api.js#renderNav injects:
     <details class="nav-group">
       <summary class="nav-group__btn">Group label</summary>
       <div class="nav-group__menu">
         <a class="nav-link" data-path="...">Link</a>
       </div>
     </details>
   Desktop  : <details> is an inline dropdown; menu is absolutely
              positioned beneath the summary. Click toggles open;
              click-outside closes (handled in JS).
   Mobile   : the .nav-left drawer at <=768px puts each <details>
              full-width with its menu as normal flow. The active
              group is auto-opened so the user lands on the right
              section.
   ------------------------------------------------------------ */
details.nav-group {
  position: relative;
  margin: 0;
  padding: 0;
}
details.nav-group > summary.nav-group__btn {
  list-style: none;
  cursor: pointer;
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: #cbd5e1;
  background: transparent;
  border: 1px solid transparent;
  transition: color .12s ease, background-color .12s ease, border-color .12s ease;
  -webkit-tap-highlight-color: transparent;
}
details.nav-group > summary.nav-group__btn::-webkit-details-marker { display: none; }
details.nav-group > summary.nav-group__btn::after {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-left: 2px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translate(-1px, -1px);
  transition: transform .12s ease;
  opacity: .75;
}
details.nav-group[open] > summary.nav-group__btn::after {
  transform: rotate(225deg) translate(-1px, -1px);
}
details.nav-group > summary.nav-group__btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, .08);
}
details.nav-group > summary.nav-group__btn:focus-visible {
  outline: 2px solid #60a5fa;
  outline-offset: 2px;
}
details.nav-group[data-active="true"] > summary.nav-group__btn {
  color: #fff;
  font-weight: 600;
  background: rgba(255, 255, 255, .06);
}

details.nav-group > .nav-group__menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
  z-index: 60;
}
details.nav-group:not([open]) > .nav-group__menu { display: none; }

details.nav-group .nav-group__menu .nav-link {
  display: block;
  padding: 8px 10px;
  font-size: 13px;
  border-radius: 6px;
  color: #cbd5e1;
  white-space: nowrap;
}
details.nav-group .nav-group__menu .nav-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, .08);
}
details.nav-group .nav-group__menu .nav-link.active {
  color: #fff;
  background: rgba(37, 99, 235, .28);
}

/* Mobile: groups go into the drawer as full-width collapsible sections. */
@media (max-width: 768px) {
  details.nav-group {
    width: 100%;
    border-bottom: 1px solid rgba(255, 255, 255, .06);
  }
  details.nav-group > summary.nav-group__btn {
    width: 100%;
    padding: 14px 18px;
    border-radius: 0;
    font-size: 13px;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: #94a3b8;
    background: transparent;
    border: none;
    justify-content: space-between;
  }
  details.nav-group[data-active="true"] > summary.nav-group__btn { color: #fff; }
  details.nav-group > .nav-group__menu {
    position: static;
    min-width: 0;
    width: 100%;
    padding: 0 0 6px;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    z-index: auto;
  }
  details.nav-group .nav-group__menu .nav-link {
    padding: 12px 18px 12px 28px;
    border-radius: 0;
    min-height: 44px;
    font-size: 15px;
  }
  details.nav-group .nav-group__menu .nav-link.active {
    background: rgba(37, 99, 235, .22);
    color: #fff;
    border-left: 3px solid #60a5fa;
    padding-left: 25px;
  }
}


/* ------------------------------------------------------------
   Hamburger / drawer markup primitives (mobile only).
   The checkbox + label live INSIDE <nav class="nav">.
   On desktop (>768px) the hamburger and backdrop are hidden;
   .nav-left renders inline as before.
   ------------------------------------------------------------ */

.nav-toggle-checkbox {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 40px;
  margin-right: 4px;
  border-radius: 8px;
  cursor: pointer;
  color: #e2e8f0;
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .14);
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
  gap: 4px;
}
.nav-toggle:hover { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .22); }
.nav-toggle:focus-visible { outline: 2px solid #60a5fa; outline-offset: 2px; }
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2.5px;
  background: currentColor;
  margin: 0;
  border-radius: 2px;
  transition: transform .2s ease, opacity .2s ease;
}

.nav-backdrop {
  display: none;
  position: fixed;
  inset: 52px 0 0 0;
  background: rgba(15, 23, 42, .5);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
  z-index: 40;
  cursor: pointer;
}

/* ------------------------------------------------------------
   Mobile breakpoint: drawer + tighter nav.
   Threshold 768px (per plan). Above this, desktop nav is unchanged.
   ------------------------------------------------------------ */

@media (max-width: 768px) {
  /* Allow the drawer to extend past the nav */
  .nav { position: relative; padding: 0 12px; gap: 8px; }

  .nav-toggle { display: inline-flex; }

  /* Animated hamburger -> X when checked */
  .nav-toggle-checkbox:checked ~ .nav-toggle span:nth-child(1) {
    transform: translateY(6.5px) rotate(45deg);
  }
  .nav-toggle-checkbox:checked ~ .nav-toggle span:nth-child(2) {
    opacity: 0;
  }
  .nav-toggle-checkbox:checked ~ .nav-toggle span:nth-child(3) {
    transform: translateY(-6.5px) rotate(-45deg);
  }

  /* Slide-over drawer: .nav-left becomes a fixed-position panel */
  .nav-left {
    position: fixed;
    top: 52px;
    left: 0;
    bottom: 0;
    width: min(82vw, 300px);
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px 0 16px;
    background: #0f172a;
    border-right: 1px solid rgba(255, 255, 255, .08);
    transform: translateX(-100%);
    transition: transform .22s ease;
    z-index: 50;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .nav-toggle-checkbox:checked ~ .nav-left { transform: translateX(0); }

  .nav-left .nav-brand {
    padding: 14px 18px 14px;
    font-size: 14px;
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    margin-bottom: 6px;
  }

  .nav-left .nav-link {
    display: flex;
    align-items: center;
    padding: 12px 18px;
    border-radius: 0;
    font-size: 15px;
    min-height: 44px;
    color: #cbd5e1;
  }
  .nav-left .nav-link:hover {
    background: rgba(255, 255, 255, .06);
    color: #fff;
  }
  .nav-left .nav-link.active {
    background: rgba(37, 99, 235, .22);
    color: #fff;
    border-left: 3px solid #60a5fa;
    padding-left: 15px;
  }

  /* Backdrop is shown when drawer is open */
  .nav-backdrop { display: block; }
  .nav-toggle-checkbox:checked ~ .nav-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  /* Right side stays slim */
  .nav-right { gap: 10px; font-size: 13px; }
  #nav-agent {
    max-width: 36vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Body scroll lock when drawer is open */
  html:has(.nav-toggle-checkbox:checked) { overflow: hidden; }
}

/* ------------------------------------------------------------
   Reduced motion: disable drawer animation
   ------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  .nav-left,
  .nav-backdrop,
  .nav-toggle span {
    transition: none !important;
  }
}

/* ------------------------------------------------------------
   Responsive table-to-card primitive (opt-in via .responsive-table)
   At <=720px, table rows become stacked cards.
   JS must add data-label="…" to each <td> for the label to show.
   ------------------------------------------------------------ */
@media (max-width: 720px) {
  table.responsive-table,
  table.responsive-table thead,
  table.responsive-table tbody,
  table.responsive-table tr,
  table.responsive-table th,
  table.responsive-table td {
    display: block;
    width: auto;
  }
  table.responsive-table thead {
    position: absolute;
    left: -9999px;
    top: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
  }
  table.responsive-table tr {
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 8px;
    background: var(--bg-panel, #fff);
    margin-bottom: 10px;
    padding: 10px 12px;
    box-shadow: var(--shadow-sm, 0 1px 2px rgba(15, 23, 42, .04));
  }
  table.responsive-table td {
    border: none !important;
    padding: 6px 0 !important;
    text-align: left !important;
    min-height: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: baseline;
    word-break: break-word;
    overflow-wrap: anywhere;
  }
  table.responsive-table td::before {
    content: attr(data-label);
    flex: 0 0 110px;
    color: var(--text-muted, #64748b);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .02em;
    text-transform: uppercase;
  }
  /* Cells without a data-label (action rows etc.) take full row */
  table.responsive-table td:not([data-label])::before {
    content: none;
  }
  table.responsive-table td:not([data-label]) {
    flex-direction: row;
    flex-wrap: wrap;
    padding-top: 8px !important;
    border-top: 1px solid var(--border-soft, #f1f5f9) !important;
    margin-top: 4px;
  }
  /* Empty-state row: don't card-wrap */
  table.responsive-table td.status-empty,
  table.responsive-table td[colspan] {
    text-align: center !important;
    color: var(--text-muted, #64748b);
  }
  table.responsive-table td.status-empty::before,
  table.responsive-table td[colspan]::before {
    content: none;
  }
}

/* ------------------------------------------------------------
   Drill-in helper (knowledge-library, knowledge-review).
   Page opts-in by giving its workspace `.responsive-split` and
   the JS toggling `.viewing-detail` when a row is opened.
   At <=760px: list and detail occupy the full width; only one
   is shown at a time. Mirrors inbox's `.viewing-thread` pattern.
   ------------------------------------------------------------ */
@media (max-width: 760px) {
  .responsive-split.viewing-detail > .responsive-split-list { display: none; }
  .responsive-split:not(.viewing-detail) > .responsive-split-detail { display: none; }
  .responsive-split-detail .back-btn {
    display: inline-flex !important;
  }
}

/* Desktop: hide the back button by default; pages can still show it */
.responsive-split-detail .back-btn {
  display: none;
}

/* ------------------------------------------------------------
   Mobile-safe modal primitive (opt-in via .responsive-modal on
   the modal-card or backdrop). Ensures modals scroll cleanly
   and respect notch insets.
   ------------------------------------------------------------ */
@media (max-width: 720px) {
  .responsive-modal-backdrop {
    align-items: flex-start;
    padding: max(16px, env(safe-area-inset-top))
            max(12px, env(safe-area-inset-right))
            max(16px, env(safe-area-inset-bottom))
            max(12px, env(safe-area-inset-left));
    overflow-y: auto;
  }
  .responsive-modal {
    max-width: 100%;
    width: 100%;
    max-height: none;
    margin: 0;
  }
  .responsive-modal-form {
    grid-template-columns: 1fr !important;
  }
}

/* ------------------------------------------------------------
   Sticky-bottom composer primitive (opt-in via .composer-sticky)
   ------------------------------------------------------------ */
.composer-sticky {
  position: sticky;
  bottom: 0;
  background: var(--bg-panel, #fff);
  padding-bottom: max(8px, env(safe-area-inset-bottom));
  z-index: 5;
}

/* ------------------------------------------------------------
   Touch-friendly minimums on mobile.
   Applied to common control classes; overrides only for narrow widths.
   ------------------------------------------------------------ */
@media (max-width: 720px) {
  button.btn,
  .btn,
  input[type="submit"],
  input[type="button"],
  select.input,
  input.input,
  textarea.input,
  .filter-btn {
    min-height: 40px;
  }
  .btn-primary,
  .btn-danger,
  button[type="submit"] {
    min-height: 44px;
  }

  /* Form inputs: avoid iOS zoom on focus by ensuring 16px minimum */
  input:not([type="checkbox"]):not([type="radio"]),
  select,
  textarea {
    font-size: 16px;
  }
}

/* ------------------------------------------------------------
   Filter bar: horizontal scroll on mobile so chips never wrap awkwardly.
   Opt-in via .responsive-filter-row on the container.
   ------------------------------------------------------------ */
@media (max-width: 720px) {
  .responsive-filter-row {
    overflow-x: auto;
    flex-wrap: nowrap !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    padding-bottom: 4px;
  }
  .responsive-filter-row > * {
    flex-shrink: 0;
  }
}

/* ------------------------------------------------------------
   Preformatted/code block scroll safety.
   Opt-in via .scroll-x on the wrapping element.
   ------------------------------------------------------------ */
.scroll-x {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}
.scroll-x pre,
.scroll-x code {
  white-space: pre;
}
@media (max-width: 720px) {
  .scroll-x { font-size: 12px; }
}

/* ------------------------------------------------------------
   Generic mobile guards: never let main content overflow the viewport.
   These apply to every page and keep horizontal scroll off body.
   ------------------------------------------------------------ */
@media (max-width: 768px) {
  body { -webkit-text-size-adjust: 100%; }
  img, video, canvas { max-width: 100%; height: auto; }
  pre, code {
    overflow-wrap: anywhere;
    word-break: break-word;
  }
}

/* ------------------------------------------------------------
   Page-specific helpers (small, additive)
   ------------------------------------------------------------ */

/* Pagination cluster on mobile: stack neatly */
@media (max-width: 720px) {
  .pagination,
  .responsive-pagination {
    flex-wrap: wrap;
    gap: 8px;
    justify-content: space-between;
  }
  .pagination > .btn,
  .responsive-pagination > .btn {
    flex: 1 1 auto;
  }
}

/* ============================================================
   Inbox-specific mobile tweaks
   Override only at narrow widths; desktop layout untouched.
   Goal: WhatsApp-like focused chat on mobile.
   ============================================================ */

/* Mobile-only details drawer close button — hidden globally; only the
   mobile media query promotes it when the drawer is open. */
.details-close-btn { display: none; }

@media (max-width: 760px) {
  /* Compact chat header — gives messages most of the screen.
     The flex-column panel already pins the head; no sticky needed. */
  .thread-head {
    padding: 8px 10px;
    gap: 6px;
  }
  .thread-head-name { font-size: 15px; }
  .thread-head-meta { font-size: 11px; gap: 4px; margin-top: 1px; }
  .thread-head-meta .channel-pill,
  .thread-head-meta .state-pill { padding: 1px 6px; font-size: 10px; }
  .thread-head-actions { gap: 4px; }
  .thread-head-actions .icon-btn { width: 38px; height: 38px; }
  .thread-head .back-btn { padding: 6px 6px; }

  /* Thread takes most of the vertical space; reduced padding */
  .thread { padding: 12px 12px; gap: 8px; }
  .msg-bubble { max-width: 86% !important; }

  /* Composer / action bar: tight, sticky, safe-area aware */
  #action-bar {
    padding: 8px 10px max(8px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--border, #e2e8f0);
  }

  /* Compact state-notice: single line, smaller font, less margin */
  #action-bar .state-notice {
    font-size: 12px;
    padding: 6px 10px;
    margin-bottom: 6px;
    line-height: 1.35;
    border-radius: 6px;
  }

  /* Reply textarea: 16px prevents iOS focus zoom; tighter min-height */
  #action-bar .reply-textarea {
    font-size: 16px;
    line-height: 1.4;
    min-height: 40px;
    padding: 8px 12px;
    border-radius: 18px;
  }
  #action-bar .composer { gap: 6px; }
  #action-bar .composer-input-row { gap: 6px; }
  #action-bar .composer-hint { display: none; }

  /* Smaller but still touch-friendly composer buttons */
  #action-bar .btn-attach,
  #action-bar .send-btn {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
  }
  #action-bar .btn-attach svg,
  #action-bar .send-btn svg { width: 18px; height: 18px; }

  /* Compact action row: small wrap-friendly buttons (not 44px giants) */
  #action-bar .action-row {
    gap: 6px;
    row-gap: 6px;
    margin-top: 6px;
  }
  #action-bar .action-row .btn,
  #action-bar .btn {
    min-height: 36px;
    padding: 7px 12px;
    font-size: 13px;
    flex: 1 1 auto;
  }
  /* Send is round, not in action-row — preserve circle shape */
  #action-bar .send-btn,
  #action-bar .btn-attach { min-height: 0 !important; padding: 0 !important; flex: 0 0 auto !important; }

  /* Inline forms (handback note, force-close reason, nominate summary):
     keep stacked but compact */
  #action-bar .inline-form { padding: 10px; gap: 6px; }
  #action-bar .inline-form textarea { min-height: 60px; }

  /* Strict mobile single-pane layout:
     The inline <style> in inbox/index.html already force-hides
     #panel-detail and toggles list/thread via .viewing-thread. We
     duplicate the detail-hidden rule here defensively so any other
     stylesheet loaded after this one cannot accidentally re-show the
     detail panel inline beneath the list or chat. */
  #workspace #panel-detail { display: none !important; }

  /* Body/page must not scroll into the (now-empty) area below the
     visible panel on mobile. body already has overflow:hidden globally,
     but we re-assert here in case a nested overflow leaks. */
  body { overflow: hidden; }

  /* List panel head padding */
  .panel-list .panel-head { padding: 10px 14px 8px; }

  /* State chips horizontally scroll instead of wrapping awkwardly */
  #state-chips {
    overflow-x: auto;
    flex-wrap: nowrap !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
    margin-left: -2px;
    margin-right: -2px;
  }
  #state-chips::-webkit-scrollbar { display: none; }
  #state-chips > .chip { flex-shrink: 0; }

  /* Secondary filter row wraps cleanly; controls touch-friendly */
  .filter-row {
    flex-wrap: wrap;
    gap: 10px;
    row-gap: 8px;
    justify-content: flex-start;
  }
  .filter-row select {
    padding: 8px 10px;
    font-size: 14px;
    min-height: 38px;
  }
  .filter-row label { min-height: 36px; }

  /* Conversation list rows: comfortable tap targets */
  .conv-row { padding: 12px 14px; }

  /* ------------------------------------------------------------
     Mobile Details overlay (drawer / sheet)
     The detail panel is force-hidden inline on mobile. Tapping the
     info button adds .details-open on #workspace; the rule below
     promotes #panel-detail to a fixed slide-over that does NOT
     participate in normal flow (so list/chat behind it never get
     pushed down). ID + class specificity (0,2,1,0) beats the
     #workspace #panel-detail (0,2,0,0) hide rule, both !important.
     ------------------------------------------------------------ */
  #workspace.details-open #panel-detail {
    display: flex !important;
    position: fixed !important;
    top: 52px;
    bottom: 0;
    right: 0;
    left: auto;
    width: min(92vw, 380px);
    height: auto;
    z-index: 60;
    box-shadow: -8px 0 24px rgba(15, 23, 42, .18);
    border-left: 1px solid var(--border, #e2e8f0);
    animation: detailsSlideIn .22s ease-out;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  @keyframes detailsSlideIn {
    from { transform: translateX(100%); }
    to   { transform: translateX(0); }
  }
  #workspace.details-open #panel-detail .panel-head {
    padding-right: 14px;
    position: sticky;
    top: 0;
    z-index: 1;
  }
  /* Backdrop behind drawer (tap to close — JS listens for clicks
     outside the drawer) */
  #workspace.details-open::before {
    content: '';
    position: fixed;
    inset: 52px 0 0 0;
    background: rgba(15, 23, 42, .45);
    z-index: 55;
  }
  /* Close affordance — shown only when drawer open */
  #workspace.details-open .details-close-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: transparent;
    border: none;
    color: var(--text-muted, #64748b);
    cursor: pointer;
  }
  #workspace.details-open .details-close-btn:hover {
    background: var(--bg-row-hover, #f1f5f9);
    color: var(--text, #0f172a);
  }
}

/* Composer further compaction at very narrow widths */
@media (max-width: 480px) {
  #action-bar .btn-attach,
  #action-bar .send-btn {
    width: 38px;
    height: 38px;
  }
  /* Stack inline forms vertically only when truly cramped */
  #action-bar .inline-form-btns { flex-direction: column-reverse; }
  #action-bar .inline-form-btns .btn { width: 100%; }
}

/* ============================================================
   Operational dashboard helpers (additive, page-agnostic)
   --------------------------------------------------------------
   Used by the polished /, /customers/, /orders/, /catalog/
   detail panels and section bodies. Each helper is namespaced
   with `ds-` ("dashboard shared") so it cannot clash with the
   existing per-page styles already loaded above.
   ============================================================ */

/* Detail panel that scrolls inside its own viewport instead of
   pushing the page into a long scroll wall. Pair with a sticky
   panel container at the parent layer. */
.ds-detail-scroll {
  max-height: calc(100vh - 92px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
@media (max-width: 1100px) {
  .ds-detail-scroll { max-height: none; overflow: visible; }
}

/* Compact section header inside a flat panel — uppercase title +
   optional inline action link. */
.ds-section-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  margin: 0 0 8px;
}
.ds-section-head .ds-section-title {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  color: #64748b;
  margin: 0;
  line-height: 1.2;
}
.ds-section-head .ds-section-cta {
  font-size: 12px; color: #2563eb; font-weight: 500;
  white-space: nowrap; text-decoration: none;
}
.ds-section-head .ds-section-cta:hover { text-decoration: underline; }

/* Compact label/value line — sits flat in a section, no nested card.
   First child is the label (muted, wraps); last child is the value
   (right-aligned, tabular-nums, no wrap by default). */
.ds-kv-line {
  display: flex; gap: 12px; justify-content: space-between;
  padding: 6px 0;
  border-top: 1px solid #f1f5f9;
  font-size: 13px;
  align-items: baseline;
}
.ds-kv-line:first-child { border-top: none; }
.ds-kv-line > .ds-kv-label {
  color: #64748b;
  flex: 1 1 auto; min-width: 0;
  overflow-wrap: break-word;
}
.ds-kv-line > .ds-kv-value {
  color: #0f172a; font-weight: 500;
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex: 0 0 auto;
}
.ds-kv-line > .ds-kv-value.ds-multi {
  white-space: normal; word-break: break-word;
  flex: 1 1 auto; max-width: 60%;
}
.ds-kv-line > .ds-kv-value.ds-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12.5px;
}
.ds-kv-value.ds-muted { color: #94a3b8; font-weight: 400; }
.ds-kv-value.ds-ok    { color: #047857; }
.ds-kv-value.ds-warn  { color: #b45309; }
.ds-kv-value.ds-danger{ color: #b91c1c; }

/* Calm pill: smaller and quieter than the per-page .pill / .chip
   variants. Used in section bodies for stock, status, channel labels. */
.ds-pill {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600;
  letter-spacing: .01em;
  white-space: nowrap;
  background: #eef2f7; color: #475569; border: 1px solid #e2e8f0;
}
.ds-pill.ok      { background: #ecfdf5; color: #047857; border-color: #d1fae5; }
.ds-pill.warn    { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.ds-pill.bad     { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.ds-pill.info    { background: #eff6ff; color: #1d4ed8; border-color: #dbeafe; }
.ds-pill.tag     { background: #f5f3ff; color: #6d28d9; border-color: #ede9fe; }
.ds-pill.neutral { background: #f1f5f9; color: #475569; border-color: #e2e8f0; }

/* Compact timeline row — small dot, label on top, time below. Calm
   visual hierarchy for the customers timeline. */
.ds-timeline-row {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  gap: 10px;
  padding: 7px 0;
  border-top: 1px solid #f1f5f9;
  align-items: baseline;
}
.ds-timeline-row:first-child { border-top: none; }
.ds-timeline-row .ds-tl-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #94a3b8;
  margin-top: 6px;
}
.ds-timeline-row .ds-tl-dot.ok     { background: #059669; }
.ds-timeline-row .ds-tl-dot.warn   { background: #d97706; }
.ds-timeline-row .ds-tl-dot.info   { background: #2563eb; }
.ds-timeline-row .ds-tl-dot.danger { background: #dc2626; }
.ds-timeline-row .ds-tl-body {
  display: flex; flex-direction: column; gap: 2px; min-width: 0;
}
.ds-timeline-row .ds-tl-label {
  font-size: 13px; color: #0f172a; font-weight: 500;
  overflow-wrap: break-word;
}
.ds-timeline-row .ds-tl-time {
  font-size: 11.5px; color: #64748b;
}

/* Empty-state text used inside a section (one line, calm). */
.ds-empty-line {
  padding: 8px 0;
  font-size: 12.5px;
  color: #64748b;
}

/* Show-more inline toggle (used by timeline). */
.ds-show-more {
  display: inline-flex; align-items: center;
  margin-top: 8px;
  padding: 4px 10px;
  font-size: 12px; font-weight: 500;
  color: #2563eb; background: transparent;
  border: 1px solid #dbeafe; border-radius: 999px;
  cursor: pointer;
}
.ds-show-more:hover { background: #eff6ff; }
